From 896f0ae857b693782658145e16e21a3054dd5280 Mon Sep 17 00:00:00 2001 From: David Kalnischkies Date: Fri, 8 Jan 2016 13:08:19 +0100 Subject: [PATCH] tests: limit autotest-functionname generation to sane characters Some (older) versions of bash seem to be allergic to a method named "aptautotest_grep_^apt" (note the caret). Unlikely that we are going to write autotests for such commands so we could just skip those, but lets instead just use "normal" characters in the names and strip the rest as we already did with the (arguable more common) '-'. --- test/integration/framework | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/test/integration/framework b/test/integration/framework index 430ee552d..c547032c2 100644 --- a/test/integration/framework +++ b/test/integration/framework @@ -95,7 +95,7 @@ msgfail() { if [ $# -gt 0 ] && [ -n "$1" ]; then printf "${CFAIL}FAIL: $*${CNORMAL}\n" >&2; else printf "${CFAIL}FAIL${CNORMAL}\n" >&2; fi if [ -n "$APT_DEBUG_TESTS" ]; then - APT_CONFIG="$(getaptconfig)" LD_LIBRARY_PATH="${LIBRARYPATH}:${LD_LIBRARY_PATH}" $SHELL + runapt $SHELL fi EXIT_CODE=$((EXIT_CODE+1)); } @@ -173,7 +173,7 @@ runapt() { sh|aptitude|*/*|command) ;; *) CMD="${BUILDDIRECTORY}/$CMD";; esac - MALLOC_PERTURB_=21 MALLOC_CHECK_=2 APT_CONFIG="$(getaptconfig)" LD_LIBRARY_PATH=${LIBRARYPATH} "$CMD" "$@" + MALLOC_PERTURB_=21 MALLOC_CHECK_=2 APT_CONFIG="$(getaptconfig)" LD_LIBRARY_PATH="${LIBRARYPATH}:${LD_LIBRARY_PATH}" "$CMD" "$@" } aptconfig() { runapt apt-config "$@"; } aptcache() { runapt apt-cache "$@"; } @@ -1842,7 +1842,7 @@ aptautotest() { local TESTCALL="$1" local CMD="$2" local FIRSTOPT="$3" - local AUTOTEST="aptautotest_$(echo "${CMD##*/}_${FIRSTOPT}" | tr -d '-')" + local AUTOTEST="aptautotest_$(echo "${CMD##*/}_${FIRSTOPT}" | tr -d -c 'A-za-z0-9')" if command -v $AUTOTEST >/dev/null; then shift 3 # save and restore the *.output files from other tests -- 2.45.2