浏览代码

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) '-'.
David Kalnischkies 10 年之前
父节点
当前提交
896f0ae857
共有 1 个文件被更改,包括 3 次插入3 次删除
  1. 3 3
      test/integration/framework

+ 3 - 3
test/integration/framework

@@ -95,7 +95,7 @@ msgfail() {
 	if [ $# -gt 0 ] && [ -n "$1" ]; then printf "${CFAIL}FAIL: $*${CNORMAL}\n" >&2;
 	if [ $# -gt 0 ] && [ -n "$1" ]; then printf "${CFAIL}FAIL: $*${CNORMAL}\n" >&2;
 	else printf "${CFAIL}FAIL${CNORMAL}\n" >&2; fi
 	else printf "${CFAIL}FAIL${CNORMAL}\n" >&2; fi
 	if [ -n "$APT_DEBUG_TESTS" ]; then
 	if [ -n "$APT_DEBUG_TESTS" ]; then
-		APT_CONFIG="$(getaptconfig)" LD_LIBRARY_PATH="${LIBRARYPATH}:${LD_LIBRARY_PATH}" $SHELL
+		runapt $SHELL
 	fi
 	fi
 	EXIT_CODE=$((EXIT_CODE+1));
 	EXIT_CODE=$((EXIT_CODE+1));
 }
 }
@@ -173,7 +173,7 @@ runapt() {
 	sh|aptitude|*/*|command) ;;
 	sh|aptitude|*/*|command) ;;
 	*) CMD="${BUILDDIRECTORY}/$CMD";;
 	*) CMD="${BUILDDIRECTORY}/$CMD";;
 	esac
 	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 "$@"; }
 aptconfig() { runapt apt-config "$@"; }
 aptcache() { runapt apt-cache "$@"; }
 aptcache() { runapt apt-cache "$@"; }
@@ -1842,7 +1842,7 @@ aptautotest() {
 	local TESTCALL="$1"
 	local TESTCALL="$1"
 	local CMD="$2"
 	local CMD="$2"
 	local FIRSTOPT="$3"
 	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
 	if command -v $AUTOTEST >/dev/null; then
 		shift 3
 		shift 3
 		# save and restore the *.output files from other tests
 		# save and restore the *.output files from other tests