Skip to content
Permalink
Browse files
r=pcwalton; shell script to run SpiderMonkey test suite; also a new -…
…I command-line option to drop into SpiderMonkey
  • Loading branch information
Dave Herman committed Dec 9, 2010
1 parent 684f401 commit 7ef973f51753eaaeb6203bec1cfaca4b8037985f
44 jstests
@@ -0,0 +1,44 @@
#!/bin/sh

# Root of the narcissus tree
NJS_HOME=`dirname $0`
NJS_HOME=`(cd $NJS_HOME; pwd)`

# Fake information for the test harness's |xulRuntime| configuration object.
XUL_INFO=none:none:true

if [ $# -eq 1 -a "$1" = "-h" ]; then
echo "usage: jstests [-h | -a | <test> ...]" 1>&2
echo " -h display this usage information and quit" 1>&2
echo " -a run all but the slowest tests (those in xfail/narcissus-slow.txt)" 1>&2
echo " <test> path to individual test (relative to test directory)" 1>&2
echo "" 1>&2
echo "With no arguments, jstests runs all tests except those listed in" 1>&2
echo "xfail/narcissus-failures.txt, which includes all the tests listed in" 1>&2
echo "xfail/narcissus-slow.txt." 1>&2
echo "" 1>&2
echo "The test directory is searched for either in NJS_TESTS or in" 1>&2
echo "a tests/ subdirectory of the Narcissus home directory."
exit
elif [ $# -gt 0 -a "$1" = "-a" ]; then
shift
XFAIL=narcissus-slow.txt
else
XFAIL=narcissus-failures.txt
fi

if [ ! -z $NJS_TESTS -a -d $NJS_TESTS ]; then
cd $NJS_TESTS
elif [ -d $NJS_HOME/tests ]; then
cd $NJS_HOME/tests
else
echo 'Expected a test directory in $NJS_TESTS or '"$NJS_HOME/tests." 1>&2
echo "Run jstests -h for more information." 1>&2
exit 1
fi

if [ $# -gt 0 ]; then
exec python jstests.py --xul-info=$XUL_INFO -s -o -d -j 4 $NJS_HOME/njs $*
else
exec python jstests.py --xul-info=$XUL_INFO -d -j 4 $NJS_HOME/njs -x $NJS_HOME/xfail/$XFAIL
fi
14 njs
@@ -37,6 +37,8 @@ if __name__ == '__main__':
help='JS expression to evaluate')
op.add_option('-i', '--interactive', dest='js_interactive', action='store_true',
help='enable interactive shell')
op.add_option('-I', '--interactive-meta', dest='js_interactive_meta', action='store_true',
help='load Narcissus but run interactive SpiderMonkey shell')
op.add_option('-H', '--harmony', dest='js_harmony', action='store_true',
help='enable ECMAScript Harmony mode')
op.add_option('-P', '--parse-only', dest='js_parseonly', action='store_true',
@@ -78,11 +80,13 @@ if __name__ == '__main__':

argv = [js_cmd, '-f', narc_jsdefs, '-f', narc_jslex, '-f', narc_jsparse, '-f', narc_jsdecomp, '-f', narc_jsexec]

if options.js_interactive:
cmd += 'Narcissus.interpreter.repl();'
argv = ['rlwrap'] + argv

argv += ['-e', cmd]
if options.js_interactive_meta:
argv += ['-e', cmd, '-i']
else:
if options.js_interactive:
cmd += 'Narcissus.interpreter.repl();'
argv = ['rlwrap'] + argv
argv += ['-e', cmd]

try:
Popen(argv).wait()

This file was deleted.

File renamed without changes.
File renamed without changes.

0 comments on commit 7ef973f

Please sign in to comment.