Debian Codegraph @

scripts/test1_wrong_code_kcc.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 >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 RunSafely.sh 3 1 /dev/null out1.txt ./small1 >/dev/null 2>&1 &&\
50 XXOPT2 small.c -o small2 > cc_out2.txt 2>&1 &&\
51 RunSafely.sh 3 1 /dev/null out2.txt ./small2 >/dev/null 2>&1 &&\
52 ! diff out1.txt out2.txt &&\
53 kcc -s small.c >/dev/null 2>&1
54 then
55 if
56 RunSafely.sh 125 1 /dev/null out_kcc.txt ./a.out >/dev/null 2>&1
57 then
58 exit 0
59 else
60 cat out_kcc.txt
61 TMPF="undefined_$$.c"
62 echo copying C file to $TMPF
63 cp small.c $TMPF
64 exit 1
65 fi
66 else
67 exit 1
68 fi