changeset 72:b0e95b878322

added segfault detection support
author thomask
date Wed, 27 Oct 2004 17:26:14 +0000
parents b59a98da84f4
children 8d4cb9b99b21
files Makefile complex/command_line/complex.mak complex/debug/complex.mak complex/private_import/complex.mak ifeq__.c readme.txt return__.c
diffstat 7 files changed, 144 insertions(+), 61 deletions(-) [+]
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
 #
--- a/complex/command_line/complex.mak	Wed Oct 27 17:24:53 2004 +0000
+++ b/complex/command_line/complex.mak	Wed Oct 27 17:26:14 2004 +0000
@@ -60,7 +60,7 @@
 	@if $(DMD) $(z_arg) complex/command_line/dummy.$(ext_source) $(to_log); then \
 		$(ECHO) "PASS:  $(z_name)"; \
 	else \
-		$(ECHO) "XFAIL: $(z_name)"; \
+		$(ECHO) "FAIL: $(z_name)"; \
 	fi
 
 #
@@ -74,7 +74,7 @@
 	@if $(DMD) $(z_arg) complex/command_line/dummy.$(ext_source) $(to_log); then \
 		$(ECHO) "XPASS: $(z_name)"; \
 	else \
-		$(ECHO) "FAIL:  $(z_name)"; \
+		$(ECHO) "XFAIL:  $(z_name)"; \
 	fi
 
 #
@@ -88,7 +88,7 @@
 	@if $(CD) complex/command_line ; $(DMD) $(z_arg) $(to_log); then \
 		$(ECHO) "XPASS: $(z_name)"; \
 	else \
-		$(ECHO) "FAIL:  $(z_name)"; \
+		$(ECHO) "XFAIL:  $(z_name)"; \
 	fi	
 	
 # this will be called by root's "clean" target
--- a/complex/debug/complex.mak	Wed Oct 27 17:24:53 2004 +0000
+++ b/complex/debug/complex.mak	Wed Oct 27 17:26:14 2004 +0000
@@ -33,10 +33,10 @@
 		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)"; \
+		$(ECHO) "FAIL: $(z_name) (compiling error)"; \
 	fi
 
 complex/debug/debug_02.$(ext_run) :  complex/debug/debug_02.$(ext_source) complex/debug/$(complex_todo)
@@ -45,10 +45,10 @@
 		if $@ $(to_log); then \
 			$(ECHO) "PASS:  $(z_name)"; \
 		else \
-			$(ECHO) "XFAIL: $(z_name)"; $(RM) $@; \
+			$(ECHO) "FAIL: $(z_name)"; $(RM) $@; \
 		fi \
 	else \
-		$(ECHO) "XFAIL: debug_02 (compiling error)"; \
+		$(ECHO) "FAIL: debug_02 (compiling error)"; \
 	fi
 
 complex/debug/debug_03.$(ext_run) :  complex/debug/debug_03.$(ext_source) complex/debug/$(complex_todo)
@@ -57,10 +57,10 @@
 		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)"; \
+		$(ECHO) "FAIL: $(z_name) (compiling error)"; \
 	fi
 
 
--- a/complex/private_import/complex.mak	Wed Oct 27 17:24:53 2004 +0000
+++ b/complex/private_import/complex.mak	Wed Oct 27 17:26:14 2004 +0000
@@ -35,7 +35,7 @@
 	@if $(DMD) $(DFLAGS) -c -Icomplex/private_import/ -ofcomplex/private_import/c.$(ext_compile) complex/private_import/c.$(ext_source) $(to_log); then \
 		$(ECHO) "XPASS: $(z_name)"; \
 	else \
-		$(ECHO) "FAIL:  $(z_name)"; $(TOUCH) $@; \
+		$(ECHO) "XFAIL:  $(z_name)"; $(TOUCH) $@; \
 	fi
 
 #
@@ -46,7 +46,7 @@
 	@if $(DMD) $(DFLAGS) -c -od$(OBJ_DIR) complex/private_import/a.$(ext_source) complex/private_import/b.$(ext_source) complex/private_import/c.$(ext_source) $(to_log); then \
 		$(ECHO) "XPASS: $(z_name)"; \
 	else \
-		$(ECHO) "FAIL:  $(z_name)"; $(TOUCH) $@; \
+		$(ECHO) "XFAIL:  $(z_name)"; $(TOUCH) $@; \
 	fi
 
 
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/ifeq__.c	Wed Oct 27 17:26:14 2004 +0000
@@ -0,0 +1,5 @@
+#include <string.h>
+
+int main(int argc, char *argv[]){
+	return strcmp(argv[1], argv[2]);
+}
--- a/readme.txt	Wed Oct 27 17:24:53 2004 +0000
+++ b/readme.txt	Wed Oct 27 17:26:14 2004 +0000
@@ -18,11 +18,12 @@
 	3) wrong assertion
 	4) return value of main isn't 0 (zero)
 
-Output Synopsis:
-	FAIL:	expected failure
-	XFAIL:	unexpected failure
+Output Synopsis: (DejaGnu / POSIX 1003.3)
 	PASS:	expected pass
 	XPASS:	unexpected pass
+	FAIL:	unexpected fail
+	XFAIL:	expected fail
+	ERROR:	test error (compiler, linker or test case segfaulted)
 
 Source code comments:
 	@author@ 	reporter / author
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/return__.c	Wed Oct 27 17:26:14 2004 +0000
@@ -0,0 +1,8 @@
+#include <stdio.h>
+#include <stdlib.h>
+
+int main(int argc, char *argv[]){
+	int returnCode = system(argv[1]);
+	printf("%d\n", returnCode);
+	return 0;
+}