Bug 458256. Use LoadLibraryW instead of LoadLibrary (patch by DougT). r+sr=vlad
[wine-gecko.git] / tools / test-harness / xpcshell-simple / test_all.sh
blobaf7d80468edd8db695f98d3e09af5dd8902d491e
1 #!/bin/bash
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
16 # License.
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.
24 # Contributor(s):
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 ***** */
43 # allow core dumps
44 ulimit -c 20480 2> /dev/null
46 # Make assertions fatal
47 XPCOM_DEBUG_BREAK=stack-and-abort; export XPCOM_DEBUG_BREAK
49 exit_status=0
52 ##########################
53 # COMMAND-LINE ARGUMENTS #
54 ##########################
56 # This provides the path to xpcshell.
57 xpcshell="$1"
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.
62 topsrcdir="$2"
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
69 # clean manner.
70 native_topsrcdir="$3"
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.
75 testdir="$4"
76 if [ "x$testdir" = "x" ]; then
77 testdir=.
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
90 if [ -f $h ]; then
91 headfiles="$headfiles -f $h"
93 done
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
101 if [ -f $t ]; then
102 tailfiles="$tailfiles -f $t"
104 done
107 #################
108 # RUN EACH TEST #
109 #################
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
114 rv="$?"
115 if [ ! "$rv" = "0" -o \
116 `grep -c '\*\*\* PASS' $t.log` = 0 ]
117 then
118 echo "TEST-UNEXPECTED-FAIL | $t | test failed, see log"
119 echo "$t.log:"
120 echo ">>>>>>>"
121 cat $t.log
122 echo ""
123 echo "<<<<<<<"
124 exit_status=1
125 else
126 echo "TEST-PASS | $t | all tests passed"
128 done
130 exit $exit_status