]> git.ipfire.org Git - thirdparty/squid.git/blame - test-suite/testheaders.sh
Fixed build issue in purge tool.
[thirdparty/squid.git] / test-suite / testheaders.sh
CommitLineData
43c58c85 1#!/bin/sh
e1f7507e
AJ
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#
11cc="${1}"
12
72a8cb42 13if test "${2}" = ""; then
e1f7507e
AJ
14 dir="."
15else
16 dir="${2}"
17fi
18
d18e40db
AR
19exitCode=0
20
e1f7507e
AJ
21for f in `cd ${dir} && ls -1 *.h 2>/dev/null`; do
22 echo -n "Testing ${dir}/${f} ..."
1129e8f2 23 hdr=`echo "${f}" | sed s/.h//`
c535dc4e 24 if [ ! -e ./testHeaderDeps_${hdr}.o -o ${dir}/${f} -nt ./testHeaderDeps_${hdr}.o ]; then
e1f7507e
AJ
25 ( echo "/* This file is AUTOMATICALLY GENERATED. DO NOT ALTER IT */"
26 echo "#include \"${dir}/${f}\" "
27 echo "int main( int argc, char* argv[] ) { return 0; } "
1129e8f2 28 ) >./testHeaderDeps_${hdr}.cc
e1f7507e
AJ
29
30 # run compile test on the new file.
1129e8f2 31 # DEBUG: echo "TRY: ${cc} -o testHeaderDeps.o ./testHeaderDeps_${hdr}.cc"
1c46fbd5 32 ${cc} -c -o testHeaderDeps_${hdr}.o ./testHeaderDeps_${hdr}.cc
1129e8f2 33 rm ./testHeaderDeps_${hdr}.cc
e1f7507e 34 fi
1129e8f2 35 if [ ! -f testHeaderDeps_${hdr}.o ]; then
e1f7507e 36 rm testHeaders
d18e40db
AR
37 exitCode=1
38 else
39 echo "OK."
40 # unit-tests require an app to run.
41 # our most-recent object suits this purpose.
42 # let's link or some tests will fail
43 ${cc} ./testHeaderDeps_${hdr}.o -o ./testHeaders
e1f7507e 44 fi
e1f7507e 45done
d18e40db
AR
46
47exit $exitCode