]> Savannah Git Hosting - gnulib.git/commitdiff
argp tests: Avoid test failures on Alpine Linux.
authorBruno Haible <bruno@clisp.org>
Sun, 17 Jan 2021 08:22:11 +0000 (09:22 +0100)
committerBruno Haible <bruno@clisp.org>
Sun, 17 Jan 2021 08:22:11 +0000 (09:22 +0100)
* 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
tests/test-argp-2.sh
tests/test-argp-version-etc-1.sh

index cb9037d282a5ca50034d349f17d9cc00750a679f..3c4a5133bef6ca07b8a010479c3847f1970710ce 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,10 @@
+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.
index 9388c015ee9378e1a60801e3e6916dd2b2af1e84..4a33fac47f67b123479a2aa75e1e0fe76741abc0 100755 (executable)
 # 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
index 10b51d74c1c92faefeccd4e312842729b2c96469..3ac42365aa01bbf5dae53e1a5433d1c8e6ccfc1e 100755 (executable)
 # 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