From: Joel Rosdahl Date: Mon, 20 Sep 2021 05:38:27 +0000 (+0200) Subject: test: Cope with CC being a wrapper script that uses ccache X-Git-Tag: v4.4.2~7 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=3c47a8a23d773f5d32174ddbb3d3e9409a3f201e;p=thirdparty%2Fccache.git test: Cope with CC being a wrapper script that uses ccache Fixes #914. --- diff --git a/test/run b/test/run index b9abc0948..d8b5466b3 100755 --- a/test/run +++ b/test/run @@ -458,13 +458,14 @@ for HOST_CCACHE_DIR in $HOST_CCACHE_DIRS; do done export PATH -if [ -n "$CC" ]; then - COMPILER="$CC" -elif [[ "$OSTYPE" == "darwin"* && -x "$(command -v clang)" ]]; then - COMPILER=clang -else - COMPILER=gcc +if [ -z "$CC" ]; then + if [[ "$OSTYPE" == "darwin"* && -x "$(command -v clang)" ]]; then + CC=clang + else + CC=gcc + fi fi + if [ -z "$CCACHE" ]; then CCACHE=`pwd`/ccache fi @@ -485,17 +486,17 @@ HOST_OS_FREEBSD=false HOST_OS_WINDOWS=false HOST_OS_CYGWIN=false -compiler_version="`$COMPILER --version 2>/dev/null | head -1`" +compiler_version="`$CC --version 2>/dev/null | head -1`" case $compiler_version in *gcc*|*g++*|2.95*) COMPILER_TYPE_GCC=true ;; *clang*) COMPILER_TYPE_CLANG=true - CLANG_VERSION_SUFFIX=$(echo "${COMPILER%% *}" | sed 's/.*clang//') + CLANG_VERSION_SUFFIX=$(echo "${CC%% *}" | sed 's/.*clang//') ;; *) - echo "WARNING: Compiler $COMPILER not supported (version: $compiler_version) -- Skipped running tests" >&2 + echo "WARNING: Compiler $CC not supported (version: $compiler_version) -- Skipped running tests" >&2 exit $skip_code ;; esac @@ -574,22 +575,19 @@ symlink_testdir_on_failure() { ln -s "$$" "$TEST_FAILED_SYMLINK" } -cd $TESTDIR || exit 1 - -COMPILER_BIN=$(echo $COMPILER | awk '{print $1}') -COMPILER_ARGS=$(echo $COMPILER | awk '{$1 = ""; print}') +COMPILER_BIN=$(echo $CC | awk '{print $1}') +COMPILER_ARGS=$(echo $CC | awk '{$1 = ""; print}') REAL_COMPILER_BIN=$(find_compiler $COMPILER_BIN) REAL_COMPILER="$REAL_COMPILER_BIN$COMPILER_ARGS" +REAL_NVCC=$(find_compiler nvcc) -if [ "$REAL_COMPILER" = "$COMPILER" ]; then - echo "Compiler: $COMPILER" +if [ "$REAL_COMPILER_BIN" = "$COMPILER_BIN" ]; then + echo "Compiler: $CC" else - echo "Compiler: $COMPILER ($REAL_COMPILER)" + echo "Compiler: $CC ($REAL_COMPILER)" fi -echo "Compiler version: $($COMPILER --version 2>/dev/null | head -n 1)" +echo "Compiler version: $($CC --version 2>/dev/null | head -n 1)" -REAL_NVCC=$(find_compiler nvcc) -REAL_CUOBJDUMP=$(find_compiler cuobjdump) if [ -n "$REAL_NVCC" ]; then echo "CUDA compiler: $($REAL_NVCC --version | tail -n 1) ($REAL_NVCC)" else @@ -597,6 +595,18 @@ else fi echo +cd $TESTDIR || exit 1 + +mkdir compiler +COMPILER="$(pwd)/compiler/$(basename "$REAL_COMPILER_BIN")" +cat >"$COMPILER" <test1.c @@ -402,7 +402,7 @@ fi expect_stat preprocessed_cache_hit 0 expect_stat cache_miss 2 - $REAL_COMPILER -c -o reference_test1.o test1.c + $COMPILER -c -o reference_test1.o test1.c expect_equal_object_files reference_test1.o test1.o # ------------------------------------------------------------------------- @@ -454,7 +454,7 @@ fi expect_stat cache_miss 1 expect_stat recache 1 - $REAL_COMPILER -c -o reference_test1.o test1.c + $COMPILER -c -o reference_test1.o test1.c expect_equal_object_files reference_test1.o test1.o expect_stat files_in_cache 1 @@ -525,7 +525,7 @@ fi # ------------------------------------------------------------------------- TEST "Directory is not hashed if using -gz" - $REAL_COMPILER -E test1.c -gz >preprocessed.i 2>/dev/null + $COMPILER -E test1.c -gz >preprocessed.i 2>/dev/null if [ -s preprocessed.i ] && ! fgrep -q $PWD preprocessed.i; then mkdir dir1 dir2 cp test1.c dir1 @@ -548,7 +548,7 @@ fi # ------------------------------------------------------------------------- TEST "Directory is not hashed if using -gz=zlib" - $REAL_COMPILER -E test1.c -gz=zlib >preprocessed.i 2>/dev/null + $COMPILER -E test1.c -gz=zlib >preprocessed.i 2>/dev/null if [ -s preprocessed.i ] && ! fgrep -q $PWD preprocessed.i; then mkdir dir1 dir2 cp test1.c dir1 @@ -682,7 +682,7 @@ b" expect_stat preprocessed_cache_hit 0 expect_stat cache_miss 1 - $REAL_COMPILER -c test1.c -E >test1.i + $COMPILER -c test1.c -E >test1.i $CCACHE_COMPILE -c test1.i expect_stat preprocessed_cache_hit 1 expect_stat cache_miss 1 @@ -776,7 +776,7 @@ b" # ------------------------------------------------------------------------- TEST "-frecord-gcc-switches" - if $REAL_COMPILER -frecord-gcc-switches -c test1.c >&/dev/null; then + if $COMPILER -frecord-gcc-switches -c test1.c >&/dev/null; then $CCACHE_COMPILE -frecord-gcc-switches -c test1.c expect_stat preprocessed_cache_hit 0 expect_stat cache_miss 1 @@ -797,15 +797,18 @@ b" # ------------------------------------------------------------------------- TEST "CCACHE_COMPILER" - $REAL_COMPILER -c -o reference_test1.o test1.c + $COMPILER -c -o reference_test1.o test1.c + export CCACHE_DEBUG=1 + export CCACHE_DEBUGDIR=/tmp/a $CCACHE_COMPILE -c test1.c expect_stat preprocessed_cache_hit 0 expect_stat cache_miss 1 expect_stat files_in_cache 1 expect_equal_object_files reference_test1.o test1.o - CCACHE_COMPILER=$COMPILER_BIN $CCACHE \ + export CCACHE_DEBUGDIR=/tmp/b + CCACHE_COMPILER=$COMPILER $CCACHE \ non_existing_compiler_will_be_overridden_anyway \ $COMPILER_ARGS -c test1.c expect_stat preprocessed_cache_hit 1 @@ -813,14 +816,14 @@ b" expect_stat files_in_cache 1 expect_equal_object_files reference_test1.o test1.o - CCACHE_COMPILER=$COMPILER_BIN $CCACHE same/for/relative \ + CCACHE_COMPILER=$COMPILER $CCACHE same/for/relative \ $COMPILER_ARGS -c test1.c expect_stat preprocessed_cache_hit 2 expect_stat cache_miss 1 expect_stat files_in_cache 1 expect_equal_object_files reference_test1.o test1.o - CCACHE_COMPILER=$COMPILER_BIN $CCACHE /and/even/absolute/compilers \ + CCACHE_COMPILER=$COMPILER $CCACHE /and/even/absolute/compilers \ $COMPILER_ARGS -c test1.c expect_stat preprocessed_cache_hit 3 expect_stat cache_miss 1 @@ -1105,7 +1108,7 @@ EOF echo '#warning This triggers a compiler warning' >stderr.c - $REAL_COMPILER -Wall -c stderr.c -fsyntax-only 2>reference_stderr.txt + $COMPILER -Wall -c stderr.c -fsyntax-only 2>reference_stderr.txt expect_contains reference_stderr.txt "This triggers a compiler warning" @@ -1156,7 +1159,7 @@ int stderr(void) // Trigger warning by having no return statement. } EOF - $REAL_COMPILER -c -Wall -W -c stderr.c 2>reference_stderr.txt + $COMPILER -c -Wall -W -c stderr.c 2>reference_stderr.txt $CCACHE_COMPILE -Wall -W -c stderr.c 2>stderr.txt expect_equal_content reference_stderr.txt stderr.txt @@ -1194,7 +1197,7 @@ EOF cat <test.c #warning Foo EOF - $REAL_COMPILER -c test.c -MMD 2>reference.stderr + $COMPILER -c test.c -MMD 2>reference.stderr mv test.d reference.d $CCACHE_COMPILE -c test.c -MMD 2>test.stderr diff --git a/test/suites/basedir.bash b/test/suites/basedir.bash index 34e5cb702..e3273f8af 100644 --- a/test/suites/basedir.bash +++ b/test/suites/basedir.bash @@ -81,7 +81,7 @@ EOF ln -s d1/d2 d3 CCACHE_BASEDIR=/ $CCACHE_COMPILE -c $PWD/d3/c.c - $REAL_COMPILER c.o -o c + $COMPILER c.o -o c if [ "$(./c)" != OK ]; then test_failed "Incorrect header file used" fi @@ -104,7 +104,7 @@ EOF ln -s d/c.c c.c CCACHE_BASEDIR=/ $CCACHE_COMPILE -c $PWD/c.c - $REAL_COMPILER c.o -o c + $COMPILER c.o -o c if [ "$(./c)" != OK ]; then test_failed "Incorrect header file used" fi @@ -282,7 +282,7 @@ EOF backdate test.h pwd="$(pwd -P)" - $REAL_COMPILER -c $pwd/test.c 2>reference.stderr + $COMPILER -c $pwd/test.c 2>reference.stderr CCACHE_ABSSTDERR=1 CCACHE_BASEDIR="$pwd" $CCACHE_COMPILE -c $pwd/test.c 2>ccache.stderr expect_stat direct_cache_hit 0 @@ -296,8 +296,8 @@ EOF expect_stat cache_miss 1 expect_equal_content reference.stderr ccache.stderr - if $REAL_COMPILER -fdiagnostics-color=always -c test.c 2>/dev/null; then - $REAL_COMPILER -fdiagnostics-color=always -c $pwd/test.c 2>reference.stderr + if $COMPILER -fdiagnostics-color=always -c test.c 2>/dev/null; then + $COMPILER -fdiagnostics-color=always -c $pwd/test.c 2>reference.stderr CCACHE_ABSSTDERR=1 CCACHE_BASEDIR="$pwd" $CCACHE_COMPILE -fdiagnostics-color=always -c $pwd/test.c 2>ccache.stderr expect_stat direct_cache_hit 2 diff --git a/test/suites/color_diagnostics.bash b/test/suites/color_diagnostics.bash index b7264bde5..004eb15e4 100644 --- a/test/suites/color_diagnostics.bash +++ b/test/suites/color_diagnostics.bash @@ -15,9 +15,9 @@ SUITE_color_diagnostics_PROBE() { # Probe that real compiler actually supports colored diagnostics. if [[ ! $color_diagnostics_enable || ! $color_diagnostics_disable ]]; then echo "compiler $COMPILER does not support colored diagnostics" - elif ! $REAL_COMPILER $color_diagnostics_enable -E - /dev/null 2>&1; then + elif ! $COMPILER $color_diagnostics_enable -E - /dev/null 2>&1; then echo "compiler $COMPILER (version: $compiler_version) does not support $color_diagnostics_enable" - elif ! $REAL_COMPILER $color_diagnostics_disable -E - /dev/null 2>&1; then + elif ! $COMPILER $color_diagnostics_disable -E - /dev/null 2>&1; then echo "compiler $COMPILER (version: $compiler_version) does not support $color_diagnostics_disable" fi } diff --git a/test/suites/cpp1.bash b/test/suites/cpp1.bash index f2a83a3ab..e472b2852 100644 --- a/test/suites/cpp1.bash +++ b/test/suites/cpp1.bash @@ -1,12 +1,12 @@ SUITE_cpp1_PROBE() { touch test.c if $COMPILER_TYPE_GCC; then - if ! $REAL_COMPILER -E -fdirectives-only test.c >&/dev/null; then + if ! $COMPILER -E -fdirectives-only test.c >&/dev/null; then echo "-fdirectives-only not supported by compiler" return fi elif $COMPILER_TYPE_CLANG; then - if ! $REAL_COMPILER -E -frewrite-includes test.c >&/dev/null; then + if ! $COMPILER -E -frewrite-includes test.c >&/dev/null; then echo "-frewrite-includes not supported by compiler" return fi @@ -38,7 +38,7 @@ SUITE_cpp1() { # ------------------------------------------------------------------------- TEST "Base case" - $REAL_COMPILER $cpp_flag -c -o reference_test1.o test1.c + $COMPILER $cpp_flag -c -o reference_test1.o test1.c $CCACHE_COMPILE $cpp_flag -c test1.c expect_stat direct_cache_hit 0 diff --git a/test/suites/debug_prefix_map.bash b/test/suites/debug_prefix_map.bash index d0cc264bf..5911cf617 100644 --- a/test/suites/debug_prefix_map.bash +++ b/test/suites/debug_prefix_map.bash @@ -1,6 +1,6 @@ SUITE_debug_prefix_map_PROBE() { touch test.c - if ! $REAL_COMPILER -c -fdebug-prefix-map=old=new test.c 2>/dev/null; then + if ! $COMPILER -c -fdebug-prefix-map=old=new test.c 2>/dev/null; then echo "-fdebug-prefix-map not supported by compiler" fi } diff --git a/test/suites/depend.bash b/test/suites/depend.bash index 24944acbc..24d8a827f 100644 --- a/test/suites/depend.bash +++ b/test/suites/depend.bash @@ -18,8 +18,8 @@ int test3; EOF backdate test1.h test2.h test3.h - $REAL_COMPILER -c -Wp,-MD,expected.d test.c - $REAL_COMPILER -c -Wp,-MMD,expected_mmd.d test.c + $COMPILER -c -Wp,-MD,expected.d test.c + $COMPILER -c -Wp,-MMD,expected_mmd.d test.c rm test.o DEPSFLAGS_REAL="-MP -MMD -MF reference_test.d" @@ -83,7 +83,7 @@ EOF generate_reference_compiler_output() { rm -f *.o *.d - $REAL_COMPILER $DEPFLAGS -c -o test.o test.c + $COMPILER $DEPFLAGS -c -o test.o test.c mv test.o reference_test.o mv test.d reference_test.d } @@ -92,7 +92,7 @@ SUITE_depend() { # ------------------------------------------------------------------------- TEST "Base case" - $REAL_COMPILER $DEPSFLAGS_REAL -c -o reference_test.o test.c + $COMPILER $DEPSFLAGS_REAL -c -o reference_test.o test.c CCACHE_DEPEND=1 $CCACHE_COMPILE $DEPSFLAGS_CCACHE -c test.c expect_equal_object_files reference_test.o test.o @@ -130,7 +130,7 @@ SUITE_depend() { # ------------------------------------------------------------------------- TEST "No explicit dependency file" - $REAL_COMPILER $DEPSFLAGS_REAL -c -o reference_test.o test.c + $COMPILER $DEPSFLAGS_REAL -c -o reference_test.o test.c CCACHE_DEPEND=1 $CCACHE_COMPILE -MD -c test.c expect_equal_object_files reference_test.o test.o @@ -166,7 +166,7 @@ int stderr(void) // Trigger compiler warning by having no return statement. } EOF - $REAL_COMPILER -MD -Wall -W -c cpp-warning.c 2>stderr-baseline.txt + $COMPILER -MD -Wall -W -c cpp-warning.c 2>stderr-baseline.txt CCACHE_DEPEND=1 $CCACHE_COMPILE -MD -Wall -W -c cpp-warning.c 2>stderr-orig.txt expect_stat direct_cache_hit 0 @@ -301,7 +301,7 @@ EOF TEST "Source file with special characters" touch 'file with$special#characters.c' - $REAL_COMPILER -MMD -c 'file with$special#characters.c' + $COMPILER -MMD -c 'file with$special#characters.c' mv 'file with$special#characters.d' reference.d CCACHE_DEPEND=1 $CCACHE_COMPILE -MMD -c 'file with$special#characters.c' diff --git a/test/suites/direct.bash b/test/suites/direct.bash index 9b54a5974..c17d8b613 100644 --- a/test/suites/direct.bash +++ b/test/suites/direct.bash @@ -18,8 +18,8 @@ int test3; EOF backdate test1.h test2.h test3.h - $REAL_COMPILER -c -Wp,-MD,expected.d test.c - $REAL_COMPILER -c -Wp,-MMD,expected_mmd.d test.c + $COMPILER -c -Wp,-MD,expected.d test.c + $COMPILER -c -Wp,-MMD,expected_mmd.d test.c rm test.o } @@ -27,7 +27,7 @@ SUITE_direct() { # ------------------------------------------------------------------------- TEST "Base case" - $REAL_COMPILER -c -o reference_test.o test.c + $COMPILER -c -o reference_test.o test.c $CCACHE_COMPILE -c test.c expect_stat direct_cache_hit 0 @@ -212,10 +212,10 @@ EOF TEST "Dependency file content, $dep_args $obj_args" # ----------------------------------------------------------------- - $REAL_COMPILER -c test.c $dep_args $obj_args + $COMPILER -c test.c $dep_args $obj_args mv $dep_file $dep_file.real - $REAL_COMPILER -c test.c $dep_args -o another.o + $COMPILER -c test.c $dep_args -o another.o mv $another_dep_file another.d.real # cache miss @@ -250,7 +250,7 @@ EOF obj=$dir/$name.o dep=$(echo $obj | sed 's/\.o$/.d/') - $REAL_COMPILER $option -c test1.c -o $obj + $COMPILER $option -c test1.c -o $obj mv $dep orig.d $CCACHE_COMPILE $option -c test1.c -o $obj @@ -277,7 +277,7 @@ EOF for name in test2 obj1 obj2; do obj=$dir1/$name.o dep=$(echo $obj | sed 's/\.o$/.d/') - $REAL_COMPILER -MMD -c $src -o $obj + $COMPILER -MMD -c $src -o $obj mv $dep $orig_dep rm $obj @@ -333,7 +333,7 @@ EOF expect_stat cache_miss 1 expect_equal_content other.d expected.d - $REAL_COMPILER -c -Wp,-MD,other.d test.c -o reference_test.o + $COMPILER -c -Wp,-MD,other.d test.c -o reference_test.o expect_equal_object_files reference_test.o test.o rm -f other.d @@ -360,7 +360,7 @@ EOF expect_stat cache_miss 1 expect_equal_content other.d expected_mmd.d - $REAL_COMPILER -c -Wp,-MMD,other.d test.c -o reference_test.o + $COMPILER -c -Wp,-MMD,other.d test.c -o reference_test.o expect_equal_object_files reference_test.o test.o rm -f other.d @@ -447,7 +447,7 @@ EOF expect_stat cache_miss 1 expect_equal_content test.d expected.d - $REAL_COMPILER -c -MD test.c -o reference_test.o + $COMPILER -c -MD test.c -o reference_test.o expect_equal_object_files reference_test.o test.o rm -f test.d @@ -486,7 +486,7 @@ EOF int test() { return 0; } EOF - if $REAL_COMPILER -c -fstack-usage code.c >/dev/null 2>&1; then + if $COMPILER -c -fstack-usage code.c >/dev/null 2>&1; then $CCACHE_COMPILE -c -fstack-usage code.c expect_stat direct_cache_hit 0 expect_stat preprocessed_cache_hit 0 @@ -510,7 +510,7 @@ EOF expect_stat preprocessed_cache_hit 0 expect_stat cache_miss 1 expect_equal_content test.d expected.d - $REAL_COMPILER -c -MD test.c -o reference_test.o + $COMPILER -c -MD test.c -o reference_test.o expect_equal_object_files reference_test.o test.o rm -f test.d @@ -548,7 +548,7 @@ EOF expect_stat preprocessed_cache_hit 0 expect_stat cache_miss 1 expect_equal_content other.d expected.d - $REAL_COMPILER -c -MD -MF other.d test.c -o reference_test.o + $COMPILER -c -MD -MF other.d test.c -o reference_test.o expect_equal_object_files reference_test.o test.o rm -f other.d diff --git a/test/suites/direct_gcc.bash b/test/suites/direct_gcc.bash index 4e5109001..3cfb0c0c2 100644 --- a/test/suites/direct_gcc.bash +++ b/test/suites/direct_gcc.bash @@ -24,10 +24,10 @@ int test3; EOF backdate test1.h test2.h test3.h - DEPENDENCIES_OUTPUT="expected_dependencies_output.d" $REAL_COMPILER -c test.c - DEPENDENCIES_OUTPUT="expected_dependencies_output_target.d target.o" $REAL_COMPILER -c test.c - SUNPRO_DEPENDENCIES="expected_sunpro_dependencies.d" $REAL_COMPILER -c test.c - SUNPRO_DEPENDENCIES="expected_sunpro_dependencies_target.d target.o" $REAL_COMPILER -c test.c + DEPENDENCIES_OUTPUT="expected_dependencies_output.d" $COMPILER -c test.c + DEPENDENCIES_OUTPUT="expected_dependencies_output_target.d target.o" $COMPILER -c test.c + SUNPRO_DEPENDENCIES="expected_sunpro_dependencies.d" $COMPILER -c test.c + SUNPRO_DEPENDENCIES="expected_sunpro_dependencies_target.d target.o" $COMPILER -c test.c rm test.o } @@ -41,7 +41,7 @@ SUITE_direct_gcc() { expect_stat cache_miss 1 expect_equal_content other.d expected_dependencies_output.d - DEPENDENCIES_OUTPUT="other.d" $REAL_COMPILER -c test.c -o reference_test.o + DEPENDENCIES_OUTPUT="other.d" $COMPILER -c test.c -o reference_test.o expect_equal_object_files reference_test.o test.o rm -f other.d @@ -68,7 +68,7 @@ SUITE_direct_gcc() { expect_stat cache_miss 1 expect_equal_content other.d expected_dependencies_output_target.d - DEPENDENCIES_OUTPUT="other.d target.o" $REAL_COMPILER -c test.c -o reference_test.o + DEPENDENCIES_OUTPUT="other.d target.o" $COMPILER -c test.c -o reference_test.o expect_equal_object_files reference_test.o test.o rm -f other.d @@ -95,7 +95,7 @@ SUITE_direct_gcc() { expect_stat cache_miss 1 expect_equal_content other.d expected_sunpro_dependencies.d - SUNPRO_DEPENDENCIES="other.d" $REAL_COMPILER -c test.c -o reference_test.o + SUNPRO_DEPENDENCIES="other.d" $COMPILER -c test.c -o reference_test.o expect_equal_object_files reference_test.o test.o rm -f other.d @@ -122,7 +122,7 @@ SUITE_direct_gcc() { expect_stat cache_miss 1 expect_equal_content other.d expected_sunpro_dependencies_target.d - SUNPRO_DEPENDENCIES="other.d target.o" $REAL_COMPILER -c test.c -o reference_test.o + SUNPRO_DEPENDENCIES="other.d target.o" $COMPILER -c test.c -o reference_test.o expect_equal_object_files reference_test.o test.o rm -f other.d diff --git a/test/suites/fileclone.bash b/test/suites/fileclone.bash index 3ae1b462e..25aec4d7c 100644 --- a/test/suites/fileclone.bash +++ b/test/suites/fileclone.bash @@ -11,7 +11,7 @@ SUITE_fileclone() { generate_code 1 test.c - $REAL_COMPILER -c -o reference_test.o test.c + $COMPILER -c -o reference_test.o test.c CCACHE_FILECLONE=1 $CCACHE_COMPILE -c test.c expect_stat preprocessed_cache_hit 0 @@ -37,7 +37,7 @@ SUITE_fileclone() { generate_code 1 test.c - $REAL_COMPILER -c -o reference_test.o test.c + $COMPILER -c -o reference_test.o test.c $CCACHE_COMPILE -c test.c expect_stat preprocessed_cache_hit 0 diff --git a/test/suites/hardlink.bash b/test/suites/hardlink.bash index 76b0f2948..cf3c5304e 100644 --- a/test/suites/hardlink.bash +++ b/test/suites/hardlink.bash @@ -13,7 +13,7 @@ SUITE_hardlink() { generate_code 1 test1.c - $REAL_COMPILER -c -o reference_test1.o test1.c + $COMPILER -c -o reference_test1.o test1.c CCACHE_HARDLINK=1 $CCACHE_COMPILE -c test1.c expect_stat preprocessed_cache_hit 0 @@ -52,9 +52,9 @@ SUITE_hardlink() { TEST "Overwrite assembler" generate_code 1 test1.c - $REAL_COMPILER -S -o test1.s test1.c + $COMPILER -S -o test1.s test1.c - $REAL_COMPILER -c -o reference_test1.o test1.s + $COMPILER -c -o reference_test1.o test1.s CCACHE_HARDLINK=1 $CCACHE_COMPILE -c test1.s expect_stat preprocessed_cache_hit 0 @@ -62,7 +62,7 @@ SUITE_hardlink() { expect_stat files_in_cache 2 generate_code 2 test1.c - $REAL_COMPILER -S -o test1.s test1.c + $COMPILER -S -o test1.s test1.c CCACHE_HARDLINK=1 $CCACHE_COMPILE -c test1.s expect_stat preprocessed_cache_hit 0 @@ -70,7 +70,7 @@ SUITE_hardlink() { expect_stat files_in_cache 4 generate_code 1 test1.c - $REAL_COMPILER -S -o test1.s test1.c + $COMPILER -S -o test1.s test1.c CCACHE_HARDLINK=1 $CCACHE_COMPILE -c test1.s expect_stat preprocessed_cache_hit 1 diff --git a/test/suites/input_charset.bash b/test/suites/input_charset.bash index a7bb40511..833ab3b47 100644 --- a/test/suites/input_charset.bash +++ b/test/suites/input_charset.bash @@ -1,6 +1,6 @@ SUITE_input_charset_PROBE() { touch test.c - if ! $REAL_COMPILER -c -finput-charset=latin1 test.c >/dev/null 2>&1; then + if ! $COMPILER -c -finput-charset=latin1 test.c >/dev/null 2>&1; then echo "compiler doesn't support -finput-charset" fi } diff --git a/test/suites/masquerading.bash b/test/suites/masquerading.bash index cf371318b..bfba17699 100644 --- a/test/suites/masquerading.bash +++ b/test/suites/masquerading.bash @@ -19,7 +19,7 @@ SUITE_masquerading() { # ------------------------------------------------------------------------- TEST "Masquerading via symlink, relative path" - $REAL_COMPILER -c -o reference_test1.o test1.c + $COMPILER -c -o reference_test1.o test1.c ./$COMPILER_BIN $COMPILER_ARGS -c test1.c expect_stat preprocessed_cache_hit 0 @@ -36,7 +36,7 @@ SUITE_masquerading() { # ------------------------------------------------------------------------- TEST "Masquerading via symlink, absolute path" - $REAL_COMPILER -c -o reference_test1.o test1.c + $COMPILER -c -o reference_test1.o test1.c $PWD/$COMPILER_BIN $COMPILER_ARGS -c test1.c expect_stat preprocessed_cache_hit 0 diff --git a/test/suites/no_compression.bash b/test/suites/no_compression.bash index a7cb7bbd6..d690b19e1 100644 --- a/test/suites/no_compression.bash +++ b/test/suites/no_compression.bash @@ -9,7 +9,7 @@ SUITE_no_compression() { # ------------------------------------------------------------------------- TEST "Base case" - $REAL_COMPILER -c -o reference_test.o test.c + $COMPILER -c -o reference_test.o test.c $CCACHE_COMPILE -c test.c expect_stat direct_cache_hit 0 diff --git a/test/suites/nvcc.bash b/test/suites/nvcc.bash index bf435c718..8fa090954 100644 --- a/test/suites/nvcc.bash +++ b/test/suites/nvcc.bash @@ -1,7 +1,7 @@ nvcc_PROBE() { if [ -z "$REAL_NVCC" ]; then echo "nvcc is not available" - elif [ -z "$REAL_CUOBJDUMP" ]; then + elif ! command -v cuobjdump >/dev/null; then echo "cuobjdump is not available" fi } @@ -58,7 +58,7 @@ nvcc_tests() { nvcc_opts_gpu2="--generate-code arch=compute_52,code=sm_52" ccache_nvcc_cpp="$CCACHE $REAL_NVCC $nvcc_opts_cpp" ccache_nvcc_cuda="$CCACHE $REAL_NVCC $nvcc_opts_cuda" - cuobjdump="$REAL_CUOBJDUMP -all -elf -symbols -ptx -sass" + cuobjdump="cuobjdump -all -elf -symbols -ptx -sass" # ------------------------------------------------------------------------- TEST "Simple mode" @@ -215,17 +215,17 @@ nvcc_tests() { # ------------------------------------------------------------------------- TEST "Option --compiler-bindir" - $REAL_NVCC $nvcc_opts_cpp --compiler-bindir $REAL_COMPILER_BIN \ + $REAL_NVCC $nvcc_opts_cpp --compiler-bindir $COMPILER_BIN \ -o reference_test1.o test_cpp.cu # First compile. - $ccache_nvcc_cpp --compiler-bindir $REAL_COMPILER_BIN test_cpp.cu + $ccache_nvcc_cpp --compiler-bindir $COMPILER_BIN test_cpp.cu expect_stat preprocessed_cache_hit 0 expect_stat cache_miss 1 expect_stat files_in_cache 1 expect_equal_content reference_test1.o test_cpp.o - $ccache_nvcc_cpp --compiler-bindir $REAL_COMPILER_BIN test_cpp.cu + $ccache_nvcc_cpp --compiler-bindir $COMPILER_BIN test_cpp.cu expect_stat preprocessed_cache_hit 1 expect_stat cache_miss 1 expect_stat files_in_cache 1 @@ -234,17 +234,17 @@ nvcc_tests() { # ------------------------------------------------------------------------- TEST "Option -ccbin" - $REAL_NVCC $nvcc_opts_cpp -ccbin $REAL_COMPILER_BIN \ + $REAL_NVCC $nvcc_opts_cpp -ccbin $COMPILER_BIN \ -o reference_test1.o test_cpp.cu # First compile. - $ccache_nvcc_cpp -ccbin $REAL_COMPILER_BIN test_cpp.cu + $ccache_nvcc_cpp -ccbin $COMPILER_BIN test_cpp.cu expect_stat preprocessed_cache_hit 0 expect_stat cache_miss 1 expect_stat files_in_cache 1 expect_equal_content reference_test1.o test_cpp.o - $ccache_nvcc_cpp -ccbin $REAL_COMPILER_BIN test_cpp.cu + $ccache_nvcc_cpp -ccbin $COMPILER_BIN test_cpp.cu expect_stat preprocessed_cache_hit 1 expect_stat cache_miss 1 expect_stat files_in_cache 1 diff --git a/test/suites/nvcc_direct.bash b/test/suites/nvcc_direct.bash index 873e659cb..0b28d9889 100644 --- a/test/suites/nvcc_direct.bash +++ b/test/suites/nvcc_direct.bash @@ -20,7 +20,7 @@ SUITE_nvcc_direct() { nvcc_opts_gpu2="--generate-code arch=compute_52,code=sm_52" ccache_nvcc_cpp="$CCACHE $REAL_NVCC $nvcc_opts_cpp" ccache_nvcc_cuda="$CCACHE $REAL_NVCC $nvcc_opts_cuda" - cuobjdump="$REAL_CUOBJDUMP -all -elf -symbols -ptx -sass" + cuobjdump="cuobjdump -all -elf -symbols -ptx -sass" # ------------------------------------------------------------------------- TEST "Simple mode" diff --git a/test/suites/nvcc_ldir.bash b/test/suites/nvcc_ldir.bash index e18c664fc..13177e240 100644 --- a/test/suites/nvcc_ldir.bash +++ b/test/suites/nvcc_ldir.bash @@ -2,7 +2,7 @@ SUITE_nvcc_ldir_PROBE() { if [ -z "$REAL_NVCC" ]; then echo "nvcc is not available" return - elif [ -z "$REAL_CUOBJDUMP" ]; then + elif ! command -v cuobjdump >/dev/null; then echo "cuobjdump is not available" return fi @@ -23,9 +23,9 @@ SUITE_nvcc_ldir_PROBE() { echo "include directory $nvcc_idir not found" fi - echo "int main() { return 0; }" | $REAL_NVCC -Wno-deprecated-gpu-targets -ccbin $REAL_COMPILER_BIN -c -x cu - + echo "int main() { return 0; }" | $REAL_NVCC -Wno-deprecated-gpu-targets -ccbin $COMPILER_BIN -c -x cu - if [ $? -ne 0 ]; then - echo "nvcc of a canary failed; Is CUDA compatible with the host compiler ($REAL_COMPILER_BIN)?" + echo "nvcc of a canary failed; Is CUDA compatible with the host compiler ($COMPILER_BIN)?" fi } @@ -34,9 +34,9 @@ SUITE_nvcc_ldir_SETUP() { } SUITE_nvcc_ldir() { - nvcc_opts_cuda="-Wno-deprecated-gpu-targets -c -ccbin $REAL_COMPILER_BIN" + nvcc_opts_cuda="-Wno-deprecated-gpu-targets -c -ccbin $COMPILER_BIN" ccache_nvcc_cuda="$CCACHE $REAL_NVCC $nvcc_opts_cuda" - cuobjdump="$REAL_CUOBJDUMP -all -elf -symbols -ptx -sass" + cuobjdump="cuobjdump -all -elf -symbols -ptx -sass" nvcc_dir=$(dirname $REAL_NVCC) nvcc_ldir=$nvcc_dir/../nvvm/libdevice cicc_path=$nvcc_dir/../nvvm/bin diff --git a/test/suites/pch.bash b/test/suites/pch.bash index ad77c8224..ec5fc08ad 100644 --- a/test/suites/pch.bash +++ b/test/suites/pch.bash @@ -2,13 +2,13 @@ SUITE_pch_PROBE() { touch pch.h empty.c mkdir dir - if ! $REAL_COMPILER $SYSROOT -fpch-preprocess pch.h 2>/dev/null \ + if ! $COMPILER $SYSROOT -fpch-preprocess pch.h 2>/dev/null \ || [ ! -f pch.h.gch ]; then echo "compiler ($($COMPILER --version | head -n 1)) doesn't support precompiled headers" fi - $REAL_COMPILER $SYSROOT -c pch.h -o dir/pch.h.gch 2>/dev/null - if ! $REAL_COMPILER $SYSROOT -c -include dir/pch.h empty.c 2>/dev/null; then + $COMPILER $SYSROOT -c pch.h -o dir/pch.h.gch 2>/dev/null + if ! $COMPILER $SYSROOT -c -include dir/pch.h empty.c 2>/dev/null; then echo "compiler ($($COMPILER --version | head -n 1)) seems to have broken support for precompiled headers" fi } @@ -121,7 +121,7 @@ pch_suite_common() { # ------------------------------------------------------------------------- TEST "Use .gch, #include, remove pch.h" - $REAL_COMPILER $SYSROOT -c pch.h + $COMPILER $SYSROOT -c pch.h backdate pch.h.gch rm pch.h @@ -136,7 +136,7 @@ pch_suite_common() { # ------------------------------------------------------------------------- TEST "Use .gch, -include, no sloppiness" - $REAL_COMPILER $SYSROOT -c pch.h + $COMPILER $SYSROOT -c pch.h backdate pch.h.gch $CCACHE_COMPILE $SYSROOT -c -include pch.h pch2.c @@ -149,7 +149,7 @@ pch_suite_common() { # ------------------------------------------------------------------------- TEST "Use .gch, -include" - $REAL_COMPILER $SYSROOT -c pch.h + $COMPILER $SYSROOT -c pch.h backdate pch.h.gch CCACHE_SLOPPINESS="$DEFAULT_SLOPPINESS time_macros" $CCACHE_COMPILE $SYSROOT -c -include pch.h pch2.c @@ -164,7 +164,7 @@ pch_suite_common() { echo '#include /*change pch*/' >>pch.h backdate pch.h - $REAL_COMPILER $SYSROOT -c pch.h + $COMPILER $SYSROOT -c pch.h backdate pch.h.gch CCACHE_SLOPPINESS="$DEFAULT_SLOPPINESS time_macros" $CCACHE_COMPILE $SYSROOT -c -include pch.h pch2.c @@ -180,7 +180,7 @@ pch_suite_common() { # ------------------------------------------------------------------------- TEST "Use .gch, preprocessor mode, -include" - $REAL_COMPILER $SYSROOT -c pch.h + $COMPILER $SYSROOT -c pch.h backdate pch.h.gch CCACHE_NODIRECT=1 CCACHE_SLOPPINESS="$DEFAULT_SLOPPINESS time_macros" $CCACHE_COMPILE $SYSROOT -c -include pch.h pch.c @@ -195,7 +195,7 @@ pch_suite_common() { echo '#include /*change pch*/' >>pch.h backdate pch.h - $REAL_COMPILER $SYSROOT -c pch.h + $COMPILER $SYSROOT -c pch.h backdate pch.h.gch CCACHE_NODIRECT=1 CCACHE_SLOPPINESS="$DEFAULT_SLOPPINESS time_macros" $CCACHE_COMPILE $SYSROOT -c -include pch.h pch.c @@ -236,7 +236,7 @@ pch_suite_common() { # ------------------------------------------------------------------------- TEST "Use .gch, -include, PCH_EXTSUM=1" - $REAL_COMPILER $SYSROOT -c pch.h + $COMPILER $SYSROOT -c pch.h backdate pch.h.gch echo "original checksum" > pch.h.gch.sum @@ -270,7 +270,7 @@ pch_suite_common() { sleep 1 touch pch.h - $REAL_COMPILER $SYSROOT -c pch.h + $COMPILER $SYSROOT -c pch.h backdate pch.h.gch CCACHE_PCH_EXTSUM=1 CCACHE_SLOPPINESS="$DEFAULT_SLOPPINESS time_macros" $CCACHE_COMPILE $SYSROOT -c -include pch.h pch2.c @@ -281,7 +281,7 @@ pch_suite_common() { # ------------------------------------------------------------------------- TEST "Use .gch, -include, no PCH_EXTSUM" - $REAL_COMPILER $SYSROOT -c pch.h + $COMPILER $SYSROOT -c pch.h backdate pch.h.gch echo "original checksum" > pch.h.gch.sum @@ -307,7 +307,7 @@ pch_suite_common() { TEST "Use .gch, -include, other dir for .gch" mkdir -p dir - $REAL_COMPILER $SYSROOT -c pch.h -o dir/pch.h.gch + $COMPILER $SYSROOT -c pch.h -o dir/pch.h.gch backdate dir/pch.h.gch rm -f pch.h.gch @@ -323,7 +323,7 @@ pch_suite_common() { echo '#include /*change pch*/' >>pch.h backdate pch.h - $REAL_COMPILER $SYSROOT -c pch.h -o dir/pch.h.gch + $COMPILER $SYSROOT -c pch.h -o dir/pch.h.gch backdate dir/pch.h.gch CCACHE_SLOPPINESS="$DEFAULT_SLOPPINESS time_macros" $CCACHE_COMPILE $SYSROOT -c -include dir/pch.h pch2.c @@ -341,7 +341,7 @@ pch_suite_common() { TEST "Use .gch, preprocessor mode, -include, other dir for .gch" mkdir -p dir - $REAL_COMPILER $SYSROOT -c pch.h -o dir/pch.h.gch + $COMPILER $SYSROOT -c pch.h -o dir/pch.h.gch backdate dir/pch.h.gch rm -f pch.h.gch @@ -357,7 +357,7 @@ pch_suite_common() { echo '#include /*change pch*/' >>pch.h backdate pch.h - $REAL_COMPILER $SYSROOT -c pch.h -o dir/pch.h.gch + $COMPILER $SYSROOT -c pch.h -o dir/pch.h.gch backdate dir/pch.h.gch CCACHE_NODIRECT=1 CCACHE_SLOPPINESS="$DEFAULT_SLOPPINESS time_macros" $CCACHE_COMPILE $SYSROOT -c -include dir/pch.h pch.c @@ -374,7 +374,7 @@ pch_suite_common() { # ------------------------------------------------------------------------- TEST "Use .gch, depend mode, -include" - $REAL_COMPILER $SYSROOT -c pch.h + $COMPILER $SYSROOT -c pch.h backdate pch.h.gch CCACHE_DEPEND=1 CCACHE_SLOPPINESS="$DEFAULT_SLOPPINESS time_macros" $CCACHE_COMPILE $SYSROOT -c -include pch.h pch2.c -MD -MF pch.d @@ -389,7 +389,7 @@ pch_suite_common() { echo '#include /*change pch*/' >>pch.h backdate pch.h - $REAL_COMPILER $SYSROOT -c pch.h + $COMPILER $SYSROOT -c pch.h backdate pch.h.gch CCACHE_DEPEND=1 CCACHE_SLOPPINESS="$DEFAULT_SLOPPINESS time_macros" $CCACHE_COMPILE $SYSROOT -c -include pch.h pch2.c -MD -MF pch.d @@ -407,7 +407,7 @@ pch_suite_gcc() { # ------------------------------------------------------------------------- TEST "Use .gch, -include, remove pch.h" - $REAL_COMPILER $SYSROOT -c pch.h + $COMPILER $SYSROOT -c pch.h backdate pch.h.gch rm pch.h @@ -424,7 +424,7 @@ pch_suite_gcc() { # ------------------------------------------------------------------------- TEST "Use .gch, #include, no sloppiness" - $REAL_COMPILER $SYSROOT -c pch.h + $COMPILER $SYSROOT -c pch.h backdate pch.h.gch rm pch.h @@ -437,7 +437,7 @@ pch_suite_gcc() { # ------------------------------------------------------------------------- TEST "Use .gch, #include" - $REAL_COMPILER $SYSROOT -c pch.h + $COMPILER $SYSROOT -c pch.h backdate pch.h.gch rm pch.h @@ -453,7 +453,7 @@ pch_suite_gcc() { echo '#include /*change pch*/' >>pch.h backdate pch.h - $REAL_COMPILER $SYSROOT -c pch.h + $COMPILER $SYSROOT -c pch.h backdate pch.h.gch CCACHE_SLOPPINESS="$DEFAULT_SLOPPINESS time_macros" $CCACHE_COMPILE $SYSROOT -c -fpch-preprocess pch.c @@ -469,7 +469,7 @@ pch_suite_gcc() { # ------------------------------------------------------------------------- TEST "Use .gch, preprocessor mode, #include" - $REAL_COMPILER $SYSROOT -c pch.h + $COMPILER $SYSROOT -c pch.h backdate pch.h.gch rm pch.h @@ -485,7 +485,7 @@ pch_suite_gcc() { echo '#include /*change pch*/' >>pch.h backdate pch.h - $REAL_COMPILER $SYSROOT -c pch.h + $COMPILER $SYSROOT -c pch.h backdate pch.h.gch CCACHE_NODIRECT=1 CCACHE_SLOPPINESS="$DEFAULT_SLOPPINESS time_macros" $CCACHE_COMPILE $SYSROOT -c -fpch-preprocess pch.c @@ -543,7 +543,7 @@ pch_suite_gcc() { # ------------------------------------------------------------------------- TEST "Use .gch, #include, PCH_EXTSUM=1" - $REAL_COMPILER $SYSROOT -c pch.h + $COMPILER $SYSROOT -c pch.h backdate pch.h.gch echo "original checksum" > pch.h.gch.sum @@ -577,7 +577,7 @@ pch_suite_gcc() { sleep 1 touch pch.h - $REAL_COMPILER $SYSROOT -c pch.h + $COMPILER $SYSROOT -c pch.h backdate pch.h.gch CCACHE_PCH_EXTSUM=1 CCACHE_SLOPPINESS="$DEFAULT_SLOPPINESS time_macros" $CCACHE_COMPILE $SYSROOT -c -fpch-preprocess pch.c @@ -588,7 +588,7 @@ pch_suite_gcc() { # ------------------------------------------------------------------------- TEST "Use .gch, #include, no PCH_EXTSUM" - $REAL_COMPILER $SYSROOT -c pch.h + $COMPILER $SYSROOT -c pch.h backdate pch.h.gch echo "original checksum" > pch.h.gch.sum @@ -624,7 +624,7 @@ pch_suite_gcc() { touch lib.h touch main.c - $REAL_COMPILER $SYSROOT -c lib.h + $COMPILER $SYSROOT -c lib.h touch -d "@$(($(date +%s) + 60))" lib.h.gch # 1 minute in the future CCACHE_SLOPPINESS="$DEFAULT_SLOPPINESS pch_defines,time_macros" $CCACHE_COMPILE -include lib.h -c main.c @@ -661,7 +661,7 @@ EOF expect_stat preprocessed_cache_hit 0 expect_stat cache_miss 2 - $REAL_COMPILER $SYSROOT -c -include pch2.h pch2.c + $COMPILER $SYSROOT -c -include pch2.h pch2.c expect_exists pch2.o CCACHE_SLOPPINESS="$DEFAULT_SLOPPINESS pch_defines" $CCACHE_COMPILE $SYSROOT -c pch2.h @@ -672,7 +672,7 @@ EOF # ------------------------------------------------------------------------- TEST "Use .pch, -include, no sloppiness" - $REAL_COMPILER $SYSROOT -c pch.h -o pch.h.pch + $COMPILER $SYSROOT -c pch.h -o pch.h.pch backdate pch.h.pch $CCACHE_COMPILE $SYSROOT -c -include pch.h pch2.c @@ -685,7 +685,7 @@ EOF # ------------------------------------------------------------------------- TEST "Use .pch, -include" - $REAL_COMPILER $SYSROOT -c pch.h -o pch.h.pch + $COMPILER $SYSROOT -c pch.h -o pch.h.pch backdate pch.h.pch CCACHE_SLOPPINESS="$DEFAULT_SLOPPINESS time_macros" $CCACHE_COMPILE $SYSROOT -c -include pch.h pch2.c @@ -700,7 +700,7 @@ EOF echo '#include /*change pch*/' >>pch.h backdate pch.h - $REAL_COMPILER $SYSROOT -c pch.h -o pch.h.pch + $COMPILER $SYSROOT -c pch.h -o pch.h.pch backdate pch.h.pch CCACHE_SLOPPINESS="$DEFAULT_SLOPPINESS time_macros" $CCACHE_COMPILE $SYSROOT -c -include pch.h pch2.c @@ -711,7 +711,7 @@ EOF # ------------------------------------------------------------------------- TEST "Use .pch, preprocessor mode, -include" - $REAL_COMPILER $SYSROOT -c pch.h -o pch.h.pch + $COMPILER $SYSROOT -c pch.h -o pch.h.pch backdate pch.h.pch CCACHE_NODIRECT=1 CCACHE_SLOPPINESS="$DEFAULT_SLOPPINESS time_macros" $CCACHE_COMPILE $SYSROOT -c -include pch.h pch.c @@ -726,7 +726,7 @@ EOF echo '#include /*change pch*/' >>pch.h backdate pch.h - $REAL_COMPILER $SYSROOT -c pch.h -o pch.h.pch + $COMPILER $SYSROOT -c pch.h -o pch.h.pch backdate pch.h.pch CCACHE_NODIRECT=1 CCACHE_SLOPPINESS="$DEFAULT_SLOPPINESS time_macros" $CCACHE_COMPILE $SYSROOT -c -include pch.h pch.c @@ -742,7 +742,7 @@ EOF # ------------------------------------------------------------------------- TEST "Use .pch, -include-pch" - $REAL_COMPILER $SYSROOT -c pch.h -o pch.h.pch + $COMPILER $SYSROOT -c pch.h -o pch.h.pch backdate pch.h.pch CCACHE_SLOPPINESS="$DEFAULT_SLOPPINESS time_macros" $CCACHE_COMPILE $SYSROOT -c -include-pch pch.h.pch pch2.c @@ -757,7 +757,7 @@ EOF echo '#include /*change pch*/' >>pch.h backdate pch.h - $REAL_COMPILER $SYSROOT -c pch.h -o pch.h.pch + $COMPILER $SYSROOT -c pch.h -o pch.h.pch backdate pch.h.pch CCACHE_SLOPPINESS="$DEFAULT_SLOPPINESS time_macros" $CCACHE_COMPILE $SYSROOT -c -include-pch pch.h.pch pch2.c @@ -768,7 +768,7 @@ EOF # ------------------------------------------------------------------------- TEST "Use .pch, preprocessor mode, -include-pch" - $REAL_COMPILER $SYSROOT -c pch.h -o pch.h.pch + $COMPILER $SYSROOT -c pch.h -o pch.h.pch backdate pch.h.pch CCACHE_NODIRECT=1 CCACHE_SLOPPINESS="$DEFAULT_SLOPPINESS time_macros" $CCACHE_COMPILE $SYSROOT -c -include-pch pch.h.pch pch.c @@ -783,7 +783,7 @@ EOF echo '#include /*change pch*/' >>pch.h backdate pch.h - $REAL_COMPILER $SYSROOT -c pch.h -o pch.h.pch + $COMPILER $SYSROOT -c pch.h -o pch.h.pch backdate pch.h.pch CCACHE_NODIRECT=1 CCACHE_SLOPPINESS="$DEFAULT_SLOPPINESS time_macros" $CCACHE_COMPILE $SYSROOT -c -include-pch pch.h.pch pch.c @@ -823,7 +823,7 @@ EOF # ------------------------------------------------------------------------- TEST "Use .pch the with -Xclang options" - $REAL_COMPILER $SYSROOT -Xclang -emit-pch -o pch.h.pch -c pch.h + $COMPILER $SYSROOT -Xclang -emit-pch -o pch.h.pch -c pch.h backdate pch.h.pch CCACHE_SLOPPINESS="$DEFAULT_SLOPPINESS time_macros" $CCACHE_COMPILE $SYSROOT -Xclang -include-pch -Xclang pch.h.pch -Xclang -include -Xclang pch.h -c pch.c @@ -838,7 +838,7 @@ EOF echo '#include /*change pch*/' >>pch.h backdate pch.h - $REAL_COMPILER $SYSROOT -Xclang -emit-pch -o pch.h.pch -c pch.h + $COMPILER $SYSROOT -Xclang -emit-pch -o pch.h.pch -c pch.h backdate pch.h.pch CCACHE_SLOPPINESS="$DEFAULT_SLOPPINESS time_macros" $CCACHE_COMPILE $SYSROOT -Xclang -include-pch -Xclang pch.h.pch -Xclang -include -Xclang pch.h -c pch.c diff --git a/test/suites/profiling.bash b/test/suites/profiling.bash index aa0c93ed0..c1231b0ee 100644 --- a/test/suites/profiling.bash +++ b/test/suites/profiling.bash @@ -162,7 +162,7 @@ SUITE_profiling() { touch "$dir/test.c" find -name '*.gcno' -delete - $REAL_COMPILER $flag -ftest-coverage -c $dir/test.c -o $dir/test.o + $COMPILER $flag -ftest-coverage -c $dir/test.c -o $dir/test.o gcno_name=$(find -name '*.gcno') rm "$gcno_name" diff --git a/test/suites/sanitize_blacklist.bash b/test/suites/sanitize_blacklist.bash index 8ca436263..792a4086c 100644 --- a/test/suites/sanitize_blacklist.bash +++ b/test/suites/sanitize_blacklist.bash @@ -1,6 +1,6 @@ SUITE_sanitize_blacklist_PROBE() { touch test.c blacklist.txt - if ! $REAL_COMPILER -c -fsanitize-blacklist=blacklist.txt \ + if ! $COMPILER -c -fsanitize-blacklist=blacklist.txt \ test.c 2>/dev/null; then echo "-fsanitize-blacklist not supported by compiler" fi @@ -18,7 +18,7 @@ SUITE_sanitize_blacklist() { # ------------------------------------------------------------------------- TEST "Compile OK" - $REAL_COMPILER -c -fsanitize-blacklist=blacklist.txt test1.c + $COMPILER -c -fsanitize-blacklist=blacklist.txt test1.c $CCACHE_COMPILE -c -fsanitize-blacklist=blacklist.txt test1.c expect_stat direct_cache_hit 0 @@ -45,7 +45,7 @@ SUITE_sanitize_blacklist() { # ------------------------------------------------------------------------- TEST "Unsuccessful compilation" - if $REAL_COMPILER -c -fsanitize-blacklist=nosuchfile.txt test1.c 2>expected.stderr; then + if $COMPILER -c -fsanitize-blacklist=nosuchfile.txt test1.c 2>expected.stderr; then test_failed "Expected an error compiling test1.c" fi @@ -60,7 +60,7 @@ SUITE_sanitize_blacklist() { # ------------------------------------------------------------------------- TEST "Multiple -fsanitize-blacklist" - $REAL_COMPILER -c -fsanitize-blacklist=blacklist2.txt -fsanitize-blacklist=blacklist.txt test1.c + $COMPILER -c -fsanitize-blacklist=blacklist2.txt -fsanitize-blacklist=blacklist.txt test1.c $CCACHE_COMPILE -c -fsanitize-blacklist=blacklist2.txt -fsanitize-blacklist=blacklist.txt test1.c expect_stat direct_cache_hit 0 diff --git a/test/suites/serialize_diagnostics.bash b/test/suites/serialize_diagnostics.bash index 6163da73e..cb6101085 100644 --- a/test/suites/serialize_diagnostics.bash +++ b/test/suites/serialize_diagnostics.bash @@ -1,6 +1,6 @@ SUITE_serialize_diagnostics_PROBE() { touch test.c - if ! $REAL_COMPILER -c --serialize-diagnostics \ + if ! $COMPILER -c --serialize-diagnostics \ test1.dia test.c 2>/dev/null; then echo "--serialize-diagnostics not supported by compiler" fi @@ -14,7 +14,7 @@ SUITE_serialize_diagnostics() { # ------------------------------------------------------------------------- TEST "Compile OK" - $REAL_COMPILER -c --serialize-diagnostics expected.dia test1.c + $COMPILER -c --serialize-diagnostics expected.dia test1.c $CCACHE_COMPILE -c --serialize-diagnostics test.dia test1.c expect_stat preprocessed_cache_hit 0 @@ -34,7 +34,7 @@ SUITE_serialize_diagnostics() { TEST "Unsuccessful compilation" echo "bad source" >error.c - if $REAL_COMPILER -c --serialize-diagnostics expected.dia error.c 2>expected.stderr; then + if $COMPILER -c --serialize-diagnostics expected.dia error.c 2>expected.stderr; then test_failed "Expected an error compiling error.c" fi diff --git a/test/suites/source_date_epoch.bash b/test/suites/source_date_epoch.bash index c5efdc7af..a36bcbccc 100644 --- a/test/suites/source_date_epoch.bash +++ b/test/suites/source_date_epoch.bash @@ -1,6 +1,6 @@ SUITE_source_date_epoch_PROBE() { echo 'char x[] = __DATE__;' >test.c - if ! SOURCE_DATE_EPOCH=0 $REAL_COMPILER -E test.c | grep -q 1970; then + if ! SOURCE_DATE_EPOCH=0 $COMPILER -E test.c | grep -q 1970; then echo "SOURCE_DATE_EPOCH not supported by compiler" fi } diff --git a/test/suites/split_dwarf.bash b/test/suites/split_dwarf.bash index 7b77ca8eb..dcbac0b31 100644 --- a/test/suites/split_dwarf.bash +++ b/test/suites/split_dwarf.bash @@ -1,6 +1,6 @@ SUITE_split_dwarf_PROBE() { touch test.c - if ! $REAL_COMPILER -c -gsplit-dwarf test.c 2>/dev/null || [ ! -e test.dwo ]; then + if ! $COMPILER -c -gsplit-dwarf test.c 2>/dev/null || [ ! -e test.dwo ]; then echo "-gsplit-dwarf not supported by compiler" elif ! $COMPILER -fdebug-prefix-map=a=b -c test.c 2>/dev/null; then echo "-fdebug-prefix-map not supported by compiler" @@ -50,11 +50,11 @@ SUITE_split_dwarf() { cd dir1 - $REAL_COMPILER -I$(pwd)/include -c src/test.c -o test.o -gsplit-dwarf + $COMPILER -I$(pwd)/include -c src/test.c -o test.o -gsplit-dwarf mv test.o reference.o mv test.dwo reference.dwo - $REAL_COMPILER -I$(pwd)/include -c src/test.c -o test.o -gsplit-dwarf + $COMPILER -I$(pwd)/include -c src/test.c -o test.o -gsplit-dwarf mv test.o reference2.o mv test.dwo reference2.dwo @@ -75,7 +75,7 @@ SUITE_split_dwarf() { expect_stat cache_miss 1 expect_stat files_in_cache 2 - $REAL_COMPILER -I$(pwd)/include -c src/test.c -o test2.o -gsplit-dwarf + $COMPILER -I$(pwd)/include -c src/test.c -o test2.o -gsplit-dwarf mv test2.o reference2.o mv test2.dwo reference2.dwo @@ -124,7 +124,7 @@ SUITE_split_dwarf() { # "gcc -gsplit-dwarf -g1" produces a .dwo file, but "clang -gsplit-dwarf # -g1" doesn't, so test that ccache handles it gracefully either way. - $REAL_COMPILER -gsplit-dwarf -g1 -c test.c -o reference.o + $COMPILER -gsplit-dwarf -g1 -c test.c -o reference.o $CCACHE_COMPILE -gsplit-dwarf -g1 -c test.c expect_stat direct_cache_hit 0