[Debian-l10n-commits] r1194 - in /ddtp-dinstall/trunk: Changelog tests/testsuite.sh

nekral-guest at users.alioth.debian.org nekral-guest at users.alioth.debian.org
Wed Aug 13 02:29:37 UTC 2008


Author: nekral-guest
Date: Wed Aug 13 02:29:36 2008
New Revision: 1194

URL: http://svn.debian.org/wsvn/?sc=1&rev=1194
Log:
	* tests/testsuite.sh: Send error messages to stderr.
	* tests/testsuite.sh: Check the checker's options.  Add support
	for providing checker options to run_test().  prepare_testsuite():
	Drop the lines starting with #DEBUG# in the expected logs when
	--debug is not specified.  Indicate the options used when a test
	unit fails.

Modified:
    ddtp-dinstall/trunk/Changelog
    ddtp-dinstall/trunk/tests/testsuite.sh

Modified: ddtp-dinstall/trunk/Changelog
URL: http://svn.debian.org/wsvn/ddtp-dinstall/trunk/Changelog?rev=1194&op=diff
==============================================================================
--- ddtp-dinstall/trunk/Changelog (original)
+++ ddtp-dinstall/trunk/Changelog Wed Aug 13 02:29:36 2008
@@ -1,3 +1,12 @@
+2008-08-12  Nicolas François  <nicolas.francois at centraliens.net>
+
+	* tests/testsuite.sh: Send error messages to stderr.
+	* tests/testsuite.sh: Check the checker's options.  Add support
+	for providing checker options to run_test().  prepare_testsuite():
+	Drop the lines starting with #DEBUG# in the expected logs when
+	--debug is not specified.  Indicate the options used when a test
+	unit fails.
+
 2008-08-12  Nicolas François  <nicolas.francois at centraliens.net>
 
 	* checks/ddtp_i18n_check.sh: Added support for the--dry-run option

Modified: ddtp-dinstall/trunk/tests/testsuite.sh
URL: http://svn.debian.org/wsvn/ddtp-dinstall/trunk/tests/testsuite.sh?rev=1194&op=diff
==============================================================================
--- ddtp-dinstall/trunk/tests/testsuite.sh (original)
+++ ddtp-dinstall/trunk/tests/testsuite.sh Wed Aug 13 02:29:36 2008
@@ -22,7 +22,7 @@
 			BUILD_EXPECTED=1
 			;;
 		*)
-			echo "$0: Invalid option: $opt"
+			echo "$0: Invalid option: $opt" >&2
 			exit 1
 			;;
 	esac
@@ -42,13 +42,21 @@
 
 prepare_testsuite () {
 	pt_d="$1"
+	pt_checker_options="$2"
 	pt_basename=$(basename "$pt_d")
 	pt_dirname=$(dirname "$pt_d")
 	pt_tmp=$(mktemp -d testsuite-XXXXXX)
 	cp -aH "$pt_d" "$pt_tmp/test"
 	cp -aH "$pt_dirname.pkgs/$pt_basename" "$pt_tmp/test.pkgs"
 	if [ "$BUILD_EXPECTED" = "0" ]; then
-		cp "$pt_d.expected" "$pt_tmp/test.expected"
+		if ! echo "$pt_checker_options" | grep -q -- "--debug"; then
+			# Remove the lines which will only appear in case
+			# of --debug.
+			grep -v "^#DEBUG#" "$pt_d.expected" > "$pt_tmp/test.expected"
+		else
+			# Remove the #DEBUG# header.
+			sed -e 's/^#DEBUG#//' "$pt_d.expected" > "$pt_tmp/test.expected"
+		fi
 	fi
 	find "$pt_tmp" -name ".svn" -print0 | xargs -0 rm -rf
 
@@ -61,12 +69,13 @@
 }
 
 run_test () {
-	rt_tmp="$1"
-	rt_expected_status="$2"
-	rt_test_name="$3"
+	rt_options="$1"
+	rt_tmp="$2"
+	rt_expected_status="$3"
+	rt_test_name="$4"
 	rt_status=0
 
-	$CHECK_SCRIPT "$rt_tmp/test" "$rt_tmp/test.pkgs" > "$rt_tmp/test.log" 2>&1 || {
+	$CHECK_SCRIPT $rt_options "$rt_tmp/test" "$rt_tmp/test.pkgs" > "$rt_tmp/test.log" 2>&1 || {
 		rt_status=$?
 	}
 	echo "status: $rt_status" >> "$rt_tmp/test.log"
@@ -92,20 +101,23 @@
 	fi
 }
 
+for checker_options in "" "--dry-run" "--debug" "--dry-run --debug"; do
+	echo ""
+	echo "Testing options '$checker_options'"
 for d in $TESTSUITE_DIR/{good,bad}/*; do
 	[ ! -d "$d" ] && continue
-	tmp=$(prepare_testsuite "$d")
+	tmp=$(prepare_testsuite "$d" "$checker_options")
 
 	case $(dirname "$d") in
 		"$TESTSUITE_DIR/good")	expected_status=0;;
 		"$TESTSUITE_DIR/bad")	expected_status=1;;
 	esac
 
-	if run_test "$tmp" $expected_status "$d"; then
+	if run_test "$checker_options" "$tmp" $expected_status "$d"; then
 		echo " OK* $d"
 	else
 		echo "*NO  $d"
-		failures="$failures $d"
+		failures="$failures $d.log (options: '$checker_options')"
 	fi
 
 	if [ "$BUILD_EXPECTED" = "1" ]; then
@@ -113,6 +125,7 @@
 	fi
 
 	clean_testsuite "$tmp"
+done
 done
 
 echo ""




More information about the Debian-l10n-commits mailing list