| 1 | #!/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_h(){ |
| 11 | case $(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 | echo "Files from this mask will not be checked: $ignore_list" |
| 22 | |
| 23 | codebase=$(find $top_srcdir/src/ $top_srcdir/tests/ -name "*.c" | sort) |
| 24 | echo "$codebase" | grep -vE "$ignore_list" | while read filename; |
| 25 | do |
| 26 | grep -E "$text" "$filename" --quiet || { |
| 27 | echo "$filename does not contain '$text'" |
| 28 | return 1 |
| 29 | } |
| 30 | done |
| 31 | } |
| 32 | |
| 33 | test_init "test_config_h.log" |
| 34 | |
| 35 | if [ -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 |