From 65eb6d6f99e7046a74ed5ae6a7aaf89a566230f2 Mon Sep 17 00:00:00 2001 From: "reed%reedloden.com" Date: Fri, 23 Nov 2007 01:42:22 +0000 Subject: [PATCH] Bug 404513 - "Add Makefile target to launch solo xpcshell test without interactive mode" [p=laurent@xulfr.org (Laurent Jouanneau) r=robcee sr=luser a1.9=beltzner] --- config/rules.mk | 19 +++++++++++++++++-- .../test-harness/xpcshell-simple/test_one.sh | 19 +++++++++++++++---- 2 files changed, 32 insertions(+), 6 deletions(-) diff --git a/config/rules.mk b/config/rules.mk index 98c2fbad13b..e6dc749772c 100644 --- a/config/rules.mk +++ b/config/rules.mk @@ -1899,7 +1899,18 @@ check-interactive:: $(FWDSLASH_TOPSRCDIR) \ $(NATIVE_TOPSRCDIR) \ $(DEPTH)/_tests/xpcshell-simple/$(MODULE)/$$testdir \ - $(SOLO_FILE); + $(SOLO_FILE) 1; + +# Test execution +check-one:: + @$(EXIT_ON_ERROR) \ + $(RUN_TEST_PROGRAM) \ + $(topsrcdir)/tools/test-harness/xpcshell-simple/test_one.sh \ + $(DIST)/bin/xpcshell \ + $(FWDSLASH_TOPSRCDIR) \ + $(NATIVE_TOPSRCDIR) \ + $(DEPTH)/_tests/xpcshell-simple/$(MODULE)/$$testdir \ + $(SOLO_FILE) 0; endif # XPCSHELL_TESTS @@ -2036,7 +2047,7 @@ endif # Fake targets. Always run these rules, even if a file/directory with that # name already exists. # -.PHONY: all all_platforms alltags boot checkout chrome realchrome clean clobber clobber_all export install libs makefiles realclean run_viewer run_apprunner tools $(DIRS) $(TOOL_DIRS) FORCE check check-interactive +.PHONY: all all_platforms alltags boot checkout chrome realchrome clean clobber clobber_all export install libs makefiles realclean run_viewer run_apprunner tools $(DIRS) $(TOOL_DIRS) FORCE check check-interactive check-one # Used as a dependency to force targets to rebuild FORCE: @@ -2175,3 +2186,7 @@ check:: $(SUBMAKEFILES) $(MAKE_DIRS) check-interactive:: $(SUBMAKEFILES) $(MAKE_DIRS) +$(LOOP_OVER_DIRS) +$(LOOP_OVER_TOOL_DIRS) + +check-one:: $(SUBMAKEFILES) $(MAKE_DIRS) + +$(LOOP_OVER_DIRS) + +$(LOOP_OVER_TOOL_DIRS) diff --git a/tools/test-harness/xpcshell-simple/test_one.sh b/tools/test-harness/xpcshell-simple/test_one.sh index 8e52ba2485e..f895c8c309b 100755 --- a/tools/test-harness/xpcshell-simple/test_one.sh +++ b/tools/test-harness/xpcshell-simple/test_one.sh @@ -85,6 +85,9 @@ fi # The actual JS test to run. target_js="$5" +# Says if the test should be launch in interactive mode or not +interactive_mode="$6" + ############################### # SETUP FOR RUNNING THE TESTS # ############################### @@ -95,18 +98,22 @@ headfiles="-f $topsrcdir/tools/test-harness/xpcshell-simple/head.js" for h in $testdir/unit/head_*.js do if [ -f $h ]; then - headfiles="$headfiles -f $h" + headfiles="$headfiles -f $h" fi done # files matching the pattern tail_*.js are treated like teardown files # - they are run after tail.js tailfiles="-f $topsrcdir/tools/test-harness/xpcshell-simple/tail.js" -#tailfiles="$tailfiles -f $topsrcdir/tools/test-harness/xpcshell-simple/execute_test.js" + +if [ ! "$interactive_mode" = "1" ]; then + tailfiles="$tailfiles -f $topsrcdir/tools/test-harness/xpcshell-simple/execute_test.js" +fi + for t in $testdir/unit/tail_*.js do if [ -f $t ]; then - tailfiles="$tailfiles -f $t" + tailfiles="$tailfiles -f $t" fi done @@ -117,7 +124,11 @@ done echo "NATIVE_TOPSRCDIR='$native_topsrcdir' TOPSRCDIR='$topsrcdir' $xpcshell -s $headfiles -f $testdir/unit/$target_js $tailfiles 2>&1" echo -n "$target_js: " -NATIVE_TOPSRCDIR="$native_topsrcdir" TOPSRCDIR="$topsrcdir" $xpcshell -s $headfiles -f $testdir/unit/$target_js $tailfiles -i 2>&1 +if [ ! "$interactive_mode" = "1" ]; then + NATIVE_TOPSRCDIR="$native_topsrcdir" TOPSRCDIR="$topsrcdir" $xpcshell -s $headfiles -f $testdir/unit/$target_js $tailfiles 2> $testdir/unit/$target_js.log 1>&2 +else + NATIVE_TOPSRCDIR="$native_topsrcdir" TOPSRCDIR="$topsrcdir" $xpcshell -s $headfiles -f $testdir/unit/$target_js $tailfiles -i 2>&1 +fi rv="$?" if [ ! "$rv" = "0" -o \ `grep -c '\*\*\* PASS' $testdir/unit/$target_js.log` = 0 ]