فهرست منبع

Add verification makefile rule

Jeremy Soller 7 سال پیش
والد
کامیت
54655a4e3b
2فایلهای تغییر یافته به همراه24 افزوده شده و 6 حذف شده
  1. 1 0
      tests/.gitignore
  2. 23 6
      tests/Makefile

+ 1 - 0
tests/.gitignore

@@ -1,3 +1,4 @@
+/gen/
 /alloc
 /alloc
 /args
 /args
 /atof
 /atof

+ 23 - 6
tests/Makefile

@@ -26,15 +26,32 @@ all: $(BINS)
 clean:
 clean:
 	rm -f $(BINS) *.out
 	rm -f $(BINS) *.out
 
 
+run: $(BINS)
+	for bin in $(BINS); \
+	do
+		echo "# $${bin} #"; \
+		"./$${bin}" test args; \
+	done
+
 expected: $(BINS)
 expected: $(BINS)
+	rm -rf expected
 	mkdir -p expected
 	mkdir -p expected
-	for bin in $(BINS); do "./$${bin}" test args > "expected/$${bin}.stdout" 2> "expected/$${bin}.stderr"; done
+	for bin in $(BINS); \
-
+	do \
-run: $(BINS)
+		echo "# $${bin} #"; \
-	for bin in $(BINS); do echo "# $${bin} #"; "./$${bin}" test args; done
+		"./$${bin}" test args > "expected/$${bin}.stdout" 2> "expected/$${bin}.stderr"; \
+	done
 
 
-test: $(BINS)
+verify: $(BINS)
-	for bin in $(BINS); do echo "# $${bin} #"; "./$${bin}" test args; done
+	rm -rf gen
+	mkdir -p gen
+	for bin in $(BINS); \
+	do \
+		echo "# $${bin} #"; \
+		"./$${bin}" test args > "gen/$${bin}.stdout" 2> "gen/$${bin}.stderr"; \
+		diff -u "gen/$${bin}.stdout" "expected/$${bin}.stdout"; \
+		diff -u "gen/$${bin}.stderr" "expected/$${bin}.stderr"; \
+	done
 
 
 GCCHEAD=\
 GCCHEAD=\
 	-nostdinc \
 	-nostdinc \