Debian Codegraph @

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