bug 443220 - check-one and check-interactive cannot run tests not in a unit/ directory. r=ted.mielczarek

This commit is contained in:
Alex Vincent 2008-07-08 17:12:41 -04:00
Родитель 753ca462de
Коммит 8cd5d31daa
1 изменённых файлов: 27 добавлений и 8 удалений

Просмотреть файл

@ -82,8 +82,27 @@ if [ "x$testdir" = "x" ]; then
testdir=. testdir=.
fi fi
# The actual JS test to run. # Get the actual JS test to run. Also get the directory it lives in, to load
# head and tail scripts.
target_js="$5" target_js="$5"
target_dir=""
_hasSlash=`expr index "$target_js" "/"`
while [ $_hasSlash != 0 ]
do
target_dir="$target_dir${target_js:0:$_hasSlash}"
target_js=${target_js:$_hasSlash}
_hasSlash=`expr index "$target_js" "/"`
done
# Default to unit, if the user didn't provide a directory.
if [ "$target_dir" = "" ]
then
target_dir="unit/"
fi
# Remove the trailing slash.
_strlen=`expr length $target_dir - 1`
target_dir=${target_dir:0:$_strlen}
# Says if the test should be launch in interactive mode or not # Says if the test should be launch in interactive mode or not
interactive_mode="$6" interactive_mode="$6"
@ -95,7 +114,7 @@ interactive_mode="$6"
# files matching the pattern head_*.js are treated like test setup files # files matching the pattern head_*.js are treated like test setup files
# - they are run after head.js but before the test file # - they are run after head.js but before the test file
headfiles="-f $topsrcdir/tools/test-harness/xpcshell-simple/head.js" headfiles="-f $topsrcdir/tools/test-harness/xpcshell-simple/head.js"
for h in $testdir/unit/head_*.js for h in $testdir/$target_dir/head_*.js
do do
if [ -f $h ]; then if [ -f $h ]; then
headfiles="$headfiles -f $h" headfiles="$headfiles -f $h"
@ -110,7 +129,7 @@ if [ ! "$interactive_mode" = "1" ]; then
tailfiles="$tailfiles -f $topsrcdir/tools/test-harness/xpcshell-simple/execute_test.js" tailfiles="$tailfiles -f $topsrcdir/tools/test-harness/xpcshell-simple/execute_test.js"
fi fi
for t in $testdir/unit/tail_*.js for t in $testdir/$target_dir/tail_*.js
do do
if [ -f $t ]; then if [ -f $t ]; then
tailfiles="$tailfiles -f $t" tailfiles="$tailfiles -f $t"
@ -122,21 +141,21 @@ done
# RUN TEST # # RUN TEST #
############ ############
echo "NATIVE_TOPSRCDIR='$native_topsrcdir' TOPSRCDIR='$topsrcdir' $xpcshell -s $headfiles -f $testdir/unit/$target_js $tailfiles 2>&1" echo "NATIVE_TOPSRCDIR='$native_topsrcdir' TOPSRCDIR='$topsrcdir' $xpcshell -s $headfiles -f $testdir/$target_dir/$target_js $tailfiles 2>&1"
echo -n "$target_js: " echo -n "$target_js: "
if [ ! "$interactive_mode" = "1" ]; then 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 NATIVE_TOPSRCDIR="$native_topsrcdir" TOPSRCDIR="$topsrcdir" $xpcshell -s $headfiles -f $testdir/$target_dir/$target_js $tailfiles 2> $testdir/$target_js.log 1>&2
else else
NATIVE_TOPSRCDIR="$native_topsrcdir" TOPSRCDIR="$topsrcdir" $xpcshell -s $headfiles -f $testdir/unit/$target_js $tailfiles -i 2>&1 NATIVE_TOPSRCDIR="$native_topsrcdir" TOPSRCDIR="$topsrcdir" $xpcshell -s $headfiles -f $testdir/$target_dir/$target_js $tailfiles -i 2>&1
fi fi
rv="$?" rv="$?"
if [ ! "$rv" = "0" -o \ if [ ! "$rv" = "0" -o \
`grep -c '\*\*\* PASS' $testdir/unit/$target_js.log` = 0 ] `grep -c '\*\*\* PASS' $testdir/$target_dir/$target_js.log` = 0 ]
then then
echo "FAIL" echo "FAIL"
echo "$target_js.log:" echo "$target_js.log:"
echo ">>>>>>>" echo ">>>>>>>"
cat $testdir/unit/$target_js.log cat $testdir/$target_dir/$target_js.log
echo "" echo ""
echo "<<<<<<<" echo "<<<<<<<"
exit_status=1 exit_status=1