Procházet zdrojové kódy

Only expect output for a whitelist of binaries

Jeremy Soller před 7 roky
rodič
revize
41e552b696

+ 14 - 9
tests/Makefile

@@ -1,5 +1,5 @@
-BINS=\
-	alloc \
+# Binaries that should generate the same output every time
+EXPECT_BINS=\
 	atof \
 	atoi \
 	brk \
@@ -13,14 +13,12 @@ BINS=\
 	fcntl \
 	fsync \
 	ftruncate \
-	getid \
 	link \
 	math \
 	mem \
 	pipe \
 	printf \
 	rmdir \
-	setid \
 	sleep \
 	sprintf \
 	stdlib/strtol \
@@ -33,32 +31,39 @@ BINS=\
 	unlink \
 	write
 
+# Binaries that may generate varied output
+BINS=\
+	$(EXPECT_BINS) \
+	alloc \
+	getid \
+	setid
+
 all: $(BINS)
 
 clean:
 	rm -f $(BINS) *.out
 
 run: $(BINS)
-	for bin in $(BINS); \
+	for bin in $^; \
 	do \
 		echo "# $${bin} #"; \
 		"./$${bin}" test args; \
 	done
 
-expected: $(BINS)
+expected: $(EXPECT_BINS)
 	rm -rf expected
 	mkdir -p expected
-	for bin in $(BINS); \
+	for bin in $^; \
 	do \
 		echo "# $${bin} #"; \
 		mkdir -p expected/`dirname $${bin}`; \
 		"./$${bin}" test args > "expected/$${bin}.stdout" 2> "expected/$${bin}.stderr"; \
 	done
 
-verify: $(BINS)
+verify: $(EXPECT_BINS)
 	rm -rf gen
 	mkdir -p gen
-	for bin in $(BINS); \
+	for bin in $^; \
 	do \
 		echo "# $${bin} #"; \
 		mkdir -p gen/`dirname $${bin}`; \

+ 0 - 0
tests/expected/alloc.stderr


+ 0 - 2
tests/expected/alloc.stdout

@@ -1,2 +0,0 @@
-malloc 0x560fde600618
-calloc 0x560fde600618

+ 0 - 0
tests/expected/getid.stderr


+ 0 - 1
tests/expected/getid.stdout

@@ -1 +0,0 @@
-egid: 1000, euid: 1000, gid: 1000, pgid: 31979, pid: 32027, ppid 31982, uid 1000

+ 0 - 0
tests/expected/setid.stderr


+ 0 - 3
tests/expected/setid.stdout

@@ -1,3 +0,0 @@
-32050 belongs to process group 32050
-32050 has egid 1000 and gid 1000
-32050 has euid 1000 and uid 1000