+if [ -n "$TESTTORUN" ]; then
+ # collecting the output of one test to have it together
+ OUTPUT="$(mktemp)"
+ CURRENTTRAP="rm -f \"$OUTPUT\"; $CURRENTTRAP"
+ trap "$CURRENTTRAP" 0 HUP INT QUIT ILL ABRT FPE SEGV PIPE TERM
+ {
+ if [ "$MSGLEVEL" -le 2 ]; then
+ printf "${CTEST}Testcase ${CHIGH}${TESTTORUN##*/}${CRESET}: "
+ else
+ printf "${CTEST}Run Testcase ${CHIGH}${TESTTORUN##*/}${CRESET}\n"
+ fi
+ if ! "$TESTTORUN"; then
+ FAIL='yes'
+ if [ "$MSGLEVEL" -le 2 ]; then
+ printf >&2 "\n${CHIGH}Running ${TESTTORUN##*/} -> FAILED${CRESET}"
+ else
+ echo >&2 "${CHIGH}Running ${TESTTORUN##*/} -> FAILED${CRESET}"
+ fi
+ fi
+ if [ "$MSGLEVEL" -le 2 ]; then
+ echo
+ fi
+ } >"$OUTPUT" 2>&1
+ # without we end up getting stepped output 'randomly'
+ stty sane
+ cat >&2 "$OUTPUT"
+ stty sane
+ if [ "$FAIL" = 'yes' ]; then
+ exit 1
+ else
+ exit 0
+ fi
+fi
+
+FAIL=0
+PASS=0
+ALL=0
+FAILED_TESTS=""
+DIR="$(readlink -f "$(dirname "$0")")"
+cd "$DIR"
+TESTLIST="$(find . -mindepth 1 -maxdepth 1 -regex '^\./test-[^/]*$' | sort)"
+if [ -n "$APT_TEST_JOBS" ]; then
+ if [ "$MSGCOLOR" != 'NO' ]; then
+ export MSGCOLOR='ALWAYS'
+ fi
+ exec parallel -j "$APT_TEST_JOBS" "./$(basename "$0")" -- $(echo "$TESTLIST")
+fi
+TOTAL="$(echo "$TESTLIST" | wc -l)"
+for testcase in $TESTLIST; do