summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBruno Haible <bruno@clisp.org>2021-01-17 09:22:11 +0100
committerBruno Haible <bruno@clisp.org>2021-01-17 09:22:11 +0100
commit2473046c43577acf1ab8a9960a85a3273596659c (patch)
tree2c77961d27aab784cad87e28c1a9ac1e1403edd3
parent2e9b9370bcc74dc88b35cb761ae15db72401add2 (diff)
downloadgnulib-2473046c43577acf1ab8a9960a85a3273596659c.tar.gz
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.
-rw-r--r--ChangeLog7
-rwxr-xr-xtests/test-argp-2.sh28
-rwxr-xr-xtests/test-argp-version-etc-1.sh17
3 files changed, 30 insertions, 22 deletions
diff --git a/ChangeLog b/ChangeLog
index cb9037d282..3c4a5133be 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,12 @@
2021-01-17 Bruno Haible <bruno@clisp.org>
+ 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 <bruno@clisp.org>
+
get-rusage-data tests: Avoid test failure on musl libc.
* modules/get-rusage-data-tests (Files): Add m4/musl.m4.
(configure.ac): Invoke gl_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 <https://www.gnu.org/licenses/>. */
-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 <<EOT
+cat > expected <<EOT
Usage: test-argp [-tvCSOlp?V] [-f FILE] [-r FILE] [-o[ARG]] [--test]
[--file=FILE] [--input=FILE] [--read=FILE] [--verbose] [--cantiga]
[--sonet] [--option] [--optional[=ARG]] [--many] [--one] [--two]
[--limerick] [--poem] [--help] [--usage] [--version] ARGS...
EOT
-${CHECKER} ./test-argp${EXEEXT} --usage | func_compare || ERR=1
+${CHECKER} test-argp${EXEEXT} --usage | func_compare || ERR=1
####
# Test working usage-indent format
-cat > $TMP <<EOT
+cat > expected <<EOT
Usage: test-argp [-tvCSOlp?V] [-f FILE] [-r FILE] [-o[ARG]] [--test]
[--file=FILE] [--input=FILE] [--read=FILE] [--verbose] [--cantiga] [--sonet]
[--option] [--optional[=ARG]] [--many] [--one] [--two] [--limerick] [--poem]
[--help] [--usage] [--version] ARGS...
EOT
-ARGP_HELP_FMT='usage-indent=0' ${CHECKER} ./test-argp${EXEEXT} --usage | func_compare || ERR=1
+ARGP_HELP_FMT='usage-indent=0' ${CHECKER} test-argp${EXEEXT} --usage | func_compare || ERR=1
####
# Test --help output
-cat >$TMP <<EOT
+cat >expected <<EOT
Usage: test-argp [OPTION...] ARGS...
documentation string
@@ -96,18 +98,16 @@ Report bugs to <>.
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 <https://www.gnu.org/licenses/>.
-TMP=ave-expected.tmp
+. "${srcdir=.}/init.sh"; path_prepend_ .
+
+ERR=0
+
LC_ALL=C
export LC_ALL
-ERR=0
-cat > $TMP <<EOT
+cat > expected <<EOT
test-argp-version-etc (PROJECT) VERSION
COPYRIGHT Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <https://gnu.org/licenses/gpl.html>.
@@ -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