Debian Codegraph @

tests/test2.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="file1.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 if
24 "$CLANG" -pedantic -Wall -O0 "$file" >out.txt 2>&1 &&\
25 ! grep 'incompatible redeclaration' out.txt &&\
26 ! grep 'ordered comparison between pointer' out.txt &&\
27 ! grep 'eliding middle term' out.txt &&\
28 ! grep 'end of non-void function' out.txt &&\
29 ! grep 'invalid in C99' out.txt &&\
30 ! grep 'specifies type' out.txt &&\
31 ! grep 'should return a value' out.txt &&\
32 ! grep 'too few argument' out.txt &&\
33 ! grep 'too many argument' out.txt &&\
34 ! grep "return type of 'main" out.txt &&\
35 ! grep 'uninitialized' out.txt &&\
36 ! grep 'incompatible pointer to' out.txt &&\
37 ! grep 'incompatible integer to' out.txt &&\
38 ! grep 'type specifier missing' out.txt &&\
39 "$GCC" -c -Wall -Wextra -O "$file" >outa.txt 2>&1 &&\
40 ! grep uninitialized outa.txt &&\
41 ! grep 'control reaches end' outa.txt &&\
42 ! grep 'no semicolon at end' outa.txt &&\
43 ! grep 'incompatible pointer' outa.txt &&\
44 ! grep 'cast from pointer to integer' outa.txt &&\
45 ! grep 'ordered comparison of pointer with integer' outa.txt &&\
46 ! grep 'declaration does not declare anything' outa.txt &&\
47 ! grep 'expects type' outa.txt &&\
48 ! grep 'assumed to have one element' outa.txt &&\
49 ! grep 'division by zero' outa.txt &&\
50 ! grep 'pointer from integer' outa.txt &&\
51 ! grep 'incompatible implicit' outa.txt &&\
52 ! grep 'excess elements in struct initializer' outa.txt &&\
53 ! grep 'comparison between pointer and integer' outa.txt &&\
54 grep '0x342F2529DAF1EF7ALL' "$file"
55 then
56 exit 0
57 else
58 exit 1
59 fi
60
61 # "$CLANG" --analyze "$file" > out_analyze.txt 2>&1 &&\
62 # ! grep garbage out_analyze.txt &&\
63 # ! grep undefined out_analyze.txt &&\