3 # vim:set ts=2 sw=2 sts=2 et:
5 # ***** BEGIN LICENSE BLOCK *****
6 # Version: MPL 1.1/GPL 2.0/LGPL 2.1
8 # The contents of this file are subject to the Mozilla Public License Version
9 # 1.1 (the "License"); you may not use this file except in compliance with
10 # the License. You may obtain a copy of the License at
11 # http://www.mozilla.org/MPL/
13 # Software distributed under the License is distributed on an "AS IS" basis,
14 # WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
15 # for the specific language governing rights and limitations under the
18 # The Original Code is mozilla.org code.
20 # The Initial Developer of the Original Code is Google Inc.
21 # Portions created by the Initial Developer are Copyright (C) 2005
22 # the Initial Developer. All Rights Reserved.
25 # Darin Fisher <darin@meer.net>
26 # Dave Liebreich <davel@mozilla.com>
27 # Jeff Walden <jwalden+code@mit.edu>
29 # Alternatively, the contents of this file may be used under the terms of
30 # either the GNU General Public License Version 2 or later (the "GPL"), or
31 # the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
32 # in which case the provisions of the GPL or the LGPL are applicable instead
33 # of those above. If you wish to allow use of your version of this file only
34 # under the terms of either the GPL or the LGPL, and not to allow others to
35 # use your version of this file under the terms of the MPL, indicate your
36 # decision by deleting the provisions above and replace them with the notice
37 # and other provisions required by the GPL or the LGPL. If you do not delete
38 # the provisions above, a recipient may use your version of this file under
39 # the terms of any one of the MPL, the GPL or the LGPL.
41 # ***** END LICENSE BLOCK ***** */
44 ulimit -c 20480 2> /dev
/null
46 # Make assertions fatal
47 XPCOM_DEBUG_BREAK
=stack-and-abort
; export XPCOM_DEBUG_BREAK
52 ##########################
53 # COMMAND-LINE ARGUMENTS #
54 ##########################
56 # This provides the path to xpcshell.
59 # The directory containing Mozilla source code is specified as the first
60 # argument to this script, in a format usable by load() in xpcshell. This
61 # enables do_import_script to work for any JS file in the source tree.
64 # Tests which depend on files in the source directory will need a native path
65 # to actually access those files, or otherwise they must rely on hacks such as
66 # getting the current working/process directory and committing other atrocities.
67 # This argument is a native path to the top-level source directory, useful for
68 # tests which require access to files so that they can access them in a vaguely
72 # The sample Makefile for the xpcshell-simple harness adds the directory where
73 # the test_*.js files reside as an arg. If no arg is specified, assume the
74 # current directory is where the *.js files live.
76 if [ "x$testdir" = "x" ]; then
81 ###############################
82 # SETUP FOR RUNNING THE TESTS #
83 ###############################
85 # files matching the pattern head_*.js are treated like test setup files
86 # - they are run after head.js but before the test file
87 headfiles
="-f $topsrcdir/tools/test-harness/xpcshell-simple/head.js"
88 for h
in $testdir/head_
*.js
91 headfiles
="$headfiles -f $h"
95 # files matching the pattern tail_*.js are treated like teardown files
96 # - they are run after tail.js
97 tailfiles
="-f $topsrcdir/tools/test-harness/xpcshell-simple/tail.js"
98 tailfiles
="$tailfiles -f $topsrcdir/tools/test-harness/xpcshell-simple/execute_test.js"
99 for t
in $testdir/tail_
*.js
102 tailfiles
="$tailfiles -f $t"
111 for t
in $testdir/test_
*.js
113 NATIVE_TOPSRCDIR
="$native_topsrcdir" TOPSRCDIR
="$topsrcdir" $xpcshell -j -s $headfiles -f $t $tailfiles 2> $t.log
1>&2
115 if [ ! "$rv" = "0" -o \
116 `grep -c '\*\*\* PASS' $t.log` = 0 ]
118 echo "TEST-UNEXPECTED-FAIL | $t | test failed, see log"
126 echo "TEST-PASS | $t | all tests passed"