Browse Source

test, travis: Quieter testing with a new -qq mode

Introduce a new -qq mode for our integration test framework,
and make travis use it.

The new -qq mode sets MSGLEVEL to 1. In MSGLEVEL=1, no messages
are generated for passed tests, and all testcase filenames are
printed in the same line.

Also install first in travis, do not ls the installed output
and run the install with chronic, so we only get output if it
failed.

Gbp-Dch: ignore
Julian Andres Klode 7 years ago
parent
commit
30ea7a6040
4 changed files with 38 additions and 10 deletions
  1. 3 4
      .travis.yml
  2. 1 1
      prepare-release
  3. 5 0
      test/integration/framework
  4. 29 5
      test/integration/run-tests

+ 3 - 4
.travis.yml

@@ -17,8 +17,7 @@ before_script:
  - make -C build -j4
  - make -C build -j4
 script:
 script:
  - CTEST_OUTPUT_ON_FAILURE=1 make -C build test
  - CTEST_OUTPUT_ON_FAILURE=1 make -C build test
- - ./test/integration/run-tests -q
+ - chronic make -C build install DESTDIR=$PWD/rootdir
+ - ./test/integration/run-tests -qq
  - sudo adduser --force-badname --system --home /nonexistent --no-create-home --quiet _apt || true
  - sudo adduser --force-badname --system --home /nonexistent --no-create-home --quiet _apt || true
- - sudo ./test/integration/run-tests -q
- - make -C build install DESTDIR=$PWD/rootdir
- - find rootdir -print0 | xargs -0 ls -ld
+ - sudo ./test/integration/run-tests -qq

+ 1 - 1
prepare-release

@@ -178,7 +178,7 @@ elif [ "$1" = 'buildlog' ]; then
 		shift
 		shift
 	done
 	done
 elif [ "$1" = 'travis-ci' ]; then
 elif [ "$1" = 'travis-ci' ]; then
-	apt-get install -qy --no-install-recommends dctrl-tools equivs gdebi-core
+	apt-get install -qy --no-install-recommends dctrl-tools equivs gdebi-core moreutils
 
 
 	test_deb_control > test-control
 	test_deb_control > test-control
 	equivs-build test-control
 	equivs-build test-control

+ 5 - 0
test/integration/framework

@@ -5,6 +5,8 @@ EXIT_CODE=0
 while [ -n "$1" ]; do
 while [ -n "$1" ]; do
 	if [ "$1" = "-q" ]; then
 	if [ "$1" = "-q" ]; then
 		export MSGLEVEL=2
 		export MSGLEVEL=2
+	elif [ "$1" = "-qq" ]; then
+		export MSGLEVEL=1
 	elif [ "$1" = "-v" ]; then
 	elif [ "$1" = "-v" ]; then
 		export MSGLEVEL=4
 		export MSGLEVEL=4
 	elif [ "$1" = '--color=no' ]; then
 	elif [ "$1" = '--color=no' ]; then
@@ -142,6 +144,9 @@ if [ $MSGLEVEL -le 4 ]; then
 	msgdebug() { true; }
 	msgdebug() { true; }
 	msgndebug() { true; }
 	msgndebug() { true; }
 fi
 fi
