From a5f6df2b1f3f0fdc73635de3ad285d21703dab18 Mon Sep 17 00:00:00 2001 From: Eric Blake Date: Tue, 29 Nov 2011 14:37:14 -0700 Subject: [PATCH] maint.mk: add syntax check for use of compare from init.sh Comparing expected against actual gives more consistent diff listings when reporting test failures. Enforce this idiom on test files that use init.sh, and allow projects to recognize an alternate pattern for recognizing tests scripts that use a compare function. * top/maint.mk (sc_prohibit_reversed_compare_failure): New rule, moved here from coreutils. Signed-off-by: Eric Blake --- ChangeLog | 4 ++++ top/maint.mk | 10 ++++++++++ 2 files changed, 14 insertions(+) diff --git a/ChangeLog b/ChangeLog index 95d71fd39..9735aa876 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,9 @@ 2011-11-29 Eric Blake + maint.mk: add syntax check for use of compare from init.sh + * top/maint.mk (sc_prohibit_reversed_compare_failure): New rule, + moved here from coreutils. + manywarnings: drop -Wunsuffixed-float-constants * m4/manywarnings.m4 (gl_MANYWARN_ALL_GCC): C99 does not allow '1.0D', which is the only way to silence this warning for 'double'. diff --git a/top/maint.mk b/top/maint.mk index 76844a079..e4efb5f7b 100644 --- a/top/maint.mk +++ b/top/maint.mk @@ -1157,6 +1157,16 @@ sc_cross_check_PATH_usage_in_tests: 1>&2; exit 1; } || :; \ fi +# BRE regex of file contents to identify a test script. +_test_script_regex ?= \ + +# In tests, use "compare expected actual", not the reverse. +sc_prohibit_reversed_compare_failure: + @prohibit='\