| 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 1 |
| 14 | ulimit -v 2000000 |
| 15 | |
| 16 | if |
| 17 | clang -pedantic -Wall -O0 -c small.c >out.txt 2>&1 &&\ |
| 18 | ! grep 'incompatible redeclaration' out.txt &&\ |
| 19 | ! grep 'ordered comparison between pointer' out.txt &&\ |
| 20 | ! grep 'eliding middle term' out.txt &&\ |
| 21 | ! grep 'end of non-void function' out.txt &&\ |
| 22 | ! grep 'invalid in C99' out.txt &&\ |
| 23 | ! grep 'specifies type' out.txt &&\ |
| 24 | ! grep 'should return a value' out.txt &&\ |
| 25 | ! grep 'too few argument' out.txt &&\ |
| 26 | ! grep 'too many argument' out.txt &&\ |
| 27 | ! grep "return type of 'main" out.txt &&\ |
| 28 | ! grep 'uninitialized' out.txt &&\ |
| 29 | ! grep 'incompatible pointer to' out.txt &&\ |
| 30 | ! grep 'incompatible integer to' out.txt &&\ |
| 31 | ! grep 'type specifier missing' out.txt &&\ |
| 32 | gcc -c -Wall -Wextra -O1 small.c >outa.txt 2>&1 &&\ |
| 33 | ! grep uninitialized outa.txt &&\ |
| 34 | ! grep 'control reaches end' outa.txt &&\ |
| 35 | ! grep 'no semicolon at end' outa.txt &&\ |
| 36 | ! grep 'incompatible pointer' outa.txt &&\ |
| 37 | ! grep 'cast from pointer to integer' outa.txt &&\ |
| 38 | ! grep 'ordered comparison of pointer with integer' outa.txt &&\ |
| 39 | ! grep 'declaration does not declare anything' outa.txt &&\ |
| 40 | ! grep 'expects type' outa.txt &&\ |
| 41 | ! grep 'assumed to have one element' outa.txt &&\ |
| 42 | ! grep 'division by zero' outa.txt &&\ |
| 43 | ! grep 'pointer from integer' outa.txt &&\ |
| 44 | ! grep 'incompatible implicit' outa.txt &&\ |
| 45 | ! grep 'excess elements in struct initializer' outa.txt &&\ |
| 46 | ! grep 'comparison between pointer and integer' outa.txt &&\ |
| 47 | ! XXOPT1 small.c -o small1 > cc_out1.txt 2>&1 &&\ |
| 48 | grep XXFAIL cc_out1.txt |
| 49 | then |
| 50 | exit 0 |
| 51 | else |
| 52 | exit 1 |
| 53 | fi |
| 54 | |
| 55 | # clang --analyze small.c > out_analyze.txt 2>&1 &&\ |
| 56 | # ! grep garbage out_analyze.txt &&\ |
| 57 | # ! grep undefined out_analyze.txt &&\ |