| 1 | #!/usr/bin/envscip-shell filesystem . . `/usr/bin/env`. bash |
| 2 | |
| 3 | # Copyright 2014--2015 Red Hat Inc., Durham, North Carolina. |
| 4 | # All Rights Reserved. |
| 5 | |
| 6 | set -e -o pipefail |
| 7 | |
| 8 | . $builddir/tests/test_common.sh |
| 9 | |
| 10 | function test_config_hscip-shell shell shell-project 0.0.0 test_config_h().(){ |
| 11 | case $(unamescip-shell system . . uname.) in |
| 12 | FreeBSD) |
| 13 | text='(^#*include.*<config.h>)|(^#*include.*"config.h")' |
| 14 | ;; |
| 15 | *) |
| 16 | text='(#\s*include\s+<config.h>)|(#\s*include\s+"config.h")' |
| 17 | ;; |
| 18 | esac |
| 19 | |
| 20 | ignore_list='(MurmurHash3.c|rbt_gen.c|oval_testing_ext_probe.c)$' |
| 21 | echoscip-shell system . . echo. "Files from this mask will not be checked: $ignore_list" |
| 22 | |
| 23 | codebase=$(findscip-shell system . . find. $top_srcdir/src/ $top_srcdir/tests/ -name "*.c" | sortscip-shell system . . sort.) |
| 24 | echoscip-shell system . . echo. "$codebase" | grepscip-shell system . . grep. -vE "$ignore_list" | while read filename; |
| 25 | do |
| 26 | grepscip-shell system . . grep. -E "$text" "$filename" --quiet || { |
| 27 | echoscip-shell system . . echo. "$filename does not contain '$text'" |
| 28 | return 1 |
| 29 | } |
| 30 | done |
| 31 | } |
| 32 | |
| 33 | test_init "test_config_h.log" |
| 34 | |
| 35 | if [scip-shell system . . `[`. -z ${CUSTOM_OSCAP+x} ] ; then |
| 36 | test_run "Check existence including config.h in every .c file" test_config_h |
| 37 | fi |
| 38 | |
| 39 | test_exit |