]> git.ipfire.org Git - thirdparty/squid.git/commitdiff
Compilation speedup: optimize test-suite/testheaders.sh
authorFrancesco Chemolli <kinkie@squid-cache.org>
Fri, 20 Aug 2010 16:15:46 +0000 (18:15 +0200)
committerFrancesco Chemolli <kinkie@squid-cache.org>
Fri, 20 Aug 2010 16:15:46 +0000 (18:15 +0200)
compat/Makefile.am
lib/Makefile.am
src/Makefile.am
src/auth/Makefile.am
src/fs/Makefile.am
src/repl/Makefile.am
test-suite/testheaders.sh

index 1761ef3934646da43164d392aaaa03c4e8127525..55493e2369d230805f24c83dbe3495d877077270 100644 (file)
@@ -72,8 +72,7 @@ TESTS += testHeaders
 ## Special Universal .h dependency test script
 ## aborts if error encountered
 testHeaders: $(srcdir)/*.h $(srcdir)/os/*.h
-       $(SHELL) $(top_srcdir)/test-suite/testheaders.sh "$(CXXCOMPILE)" "$(srcdir)" || exit 1
-       $(SHELL) $(top_srcdir)/test-suite/testheaders.sh "$(CXXCOMPILE)" "$(srcdir)/os" || exit 1
+       $(SHELL) $(top_srcdir)/test-suite/testheaders.sh "$(CXXCOMPILE)" $^ || exit 1
 
 CLEANFILES += testHeaders
 
index a1fcf15c3726b24a2b72ea3be8d79ee5fda870f5..8427107fb4d161876465f32d71b333c5ba940132 100644 (file)
@@ -108,7 +108,7 @@ tests_testAll_LDFLAGS = $(LIBADD_DL)
 ## Special Universal .h dependency test script
 ## aborts if error encountered
 testHeaders: $(top_srcdir)/include/*.h
-       $(SHELL) $(top_srcdir)/test-suite/testheaders.sh "$(CXXCOMPILE)" "$(top_srcdir)/include" || exit 1
+       $(SHELL) $(top_srcdir)/test-suite/testheaders.sh "$(CXXCOMPILE)" $^ || exit 1
 
 TESTS += testHeaders
 CLEANFILES += testHeaders
index 1e6b57e126f8cf3677b882e36fa26b15fd9bbda5..97c189222e3072b05ab3efa1cc26aafcfdf32f4e 100644 (file)
@@ -2281,12 +2281,7 @@ TESTS += testHeaders
 ## Special Universal .h dependency test script
 ## aborts if error encountered
 testHeaders: $(srcdir)/*.h $(srcdir)/DiskIO/*.h $(srcdir)/DiskIO/*/*.h
-       $(SHELL) $(top_srcdir)/test-suite/testheaders.sh "$(CXXCOMPILE)" "$(srcdir)" || exit 1
-       $(SHELL) $(top_srcdir)/test-suite/testheaders.sh "$(CXXCOMPILE)" "$(srcdir)/DiskIO" || exit 1
-       $(SHELL) $(top_srcdir)/test-suite/testheaders.sh "$(CXXCOMPILE)" "$(srcdir)/DiskIO/AIO" || exit 1
-       $(SHELL) $(top_srcdir)/test-suite/testheaders.sh "$(CXXCOMPILE)" "$(srcdir)/DiskIO/Blocking" || exit 1
-       $(SHELL) $(top_srcdir)/test-suite/testheaders.sh "$(CXXCOMPILE)" "$(srcdir)/DiskIO/DiskDaemon" || exit 1
-       $(SHELL) $(top_srcdir)/test-suite/testheaders.sh "$(CXXCOMPILE)" "$(srcdir)/DiskIO/DiskThreads" || exit 1
+       $(SHELL) $(top_srcdir)/test-suite/testheaders.sh "$(CXXCOMPILE)" $^ || exit 1
 ## src/repl/ has no .h files and its own makefile.
 
 CLEANFILES += testHeaders
