1 |
#!/bin/sh |
2 |
# fatal.sh - test various fatal errors |
3 |
# Copyright (C) 2007 siliconforks.com |
4 |
# |
5 |
# This program is free software; you can redistribute it and/or modify |
6 |
# it under the terms of the GNU General Public License as published by |
7 |
# the Free Software Foundation; either version 2 of the License, or |
8 |
# (at your option) any later version. |
9 |
# |
10 |
# This program is distributed in the hope that it will be useful, |
11 |
# but WITHOUT ANY WARRANTY; without even the implied warranty of |
12 |
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
13 |
# GNU General Public License for more details. |
14 |
# |
15 |
# You should have received a copy of the GNU General Public License along |
16 |
# with this program; if not, write to the Free Software Foundation, Inc., |
17 |
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. |
18 |
|
19 |
set -e |
20 |
|
21 |
trap 'rm -fr DIR OUT ERR' 1 2 3 15 |
22 |
|
23 |
export PATH=.:..:$PATH |
24 |
|
25 |
rm -fr DIR |
26 |
|
27 |
$VALGRIND jscoverage javascript-xml DIR > OUT 2> ERR && exit 1 |
28 |
test ! -s OUT |
29 |
test -s ERR |
30 |
diff --strip-trailing-cr javascript-xml.expected.err ERR |
31 |
|
32 |
rm -fr DIR |
33 |
|
34 |
$VALGRIND jscoverage javascript-invalid DIR > OUT 2> ERR && exit 1 |
35 |
test ! -s OUT |
36 |
test -s ERR |
37 |
diff --strip-trailing-cr javascript-invalid.expected.err ERR |
38 |
|
39 |
rm -fr DIR |
40 |
|
41 |
$VALGRIND jscoverage 1 2 3 > OUT 2> ERR && exit 1 |
42 |
test ! -s OUT |
43 |
test -s ERR |
44 |
diff --strip-trailing-cr too-many-arguments.expected.err ERR |
45 |
|
46 |
rm -fr DIR |
47 |
|
48 |
$VALGRIND jscoverage --no-instrument > OUT 2> ERR && exit 1 |
49 |
test ! -s OUT |
50 |
test -s ERR |
51 |
diff --strip-trailing-cr no-instrument-requires-argument.expected.err ERR |
52 |
|
53 |
$VALGRIND jscoverage --exclude > OUT 2> ERR && exit 1 |
54 |
test ! -s OUT |
55 |
test -s ERR |
56 |
diff --strip-trailing-cr exclude-requires-argument.expected.err ERR |
57 |
|
58 |
# first arg does not exist |
59 |
rm -f foo |
60 |
$VALGRIND jscoverage foo bar > OUT 2> ERR && exit 1 |
61 |
test ! -s OUT |
62 |
test -s ERR |
63 |
# diff --strip-trailing-cr source-does-not-exist.expected.err ERR |
64 |
|
65 |
# first arg is file |
66 |
touch foo |
67 |
$VALGRIND jscoverage foo bar > OUT 2> ERR && exit 1 |
68 |
test ! -s OUT |
69 |
test -s ERR |
70 |
# diff --strip-trailing-cr source-is-file.expected.err ERR |
71 |
rm foo |
72 |
|
73 |
# second arg is file |
74 |
rm -fr bar |
75 |
touch bar |
76 |
$VALGRIND jscoverage javascript bar > OUT 2> ERR && exit 1 |
77 |
test ! -s OUT |
78 |
test -s ERR |
79 |
# diff --strip-trailing-cr destination-is-file.expected.err ERR |
80 |
rm bar |
81 |
|
82 |
# second arg is directory, but not from previous run |
83 |
rm -fr bar |
84 |
mkdir bar |
85 |
touch bar/foo |
86 |
$VALGRIND jscoverage javascript bar > OUT 2> ERR && exit 1 |
87 |
test ! -s OUT |
88 |
test -s ERR |
89 |
# diff --strip-trailing-cr destination-is-existing-directory.expected.err ERR |
90 |
rm -fr bar |
91 |
|
92 |
rm -fr DIR OUT ERR |