Debian Codegraph @

scripts/test1_wrong_code_framac.sh

raw symbols SCIP
1 #!/usr/bin/env bash
2 ##
3 ## Copyright (c) 2012, 2016 The University of Utah
4 ## All rights reserved.
5 ##
6 ## This file is distributed under the University of Illinois Open Source
7 ## License. See the file COPYING for details.
8
9 ###############################################################################
10
11 rm -f out*.txt
12
13 ulimit -t 3
14 ulimit -v 2000000
15
16 if
17 clang -pedantic -Wall -O0 -c small.c >out.txt 2>&1 &&\
18 ! grep 'conversions than data arguments' out.txt &&\
19 ! grep 'incompatible redeclaration' out.txt &&\
20 ! grep 'ordered comparison between pointer' out.txt &&\
21 ! grep 'eliding middle term' out.txt &&\
22 ! grep 'end of non-void function' out.txt &&\
23 ! grep 'invalid in C99' out.txt &&\
24 ! grep 'specifies type' out.txt &&\
25 ! grep 'should return a value' out.txt &&\
26 ! grep 'uninitialized' out.txt &&\
27 ! grep 'incompatible pointer to' out.txt &&\
28 ! grep 'incompatible integer to' out.txt &&\
29 ! grep 'type specifier missing' out.txt &&\
30 gcc -Wall -Wextra -O1 small.c -o smallz >outa.txt 2>&1 &&\
31 ! grep uninitialized outa.txt &&\
32 ! grep 'without a cast' outa.txt &&\
33 ! grep 'control reaches end' outa.txt &&\
34 ! grep 'return type defaults' outa.txt &&\
35 ! grep 'cast from pointer to integer' outa.txt &&\
36 ! grep 'useless type name in empty declaration' outa.txt &&\
37 ! grep 'no semicolon at end' outa.txt &&\
38 ! grep 'type defaults to' outa.txt &&\
39 ! grep 'too few arguments for format' outa.txt &&\
40 ! grep 'incompatible pointer' outa.txt &&\
41 ! grep 'ordered comparison of pointer with integer' outa.txt &&\
42 ! grep 'declaration does not declare anything' outa.txt &&\
43 ! grep 'expects type' outa.txt &&\
44 ! grep 'pointer from integer' outa.txt &&\
45 ! grep 'incompatible implicit' outa.txt &&\
46 ! grep 'excess elements in struct initializer' outa.txt &&\
47 ! grep 'comparison between pointer and integer' outa.txt &&\
48 XXOPT1 small.c -o small1 > cc_out1.txt 2>&1 &&\
49 ./small1 >out1.txt 2>&1 &&\
50 XXOPT2 small.c -o small2 > cc_out2.txt 2>&1 &&\
51 ./small2 >out2.txt 2>&1 &&\
52 ! diff out1.txt out2.txt &&\
53 cp small.c small-framac.c &&\
54 perl -pi.bak -e 's/int main \(int argc, char\* argv\[\]\)/int argc; char **argv; int main (void)/' small-framac.c &&\
55 RunSafely.sh 125 1 /dev/null out_framac.txt frama-c -cpp-command \"gcc -C -Dvolatile= -E -I.\" -val-signed-overflow-alarms -val -stop-at-first-alarm -no-val-show-progress -machdep x86_64 -obviously-terminates -precise-unions small-framac.c &&\
56 ! egrep -i '(user error|assert)' out_framac.txt >/dev/null 2>&1
57 then
58 exit 0
59 else
60 exit 1
61 fi