index f87a4929903f4906db351fb864b852b129e2fade..f6faae982efaeb34628db8f091eb3fb130308b4b 100644 (file)
@@ -81,11 +81,7 @@ TESTS += testHeaders
 ## Special Universal .h dependency test script
 ## aborts if error encountered
 testHeaders: $(top_srcdir)/src/auth/*.h $(top_srcdir)/src/auth/basic/*.h $(top_srcdir)/src/auth/digest/*.h $(top_srcdir)/src/auth/ntlm/*.h $(top_srcdir)/src/auth/negotiate/*.h
-       $(SHELL) $(top_srcdir)/test-suite/testheaders.sh "$(CXXCOMPILE)" "$(top_srcdir)/src/auth/" || exit 1
-       $(SHELL) $(top_srcdir)/test-suite/testheaders.sh "$(CXXCOMPILE)" "$(top_srcdir)/src/auth/basic" || exit 1
-       $(SHELL) $(top_srcdir)/test-suite/testheaders.sh "$(CXXCOMPILE)" "$(top_srcdir)/src/auth/digest" || exit 1
-       $(SHELL) $(top_srcdir)/test-suite/testheaders.sh "$(CXXCOMPILE)" "$(top_srcdir)/src/auth/ntlm" || exit 1
-       $(SHELL) $(top_srcdir)/test-suite/testheaders.sh "$(CXXCOMPILE)" "$(top_srcdir)/src/auth/negotiate" || exit 1
+       $(SHELL) $(top_srcdir)/test-suite/testheaders.sh "$(CXXCOMPILE)" $^ || exit 1
 
 CLEANFILES += testHeaders
 .PHONY: testHeaders
index 51171216a22ed57477ac4d6676c0d26002e403e8..e7c7a0dad88d79b6f4072843080a0cbb921784f3 100644 (file)
@@ -51,8 +51,7 @@ TESTS += testHeaders
 ## Special Universal .h dependency test script
 ## aborts if error encountered
 testHeaders: $(srcdir)/ufs/*.h $(srcdir)/coss/*.h
-       $(SHELL) $(top_srcdir)/test-suite/testheaders.sh "$(CXXCOMPILE)" "$(srcdir)/ufs" || exit 1
-       $(SHELL) $(top_srcdir)/test-suite/testheaders.sh "$(CXXCOMPILE)" "$(srcdir)/coss" || exit 1
+       $(SHELL) $(top_srcdir)/test-suite/testheaders.sh "$(CXXCOMPILE)" $^ || exit 1
 ## diskd/ has no .h files
 ## aufs/ has no .h files
 ## ./ has no .h files
index 65bb5a2667404c6ac85b968024de95f2d74606fa..c246c564d27007d78695ac73a64a5885c03138ba 100644 (file)
@@ -25,7 +25,7 @@ TESTS += testHeaders
 ## Special Universal .h dependency test script
 ## aborts if error encountered
 testHeaders: $(srcdir)/heap/*.h
-       $(SHELL) $(top_srcdir)/test-suite/testheaders.sh "$(CXXCOMPILE)" "$(srcdir)/heap" || exit 1
+       $(SHELL) $(top_srcdir)/test-suite/testheaders.sh "$(CXXCOMPILE)" $^ || exit 1
 ## ./ has no .h files.
 ## ./lru/ has no .h files.
 
index 48f358fd02d4ae99f70acf94d2b704b84f17f37d..ccc7bb208d12f796dc0369190d4d6a4d97d5fdf5 100755 (executable)
@@ -9,39 +9,30 @@
 # This script should be run from the makefile with the directory path and ccflags
 #
 cc="${1}"
-
-if test "${2}" = ""; then
-       dir="."
-else
-       dir="${2}"
-fi
+shift
 
 exitCode=0
 
-for f in `cd ${dir} && ls -1 *.h 2>/dev/null`; do
-       echo -n "Testing ${dir}/${f} ..."
-       hdr=`echo "${f}" | sed s/.h//`
-       if [ ! -e ./testHeaderDeps_${hdr}.o -o ${dir}/${f} -nt ./testHeaderDeps_${hdr}.o ]; then
-               (       echo "/* This file is AUTOMATICALLY GENERATED. DO NOT ALTER IT */"
-                       echo "#include \"${dir}/${f}\" "
-                       echo "int main( int argc, char* argv[] ) { return 0; } "
-               ) >./testHeaderDeps_${hdr}.cc
-
-               # run compile test on the new file.
-               # DEBUG: echo "TRY: ${cc} -o testHeaderDeps.o ./testHeaderDeps_${hdr}.cc"
-               ${cc} -c -o testHeaderDeps_${hdr}.o ./testHeaderDeps_${hdr}.cc
-               rm ./testHeaderDeps_${hdr}.cc
-       fi
-       if [ ! -f testHeaderDeps_${hdr}.o ]; then
-               rm testHeaders
-               exitCode=1
-       else
-               echo "OK."
-               # unit-tests require an app to run.
-               # our most-recent object suits this purpose.
-               # let's link or some tests will fail
-               ${cc} ./testHeaderDeps_${hdr}.o -o ./testHeaders
-       fi
+for f in $@; do
+       echo -n "Testing ${f} ..."
+    t="testhdr_`basename ${f}`"
+    if [ ! -f "$t.o" -o $f -nt "$t.o" ]; then
+        echo >$t.cc <<EOF
+/* This file is AUTOMATICALLY GENERATED. DO NOT ALTER IT */
+#include "${f}"
+int main( int argc, char* argv[] ) { return 0; }
+EOF
+        if ${cc} -c -o $t.o $t.cc ; then 
+            echo "Ok."
+        else
+            echo "Fail."
+            exitCode=1
+        fi
+        rm $t.cc $t.o
+    fi
+    test $exitCode -eq 0 || break
 done
 
+#who ever said that the test program needs to be meaningful?
+test $exitCode -eq 0 && cp /bin/true testHeaders
 exit $exitCode