+if [ $MSGLEVEL -le 1 ]; then
+	msgpass() { true; }
+fi
 msgdone() {
 msgdone() {
 	if [ "$1" = "debug" -a $MSGLEVEL -le 4 ] ||
 	if [ "$1" = "debug" -a $MSGLEVEL -le 4 ] ||
 	   [ "$1" = "info" -a $MSGLEVEL -le 3 ] ||
 	   [ "$1" = "info" -a $MSGLEVEL -le 3 ] ||

+ 29 - 5
test/integration/run-tests

@@ -5,6 +5,8 @@ TESTTORUN=''
 while [ -n "$1" ]; do
 while [ -n "$1" ]; do
 	if [ "$1" = "-q" ]; then
 	if [ "$1" = "-q" ]; then
 		export MSGLEVEL=2
 		export MSGLEVEL=2
+	elif [ "$1" = "-qq" ]; then
+		export MSGLEVEL=1
 	elif [ "$1" = "-v" ]; then
 	elif [ "$1" = "-v" ]; then
 		export MSGLEVEL=4
 		export MSGLEVEL=4
 	elif [ "$1" = '--color=no' ]; then
 	elif [ "$1" = '--color=no' ]; then
@@ -50,7 +52,9 @@ if [ -n "$TESTTORUN" ]; then
 	CURRENTTRAP="rm -f \"$OUTPUT\"; $CURRENTTRAP"
 	CURRENTTRAP="rm -f \"$OUTPUT\"; $CURRENTTRAP"
 	trap "$CURRENTTRAP" 0 HUP INT QUIT ILL ABRT FPE SEGV PIPE TERM
 	trap "$CURRENTTRAP" 0 HUP INT QUIT ILL ABRT FPE SEGV PIPE TERM
 	{
 	{
-		if [ "$MSGLEVEL" -le 2 ]; then
+		if [ "$MSGLEVEL" -le 1 ]; then
+			printf "${TESTTORUN##*/}"
+		elif [ "$MSGLEVEL" -le 2 ]; then
 			printf "${CTEST}Testcase ${CHIGH}${TESTTORUN##*/}${CRESET}: "
 			printf "${CTEST}Testcase ${CHIGH}${TESTTORUN##*/}${CRESET}: "
 		else
 		else
 			printf "${CTEST}Run Testcase ${CHIGH}${TESTTORUN##*/}${CRESET}\n"
 			printf "${CTEST}Run Testcase ${CHIGH}${TESTTORUN##*/}${CRESET}\n"
@@ -58,12 +62,20 @@ if [ -n "$TESTTORUN" ]; then
 		if ! "$TESTTORUN"; then
 		if ! "$TESTTORUN"; then
 			FAIL='yes'
 			FAIL='yes'
 			if [ "$MSGLEVEL" -le 2 ]; then
 			if [ "$MSGLEVEL" -le 2 ]; then
+				printf >&2 "\n${CHIGH}Running ${TESTTORUN##*/} -> FAILED${CRESET}\n"
+			elif [ "$MSGLEVEL" -le 2 ]; then
 				printf >&2 "\n${CHIGH}Running ${TESTTORUN##*/} -> FAILED${CRESET}"
 				printf >&2 "\n${CHIGH}Running ${TESTTORUN##*/} -> FAILED${CRESET}"
 			else
 			else
 				echo >&2 "${CHIGH}Running ${TESTTORUN##*/} -> FAILED${CRESET}"
 				echo >&2 "${CHIGH}Running ${TESTTORUN##*/} -> FAILED${CRESET}"
 			fi
 			fi
+		else
+			if [ "$MSGLEVEL" -le 1 ]; then
+				printf " "
+			fi
 		fi
 		fi
-		if [ "$MSGLEVEL" -le 2 ]; then
+		if [ "$MSGLEVEL" -le 1 ]; then
+			:
+		elif [ "$MSGLEVEL" -le 2 ]; then
 			echo
 			echo
 		fi
 		fi
 	} >"$OUTPUT" 2>&1
 	} >"$OUTPUT" 2>&1
@@ -96,8 +108,13 @@ if [ -n "$APT_TEST_JOBS" ]; then
 	exec $parallel -j "$APT_TEST_JOBS" "./$(basename "$0")" -- $(echo "$TESTLIST")
 	exec $parallel -j "$APT_TEST_JOBS" "./$(basename "$0")" -- $(echo "$TESTLIST")
 fi
 fi
 TOTAL="$(echo "$TESTLIST" | wc -l)"
 TOTAL="$(echo "$TESTLIST" | wc -l)"
+if [ "$MSGLEVEL" -le 1 ]; then
+	printf "${CTEST}Running testcases${CRESET}: "
+fi
 for testcase in $TESTLIST; do
 for testcase in $TESTLIST; do
-	if [ "$MSGLEVEL" -le 2 ]; then
+	if [ "$MSGLEVEL" -le 1 ]; then
+		printf "${testcase##*/}"
+	elif [ "$MSGLEVEL" -le 2 ]; then
 		printf "($(($ALL+1))/${TOTAL}) ${CTEST}Testcase ${CHIGH}${testcase##*/}${CRESET}: "
 		printf "($(($ALL+1))/${TOTAL}) ${CTEST}Testcase ${CHIGH}${testcase##*/}${CRESET}: "
 	else
 	else
 		printf "${CTEST}Run Testcase ($(($ALL+1))/${TOTAL}) ${CHIGH}${testcase##*/}${CRESET}\n"
 		printf "${CTEST}Run Testcase ($(($ALL+1))/${TOTAL}) ${CHIGH}${testcase##*/}${CRESET}\n"
@@ -105,16 +122,23 @@ for testcase in $TESTLIST; do
 	if ! ${testcase}; then
 	if ! ${testcase}; then
 		FAIL=$((FAIL+1))
 		FAIL=$((FAIL+1))
 		FAILED_TESTS="$FAILED_TESTS ${testcase##*/}"
 		FAILED_TESTS="$FAILED_TESTS ${testcase##*/}"
-		if [ "$MSGLEVEL" -le 2 ]; then
+		if [ "$MSGLEVEL" -le 1 ]; then
+			printf >&2 "\n${CHIGH}Running ${testcase##*/} -> FAILED${CRESET}\n"
+		elif [ "$MSGLEVEL" -le 2 ]; then
 			printf >&2 "\n${CHIGH}Running ${testcase##*/} -> FAILED${CRESET}"
 			printf >&2 "\n${CHIGH}Running ${testcase##*/} -> FAILED${CRESET}"
 		else
 		else
 			echo >&2 "${CHIGH}Running ${testcase##*/} -> FAILED${CRESET}"
 			echo >&2 "${CHIGH}Running ${testcase##*/} -> FAILED${CRESET}"
 		fi
 		fi
 	else
 	else
 		PASS=$((PASS+1))
 		PASS=$((PASS+1))
+		if [ "$MSGLEVEL" -le 1 ]; then
+			printf " "
+		fi
 	fi
 	fi
 	ALL=$((ALL+1))
 	ALL=$((ALL+1))
-	if [ "$MSGLEVEL" -le 2 ]; then
+	if [ "$MSGLEVEL" -le 1 ]; then
+		:
+	elif [ "$MSGLEVEL" -le 2 ]; then
 		echo
 		echo
 	fi
 	fi
 done
 done