Commit Diff


commit - e14ee64c985996cc77c97f6af5c5fcc6379622fb
commit + 4f58e89131e0c8121fb717405a07decd66d5d474
blob - 569e4c944bc2541a6fd5ef8176a103a5ccf9eeec
blob + 30c726a36cf4208cce919a7ec7d61349fefb1981
--- .gitignore
+++ .gitignore
@@ -6,5 +6,5 @@ diff/diff
 tags
 test/got*.diff
 test/verify.*
-test/results_test
-test/arraylist_test
+test/arraylist_test/arraylist_test
+test/results_test/results_test
blob - c83f0509a652b85dfb6bc6806e5b7758b62817af
blob + c88d884448ed6afbebc9358cdab3c57eb79f230d
--- test/GNUmakefile
+++ test/GNUmakefile
@@ -1,24 +1,11 @@
 .PHONY: test verify clean
 test: verify clean
 
-verify: results_test arraylist_test
+# verify_all.sh runs 'make' on sub-directories containing C tests
+verify:
 	./verify_all.sh
 clean:
 	-rm verify.*
-	-rm results_test arraylist_test
 	-$(MAKE) -C ../lib clean
-
-CFLAGS = -fsanitize=address -fsanitize=undefined -g -O3
-CFLAGS += -Wstrict-prototypes -Wunused-variable
-
-# Compat sources
-CFLAGS+=       -I$(CURDIR)/../compat/include
-
-results_test: results_test.c ../lib/libdiff.a
-	gcc $(CFLAGS) -I../include -I../lib -o $@ $^
-
-arraylist_test: arraylist_test.c ../lib/libdiff.a
-	gcc $(CFLAGS) -I../include -I../lib -o $@ $^
-
-../lib/libdiff.a: ../lib/*.[hc] ../include/*.h
-	$(MAKE) -C ../lib
+	-$(MAKE) -C arraylist_test clean
+	-$(MAKE) -C results_test clean
blob - /dev/null
blob + f42511784ccd6aea584dac34d17d27d0e347ed37 (mode 644)
--- /dev/null
+++ test/Makefile
@@ -0,0 +1,12 @@
+.PHONY: test verify clean
+
+test: verify clean
+
+# verify_all.sh runs 'make' on sub-directories containing C tests
+verify:
+	./verify_all.sh
+
+clean:
+	-rm verify.*
+	make -C arraylist_test clean
+	make -C results_test clean
blob - /dev/null
blob + 255f82cf29c03cf7cfa8ee4e05c4adfec36b9cc0 (mode 644)
--- /dev/null
+++ test/arraylist_test/GNUmakefile
@@ -0,0 +1,20 @@
+.PHONY: regress clean
+
+CFLAGS = -fsanitize=address -fsanitize=undefined -g -O3
+CFLAGS += -Wstrict-prototypes -Wunused-variable
+
+CFLAGS+=       -I$(CURDIR)/../../compat/include \
+	       -I$(CURDIR)/../../include \
+	       -I$(CURDIR)/../../lib
+
+$(CURDIR)/arraylist_test: $(CURDIR)/../arraylist_test.c $(CURDIR)/../../lib/libdiff.a
+	gcc $(CFLAGS) -o $@ $^
+
+$(CURDIR)/../../lib/libdiff.a: $(CURDIR)/../../lib/*.[hc] $(CURDIR)/../../include/*.h
+	$(MAKE) -C $(CURDIR)/../../lib
+
+regress: $(CURDIR)/arraylist_test
+	$(CURDIR)/arraylist_test
+
+clean:
+	-rm $(CURDIR)/arraylist_test
blob - /dev/null
blob + f088f4767c929197c177b9f90c25cefe1f5874aa (mode 644)
--- /dev/null
+++ test/arraylist_test/Makefile
@@ -0,0 +1,11 @@
+.PATH:${.CURDIR}/../../lib
+.PATH:${.CURDIR}/..
+
+PROG = arraylist_test
+SRCS = arraylist_test.c
+
+CPPFLAGS = -I${.CURDIR}/../../include -I${.CURDIR}/../../lib
+
+NOMAN = yes
+
+.include <bsd.regress.mk>
blob - /dev/null
blob + f4fd44930667e9d3204ebb5b3350d5d54f86453d (mode 644)
--- /dev/null
+++ test/results_test/GNUmakefile
@@ -0,0 +1,20 @@
+.PHONY: regress clean
+
+CFLAGS = -fsanitize=address -fsanitize=undefined -g -O3
+CFLAGS += -Wstrict-prototypes -Wunused-variable
+
+CFLAGS+=       -I$(CURDIR)/../../compat/include \
+	       -I$(CURDIR)/../../include \
+	       -I$(CURDIR)/../../lib
+
+$(CURDIR)/results_test: $(CURDIR)/../results_test.c $(CURDIR)/../../lib/libdiff.a
+	gcc $(CFLAGS) -o $@ $^
+
+$(CURDIR)/../../lib/libdiff.a: $(CURDIR)/../../lib/*.[hc] $(CURDIR)/../../include/*.h
+	$(MAKE) -C $(CURDIR)/../../lib
+
+regress: $(CURDIR)/results_test
+	$(CURDIR)/results_test
+
+clean:
+	-rm $(CURDIR)/results_test
blob - /dev/null
blob + 4cb496ada0aacb85d02d7379d38aefec75cfa5e4 (mode 644)
--- /dev/null
+++ test/results_test/Makefile
@@ -0,0 +1,11 @@
+.PATH:${.CURDIR}/../../lib
+.PATH:${.CURDIR}/..
+
+PROG = results_test
+SRCS = results_test.c diff_atomize_text.c diff_main.c
+
+CPPFLAGS = -I${.CURDIR}/../../include -I${.CURDIR}/../../lib
+
+NOMAN = yes
+
+.include <bsd.regress.mk>
blob - 8f3824136c9686f424da3433dee3d613f052f35a
blob + 4a82754f50cfe43f53c2bb59a2696ed3c657ec47
--- test/verify_all.sh
+++ test/verify_all.sh
@@ -78,11 +78,15 @@ for left in test*.left* ; do
 	verify_diff_script "$left" "$right" "$got_diff" "$expected_diff" "$diff_opts"
 done
 
+# XXX required to keep GNU make completely silent during 'make regress'
+if make -h 2>/dev/null |  grep -q no-print-directory; then
+	make_opts="--no-print-directory"
+fi
 for ctest in *_test.c ; do
 	prog="$(echo "$ctest" | sed 's/.c//')"
 	expect_output="expect.${prog}"
 	prog_output="verify.$expect_output"
-	./"$prog" > "$prog_output"
+	make $make_opts -s -C "$prog" regress > "$prog_output"
 	if ! cmp "$prog_output" "$expect_output" ; then
 		echo "FAIL: $prog_output != $expect_output" | tee -a errors
 	else