]> git.ipfire.org Git - thirdparty/squid.git/blob - test-suite/testheaders.sh
Docs: Copyright updates for 2018 (#114)
[thirdparty/squid.git] / test-suite / testheaders.sh
1 #!/bin/sh
2 #
3 ## Copyright (C) 1996-2018 The Squid Software Foundation and contributors
4 ##
5 ## Squid software is distributed under GPLv2+ license and includes
6 ## contributions from numerous individuals and organizations.
7 ## Please see the COPYING and CONTRIBUTORS files for details.
8 ##
9
10 # test all header files (.h) for dependancy issues.
11 #
12 # Ideally this test should be performed twice before any code is accepted.
13 # With or without inline enabled. This is needed because the .cci files
14 # are only included into the .h files when inline mode is enabled.
15 #
16 # This script should be run from the makefile with the directory path and ccflags
17 #
18 cc="${1}"
19 shift
20 for dir in /usr/bin /usr/local/bin /usr/gnu/bin
21 do
22 test -x ${dir}/true && TRUE=${dir}/true
23 done
24 TRUE=${TRUE:-/bin/true}
25
26 exitCode=0
27
28 for f in $@; do
29 echo -n "Testing ${f} ..."
30 t="testhdr_`basename ${f}`"
31 if [ ! -f "$t.o" -o $f -nt "$t.o" ]; then
32 echo >$t.cc <<EOF
33 /* This file is AUTOMATICALLY GENERATED. DO NOT ALTER IT */
34 #include "squid.h"
35 #include "${f}"
36 int main( int argc, char* argv[] ) { return 0; }
37 EOF
38 if ${cc} -c -o $t.o $t.cc ; then
39 echo "Ok."
40 else
41 echo "Fail."
42 exitCode=1
43 fi
44 rm $t.cc $t.o
45 fi
46 test $exitCode -eq 0 || break
47 done
48
49 #who ever said that the test program needs to be meaningful?
50 test $exitCode -eq 0 && cp ${TRUE} testHeaders
51 exit $exitCode