Mercurial > projects > dstress
diff Makefile @ 72:b0e95b878322
added segfault detection support
author | thomask |
---|---|
date | Wed, 27 Oct 2004 17:26:14 +0000 |
parents | 9ca076fc9ce9 |
children | edc279c4f7f9 |
line wrap: on
line diff
--- a/Makefile Wed Oct 27 17:24:53 2004 +0000 +++ b/Makefile Wed Oct 27 17:26:14 2004 +0000 @@ -65,6 +65,7 @@ ############################################################################### ############################################################################### +# settings to_log = >> $(LOG) 2>&1 ext_run = exe ext_unittest_run = unittest.$(ext_run) @@ -77,13 +78,28 @@ complex_todo = complex.mak complex_done = complex.done -.PHONY: all compile nocompile run norun complex clean distclean clean_log log +# tools +return__ = ./return__ +ifeq__ = ./ifeq__ + +.PHONY: all basic_tools compile nocompile run norun complex clean distclean clean_log log # # test everything # all : Makefile compile nocompile run norun complex # +# the tools +# +return__ : return__.c + $(CC) $(CFLAGS) $< -o $@ + +ifeq__ : ifeq__.c + $(CC) $(CFLAGS) $< -o $@ + +basic_tools : Makefile $(ifeq__) $(return__) + +# # include complex test cases # complex_makefiles = $(sort $(shell $(FIND) complex -regex ".*$(complex_todo)")) @@ -94,28 +110,43 @@ # nocompile : Makefile $(sort $(subst .$(ext_source),.$(ext_nocompile),$(shell $(FIND) nocompile -regex ".*\\.$(ext_source)" ) ) $(subst .$(ext_source_html),.$(ext_nocompile),$(shell $(FIND) nocompile -regex ".*\\.$(ext_source_html)" ) ) ) -%.$(ext_nocompile) : %.$(ext_source) Makefile +%.$(ext_nocompile) : %.$(ext_source) basic_tools $(eval z_name = $(subst .$(ext_nocompile),,$@)) - @if $(DMD) $(DFLAGS) -c -of$@ $< $(to_log); then \ + $(eval z_return = $(shell $(return__) "$(DMD) $(DFLAGS) -c -of$@ $< $(to_log)")) + @if $(ifeq__) $(z_return) 0 ; then \ $(ECHO) "XPASS: $(z_name)"; $(RM) $@; \ else \ - $(ECHO) "FAIL: $(z_name)"; $(TOUCH) $@; \ + if $(ifeq__) $(z_return) 256 ; then \ + $(ECHO) "XFAIL: $(z_name)"; $(TOUCH) $@; \ + else \ + $(ECHO) "ERROR: $(z_name)"; $(RM) $@; \ + fi \ fi -%.$(ext_nocompile) : %.$(ext_source_html) Makefile +%.$(ext_nocompile) : %.$(ext_source_html) basic_tools $(eval z_name = $(subst .$(ext_nocompile),,$@)) - @if $(DMD) $(DFLAGS) -c -of$@ $< $(to_log); then \ + $(eval z_return = $(shell $(return__) "$(DMD) $(DFLAGS) -c -of$@ $< $(to_log)")) + @if $(ifeq__) $(z_return) 0 ; then \ $(ECHO) "XPASS: $(z_name)"; $(RM) $@; \ else \ - $(ECHO) "FAIL: $(z_name)"; $(TOUCH) $@; \ + if $(ifeq__) $(z_return) 256 ; then \ + $(ECHO) "XFAIL: $(z_name)"; $(TOUCH) $@; \ + else \ + $(ECHO) "ERROR: $(z_name)"; $(RM) $@; \ + fi \ fi -%.$(ext_unittest_nocompile) : %.$(ext_source) Makefile +%.$(ext_unittest_nocompile) : %.$(ext_source) basic_tools $(eval z_name = $(subst .$(ext_unittest_nocompile),,$@)) - @if $(DMD) $(DFLAGS) -unittest -c -of$@ $< $(to_log); then \ + $(eval z_return = $(shell $(return__) "$(DMD) -unittest $(DFLAGS) -c -of$@ $< $(to_log)")) + @if $(ifeq__) $(z_return) 0 ; then \ $(ECHO) "XPASS: $(z_name)"; $(RM) $@; \ else \ - $(ECHO) "FAIL: $(z_name)"; $(TOUCH) $@; \ + if $(ifeq__) $(z_return) 256 ; then \ + $(ECHO) "XFAIL: $(z_name)"; $(TOUCH) $@; \ + else \ + $(ECHO) "ERROR: $(z_name)"; $(RM) $@; \ + fi \ fi # @@ -123,62 +154,86 @@ # compile : Makefile $(sort $(subst .$(ext_source),.$(ext_compile),$(shell $(FIND) compile -regex ".*\\.$(ext_source)" ) ) $(subst .$(ext_source_html),.$(ext_compile),$(shell $(FIND) compile -regex ".*\\.$(ext_source_html)" ) ) ) -%.$(ext_compile) : %.$(ext_source) Makefile +%.$(ext_compile) : %.$(ext_source) basic_tools $(eval z_name = $(subst .$(ext_compile),,$@)) - @if $(DMD) $(DFLAGS) -c -of$@ $< $(to_log) ; then \ - $(ECHO) "PASS: $(z_name)"; $(TOUCH) $@; \ + $(eval z_return = $(shell $(return__) "$(DMD) $(DFLAGS) -c -of$@ $< $(to_log)")) + @if $(ifeq__) $(z_return) 0 ; then \ + $(ECHO) "PASS: $(z_name)"; \ else \ - $(ECHO) "XFAIL: $(z_name)"; $(RM) $@; \ + if $(ifeq__) $(z_return) 256 ; then \ + $(ECHO) "FAIL: $(z_name)"; $(RM) $@; \ + else \ + $(ECHO) "ERROR: $(z_name)"; $(RM) $@; \ + fi \ fi -%.$(ext_compile) : %.$(ext_source_html) Makefile +%.$(ext_compile) : %.$(ext_source_html) basic_tools $(eval z_name = $(subst .$(ext_compile),,$@)) - @if $(DMD) $(DFLAGS) -c -of$@ $< $(to_log) ; then \ - $(ECHO) "PASS: $(z_name)"; $(TOUCH) $@; \ + $(eval z_return = $(shell $(return__) "$(DMD) $(DFLAGS) -c -of$@ $< $(to_log)")) + @if $(ifeq__) $(z_return) 0 ; then \ + $(ECHO) "PASS: $(z_name)"; \ else \ - $(ECHO) "XFAIL: $(z_name)"; $(RM) $@; \ + if $(ifeq__) $(z_return) 256 ; then \ + $(ECHO) "FAIL: $(z_name)"; $(RM) $@; \ + else \ + $(ECHO) "ERROR: $(z_name)"; $(RM) $@; \ + fi \ fi - # # target should compile, link and run # run : Makefile $(sort $(subst .$(ext_source),.$(ext_run),$(shell $(FIND) run -regex ".*\\.$(ext_source)" ) ) $(subst .$(ext_source_html),.$(ext_run),$(shell $(FIND) run -regex ".*\\.$(ext_source_html)" ) ) ) -%.$(ext_run) : %.$(ext_source) Makefile +%.$(ext_run) : %.$(ext_source) basic_tools $(eval z_name = $(subst .$(ext_run),,$@)) - @if $(DMD) $(DFLAGS) -od$(OBJ_DIR) -of$@ $< $(to_log); then \ - if $@ $(to_log); then \ + $(eval z_return = $(shell $(return__) "$(DMD) $(DFLAGS) -od$(OBJ_DIR) -of$@ $< $(to_log)")) + @if $(ifeq__) $(z_return) 0 ; then \ + if ./$@ $(to_log); then \ $(ECHO) "PASS: $(z_name)"; \ else \ - $(ECHO) "XFAIL: $(z_name)"; $(RM) $@; \ + $(ECHO) "FAIL: $(z_name)"; $(RM) $@; \ fi \ else \ - $(ECHO) "XFAIL: $(z_name) (compiling error)"; \ + if $(ifeq__) $(z_return) 256 ; then \ + $(ECHO) "FAIL: $(z_name) (compiling error)"; \ + else \ + $(ECHO) "ERROR: $(z_name)"; \ + fi \ fi -%.$(ext_unittest_run) : %.$(ext_source) Makefile - $(eval z_name = $(subst .$(ext_unittest_run),,$@)) - @if $(DMD) $(DFLAGS) -unittest -od$(OBJ_DIR) -of$@ $< $(to_log); then \ - if $@ $(to_log); then \ +%.$(ext_unittest_run) : %.$(ext_source) basic_tools + $(eval z_name = $(subst .$(ext_run),,$@)) + $(eval z_return = $(shell $(return__) "$(DMD) $(DFLAGS) -unittest -od$(OBJ_DIR) -of$@ $< $(to_log)")) + @if $(ifeq__) $(z_return) 0 ; then \ + if ./$@ $(to_log); then \ $(ECHO) "PASS: $(z_name)"; \ else \ - $(ECHO) "XFAIL: $(z_name)"; $(RM) $@; \ + $(ECHO) "FAIL: $(z_name)"; $(RM) $@; \ fi \ else \ - $(ECHO) "XFAIL: $(z_name) (compiling error)"; \ + if $(ifeq__) $(z_return) 256 ; then \ + $(ECHO) "FAIL: $(z_name) (compiling error)"; \ + else \ + $(ECHO) "ERROR: $(z_name)"; \ + fi \ fi -%.$(ext_run) : %.$(ext_source_html) Makefile +%.$(ext_run) : %.$(ext_source_html) basic_tools $(eval z_name = $(subst .$(ext_run),,$@)) - @if $(DMD) $(DFLAGS) -od$(OBJ_DIR) -of$@ $< $(to_log); then \ - if $@ $(to_log); then \ + $(eval z_return = $(shell $(return__) "$(DMD) $(DFLAGS) -od$(OBJ_DIR) -of$@ $< $(to_log)")) + @if $(ifeq__) $(z_return) 0 ; then \ + if ./$@ $(to_log); then \ $(ECHO) "PASS: $(z_name)"; \ else \ - $(ECHO) "XFAIL: $(z_name)"; $(RM) $@; \ + $(ECHO) "FAIL: $(z_name)"; $(RM) $@; \ fi \ else \ - $(ECHO) "XFAIL: $(z_name) (compiling error)"; \ + if $(ifeq__) $(z_return) 256 ; then \ + $(ECHO) "FAIL: $(z_name) (compiling error)"; \ + else \ + $(ECHO) "ERROR: $(z_name)"; \ + fi \ fi # @@ -186,28 +241,38 @@ # norun : Makefile $(sort $(subst .$(ext_source),.$(ext_norun),$(shell $(FIND) norun -regex ".*\\.$(ext_source)" ) ) $(subst .$(ext_source_html),.$(ext_norun),$(shell $(FIND) norun -regex ".*\\.$(ext_source_html)" ) ) ) -%.$(ext_norun) : %.$(ext_source) Makefile +%.$(ext_norun) : %.$(ext_source) basic_tools $(eval z_name = $(subst .$(ext_norun),,$@)) - @if $(DMD) $(DFLAGS) -od$(OBJ_DIR) -of$@ $< $(to_log); then \ - if $@ $(to_log); \ + $(eval z_return = $(shell $(return__) "$(DMD) $(DFLAGS) -od$(OBJ_DIR) -of$@ $< $(to_log)")) + @if $(ifeq__) $(z_return) 0; then \ + if ./$@ $(to_log); \ then $(ECHO) "XPASS: $(z_name)"; $(RM) $@; \ else \ - $(ECHO) "FAIL: $(z_name)"; \ + $(ECHO) "XFAIL: $(z_name)"; \ fi \ else \ - $(ECHO) "XFAIL: $(z_name) (compiling error)"; $(RM) $@; \ + if $(ifeq__) $(z_return) 256 ; then \ + $(ECHO) "FAIL: $(z_name) (compiling error)"; $(RM) $@; \ + else \ + $(ECHO) "ERROR: $(z_name)"; \ + fi \ fi -%.$(ext_norun) : %.$(ext_source_html) Makefile +%.$(ext_norun) : %.$(ext_source_html) Makefile $(eval z_name = $(subst .$(ext_norun),,$@)) - @if $(DMD) $(DFLAGS) -od$(OBJ_DIR) -of$@ $< $(to_log); then \ - if $@ $(to_log); \ - then $(ECHO) "XPASS: $(subst .$(ext_norun),,$@)"; $(RM) $@; \ + $(eval z_return = $(shell $(return__) "$(DMD) $(DFLAGS) -od$(OBJ_DIR) -of$@ $< $(to_log)")) + @if $(ifeq__) $(z_return) 0; then \ + if ./$@ $(to_log); \ + then $(ECHO) "XPASS: $(z_name)"; $(RM) $@; \ else \ - $(ECHO) "FAIL: $(subst .$(ext_norun),,$@)"; \ + $(ECHO) "XFAIL: $(z_name)"; \ fi \ else \ - $(ECHO) "XFAIL: $(subst .$(ext_run),,$@) (compiling error)"; $(RM) $@; \ + if $(ifeq__) $(z_return) 256 ; then \ + $(ECHO) "FAIL: $(z_name) (compiling error)"; $(RM) $@; \ + else \ + $(ECHO) "ERROR: $(z_name)"; \ + fi \ fi # @@ -222,7 +287,7 @@ # # distclean : clean_log clean - $(RM) $(shell $(FIND) . -regex ".*~") + $(RM) $(shell $(FIND) . -regex ".*~") # # remove compiler and assertion messages @@ -230,6 +295,10 @@ clean_log : $(RM) $(LOG) +#test.xx : +# $(eval tempus=$(shell ./dstress_return "$(DMD) test.d -oftest.xx $(to_log)")) +# echo "$(tempus)" + # # remove targets and all temp objects #