]> git.ipfire.org Git - thirdparty/squid.git/blob - test-suite/testheaders.sh
Merged from trunk
[thirdparty/squid.git] / test-suite / testheaders.sh
1 #!/bin/bash
2 #
3 # test all header files (.h) for dependancy issues.
4 #
5 # Ideally this test should be performed twice before any code is accepted.
6 # With or without inline enabled. This is needed because the .cci files
7 # are only included into the .h files when inline mode is enabled.
8 #
9 # This script should be run from the makefile with the directory path and ccflags
10 #
11 cc="${1}"
12
13 if [ "${2}" == "" ]; then
14 dir="."
15 else
16 dir="${2}"
17 fi
18
19 for f in `cd ${dir} && ls -1 *.h 2>/dev/null`; do
20 echo -n "Testing ${dir}/${f} ..."
21 if [[ "${f}" == "cf_gen_defines.h" || "${f}" == "cf_parser.h" ]]; then
22 echo " IGNORED!"
23 continue
24 fi
25 if [ ${dir}/${f} -nt ./testHeaderDeps_${f/.h/}.o ]; then
26 ( echo "/* This file is AUTOMATICALLY GENERATED. DO NOT ALTER IT */"
27 echo "#include \"${dir}/${f}\" "
28 echo "int main( int argc, char* argv[] ) { return 0; } "
29 ) >./testHeaderDeps_${f/.h/}.cc
30
31 # run compile test on the new file.
32 # DEBUG: echo "TRY: ${cc} -o testHeaderDeps.o ./testHeaderDeps_${f/.h/}.cc"
33 ${cc} -o testHeaderDeps_${f/.h/}.o ./testHeaderDeps_${f/.h/}.cc
34 rm ./testHeaderDeps_${f/.h/}.cc
35 fi
36 if [ ! -f testHeaderDeps_${f/.h/}.o ]; then
37 rm testHeaders
38 exit 1
39 fi
40 echo "OK."
41 # unit-tests require an app to run.
42 # our most-recent object suits this purpose
43 cp ./testHeaderDeps_${f/.h/}.o ./testHeaders
44 done