1 |
siliconforks |
2 |
#!/bin/sh |
2 |
|
|
# fatal.sh - test various fatal errors |
3 |
siliconforks |
87 |
# Copyright (C) 2007, 2008 siliconforks.com |
4 |
siliconforks |
2 |
# |
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 |
siliconforks |
226 |
$VALGRIND jscoverage --encoding > OUT 2> ERR && exit 1 |
59 |
|
|
test ! -s OUT |
60 |
|
|
test -s ERR |
61 |
|
|
diff --strip-trailing-cr encoding-requires-argument.expected.err ERR |
62 |
|
|
|
63 |
siliconforks |
2 |
# first arg does not exist |
64 |
|
|
rm -f foo |
65 |
|
|
$VALGRIND jscoverage foo bar > OUT 2> ERR && exit 1 |
66 |
|
|
test ! -s OUT |
67 |
|
|
test -s ERR |
68 |
|
|
# diff --strip-trailing-cr source-does-not-exist.expected.err ERR |
69 |
|
|
|
70 |
|
|
# first arg is file |
71 |
|
|
touch foo |
72 |
|
|
$VALGRIND jscoverage foo bar > OUT 2> ERR && exit 1 |
73 |
|
|
test ! -s OUT |
74 |
|
|
test -s ERR |
75 |
|
|
# diff --strip-trailing-cr source-is-file.expected.err ERR |
76 |
|
|
rm foo |
77 |
|
|
|
78 |
|
|
# second arg is file |
79 |
|
|
rm -fr bar |
80 |
|
|
touch bar |
81 |
|
|
$VALGRIND jscoverage javascript bar > OUT 2> ERR && exit 1 |
82 |
|
|
test ! -s OUT |
83 |
|
|
test -s ERR |
84 |
|
|
# diff --strip-trailing-cr destination-is-file.expected.err ERR |
85 |
|
|
rm bar |
86 |
|
|
|
87 |
|
|
# second arg is directory, but not from previous run |
88 |
|
|
rm -fr bar |
89 |
|
|
mkdir bar |
90 |
|
|
touch bar/foo |
91 |
|
|
$VALGRIND jscoverage javascript bar > OUT 2> ERR && exit 1 |
92 |
|
|
test ! -s OUT |
93 |
|
|
test -s ERR |
94 |
|
|
# diff --strip-trailing-cr destination-is-existing-directory.expected.err ERR |
95 |
|
|
rm -fr bar |
96 |
|
|
|
97 |
|
|
rm -fr DIR OUT ERR |