Debian Codegraph @

tests/test4.sh

raw symbols SCIP
1 #!/usr/bin/env bash
2 ##
3 ## Copyright (c) 2012, 2015, 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 file="file2.c"
12
13 CLANG="${CLANG:-clang}"
14 GCC="${GCC:-gcc}"
15
16 if [ $# -ne 0 ]; then
17 echo "usage: $0" 1>&2
18 exit 1
19 fi
20
21 rm -f out*.txt
22
23 ulimit -t 15
24 ulimit -v 2000000
25
26 if
27 "$CLANG" -pedantic -Wall -O0 "$file" >out.txt 2>&1 &&\
28 ! grep 'conversions than data arguments' out.txt &&\
29 ! grep 'incompatible redeclaration' out.txt &&\
30 ! grep 'ordered comparison between pointer' out.txt &&\
31 ! grep 'eliding middle term' out.txt &&\
32 ! grep 'end of non-void function' out.txt &&\
33 ! grep 'invalid in C99' out.txt &&\
34 ! grep 'specifies type' out.txt &&\
35 ! grep 'should return a value' out.txt &&\
36 ! grep 'uninitialized' out.txt &&\
37 ! grep 'incompatible pointer to' out.txt &&\
38 ! grep 'incompatible integer to' out.txt &&\
39 ! grep 'type specifier missing' out.txt &&\
40 "$GCC" -Wall -Wextra -O "$file" -o smallz >outa.txt 2>&1 &&\
41 ! grep uninitialized outa.txt &&\
42 ! grep 'without a cast' outa.txt &&\
43 ! grep 'control reaches end' outa.txt &&\
44 ! grep 'return type defaults' outa.txt &&\
45 ! grep 'cast from pointer to integer' outa.txt &&\
46 ! grep 'useless type name in empty declaration' outa.txt &&\
47 ! grep 'no semicolon at end' outa.txt &&\
48 ! grep 'type defaults to' outa.txt &&\
49 ! grep 'too few arguments for format' outa.txt &&\
50 ! grep 'incompatible pointer' outa.txt &&\
51 ! grep 'ordered comparison of pointer with integer' outa.txt &&\
52 ! grep 'declaration does not declare anything' outa.txt &&\
53 ! grep 'expects type' outa.txt &&\
54 ! grep 'pointer from integer' outa.txt &&\
55 ! grep 'incompatible implicit' outa.txt &&\
56 ! grep 'excess elements in struct initializer' outa.txt &&\
57 ! grep 'comparison between pointer and integer' outa.txt &&\
58 ./smallz >out1.txt 2>&1 &&\
59 grep 'checksum = e' out1.txt &&\
60 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 "$file" > out_framac.txt 2>&1 &&\
61 ! egrep -i '(user error|assert)' out_framac.txt >/dev/null 2>&1
62 then
63 exit 0
64 else
65 exit 1
66 fi