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

This commit is contained in:
Alex Vincent 2008-07-20 08:32:32 -04:00
Родитель 487f974d7a
Коммит 1a32f1e3a2
1 изменённых файлов: 16 добавлений и 8 удалений

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

@ -82,8 +82,16 @@ if [ "x$testdir" = "x" ]; then
testdir=.
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_dir=${target_js%/*}
if [ "$target_dir" == "$target_js" ] ; then
target_dir="unit";
else
target_dir_length=${#target_dir};
target_js=${target_js:$target_dir_length + 1};
fi
# Says if the test should be launch in interactive mode or not
interactive_mode="$6"
@ -95,7 +103,7 @@ interactive_mode="$6"
# files matching the pattern head_*.js are treated like test setup files
# - they are run after head.js but before the test file
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
if [ -f $h ]; then
headfiles="$headfiles -f $h"
@ -110,7 +118,7 @@ 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
for t in $testdir/$target_dir/tail_*.js
do
if [ -f $t ]; then
tailfiles="$tailfiles -f $t"
@ -122,21 +130,21 @@ done
# 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: "
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
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
rv="$?"
if [ ! "$rv" = "0" -o \
`grep -c '\*\*\* PASS' $testdir/unit/$target_js.log` = 0 ]
`grep -c '\*\*\* PASS' $testdir/$target_dir/$target_js.log` = 0 ]
then
echo "FAIL"
echo "$target_js.log:"
echo ">>>>>>>"
cat $testdir/unit/$target_js.log
cat $testdir/$target_dir/$target_js.log
echo ""
echo "<<<<<<<"
exit_status=1