From 7da307031e2d8e66016c67f04afbc543ffd65f16 Mon Sep 17 00:00:00 2001 From: Jim Meyering Date: Sat, 17 Oct 2015 13:48:18 -0700 Subject: [PATCH 2/2] gnulib: update to latest; also bootstrap and tests/init.sh * bootstrap: Update from gnulib. * tests/init.sh: Likewise. * gnulib: Update submodule to latest. --- bootstrap | 3 ++- gnulib | 2 +- tests/init.sh | 22 ++++++++++++++++++++++ 3 files changed, 25 insertions(+), 2 deletions(-) diff --git a/bootstrap b/bootstrap index 2fdf267..e72894c 100755 --- a/bootstrap +++ b/bootstrap @@ -915,7 +915,8 @@ if test $use_libtool = 1; then esac fi echo "$0: $gnulib_tool $gnulib_tool_options --import ..." -$gnulib_tool $gnulib_tool_options --import $gnulib_modules && +$gnulib_tool $gnulib_tool_options --import $gnulib_modules \ + || die "gnulib-tool failed" for file in $gnulib_files; do symlink_to_dir "$GNULIB_SRCDIR" $file \ diff --git a/gnulib b/gnulib index 5513b40..37c054a 160000 --- a/gnulib +++ b/gnulib @@ -1 +1 @@ -Subproject commit 5513b40999149090987a0341c018d05d3eea1272 +Subproject commit 37c054af09357276eb560990eba1f20cdc489bfc diff --git a/tests/init.sh b/tests/init.sh index 37fc7b6..d366206 100644 --- a/tests/init.sh +++ b/tests/init.sh @@ -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 -- 2.6.0