From 2473046c43577acf1ab8a9960a85a3273596659c Mon Sep 17 00:00:00 2001 From: Bruno Haible Date: Sun, 17 Jan 2021 09:22:11 +0100 Subject: [PATCH] argp tests: Avoid test failures on Alpine Linux. * tests/test-argp-2.sh: Use the test framework (init.sh). Use the 'compare' function instead of 'diff -c'. * tests/test-argp-version-etc-1.sh: Likewise. --- ChangeLog | 7 +++++++ tests/test-argp-2.sh | 28 ++++++++++++++-------------- tests/test-argp-version-etc-1.sh | 17 +++++++++-------- 3 files changed, 30 insertions(+), 22 deletions(-) diff --git a/ChangeLog b/ChangeLog index cb9037d282..3c4a5133be 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,10 @@ +2021-01-17 Bruno Haible + + argp tests: Avoid test failures on Alpine Linux. + * tests/test-argp-2.sh: Use the test framework (init.sh). Use the + 'compare' function instead of 'diff -c'. + * tests/test-argp-version-etc-1.sh: Likewise. + 2021-01-17 Bruno Haible get-rusage-data tests: Avoid test failure on musl libc. diff --git a/tests/test-argp-2.sh b/tests/test-argp-2.sh index 9388c015ee..4a33fac47f 100755 --- a/tests/test-argp-2.sh +++ b/tests/test-argp-2.sh @@ -16,46 +16,48 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . */ -TMP=argp.$$ +. "${srcdir=.}/init.sh"; path_prepend_ . -unset ARGP_HELP_FMT ERR=0 +unset ARGP_HELP_FMT + func_compare() { # If argp was compiled without base_name, it will display full program name. # If run on mingw, it will display the program name with a .exe suffix. sed '1{ s,: [^ ]*/test-argp,: test-argp, s,: test-argp\.exe,: test-argp, - }' | LC_ALL=C tr -d '\r' | diff -c $TMP - + }' | LC_ALL=C tr -d '\r' > out + compare expected out } #### # Test --usage output -cat > $TMP < expected < $TMP < expected <$TMP <expected <. EOT # Compare --help output, but filter out any bug-reporting email address. -${CHECKER} ./test-argp${EXEEXT} --help \ +${CHECKER} test-argp${EXEEXT} --help \ | sed 's/^\(Report bugs to \)<[^>]*>.$/\1<>./' | func_compare || ERR=1 #### # Test ambiguous option handling -${CHECKER} ./test-argp${EXEEXT} --optio 2>/dev/null && ERR=1 +${CHECKER} test-argp${EXEEXT} --optio 2>/dev/null && ERR=1 #### # Run built-in tests -${CHECKER} ./test-argp${EXEEXT} || ERR=1 - -rm $TMP +${CHECKER} test-argp${EXEEXT} || ERR=1 -exit $ERR +Exit $ERR diff --git a/tests/test-argp-version-etc-1.sh b/tests/test-argp-version-etc-1.sh index 10b51d74c1..3ac42365aa 100755 --- a/tests/test-argp-version-etc-1.sh +++ b/tests/test-argp-version-etc-1.sh @@ -16,12 +16,14 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . -TMP=ave-expected.tmp +. "${srcdir=.}/init.sh"; path_prepend_ . + +ERR=0 + LC_ALL=C export LC_ALL -ERR=0 -cat > $TMP < expected <. @@ -31,13 +33,12 @@ There is NO WARRANTY, to the extent permitted by law. Written by Sergey Poznyakoff. EOT -${CHECKER} ./test-argp-version-etc${EXEEXT} --version | +${CHECKER} test-argp-version-etc${EXEEXT} --version | sed '1s/test-argp-version-etc (.*) .*/test-argp-version-etc (PROJECT) VERSION/ /^Packaged by/d 2,3 s/Copyright (C) [0-9]\{4,4\}/COPYRIGHT/' | - tr -d '\015' | - diff -c $TMP - || ERR=1 + tr -d '\015' > output -rm $TMP +compare expected output || ERR=1 -exit $ERR +Exit $ERR -- 2.39.5