From 90bf3da8cd49c54fbe8be89ee701177d17cadd35 Mon Sep 17 00:00:00 2001 From: Joel Rosdahl Date: Sun, 14 Oct 2012 10:12:27 +0200 Subject: [PATCH] Fix test suite failures when CC is a ccache-wrapped compiler CCACHE_DISABLE has to be used in order to ensure that the real compiler will be run without ccache. --- test.sh | 81 +++++++++++++++++++++++++++------------------------------ 1 file changed, 39 insertions(+), 42 deletions(-) diff --git a/test.sh b/test.sh index 41caf6b94..d1ea0a3f7 100755 --- a/test.sh +++ b/test.sh @@ -146,21 +146,21 @@ base_tests() { j=`expr $j + 1` done - $DIRECT_COMPILE -c -o compiler_direct_test1.o test1.c + CCACHE_DISABLE=1 $COMPILER -c -o reference_test1.o test1.c testname="BASIC" $CCACHE_COMPILE -c test1.c checkstat 'cache hit (preprocessed)' 0 checkstat 'cache miss' 1 checkstat 'files in cache' 1 - compare_file compiler_direct_test1.o test1.o + compare_file reference_test1.o test1.o testname="BASIC2" $CCACHE_COMPILE -c test1.c checkstat 'cache hit (preprocessed)' 1 checkstat 'cache miss' 1 checkstat 'files in cache' 1 - compare_file compiler_direct_test1.o test1.o + compare_file reference_test1.o test1.o testname="debug" $CCACHE_COMPILE -c test1.c -g @@ -177,7 +177,7 @@ base_tests() { $CCACHE_COMPILE -c test1.c -o foo.o checkstat 'cache hit (preprocessed)' 3 checkstat 'cache miss' 2 - compare_file compiler_direct_test1.o foo.o + compare_file reference_test1.o foo.o testname="link" $CCACHE_COMPILE test1.c -o test 2> /dev/null @@ -236,13 +236,13 @@ base_tests() { CCACHE_CPP2=1 $CCACHE_COMPILE -c test1.c -O -O checkstat 'cache hit (preprocessed)' 4 checkstat 'cache miss' 3 - $DIRECT_COMPILE -c test1.c -o compiler_direct_test1.o -O -O - compare_file compiler_direct_test1.o test1.o + CCACHE_DISABLE=1 $COMPILER -c test1.c -o reference_test1.o -O -O + compare_file reference_test1.o test1.o CCACHE_CPP2=1 $CCACHE_COMPILE -c test1.c -O -O checkstat 'cache hit (preprocessed)' 5 checkstat 'cache miss' 3 - compare_file compiler_direct_test1.o test1.o + compare_file reference_test1.o test1.o testname="CCACHE_NOSTATS" CCACHE_NOSTATS=1 $CCACHE_COMPILE -c test1.c -O -O @@ -253,7 +253,7 @@ base_tests() { CCACHE_RECACHE=1 $CCACHE_COMPILE -c test1.c -O -O checkstat 'cache hit (preprocessed)' 5 checkstat 'cache miss' 4 - compare_file compiler_direct_test1.o test1.o + compare_file reference_test1.o test1.o # strictly speaking should be 3 - RECACHE causes a double counting! checkstat 'files in cache' 4 @@ -264,13 +264,13 @@ base_tests() { CCACHE_HASHDIR=1 $CCACHE_COMPILE -c test1.c -O -O checkstat 'cache hit (preprocessed)' 5 checkstat 'cache miss' 5 - compare_file compiler_direct_test1.o test1.o + compare_file reference_test1.o test1.o CCACHE_HASHDIR=1 $CCACHE_COMPILE -c test1.c -O -O checkstat 'cache hit (preprocessed)' 6 checkstat 'cache miss' 5 checkstat 'files in cache' 4 - compare_file compiler_direct_test1.o test1.o + compare_file reference_test1.o test1.o testname="comments" echo '/* a silly comment */' > test1-comment.c @@ -291,8 +291,8 @@ base_tests() { mv test1-saved.c test1.c checkstat 'cache hit (preprocessed)' 7 checkstat 'cache miss' 7 - $DIRECT_COMPILE -c test1.c -o compiler_direct_test1.o - compare_file compiler_direct_test1.o test1.o + CCACHE_DISABLE=1 $COMPILER -c test1.c -o reference_test1.o + compare_file reference_test1.o test1.o testname="cache-size" @@ -772,8 +772,8 @@ EOF checkstat 'cache hit (preprocessed)' 0 checkstat 'cache miss' 1 checkfile other.d "test.o: test.c test1.h test3.h test2.h" - $DIRECT_COMPILE -c -Wp,-MD,other.d test.c -o compiler_direct_test.o - compare_file compiler_direct_test.o test.o + CCACHE_DISABLE=1 $COMPILER -c -Wp,-MD,other.d test.c -o reference_test.o + compare_file reference_test.o test.o rm -f other.d @@ -782,7 +782,7 @@ EOF checkstat 'cache hit (preprocessed)' 0 checkstat 'cache miss' 1 checkfile other.d "test.o: test.c test1.h test3.h test2.h" - compare_file compiler_direct_test.o test.o + compare_file reference_test.o test.o rm -f other.d @@ -796,8 +796,8 @@ EOF checkstat 'cache hit (preprocessed)' 0 checkstat 'cache miss' 1 checkfile other.d "test.o: test.c test1.h test3.h test2.h" - $DIRECT_COMPILE -c -Wp,-MMD,other.d test.c -o compiler_direct_test.o - compare_file compiler_direct_test.o test.o + CCACHE_DISABLE=1 $COMPILER -c -Wp,-MMD,other.d test.c -o reference_test.o + compare_file reference_test.o test.o rm -f other.d @@ -806,7 +806,7 @@ EOF checkstat 'cache hit (preprocessed)' 0 checkstat 'cache miss' 1 checkfile other.d "test.o: test.c test1.h test3.h test2.h" - compare_file compiler_direct_test.o test.o + compare_file reference_test.o test.o rm -f other.d @@ -820,14 +820,14 @@ EOF checkstat 'cache hit (direct)' 0 checkstat 'cache hit (preprocessed)' 0 checkstat 'cache miss' 1 - $DIRECT_COMPILE -c -Wp,-MD,$DEVNULL,-P test.c -o compiler_direct_test.o - compare_file compiler_direct_test.o test.o + CCACHE_DISABLE=1 $COMPILER -c -Wp,-MD,$DEVNULL,-P test.c -o reference_test.o + compare_file reference_test.o test.o $CCACHE $COMPILER -c -Wp,-MD,$DEVNULL,-P test.c checkstat 'cache hit (direct)' 0 checkstat 'cache hit (preprocessed)' 1 checkstat 'cache miss' 1 - compare_file compiler_direct_test.o test.o + compare_file reference_test.o test.o fi ################################################################## @@ -840,14 +840,14 @@ EOF checkstat 'cache hit (direct)' 0 checkstat 'cache hit (preprocessed)' 0 checkstat 'cache miss' 1 - $DIRECT_COMPILE -c -Wp,-MMD,$DEVNULL,-P test.c -o compiler_direct_test.o - compare_file compiler_direct_test.o test.o + CCACHE_DISABLE=1 $COMPILER -c -Wp,-MMD,$DEVNULL,-P test.c -o reference_test.o + compare_file reference_test.o test.o $CCACHE $COMPILER -c -Wp,-MMD,$DEVNULL,-P test.c checkstat 'cache hit (direct)' 0 checkstat 'cache hit (preprocessed)' 1 checkstat 'cache miss' 1 - compare_file compiler_direct_test.o test.o + compare_file reference_test.o test.o fi ################################################################## @@ -873,8 +873,8 @@ EOF checkstat 'cache hit (preprocessed)' 0 checkstat 'cache miss' 1 checkfile test.d "test.o: test.c test1.h test3.h test2.h" - $DIRECT_COMPILE -c -MD test.c -o compiler_direct_test.o - compare_file compiler_direct_test.o test.o + CCACHE_DISABLE=1 $COMPILER -c -MD test.c -o reference_test.o + compare_file reference_test.o test.o rm -f test.d @@ -884,7 +884,7 @@ EOF checkstat 'cache hit (preprocessed)' 0 checkstat 'cache miss' 1 checkfile test.d "test.o: test.c test1.h test3.h test2.h" - compare_file compiler_direct_test.o test.o + compare_file reference_test.o test.o ################################################################## # Check the scenario of running a ccache with direct mode on a cache @@ -897,8 +897,8 @@ EOF checkstat 'cache hit (preprocessed)' 0 checkstat 'cache miss' 1 checkfile test.d "test.o: test.c test1.h test3.h test2.h" - $DIRECT_COMPILE -c -MD test.c -o compiler_direct_test.o - compare_file compiler_direct_test.o test.o + CCACHE_DISABLE=1 $COMPILER -c -MD test.c -o reference_test.o + compare_file reference_test.o test.o rm -f test.d @@ -907,7 +907,7 @@ EOF checkstat 'cache hit (preprocessed)' 1 checkstat 'cache miss' 1 checkfile test.d "test.o: test.c test1.h test3.h test2.h" - compare_file compiler_direct_test.o test.o + compare_file reference_test.o test.o rm -f test.d @@ -916,7 +916,7 @@ EOF checkstat 'cache hit (preprocessed)' 2 checkstat 'cache miss' 1 checkfile test.d "test.o: test.c test1.h test3.h test2.h" - compare_file compiler_direct_test.o test.o + compare_file reference_test.o test.o rm -f test.d @@ -925,7 +925,7 @@ EOF checkstat 'cache hit (preprocessed)' 2 checkstat 'cache miss' 1 checkfile test.d "test.o: test.c test1.h test3.h test2.h" - compare_file compiler_direct_test.o test.o + compare_file reference_test.o test.o ################################################################## # Check that -MF works. @@ -937,8 +937,8 @@ EOF checkstat 'cache hit (preprocessed)' 0 checkstat 'cache miss' 1 checkfile other.d "test.o: test.c test1.h test3.h test2.h" - $DIRECT_COMPILE -c -MD -MF other.d test.c -o compiler_direct_test.o - compare_file compiler_direct_test.o test.o + CCACHE_DISABLE=1 $COMPILER -c -MD -MF other.d test.c -o reference_test.o + compare_file reference_test.o test.o rm -f other.d @@ -947,7 +947,7 @@ EOF checkstat 'cache hit (preprocessed)' 0 checkstat 'cache miss' 1 checkfile other.d "test.o: test.c test1.h test3.h test2.h" - compare_file compiler_direct_test.o test.o + compare_file reference_test.o test.o ################################################################## # Check that a missing .d file in the cache is handled correctly. @@ -960,15 +960,15 @@ EOF checkstat 'cache hit (preprocessed)' 0 checkstat 'cache miss' 1 checkfile other.d "test.o: test.c test1.h test3.h test2.h" - $DIRECT_COMPILE -c -MD test.c -o compiler_direct_test.o - compare_file compiler_direct_test.o test.o + CCACHE_DISABLE=1 $COMPILER -c -MD test.c -o reference_test.o + compare_file reference_test.o test.o $CCACHE $COMPILER -c -MD test.c checkstat 'cache hit (direct)' 1 checkstat 'cache hit (preprocessed)' 0 checkstat 'cache miss' 1 checkfile other.d "test.o: test.c test1.h test3.h test2.h" - compare_file compiler_direct_test.o test.o + compare_file reference_test.o test.o find $CCACHE_DIR -name '*.d' -exec rm -f '{}' \; @@ -977,7 +977,7 @@ EOF checkstat 'cache hit (preprocessed)' 1 checkstat 'cache miss' 1 checkfile other.d "test.o: test.c test1.h test3.h test2.h" - compare_file compiler_direct_test.o test.o + compare_file reference_test.o test.o ################################################################## # Check that stderr from both the preprocessor and the compiler is emitted @@ -2100,9 +2100,6 @@ CCACHE_CONFIGPATH=`pwd`/ccache.conf export CCACHE_CONFIGPATH touch $CCACHE_CONFIGPATH -# comand used to bypass ccache -DIRECT_COMPILE=`which $COMPILER` - # --------------------------------------- all_suites=" -- 2.47.3