diff options
author | Jim Meyering <meyering@fb.com> | 2016-01-01 15:06:05 -0800 |
---|---|---|
committer | Jim Meyering <meyering@fb.com> | 2016-01-01 18:00:08 -0800 |
commit | 7346a030108e032b0e8523f381f1a95b91806890 (patch) | |
tree | 9ea9b15faaa616964ca2cd69e318b5a560516dff /tests | |
parent | a3ea9cd5cb911a0319c81b01e205b24c92a8535c (diff) | |
download | diffutils-7346a030108e032b0e8523f381f1a95b91806890.tar.gz |
maint: update copyright year, bootstrap, init.sh
Run "make update-copyright" and then...
* gnulib: Update to latest.
* tests/init.sh: Update from gnulib.
* bootstrap: Likewise.
Diffstat (limited to 'tests')
-rwxr-xr-x | tests/help-version | 2 | ||||
-rw-r--r-- | tests/init.sh | 28 |
2 files changed, 27 insertions, 3 deletions
diff --git a/tests/help-version b/tests/help-version index 5f01f76..339ece7 100755 --- a/tests/help-version +++ b/tests/help-version @@ -2,7 +2,7 @@ # Make sure all these programs work properly # when invoked with --help or --version. -# Copyright (C) 2000-2013, 2015 Free Software Foundation, Inc. +# Copyright (C) 2000-2013, 2015-2016 Free Software Foundation, Inc. # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by diff --git a/tests/init.sh b/tests/init.sh index 671f802..ee08022 100644 --- a/tests/init.sh +++ b/tests/init.sh @@ -1,6 +1,6 @@ # source this file; set up for tests -# Copyright (C) 2009-2013, 2015 Free Software Foundation, Inc. +# Copyright (C) 2009-2016 Free Software Foundation, Inc. # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by @@ -93,6 +93,27 @@ skip_ () { warn_ "$ME_: skipped test: $@"; Exit 77; } fatal_ () { warn_ "$ME_: hard error: $@"; Exit 99; } framework_failure_ () { warn_ "$ME_: set-up failure: $@"; Exit 99; } +# This is used to simplify checking of the return value +# which is useful when ensuring a command fails as desired. +# I.e., just doing `command ... &&fail=1` will not catch +# a segfault in command for example. With this helper you +# instead check an explicit exit code like +# returns_ 1 command ... || fail +returns_ () { + # Disable tracing so it doesn't interfere with stderr of the wrapped command + { set +x; } 2>/dev/null + + local exp_exit="$1" + shift + "$@" + test $? -eq $exp_exit && ret_=0 || ret_=1 + + if test "$VERBOSE" = yes && test "$gl_set_x_corrupts_stderr_" = false; then + set -x + fi + { return $ret_; } 2>/dev/null +} + # Sanitize this shell to POSIX mode, if possible. DUALCASE=1; export DUALCASE if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then @@ -129,6 +150,7 @@ fi # ? - not ok gl_shell_test_script_=' test $(echo y) = y || exit 1 +f_local_() { local v=1; }; f_local_ || exit 1 score_=10 if test "$VERBOSE" = yes; then test -n "$( (exec 3>&1; set -x; P=1 true 2>&3) 2> /dev/null)" && score_=9 @@ -201,6 +223,8 @@ else *x*) opts_=-x ;; *) opts_= ;; esac + re_shell=$re_shell_ + export re_shell exec "$re_shell_" $opts_ "$0" --no-reexec "$@" echo "$ME_: exec failed" 1>&2 exit 127 @@ -303,7 +327,7 @@ elif diff_out_=`exec 2>/dev/null; diff -c "$0" "$0" < /dev/null`; then fi } fi -elif ( cmp --version < /dev/null 2>&1 | grep GNU ) > /dev/null 2>&1; then +elif cmp -s /dev/null /dev/null 2>/dev/null; then compare_ () { cmp -s "$@"; } else compare_ () { cmp "$@"; } |