Commit Diff


commit - 1d47f68bf9b6f33efff83db74a63cbd0e53c5ff6
commit + 65b27e578bc20301a764fd2cd673dd3e66b68c95
blob - a7171f20953ee46932809c2cdb7deac376f5d7ee
blob + e634d0167fc9f5c3c134d63e8f683221a9c63a5c
--- regress/secrets/Makefile
+++ regress/secrets/Makefile
@@ -7,27 +7,52 @@ SRCS =		secrets-parser.c error.c hash.c log.c secrets.
 CPPFLAGS +=	-I${.CURDIR}/../../include -I${.CURDIR}/../../lib
 CPPFLAGS +=	-I${.CURDIR}/../../gotd
 
-REGRESS_TARGETS =	empty comments quotes unclosed invalid-escape syntax
+REGRESS_TARGETS =	test_empty test_comments test_quotes test_unclosed \
+			test_invalid_escape test_syntax
 
-empty:
-	./secrets /dev/null | diff -u /dev/null -
+test_empty:
+	@echo -n '$@ '
+	@(./secrets /dev/null | diff -u /dev/null -) && echo ok
 
-comments:
-	./secrets ${.CURDIR}/01.conf | diff -u ${.CURDIR}/01.exp -
+test_comments:
+	@echo -n '$@ '
+	@(./secrets ${.CURDIR}/01.conf | diff -u ${.CURDIR}/01.exp -) && echo ok
 
-quotes:
-	./secrets ${.CURDIR}/02.conf | diff -u ${.CURDIR}/02.exp -
+test_quotes:
+	@echo -n '$@ '
+	@(./secrets ${.CURDIR}/02.conf | diff -u ${.CURDIR}/02.exp -) && echo ok
 
-unclosed:
-	! ./secrets ${.CURDIR}/03.conf
-	@echo "expected failure; it's OK"
+test_unclosed:
+	@echo -n '$@ '
+	@./secrets ${.CURDIR}/03.conf 2> ${.CURDIR}/stderr || true
+	@echo 'secrets: ${.CURDIR}/03.conf:1 no closing quote' > ${.CURDIR}/stderr.expected
+	@echo 'secrets: failed to parse ${.CURDIR}/03.conf: configuration file syntax error' >> ${.CURDIR}/stderr.expected
+	@if ! cmp -s ${.CURDIR}/stderr.expected ${.CURDIR}/stderr; then \
+		diff -u ${.CURDIR}/stderr.expected ${.CURDIR}/stderr; \
+	else \
+		echo ok; \
+	fi
 
-invalid-escape:
-	! ./secrets ${.CURDIR}/04.conf
-	@echo "expected failure; it's OK"
+test_invalid_escape:
+	@echo -n '$@ '
+	@./secrets ${.CURDIR}/04.conf 2> ${.CURDIR}/stderr || true
+	@echo 'secrets: ${.CURDIR}/04.conf:1 unterminated escape at end of line' > ${.CURDIR}/stderr.expected
+	@echo 'secrets: failed to parse ${.CURDIR}/04.conf: configuration file syntax error' >> ${.CURDIR}/stderr.expected
+	@if ! cmp -s ${.CURDIR}/stderr.expected ${.CURDIR}/stderr; then \
+		diff -u ${.CURDIR}/stderr.expected ${.CURDIR}/stderr; \
+	else \
+		echo ok; \
+	fi
 
-syntax:
-	! ./secrets ${.CURDIR}/05.conf
-	@echo "expected failure; it's OK"
+test_syntax:
+	@echo -n '$@ '
+	@./secrets ${.CURDIR}/05.conf 2> ${.CURDIR}/stderr || true
+	@echo 'secrets: ${.CURDIR}/05.conf:1 unterminated escape at end of line' > ${.CURDIR}/stderr.expected
+	@echo 'secrets: failed to parse ${.CURDIR}/05.conf: configuration file syntax error' >> ${.CURDIR}/stderr.expected
+	@if ! cmp -s ${.CURDIR}/stderr.expected ${.CURDIR}/stderr; then \
+		diff -u ${.CURDIR}/stderr.expected ${.CURDIR}/stderr; \
+	else \
+		echo ok; \
+	fi
 
 .include <bsd.regress.mk>