From 5620af79851bed9dc137096e97b83553a53cad49 Mon Sep 17 00:00:00 2001 From: Joel Rosdahl Date: Sun, 8 Aug 2021 19:28:34 +0200 Subject: [PATCH] test: Use machine-parsable statistics IDs in tests --- test/run | 28 +- test/suites/base.bash | 724 ++++++++++++------------- test/suites/basedir.bash | 144 ++--- test/suites/cache_levels.bash | 60 +- test/suites/cleanup.bash | 56 +- test/suites/color_diagnostics.bash | 18 +- test/suites/cpp1.bash | 24 +- test/suites/debug_prefix_map.bash | 32 +- test/suites/depend.bash | 144 ++--- test/suites/direct.bash | 618 ++++++++++----------- test/suites/direct_gcc.bash | 84 +-- test/suites/fileclone.bash | 24 +- test/suites/hardlink.bash | 58 +- test/suites/input_charset.bash | 16 +- test/suites/ivfsoverlay.bash | 14 +- test/suites/masquerading.bash | 24 +- test/suites/modules.bash | 22 +- test/suites/multi_arch.bash | 48 +- test/suites/no_compression.bash | 50 +- test/suites/nvcc.bash | 162 +++--- test/suites/nvcc_direct.bash | 92 ++-- test/suites/nvcc_ldir.bash | 24 +- test/suites/pch.bash | 558 +++++++++---------- test/suites/profiling.bash | 94 ++-- test/suites/profiling_clang.bash | 72 +-- test/suites/profiling_gcc.bash | 64 +-- test/suites/profiling_hip_clang.bash | 42 +- test/suites/readonly.bash | 14 +- test/suites/readonly_direct.bash | 24 +- test/suites/sanitize_blacklist.bash | 50 +- test/suites/secondary_file.bash | 88 +-- test/suites/secondary_http.bash | 98 ++-- test/suites/secondary_redis.bash | 40 +- test/suites/serialize_diagnostics.bash | 36 +- test/suites/source_date_epoch.bash | 78 +-- test/suites/split_dwarf.bash | 100 ++-- test/suites/stats_log.bash | 8 +- 37 files changed, 1920 insertions(+), 1912 deletions(-) diff --git a/test/run b/test/run index 3cb51d60f..957f5afac 100755 --- a/test/run +++ b/test/run @@ -27,6 +27,7 @@ skip_code=125 if [[ -t 1 ]]; then ansi_boldgreen='\033[1;32m' ansi_boldred='\033[1;31m' + ansi_boldyellow='\033[1;93m' ansi_bold='\033[1m' ansi_reset='\033[1;0m' fi @@ -39,6 +40,10 @@ red() { printf "$ansi_boldred%s$ansi_reset\n" "$*" } +yellow() { + printf "$ansi_boldyellow%s$ansi_reset\n" "$*" +} + bold() { printf "$ansi_bold%s$ansi_reset\n" "$*" } @@ -55,8 +60,15 @@ test_failed_internal() { echo "Test case: $(bold $CURRENT_TEST)" echo "Failure reason: $(red "$1")" echo - echo "ccache -s:" - $CCACHE -s + echo "Actual statistics counters" + echo "==========================" + while read -r key value; do + if [[ $value > 0 ]]; then + printf "$(yellow %-32s) $(yellow %s)\n" "$key" "$value" + else + printf "%-32s %s\n" "$key" "$value" + fi + done < <($CCACHE --print-stats | grep -v '^stats_') echo echo "Test data and log file have been left in $TESTDIR / $TEST_FAILED_SYMLINK" symlink_testdir_on_failure @@ -161,18 +173,14 @@ expect_stat() { local line local value="" - while IFS= read -r line; do - if [[ $line = *"$stat"* ]]; then - value="${line:32}" - # remove leading & trailing whitespace - value="${value#${value%%[![:space:]]*}}" - value="${value%${value##*[![:space:]]}}" + while read -r key value; do + if [[ $key == $stat ]]; then break fi - done < <($CCACHE -s) + done < <($CCACHE --print-stats) if [ "$expected_value" != "$value" ]; then - test_failed_internal "Expected \"$stat\" to be $expected_value, actual $value" + test_failed_internal "Expected $stat to be $expected_value, actual $value" fi } diff --git a/test/suites/base.bash b/test/suites/base.bash index 45249a42e..7251c20e9 100644 --- a/test/suites/base.bash +++ b/test/suites/base.bash @@ -5,15 +5,15 @@ base_tests() { $REAL_COMPILER -c -o reference_test1.o test1.c $CCACHE_COMPILE -c test1.c - expect_stat 'cache hit (preprocessed)' 0 - expect_stat 'cache miss' 1 - expect_stat 'files in cache' 1 + 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_COMPILE -c test1.c - expect_stat 'cache hit (preprocessed)' 1 - expect_stat 'cache miss' 1 - expect_stat 'files in cache' 1 + expect_stat preprocessed_cache_hit 1 + expect_stat cache_miss 1 + expect_stat files_in_cache 1 expect_equal_object_files reference_test1.o test1.o # ------------------------------------------------------------------------- @@ -24,21 +24,21 @@ base_tests() { $REAL_COMPILER -c -o reference_test1.o test1.c $CCACHE $COMPILER -c test1.c - expect_stat 'cache hit (preprocessed)' 0 - expect_stat 'cache miss' 1 - expect_stat 'files in cache' 1 + 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 $CCACHE $COMPILER -c test1.c - expect_stat 'cache hit (preprocessed)' 1 - expect_stat 'cache miss' 1 - expect_stat 'files in cache' 1 + expect_stat preprocessed_cache_hit 1 + expect_stat cache_miss 1 + expect_stat files_in_cache 1 expect_equal_object_files reference_test1.o test1.o $CCACHE $CCACHE $CCACHE $COMPILER -c test1.c - expect_stat 'cache hit (preprocessed)' 2 - expect_stat 'cache miss' 1 - expect_stat 'files in cache' 1 + 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 # ------------------------------------------------------------------------- @@ -55,13 +55,13 @@ base_tests() { TEST "Debug option" $CCACHE_COMPILE -c test1.c -g - expect_stat 'cache hit (preprocessed)' 0 - expect_stat 'cache miss' 1 - expect_stat 'files in cache' 1 + expect_stat preprocessed_cache_hit 0 + expect_stat cache_miss 1 + expect_stat files_in_cache 1 $CCACHE_COMPILE -c test1.c -g - expect_stat 'cache hit (preprocessed)' 1 - expect_stat 'cache miss' 1 + expect_stat preprocessed_cache_hit 1 + expect_stat cache_miss 1 $REAL_COMPILER -c -o reference_test1.o test1.c -g expect_equal_object_files reference_test1.o test1.o @@ -70,12 +70,12 @@ base_tests() { TEST "Output option" $CCACHE_COMPILE -c test1.c - expect_stat 'cache hit (preprocessed)' 0 - expect_stat 'cache miss' 1 + expect_stat preprocessed_cache_hit 0 + expect_stat cache_miss 1 $CCACHE_COMPILE -c test1.c -o foo.o - expect_stat 'cache hit (preprocessed)' 1 - expect_stat 'cache miss' 1 + expect_stat preprocessed_cache_hit 1 + expect_stat cache_miss 1 $REAL_COMPILER -c -o reference_test1.o test1.c expect_equal_object_files reference_test1.o foo.o @@ -84,16 +84,16 @@ base_tests() { TEST "Output option without space" $CCACHE_COMPILE -c test1.c - expect_stat 'cache hit (preprocessed)' 0 - expect_stat 'cache miss' 1 + expect_stat preprocessed_cache_hit 0 + expect_stat cache_miss 1 $CCACHE_COMPILE -c test1.c -odir - expect_stat 'cache hit (preprocessed)' 1 - expect_stat 'cache miss' 1 + expect_stat preprocessed_cache_hit 1 + expect_stat cache_miss 1 $CCACHE_COMPILE -c test1.c -optf - expect_stat 'cache hit (preprocessed)' 2 - expect_stat 'cache miss' 1 + expect_stat preprocessed_cache_hit 2 + expect_stat cache_miss 1 $REAL_COMPILER -c -o reference_test1.o test1.c expect_equal_object_files reference_test1.o dir @@ -103,36 +103,36 @@ base_tests() { TEST "Called for link" $CCACHE_COMPILE test1.c -o test 2>/dev/null - expect_stat 'called for link' 1 + expect_stat called_for_link 1 $CCACHE_COMPILE -c test1.c $CCACHE_COMPILE test1.o -o test 2>/dev/null - expect_stat 'called for link' 2 + expect_stat called_for_link 2 # ------------------------------------------------------------------------- TEST "No existing input file" $CCACHE_COMPILE -c foo.c 2>/dev/null - expect_stat 'no input file' 1 + expect_stat no_input_file 1 # ------------------------------------------------------------------------- TEST "No input file on command line" $CCACHE_COMPILE -c -O2 2>/dev/null - expect_stat 'no input file' 1 + expect_stat no_input_file 1 # ------------------------------------------------------------------------- TEST "Called for preprocessing" $CCACHE_COMPILE -E -c test1.c >/dev/null 2>&1 - expect_stat 'called for preprocessing' 1 + expect_stat called_for_preprocessing 1 # ------------------------------------------------------------------------- TEST "Multiple source files" touch test2.c $CCACHE_COMPILE -c test1.c test2.c - expect_stat 'multiple source files' 1 + expect_stat multiple_source_files 1 # ------------------------------------------------------------------------- TEST "Couldn't find the compiler" @@ -147,26 +147,26 @@ base_tests() { TEST "Bad compiler arguments" $CCACHE_COMPILE -c test1.c -I 2>/dev/null - expect_stat 'bad compiler arguments' 1 + expect_stat bad_compiler_arguments 1 # ------------------------------------------------------------------------- TEST "Unsupported source language" ln -f test1.c test1.ccc $CCACHE_COMPILE -c test1.ccc 2>/dev/null - expect_stat 'unsupported source language' 1 + expect_stat unsupported_source_language 1 # ------------------------------------------------------------------------- TEST "Unsupported compiler option" $CCACHE_COMPILE -M foo -c test1.c >/dev/null 2>&1 - expect_stat 'unsupported compiler option' 1 + expect_stat unsupported_compiler_option 1 # ------------------------------------------------------------------------- TEST "Compiler produced stdout" $CCACHE echo foo -c test1.c >/dev/null - expect_stat 'compiler produced stdout' 1 + expect_stat compiler_produced_stdout 1 # ------------------------------------------------------------------------- TEST "Output to directory" @@ -174,7 +174,7 @@ base_tests() { mkdir testd $CCACHE_COMPILE -o testd -c test1.c >/dev/null 2>&1 rmdir testd >/dev/null 2>&1 - expect_stat 'could not write to output file' 1 + expect_stat bad_output_file 1 # ------------------------------------------------------------------------- TEST "Output to file in nonexistent directory" @@ -182,14 +182,14 @@ base_tests() { mkdir out $CCACHE_COMPILE -c test1.c -o out/foo.o - expect_stat 'could not write to output file' "" - expect_stat 'cache miss' 1 + expect_stat bad_output_file 0 + expect_stat cache_miss 1 rm -rf out $CCACHE_COMPILE -c test1.c -o out/foo.o 2>/dev/null - expect_stat 'could not write to output file' 1 - expect_stat 'cache miss' 1 + expect_stat bad_output_file 1 + expect_stat cache_miss 1 expect_missing out/foo.o # ------------------------------------------------------------------------- @@ -199,14 +199,14 @@ base_tests() { touch src/foo $CCACHE_COMPILE -x c -c src/foo - expect_stat 'cache hit (preprocessed)' 0 - expect_stat 'cache miss' 1 + expect_stat preprocessed_cache_hit 0 + expect_stat cache_miss 1 expect_exists foo.o rm foo.o $CCACHE_COMPILE -x c -c src/foo - expect_stat 'cache hit (preprocessed)' 1 - expect_stat 'cache miss' 1 + expect_stat preprocessed_cache_hit 1 + expect_stat cache_miss 1 expect_exists foo.o rm foo.o @@ -220,14 +220,14 @@ if ! $HOST_OS_WINDOWS; then touch src/foo. $CCACHE_COMPILE -x c -c src/foo. - expect_stat 'cache hit (preprocessed)' 0 - expect_stat 'cache miss' 1 + expect_stat preprocessed_cache_hit 0 + expect_stat cache_miss 1 expect_exists foo.o rm foo.o $CCACHE_COMPILE -x c -c src/foo. - expect_stat 'cache hit (preprocessed)' 1 - expect_stat 'cache miss' 1 + expect_stat preprocessed_cache_hit 1 + expect_stat cache_miss 1 expect_exists foo.o rm foo.o @@ -241,14 +241,14 @@ fi touch src/foo.c.c $CCACHE_COMPILE -c src/foo.c.c - expect_stat 'cache hit (preprocessed)' 0 - expect_stat 'cache miss' 1 + expect_stat preprocessed_cache_hit 0 + expect_stat cache_miss 1 expect_exists foo.c.o rm foo.c.o $CCACHE_COMPILE -c src/foo.c.c - expect_stat 'cache hit (preprocessed)' 1 - expect_stat 'cache miss' 1 + expect_stat preprocessed_cache_hit 1 + expect_stat cache_miss 1 expect_exists foo.c.o rm foo.c.o @@ -258,42 +258,42 @@ fi TEST "LANG" $CCACHE_COMPILE -c test1.c - expect_stat 'cache hit (preprocessed)' 0 - expect_stat 'cache miss' 1 - expect_stat 'files in cache' 1 + expect_stat preprocessed_cache_hit 0 + expect_stat cache_miss 1 + expect_stat files_in_cache 1 $CCACHE_COMPILE -c test1.c - expect_stat 'cache hit (preprocessed)' 1 - expect_stat 'cache miss' 1 - expect_stat 'files in cache' 1 + expect_stat preprocessed_cache_hit 1 + expect_stat cache_miss 1 + expect_stat files_in_cache 1 LANG=foo $CCACHE_COMPILE -c test1.c - expect_stat 'cache hit (preprocessed)' 1 - expect_stat 'cache miss' 2 - expect_stat 'files in cache' 2 + expect_stat preprocessed_cache_hit 1 + expect_stat cache_miss 2 + expect_stat files_in_cache 2 LANG=foo $CCACHE_COMPILE -c test1.c - expect_stat 'cache hit (preprocessed)' 2 - expect_stat 'cache miss' 2 - expect_stat 'files in cache' 2 + expect_stat preprocessed_cache_hit 2 + expect_stat cache_miss 2 + expect_stat files_in_cache 2 # ------------------------------------------------------------------------- TEST "LANG with sloppiness" CCACHE_SLOPPINESS=locale LANG=foo $CCACHE_COMPILE -c test1.c - expect_stat 'cache hit (preprocessed)' 0 - expect_stat 'cache miss' 1 - expect_stat 'files in cache' 1 + expect_stat preprocessed_cache_hit 0 + expect_stat cache_miss 1 + expect_stat files_in_cache 1 CCACHE_SLOPPINESS=locale LANG=foo $CCACHE_COMPILE -c test1.c - expect_stat 'cache hit (preprocessed)' 1 - expect_stat 'cache miss' 1 - expect_stat 'files in cache' 1 + expect_stat preprocessed_cache_hit 1 + expect_stat cache_miss 1 + expect_stat files_in_cache 1 CCACHE_SLOPPINESS=locale LANG=bar $CCACHE_COMPILE -c test1.c - expect_stat 'cache hit (preprocessed)' 2 - expect_stat 'cache miss' 1 - expect_stat 'files in cache' 1 + expect_stat preprocessed_cache_hit 2 + expect_stat cache_miss 1 + expect_stat files_in_cache 1 # ------------------------------------------------------------------------- TEST "Result file is compressed" @@ -311,27 +311,27 @@ fi TEST "Corrupt result file" $CCACHE_COMPILE -c test1.c - expect_stat 'cache hit (preprocessed)' 0 - expect_stat 'cache miss' 1 - expect_stat 'files in cache' 1 + expect_stat preprocessed_cache_hit 0 + expect_stat cache_miss 1 + expect_stat files_in_cache 1 $CCACHE_COMPILE -c test1.c - expect_stat 'cache hit (preprocessed)' 1 - expect_stat 'cache miss' 1 - expect_stat 'files in cache' 1 + expect_stat preprocessed_cache_hit 1 + expect_stat cache_miss 1 + expect_stat files_in_cache 1 result_file=$(find $CCACHE_DIR -name '*R') printf foo | dd of=$result_file bs=3 count=1 seek=20 conv=notrunc >&/dev/null $CCACHE_COMPILE -c test1.c - expect_stat 'cache hit (preprocessed)' 1 - expect_stat 'cache miss' 2 - expect_stat 'files in cache' 1 + expect_stat preprocessed_cache_hit 1 + expect_stat cache_miss 2 + expect_stat files_in_cache 1 $CCACHE_COMPILE -c test1.c - expect_stat 'cache hit (preprocessed)' 2 - expect_stat 'cache miss' 2 - expect_stat 'files in cache' 1 + expect_stat preprocessed_cache_hit 2 + expect_stat cache_miss 2 + expect_stat files_in_cache 1 # ------------------------------------------------------------------------- TEST "CCACHE_DEBUG" @@ -355,7 +355,7 @@ fi TEST "CCACHE_DEBUG with too hard option" CCACHE_DEBUG=1 $CCACHE_COMPILE -c test1.c -save-temps - expect_stat 'unsupported compiler option' 1 + expect_stat unsupported_compiler_option 1 expect_exists test1.o.ccache-log # ------------------------------------------------------------------------- @@ -381,14 +381,14 @@ fi echo '// initial comment' >test1.c cat test1-saved.c >>test1.c CCACHE_COMMENTS=1 $CCACHE_COMPILE -c test1.c - expect_stat 'cache hit (preprocessed)' 0 - expect_stat 'cache miss' 1 + expect_stat preprocessed_cache_hit 0 + expect_stat cache_miss 1 echo '// different comment' >test1.c cat test1-saved.c >>test1.c CCACHE_COMMENTS=1 $CCACHE_COMPILE -c test1.c mv test1-saved.c test1.c - expect_stat 'cache hit (preprocessed)' 0 - expect_stat 'cache miss' 2 + expect_stat preprocessed_cache_hit 0 + expect_stat cache_miss 2 $REAL_COMPILER -c -o reference_test1.o test1.c expect_equal_object_files reference_test1.o test1.o @@ -397,8 +397,8 @@ fi TEST "CCACHE_NOSTATS" CCACHE_NOSTATS=1 $CCACHE_COMPILE -c test1.c -O -O - expect_stat 'cache hit (preprocessed)' 0 - expect_stat 'cache miss' 0 + expect_stat preprocessed_cache_hit 0 + expect_stat cache_miss 0 # ------------------------------------------------------------------------- TEST "stats file forward compatibility" @@ -411,9 +411,9 @@ fi echo $i done > "$stats_file" - expect_stat 'cache miss' 5 + expect_stat cache_miss 5 $CCACHE_COMPILE -c test1.c - expect_stat 'cache miss' 6 + expect_stat cache_miss 6 expect_contains "$stats_file" 101 expect_newer_than "$stats_file" "$CCACHE_DIR/timestamp_reference" @@ -425,25 +425,25 @@ fi echo "0 0 0 0 1234567890123456789" >"$stats_file" - expect_stat 'cache miss' 1234567890123456789 + expect_stat cache_miss 1234567890123456789 $CCACHE_COMPILE -c test1.c - expect_stat 'cache miss' 1234567890123456790 + expect_stat cache_miss 1234567890123456790 # ------------------------------------------------------------------------- TEST "CCACHE_RECACHE" $CCACHE_COMPILE -c test1.c - expect_stat 'cache hit (preprocessed)' 0 - expect_stat 'cache miss' 1 + expect_stat preprocessed_cache_hit 0 + expect_stat cache_miss 1 CCACHE_RECACHE=1 $CCACHE_COMPILE -c test1.c - expect_stat 'cache hit (preprocessed)' 0 - expect_stat 'cache miss' 2 + expect_stat preprocessed_cache_hit 0 + expect_stat cache_miss 2 $REAL_COMPILER -c -o reference_test1.o test1.c expect_equal_object_files reference_test1.o test1.o - expect_stat 'files in cache' 1 + expect_stat files_in_cache 1 # ------------------------------------------------------------------------- TEST "Directory is hashed if using -g" @@ -454,19 +454,19 @@ fi cd dir1 $CCACHE_COMPILE -c test1.c -g - expect_stat 'cache hit (preprocessed)' 0 - expect_stat 'cache miss' 1 + expect_stat preprocessed_cache_hit 0 + expect_stat cache_miss 1 $CCACHE_COMPILE -c test1.c -g - expect_stat 'cache hit (preprocessed)' 1 - expect_stat 'cache miss' 1 + expect_stat preprocessed_cache_hit 1 + expect_stat cache_miss 1 cd ../dir2 $CCACHE_COMPILE -c test1.c -g - expect_stat 'cache hit (preprocessed)' 1 - expect_stat 'cache miss' 2 + expect_stat preprocessed_cache_hit 1 + expect_stat cache_miss 2 $CCACHE_COMPILE -c test1.c -g - expect_stat 'cache hit (preprocessed)' 2 - expect_stat 'cache miss' 2 + expect_stat preprocessed_cache_hit 2 + expect_stat cache_miss 2 # ------------------------------------------------------------------------- TEST "Directory is not hashed if not using -g" @@ -477,16 +477,16 @@ fi cd dir1 $CCACHE_COMPILE -c test1.c - expect_stat 'cache hit (preprocessed)' 0 - expect_stat 'cache miss' 1 + expect_stat preprocessed_cache_hit 0 + expect_stat cache_miss 1 $CCACHE_COMPILE -c test1.c - expect_stat 'cache hit (preprocessed)' 1 - expect_stat 'cache miss' 1 + expect_stat preprocessed_cache_hit 1 + expect_stat cache_miss 1 cd ../dir2 $CCACHE_COMPILE -c test1.c - expect_stat 'cache hit (preprocessed)' 2 - expect_stat 'cache miss' 1 + expect_stat preprocessed_cache_hit 2 + expect_stat cache_miss 1 # ------------------------------------------------------------------------- TEST "Directory is not hashed if using -g -g0" @@ -497,16 +497,16 @@ fi cd dir1 $CCACHE_COMPILE -c test1.c -g -g0 - expect_stat 'cache hit (preprocessed)' 0 - expect_stat 'cache miss' 1 + expect_stat preprocessed_cache_hit 0 + expect_stat cache_miss 1 $CCACHE_COMPILE -c test1.c -g -g0 - expect_stat 'cache hit (preprocessed)' 1 - expect_stat 'cache miss' 1 + expect_stat preprocessed_cache_hit 1 + expect_stat cache_miss 1 cd ../dir2 $CCACHE_COMPILE -c test1.c -g -g0 - expect_stat 'cache hit (preprocessed)' 2 - expect_stat 'cache miss' 1 + expect_stat preprocessed_cache_hit 2 + expect_stat cache_miss 1 # ------------------------------------------------------------------------- TEST "Directory is not hashed if using -gz" @@ -519,16 +519,16 @@ fi cd dir1 $CCACHE_COMPILE -c test1.c -gz - expect_stat 'cache hit (preprocessed)' 0 - expect_stat 'cache miss' 1 + expect_stat preprocessed_cache_hit 0 + expect_stat cache_miss 1 $CCACHE_COMPILE -c test1.c -gz - expect_stat 'cache hit (preprocessed)' 1 - expect_stat 'cache miss' 1 + expect_stat preprocessed_cache_hit 1 + expect_stat cache_miss 1 cd ../dir2 $CCACHE_COMPILE -c test1.c -gz - expect_stat 'cache hit (preprocessed)' 2 - expect_stat 'cache miss' 1 + expect_stat preprocessed_cache_hit 2 + expect_stat cache_miss 1 fi # ------------------------------------------------------------------------- @@ -542,16 +542,16 @@ fi cd dir1 $CCACHE_COMPILE -c test1.c -gz=zlib - expect_stat 'cache hit (preprocessed)' 0 - expect_stat 'cache miss' 1 + expect_stat preprocessed_cache_hit 0 + expect_stat cache_miss 1 $CCACHE_COMPILE -c test1.c -gz=zlib - expect_stat 'cache hit (preprocessed)' 1 - expect_stat 'cache miss' 1 + expect_stat preprocessed_cache_hit 1 + expect_stat cache_miss 1 cd ../dir2 $CCACHE_COMPILE -c test1.c -gz=zlib - expect_stat 'cache hit (preprocessed)' 2 - expect_stat 'cache miss' 1 + expect_stat preprocessed_cache_hit 2 + expect_stat cache_miss 1 fi # ------------------------------------------------------------------------- @@ -563,16 +563,16 @@ fi cd dir1 CCACHE_NOHASHDIR=1 $CCACHE_COMPILE -c test1.c -g - expect_stat 'cache hit (preprocessed)' 0 - expect_stat 'cache miss' 1 + expect_stat preprocessed_cache_hit 0 + expect_stat cache_miss 1 CCACHE_NOHASHDIR=1 $CCACHE_COMPILE -c test1.c -g - expect_stat 'cache hit (preprocessed)' 1 - expect_stat 'cache miss' 1 + expect_stat preprocessed_cache_hit 1 + expect_stat cache_miss 1 cd ../dir2 CCACHE_NOHASHDIR=1 $CCACHE_COMPILE -c test1.c -g - expect_stat 'cache hit (preprocessed)' 2 - expect_stat 'cache miss' 1 + expect_stat preprocessed_cache_hit 2 + expect_stat cache_miss 1 # ------------------------------------------------------------------------- TEST "CCACHE_EXTRAFILES" @@ -581,35 +581,35 @@ fi echo "b" >b $CCACHE_COMPILE -c test1.c - expect_stat 'cache hit (preprocessed)' 0 - expect_stat 'cache miss' 1 + expect_stat preprocessed_cache_hit 0 + expect_stat cache_miss 1 $CCACHE_COMPILE -c test1.c - expect_stat 'cache hit (preprocessed)' 1 - expect_stat 'cache miss' 1 + expect_stat preprocessed_cache_hit 1 + expect_stat cache_miss 1 CCACHE_EXTRAFILES="a${PATH_DELIM}b" $CCACHE_COMPILE -c test1.c - expect_stat 'cache hit (preprocessed)' 1 - expect_stat 'cache miss' 2 + expect_stat preprocessed_cache_hit 1 + expect_stat cache_miss 2 CCACHE_EXTRAFILES="a${PATH_DELIM}b" $CCACHE_COMPILE -c test1.c - expect_stat 'cache hit (preprocessed)' 2 - expect_stat 'cache miss' 2 + expect_stat preprocessed_cache_hit 2 + expect_stat cache_miss 2 echo b2 >b CCACHE_EXTRAFILES="a${PATH_DELIM}b" $CCACHE_COMPILE -c test1.c - expect_stat 'cache hit (preprocessed)' 2 - expect_stat 'cache miss' 3 + expect_stat preprocessed_cache_hit 2 + expect_stat cache_miss 3 CCACHE_EXTRAFILES="a${PATH_DELIM}b" $CCACHE_COMPILE -c test1.c - expect_stat 'cache hit (preprocessed)' 3 - expect_stat 'cache miss' 3 + expect_stat preprocessed_cache_hit 3 + expect_stat cache_miss 3 CCACHE_EXTRAFILES="doesntexist" $CCACHE_COMPILE -c test1.c - expect_stat 'cache hit (preprocessed)' 3 - expect_stat 'cache miss' 3 - expect_stat 'error hashing extra file' 1 + expect_stat preprocessed_cache_hit 3 + expect_stat cache_miss 3 + expect_stat error_hashing_extra_file 1 # ------------------------------------------------------------------------- TEST "CCACHE_PREFIX" @@ -629,24 +629,24 @@ EOF int foo; EOF PATH=.:$PATH CCACHE_PREFIX="prefix-a prefix-b" $CCACHE_COMPILE -c file.c - expect_stat 'cache hit (direct)' 0 - expect_stat 'cache hit (preprocessed)' 0 - expect_stat 'cache miss' 1 + expect_stat direct_cache_hit 0 + expect_stat preprocessed_cache_hit 0 + expect_stat cache_miss 1 expect_content prefix.result "a b" PATH=.:$PATH CCACHE_PREFIX="prefix-a prefix-b" $CCACHE_COMPILE -c file.c - expect_stat 'cache hit (direct)' 0 - expect_stat 'cache hit (preprocessed)' 1 - expect_stat 'cache miss' 1 + expect_stat direct_cache_hit 0 + expect_stat preprocessed_cache_hit 1 + expect_stat cache_miss 1 expect_content prefix.result "a b" rm -f prefix.result PATH=.:$PATH CCACHE_PREFIX_CPP="prefix-a prefix-b" $CCACHE_COMPILE -c file.c - expect_stat 'cache hit (direct)' 0 - expect_stat 'cache hit (preprocessed)' 2 - expect_stat 'cache miss' 1 + expect_stat direct_cache_hit 0 + expect_stat preprocessed_cache_hit 2 + expect_stat cache_miss 1 expect_content prefix.result "a b" @@ -657,21 +657,21 @@ b" generate_code $i test$i.c $CCACHE_COMPILE -c test$i.c done - expect_stat 'cache hit (preprocessed)' 0 - expect_stat 'cache miss' 32 - expect_stat 'files in cache' 32 + expect_stat preprocessed_cache_hit 0 + expect_stat cache_miss 32 + expect_stat files_in_cache 32 # ------------------------------------------------------------------------- TEST "Direct .i compile" $CCACHE_COMPILE -c test1.c - expect_stat 'cache hit (preprocessed)' 0 - expect_stat 'cache miss' 1 + expect_stat preprocessed_cache_hit 0 + expect_stat cache_miss 1 $REAL_COMPILER -c test1.c -E >test1.i $CCACHE_COMPILE -c test1.i - expect_stat 'cache hit (preprocessed)' 1 - expect_stat 'cache miss' 1 + expect_stat preprocessed_cache_hit 1 + expect_stat cache_miss 1 # ------------------------------------------------------------------------- TEST "-x c" @@ -679,12 +679,12 @@ b" ln -f test1.c test1.ccc $CCACHE_COMPILE -x c -c test1.ccc - expect_stat 'cache hit (preprocessed)' 0 - expect_stat 'cache miss' 1 + expect_stat preprocessed_cache_hit 0 + expect_stat cache_miss 1 $CCACHE_COMPILE -x c -c test1.ccc - expect_stat 'cache hit (preprocessed)' 1 - expect_stat 'cache miss' 1 + expect_stat preprocessed_cache_hit 1 + expect_stat cache_miss 1 # ------------------------------------------------------------------------- TEST "-xc" @@ -692,92 +692,92 @@ b" ln -f test1.c test1.ccc $CCACHE_COMPILE -xc -c test1.ccc - expect_stat 'cache hit (preprocessed)' 0 - expect_stat 'cache miss' 1 + expect_stat preprocessed_cache_hit 0 + expect_stat cache_miss 1 $CCACHE_COMPILE -xc -c test1.ccc - expect_stat 'cache hit (preprocessed)' 1 - expect_stat 'cache miss' 1 + expect_stat preprocessed_cache_hit 1 + expect_stat cache_miss 1 # ------------------------------------------------------------------------- TEST "-x none" $CCACHE_COMPILE -x assembler -x none -c test1.c - expect_stat 'cache hit (preprocessed)' 0 - expect_stat 'cache miss' 1 + expect_stat preprocessed_cache_hit 0 + expect_stat cache_miss 1 $CCACHE_COMPILE -x assembler -x none -c test1.c - expect_stat 'cache hit (preprocessed)' 1 - expect_stat 'cache miss' 1 + expect_stat preprocessed_cache_hit 1 + expect_stat cache_miss 1 # ------------------------------------------------------------------------- TEST "-x unknown" $CCACHE_COMPILE -x unknown -c test1.c 2>/dev/null - expect_stat 'cache hit (preprocessed)' 0 - expect_stat 'cache miss' 0 - expect_stat 'unsupported source language' 1 + expect_stat preprocessed_cache_hit 0 + expect_stat cache_miss 0 + expect_stat unsupported_source_language 1 # ------------------------------------------------------------------------- TEST "-x c -c /dev/null" $CCACHE_COMPILE -x c -c /dev/null -o null.o 2>/dev/null - expect_stat 'cache hit (preprocessed)' 0 - expect_stat 'cache miss' 1 + expect_stat preprocessed_cache_hit 0 + expect_stat cache_miss 1 $CCACHE_COMPILE -x c -c /dev/null -o null.o 2>/dev/null - expect_stat 'cache hit (preprocessed)' 1 - expect_stat 'cache miss' 1 + expect_stat preprocessed_cache_hit 1 + expect_stat cache_miss 1 # ------------------------------------------------------------------------- TEST "-D not hashed" $CCACHE_COMPILE -c test1.c - expect_stat 'cache hit (preprocessed)' 0 - expect_stat 'cache miss' 1 + expect_stat preprocessed_cache_hit 0 + expect_stat cache_miss 1 $CCACHE_COMPILE -DNOT_AFFECTING=1 -c test1.c - expect_stat 'cache hit (preprocessed)' 1 - expect_stat 'cache miss' 1 + expect_stat preprocessed_cache_hit 1 + expect_stat cache_miss 1 # ------------------------------------------------------------------------- TEST "-S" $CCACHE_COMPILE -S test1.c - expect_stat 'cache hit (preprocessed)' 0 - expect_stat 'cache miss' 1 + expect_stat preprocessed_cache_hit 0 + expect_stat cache_miss 1 $CCACHE_COMPILE -S test1.c - expect_stat 'cache hit (preprocessed)' 1 - expect_stat 'cache miss' 1 + expect_stat preprocessed_cache_hit 1 + expect_stat cache_miss 1 $CCACHE_COMPILE -c test1.s - expect_stat 'cache hit (preprocessed)' 1 - expect_stat 'cache miss' 2 + expect_stat preprocessed_cache_hit 1 + expect_stat cache_miss 2 $CCACHE_COMPILE -c test1.s - expect_stat 'cache hit (preprocessed)' 2 - expect_stat 'cache miss' 2 + expect_stat preprocessed_cache_hit 2 + expect_stat cache_miss 2 # ------------------------------------------------------------------------- TEST "-frecord-gcc-switches" if $REAL_COMPILER -frecord-gcc-switches -c test1.c >&/dev/null; then $CCACHE_COMPILE -frecord-gcc-switches -c test1.c - expect_stat 'cache hit (preprocessed)' 0 - expect_stat 'cache miss' 1 + expect_stat preprocessed_cache_hit 0 + expect_stat cache_miss 1 $CCACHE_COMPILE -frecord-gcc-switches -c test1.c - expect_stat 'cache hit (preprocessed)' 1 - expect_stat 'cache miss' 1 + expect_stat preprocessed_cache_hit 1 + expect_stat cache_miss 1 $CCACHE_COMPILE -frecord-gcc-switches -Wall -c test1.c - expect_stat 'cache hit (preprocessed)' 1 - expect_stat 'cache miss' 2 + expect_stat preprocessed_cache_hit 1 + expect_stat cache_miss 2 $CCACHE_COMPILE -frecord-gcc-switches -Wall -c test1.c - expect_stat 'cache hit (preprocessed)' 2 - expect_stat 'cache miss' 2 + expect_stat preprocessed_cache_hit 2 + expect_stat cache_miss 2 fi # ------------------------------------------------------------------------- @@ -786,31 +786,31 @@ b" $REAL_COMPILER -c -o reference_test1.o test1.c $CCACHE_COMPILE -c test1.c - expect_stat 'cache hit (preprocessed)' 0 - expect_stat 'cache miss' 1 - expect_stat 'files in cache' 1 + 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 \ non_existing_compiler_will_be_overridden_anyway \ $COMPILER_ARGS -c test1.c - expect_stat 'cache hit (preprocessed)' 1 - expect_stat 'cache miss' 1 - expect_stat 'files in cache' 1 + expect_stat preprocessed_cache_hit 1 + 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 same/for/relative \ $COMPILER_ARGS -c test1.c - expect_stat 'cache hit (preprocessed)' 2 - expect_stat 'cache miss' 1 - expect_stat 'files in cache' 1 + 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 \ $COMPILER_ARGS -c test1.c - expect_stat 'cache hit (preprocessed)' 3 - expect_stat 'cache miss' 1 - expect_stat 'files in cache' 1 + expect_stat preprocessed_cache_hit 3 + expect_stat cache_miss 1 + expect_stat files_in_cache 1 expect_equal_object_files reference_test1.o test1.o # ------------------------------------------------------------------------- @@ -864,21 +864,21 @@ EOF chmod +x compiler.sh backdate compiler.sh CCACHE_COMPILERCHECK=mtime $CCACHE ./compiler.sh -c test1.c - expect_stat 'cache hit (preprocessed)' 0 - expect_stat 'cache miss' 1 + expect_stat preprocessed_cache_hit 0 + expect_stat cache_miss 1 sed_in_place 's/comment/yoghurt/' compiler.sh # Don't change the size chmod +x compiler.sh backdate compiler.sh # Don't change the timestamp CCACHE_COMPILERCHECK=mtime $CCACHE ./compiler.sh -c test1.c - expect_stat 'cache hit (preprocessed)' 1 - expect_stat 'cache miss' 1 + expect_stat preprocessed_cache_hit 1 + expect_stat cache_miss 1 touch compiler.sh CCACHE_COMPILERCHECK=mtime $CCACHE ./compiler.sh -c test1.c - expect_stat 'cache hit (preprocessed)' 1 - expect_stat 'cache miss' 2 + expect_stat preprocessed_cache_hit 1 + expect_stat cache_miss 2 # ------------------------------------------------------------------------- TEST "CCACHE_COMPILERCHECK=content" @@ -892,17 +892,17 @@ EOF chmod +x compiler.sh CCACHE_COMPILERCHECK=content $CCACHE ./compiler.sh -c test1.c - expect_stat 'cache hit (preprocessed)' 0 - expect_stat 'cache miss' 1 + expect_stat preprocessed_cache_hit 0 + expect_stat cache_miss 1 CCACHE_COMPILERCHECK=content $CCACHE ./compiler.sh -c test1.c - expect_stat 'cache hit (preprocessed)' 1 - expect_stat 'cache miss' 1 + expect_stat preprocessed_cache_hit 1 + expect_stat cache_miss 1 echo "# Compiler upgrade" >>compiler.sh CCACHE_COMPILERCHECK=content $CCACHE ./compiler.sh -c test1.c - expect_stat 'cache hit (preprocessed)' 1 - expect_stat 'cache miss' 2 + expect_stat preprocessed_cache_hit 1 + expect_stat cache_miss 2 # ------------------------------------------------------------------------- TEST "CCACHE_COMPILERCHECK=none" @@ -916,17 +916,17 @@ EOF chmod +x compiler.sh CCACHE_COMPILERCHECK=none $CCACHE ./compiler.sh -c test1.c - expect_stat 'cache hit (preprocessed)' 0 - expect_stat 'cache miss' 1 + expect_stat preprocessed_cache_hit 0 + expect_stat cache_miss 1 CCACHE_COMPILERCHECK=none $CCACHE ./compiler.sh -c test1.c - expect_stat 'cache hit (preprocessed)' 1 - expect_stat 'cache miss' 1 + expect_stat preprocessed_cache_hit 1 + expect_stat cache_miss 1 echo "# Compiler upgrade" >>compiler.sh CCACHE_COMPILERCHECK=none $CCACHE ./compiler.sh -c test1.c - expect_stat 'cache hit (preprocessed)' 2 - expect_stat 'cache miss' 1 + expect_stat preprocessed_cache_hit 2 + expect_stat cache_miss 1 # ------------------------------------------------------------------------- TEST "CCACHE_COMPILERCHECK=string" @@ -940,20 +940,20 @@ EOF chmod +x compiler.sh CCACHE_COMPILERCHECK=string:foo $CCACHE ./compiler.sh -c test1.c - expect_stat 'cache hit (preprocessed)' 0 - expect_stat 'cache miss' 1 + expect_stat preprocessed_cache_hit 0 + expect_stat cache_miss 1 CCACHE_COMPILERCHECK=string:foo $CCACHE ./compiler.sh -c test1.c - expect_stat 'cache hit (preprocessed)' 1 - expect_stat 'cache miss' 1 + expect_stat preprocessed_cache_hit 1 + expect_stat cache_miss 1 CCACHE_COMPILERCHECK=string:bar $CCACHE ./compiler.sh -c test1.c - expect_stat 'cache hit (preprocessed)' 1 - expect_stat 'cache miss' 2 + expect_stat preprocessed_cache_hit 1 + expect_stat cache_miss 2 CCACHE_COMPILERCHECK=string:bar $CCACHE ./compiler.sh -c test1.c - expect_stat 'cache hit (preprocessed)' 2 - expect_stat 'cache miss' 2 + expect_stat preprocessed_cache_hit 2 + expect_stat cache_miss 2 # ------------------------------------------------------------------------- TEST "CCACHE_COMPILERCHECK=command" @@ -967,13 +967,13 @@ EOF chmod +x compiler.sh CCACHE_COMPILERCHECK='echo %compiler%' $CCACHE ./compiler.sh -c test1.c - expect_stat 'cache hit (preprocessed)' 0 - expect_stat 'cache miss' 1 + expect_stat preprocessed_cache_hit 0 + expect_stat cache_miss 1 echo "# Compiler upgrade" >>compiler.sh CCACHE_COMPILERCHECK="echo ./compiler.sh" $CCACHE ./compiler.sh -c test1.c - expect_stat 'cache hit (preprocessed)' 1 - expect_stat 'cache miss' 1 + expect_stat preprocessed_cache_hit 1 + expect_stat cache_miss 1 cat <foobar.sh #!/bin/sh @@ -982,12 +982,12 @@ echo bar EOF chmod +x foobar.sh CCACHE_COMPILERCHECK='./foobar.sh' $CCACHE ./compiler.sh -c test1.c - expect_stat 'cache hit (preprocessed)' 1 - expect_stat 'cache miss' 2 + expect_stat preprocessed_cache_hit 1 + expect_stat cache_miss 2 CCACHE_COMPILERCHECK='echo foo; echo bar' $CCACHE ./compiler.sh -c test1.c - expect_stat 'cache hit (preprocessed)' 2 - expect_stat 'cache miss' 2 + expect_stat preprocessed_cache_hit 2 + expect_stat cache_miss 2 # ------------------------------------------------------------------------- TEST "CCACHE_COMPILERCHECK=unknown_command" @@ -1001,7 +1001,7 @@ EOF chmod +x compiler.sh CCACHE_COMPILERCHECK="unknown_command" $CCACHE ./compiler.sh -c test1.c 2>/dev/null - expect_stat 'compiler check failed' 1 + expect_stat compiler_check_failed 1 # ------------------------------------------------------------------------- @@ -1021,8 +1021,8 @@ EOF $CCACHE -M 5 >/dev/null $CCACHE_COMPILE -MMD -c test.c - expect_stat 'cache hit (preprocessed)' 0 - expect_stat 'cache miss' 1 + expect_stat preprocessed_cache_hit 0 + expect_stat cache_miss 1 result_file=$(find "$CCACHE_DIR" -name '*R') level_2_dir=$(dirname "$result_file") level_1_dir=$(dirname $(dirname "$result_file")) @@ -1038,15 +1038,15 @@ EOF rm test.o test.d $CCACHE_COMPILE -MMD -c test.c - expect_stat 'cache hit (preprocessed)' 1 - expect_stat 'cache miss' 1 + expect_stat preprocessed_cache_hit 1 + expect_stat cache_miss 1 expect_perm test.o -rw-r--r-- expect_perm test.d -rw-r--r-- $CCACHE_COMPILE -o test test.o - expect_stat 'cache hit (preprocessed)' 1 - expect_stat 'cache miss' 1 - expect_stat 'called for link' 1 + expect_stat preprocessed_cache_hit 1 + expect_stat cache_miss 1 + expect_stat called_for_link 1 expect_perm test -rwxr-xr-x # A non-cache-miss case which affects the stats file on level 2: @@ -1054,7 +1054,7 @@ EOF rm -rf "$CCACHE_DIR" $CCACHE_COMPILE --version >/dev/null - expect_stat 'no input file' 1 + expect_stat no_input_file 1 stats_file=$(find "$CCACHE_DIR" -name stats) level_2_dir=$(dirname "$stats_file") level_1_dir=$(dirname $(dirname "$stats_file")) @@ -1078,13 +1078,13 @@ EOF EOF chmod +x no-object-prefix CCACHE_PREFIX=$(pwd)/no-object-prefix $CCACHE_COMPILE -c test_no_obj.c - expect_stat 'compiler produced no output' 1 + expect_stat compiler_produced_no_output 1 CCACHE_PREFIX=$(pwd)/no-object-prefix $CCACHE_COMPILE -c test1.c - expect_stat 'cache hit (preprocessed)' 0 - expect_stat 'cache miss' 0 - expect_stat 'files in cache' 0 - expect_stat 'compiler produced no output' 2 + expect_stat preprocessed_cache_hit 0 + expect_stat cache_miss 0 + expect_stat files_in_cache 0 + expect_stat compiler_produced_no_output 2 # ------------------------------------------------------------------------- TEST "No object file due to -fsyntax-only" @@ -1096,15 +1096,15 @@ EOF expect_contains reference_stderr.txt "This triggers a compiler warning" $CCACHE_COMPILE -Wall -c stderr.c -fsyntax-only 2>stderr.txt - expect_stat 'cache hit (preprocessed)' 0 - expect_stat 'cache miss' 1 - expect_stat 'files in cache' 1 + expect_stat preprocessed_cache_hit 0 + expect_stat cache_miss 1 + expect_stat files_in_cache 1 expect_equal_text_content reference_stderr.txt stderr.txt $CCACHE_COMPILE -Wall -c stderr.c -fsyntax-only 2>stderr.txt - expect_stat 'cache hit (preprocessed)' 1 - expect_stat 'cache miss' 1 - expect_stat 'files in cache' 1 + expect_stat preprocessed_cache_hit 1 + expect_stat cache_miss 1 + expect_stat files_in_cache 1 expect_equal_text_content reference_stderr.txt stderr.txt # ------------------------------------------------------------------------- @@ -1120,18 +1120,18 @@ touch test_empty_obj.o EOF chmod +x empty-object-prefix CCACHE_PREFIX=`pwd`/empty-object-prefix $CCACHE_COMPILE -c test_empty_obj.c - expect_stat 'compiler produced empty output' 1 + expect_stat compiler_produced_empty_output 1 # ------------------------------------------------------------------------- TEST "Output to /dev/null" $CCACHE_COMPILE -c test1.c - expect_stat 'cache hit (preprocessed)' 0 - expect_stat 'cache miss' 1 + expect_stat preprocessed_cache_hit 0 + expect_stat cache_miss 1 $CCACHE_COMPILE -c test1.c -o /dev/null - expect_stat 'cache hit (preprocessed)' 1 - expect_stat 'cache miss' 1 + expect_stat preprocessed_cache_hit 1 + expect_stat cache_miss 1 # ------------------------------------------------------------------------- TEST "Caching stderr" @@ -1163,15 +1163,15 @@ EOF unset CCACHE_NOCPP2 stderr=$($CCACHE ./compiler.sh -c test1.c 2>stderr) - expect_stat 'cache hit (preprocessed)' 0 - expect_stat 'cache miss' 1 - expect_stat 'files in cache' 1 + expect_stat preprocessed_cache_hit 0 + expect_stat cache_miss 1 + expect_stat files_in_cache 1 expect_content stderr "[cc_stderr]" stderr=$(CCACHE_NOCPP2=1 $CCACHE ./compiler.sh -c test1.c 2>stderr) - expect_stat 'cache hit (preprocessed)' 0 - expect_stat 'cache miss' 2 - expect_stat 'files in cache' 2 + expect_stat preprocessed_cache_hit 0 + expect_stat cache_miss 2 + expect_stat files_in_cache 2 expect_content stderr "[cpp_stderr][cc_stderr]" # ------------------------------------------------------------------------- @@ -1184,14 +1184,14 @@ EOF mv test.d reference.d $CCACHE_COMPILE -c test.c -MMD 2>test.stderr - expect_stat 'cache hit (preprocessed)' 0 - expect_stat 'cache miss' 1 + expect_stat preprocessed_cache_hit 0 + expect_stat cache_miss 1 expect_equal_content reference.stderr test.stderr expect_equal_content reference.d test.d $CCACHE_COMPILE -c test.c -MMD 2>test.stderr - expect_stat 'cache hit (preprocessed)' 1 - expect_stat 'cache miss' 1 + expect_stat preprocessed_cache_hit 1 + expect_stat cache_miss 1 expect_equal_content reference.stderr test.stderr expect_equal_content reference.d test.d @@ -1200,63 +1200,63 @@ EOF $CCACHE_COMPILE -c test1.c $CCACHE_COMPILE -c test1.c - expect_stat 'cache hit (preprocessed)' 1 - expect_stat 'cache miss' 1 - expect_stat 'files in cache' 1 + expect_stat preprocessed_cache_hit 1 + expect_stat cache_miss 1 + expect_stat files_in_cache 1 $CCACHE -z >/dev/null - expect_stat 'cache hit (preprocessed)' 0 - expect_stat 'cache miss' 0 - expect_stat 'files in cache' 1 + expect_stat preprocessed_cache_hit 0 + expect_stat cache_miss 0 + expect_stat files_in_cache 1 # ------------------------------------------------------------------------- TEST "--clear" $CCACHE_COMPILE -c test1.c $CCACHE_COMPILE -c test1.c - expect_stat 'cache hit (preprocessed)' 1 - expect_stat 'cache miss' 1 - expect_stat 'files in cache' 1 + expect_stat preprocessed_cache_hit 1 + expect_stat cache_miss 1 + expect_stat files_in_cache 1 $CCACHE -C >/dev/null - expect_stat 'cache hit (preprocessed)' 1 - expect_stat 'cache miss' 1 - expect_stat 'files in cache' 0 + expect_stat preprocessed_cache_hit 1 + expect_stat cache_miss 1 + expect_stat files_in_cache 0 # ------------------------------------------------------------------------- TEST "-P -c" $CCACHE_COMPILE -P -c test1.c - expect_stat 'cache hit (direct)' 0 - expect_stat 'cache hit (preprocessed)' 0 - expect_stat 'cache miss' 1 + expect_stat direct_cache_hit 0 + expect_stat preprocessed_cache_hit 0 + expect_stat cache_miss 1 $CCACHE_COMPILE -P -c test1.c - expect_stat 'cache hit (direct)' 0 - expect_stat 'cache hit (preprocessed)' 1 - expect_stat 'cache miss' 1 + expect_stat direct_cache_hit 0 + expect_stat preprocessed_cache_hit 1 + expect_stat cache_miss 1 # ------------------------------------------------------------------------- TEST "-P -E" $CCACHE_COMPILE -P -E test1.c >/dev/null - expect_stat 'cache hit (direct)' 0 - expect_stat 'cache hit (preprocessed)' 0 - expect_stat 'cache miss' 0 - expect_stat 'called for preprocessing' 1 + expect_stat direct_cache_hit 0 + expect_stat preprocessed_cache_hit 0 + expect_stat cache_miss 0 + expect_stat called_for_preprocessing 1 # ------------------------------------------------------------------------- TEST "-Wp,-P" $CCACHE_COMPILE -c -Wp,-P test1.c - expect_stat 'cache hit (direct)' 0 - expect_stat 'cache hit (preprocessed)' 0 - expect_stat 'cache miss' 1 + expect_stat direct_cache_hit 0 + expect_stat preprocessed_cache_hit 0 + expect_stat cache_miss 1 $CCACHE_COMPILE -c -Wp,-P test1.c - expect_stat 'cache hit (direct)' 0 - expect_stat 'cache hit (preprocessed)' 1 - expect_stat 'cache miss' 1 + expect_stat direct_cache_hit 0 + expect_stat preprocessed_cache_hit 1 + expect_stat cache_miss 1 # ------------------------------------------------------------------------- TEST "-Wp,-P,-DFOO" @@ -1267,29 +1267,29 @@ EOF # object file produced when compiling without ccache.) $CCACHE_COMPILE -c -Wp,-P,-DFOO test1.c - expect_stat 'cache hit (direct)' 0 - expect_stat 'cache hit (preprocessed)' 0 - expect_stat 'cache miss' 0 - expect_stat 'unsupported compiler option' 1 + expect_stat direct_cache_hit 0 + expect_stat preprocessed_cache_hit 0 + expect_stat cache_miss 0 + expect_stat unsupported_compiler_option 1 $CCACHE_COMPILE -c -Wp,-DFOO,-P test1.c - expect_stat 'cache hit (direct)' 0 - expect_stat 'cache hit (preprocessed)' 0 - expect_stat 'cache miss' 0 - expect_stat 'unsupported compiler option' 2 + expect_stat direct_cache_hit 0 + expect_stat preprocessed_cache_hit 0 + expect_stat cache_miss 0 + expect_stat unsupported_compiler_option 2 # ------------------------------------------------------------------------- TEST "-Wp,-D" $CCACHE_COMPILE -c -Wp,-DFOO test1.c - expect_stat 'cache hit (direct)' 0 - expect_stat 'cache hit (preprocessed)' 0 - expect_stat 'cache miss' 1 + expect_stat direct_cache_hit 0 + expect_stat preprocessed_cache_hit 0 + expect_stat cache_miss 1 $CCACHE_COMPILE -c -DFOO test1.c - expect_stat 'cache hit (direct)' 0 - expect_stat 'cache hit (preprocessed)' 1 - expect_stat 'cache miss' 1 + expect_stat direct_cache_hit 0 + expect_stat preprocessed_cache_hit 1 + expect_stat cache_miss 1 # ------------------------------------------------------------------------- TEST "Handling of compiler-only arguments" @@ -1303,27 +1303,27 @@ EOF backdate compiler.sh $CCACHE ./compiler.sh -c test1.c - expect_stat 'cache hit (preprocessed)' 0 - expect_stat 'cache miss' 1 - expect_stat 'files in cache' 1 + expect_stat preprocessed_cache_hit 0 + expect_stat cache_miss 1 + expect_stat files_in_cache 1 if [ -z "$CCACHE_NOCPP2" ]; then expect_content compiler.args "[-E test1.c][-c -o test1.o test1.c]" fi rm compiler.args $CCACHE ./compiler.sh -c test1.c - expect_stat 'cache hit (preprocessed)' 1 - expect_stat 'cache miss' 1 - expect_stat 'files in cache' 1 + expect_stat preprocessed_cache_hit 1 + expect_stat cache_miss 1 + expect_stat files_in_cache 1 expect_content compiler.args "[-E test1.c]" rm compiler.args # Even though -Werror is not passed to the preprocessor, it should be part # of the hash, so we expect a cache miss: $CCACHE ./compiler.sh -c -Werror -rdynamic test1.c - expect_stat 'cache hit (preprocessed)' 1 - expect_stat 'cache miss' 2 - expect_stat 'files in cache' 2 + expect_stat preprocessed_cache_hit 1 + expect_stat cache_miss 2 + expect_stat files_in_cache 2 if [ -z "$CCACHE_NOCPP2" ]; then expect_content compiler.args "[-E test1.c][-Werror -rdynamic -c -o test1.o test1.c]" fi @@ -1367,14 +1367,14 @@ EOF chmod +x buggy-cpp $CCACHE ./buggy-cpp -c file.c - expect_stat 'cache hit (direct)' 0 - expect_stat 'cache hit (preprocessed)' 0 - expect_stat 'cache miss' 1 + expect_stat direct_cache_hit 0 + expect_stat preprocessed_cache_hit 0 + expect_stat cache_miss 1 $CCACHE ./buggy-cpp -DNOT_AFFECTING=1 -c file.c - expect_stat 'cache hit (direct)' 0 - expect_stat 'cache hit (preprocessed)' 1 - expect_stat 'cache miss' 1 + expect_stat direct_cache_hit 0 + expect_stat preprocessed_cache_hit 1 + expect_stat cache_miss 1 # ------------------------------------------------------------------------- if ! $HOST_OS_WINDOWS; then @@ -1385,18 +1385,18 @@ __asm__(".incbin \"/dev/null\""); EOF $CCACHE_COMPILE -c incbin.c - expect_stat 'cache hit (preprocessed)' 0 - expect_stat 'cache miss' 0 - expect_stat 'unsupported code directive' 1 + expect_stat preprocessed_cache_hit 0 + expect_stat cache_miss 0 + expect_stat unsupported_code_directive 1 cat <incbin.s .incbin "/dev/null"; EOF $CCACHE_COMPILE -c incbin.s - expect_stat 'cache hit (preprocessed)' 0 - expect_stat 'cache miss' 0 - expect_stat 'unsupported code directive' 2 + expect_stat preprocessed_cache_hit 0 + expect_stat cache_miss 0 + expect_stat unsupported_code_directive 2 fi # ------------------------------------------------------------------------- @@ -1418,16 +1418,16 @@ EOF N=1 $CCACHE ./compiler.sh -c test1.c 2>stderr.txt stderr=$(cat stderr.txt) - expect_stat 'cache hit (preprocessed)' 0 - expect_stat 'cache miss' 1 + expect_stat preprocessed_cache_hit 0 + expect_stat cache_miss 1 if [ "$stderr" != "1Pu1Cu1Cc" ]; then test_failed "Unexpected stderr: $stderr != 1Pu1Cu1Cc" fi N=2 $CCACHE ./compiler.sh -c test1.c 2>stderr.txt stderr=$(cat stderr.txt) - expect_stat 'cache hit (preprocessed)' 1 - expect_stat 'cache miss' 1 + expect_stat preprocessed_cache_hit 1 + expect_stat cache_miss 1 if [ "$stderr" != "2Pu1Cc" ]; then test_failed "Unexpected stderr: $stderr != 2Pu1Cc" fi diff --git a/test/suites/basedir.bash b/test/suites/basedir.bash index 46d2a4258..0bc83cbce 100644 --- a/test/suites/basedir.bash +++ b/test/suites/basedir.bash @@ -19,30 +19,30 @@ SUITE_basedir() { cd dir1 CCACHE_BASEDIR="`pwd`" $CCACHE_COMPILE -I`pwd`/include -c src/test.c - expect_stat 'cache hit (direct)' 0 - expect_stat 'cache hit (preprocessed)' 0 - expect_stat 'cache miss' 1 + expect_stat direct_cache_hit 0 + expect_stat preprocessed_cache_hit 0 + expect_stat cache_miss 1 cd ../dir2 CCACHE_BASEDIR="`pwd`" $CCACHE_COMPILE -I`pwd`/include -c src/test.c - expect_stat 'cache hit (direct)' 1 - expect_stat 'cache hit (preprocessed)' 0 - expect_stat 'cache miss' 1 + expect_stat direct_cache_hit 1 + expect_stat preprocessed_cache_hit 0 + expect_stat cache_miss 1 # ------------------------------------------------------------------------- TEST "Disabled (default) CCACHE_BASEDIR" cd dir1 CCACHE_BASEDIR="`pwd`" $CCACHE_COMPILE -I`pwd`/include -c src/test.c - expect_stat 'cache hit (direct)' 0 - expect_stat 'cache hit (preprocessed)' 0 - expect_stat 'cache miss' 1 + expect_stat direct_cache_hit 0 + expect_stat preprocessed_cache_hit 0 + expect_stat cache_miss 1 # CCACHE_BASEDIR="" is the default: $CCACHE_COMPILE -I`pwd`/include -c src/test.c - expect_stat 'cache hit (direct)' 0 - expect_stat 'cache hit (preprocessed)' 0 - expect_stat 'cache miss' 2 + expect_stat direct_cache_hit 0 + expect_stat preprocessed_cache_hit 0 + expect_stat cache_miss 2 # ------------------------------------------------------------------------- if ! $HOST_OS_WINDOWS && ! $HOST_OS_CYGWIN; then @@ -50,18 +50,18 @@ if ! $HOST_OS_WINDOWS && ! $HOST_OS_CYGWIN; then cd dir1 CCACHE_BASEDIR="`pwd`" $CCACHE_COMPILE -I$(pwd)/include -c src/test.c - expect_stat 'cache hit (direct)' 0 - expect_stat 'cache hit (preprocessed)' 0 - expect_stat 'cache miss' 1 + expect_stat direct_cache_hit 0 + expect_stat preprocessed_cache_hit 0 + expect_stat cache_miss 1 mkdir subdir # Rewriting triggered by CCACHE_BASEDIR should handle paths with multiple # slashes, redundant "/." parts and "foo/.." parts correctly. CCACHE_BASEDIR=$(pwd) $CCACHE_COMPILE -I$(pwd)//./subdir/../include -c $(pwd)/src/test.c - expect_stat 'cache hit (direct)' 1 - expect_stat 'cache hit (preprocessed)' 0 - expect_stat 'cache miss' 1 + expect_stat direct_cache_hit 1 + expect_stat preprocessed_cache_hit 0 + expect_stat cache_miss 1 fi # ------------------------------------------------------------------------- @@ -134,19 +134,19 @@ if ! $HOST_OS_WINDOWS && ! $HOST_OS_CYGWIN; then cd dir1/src CCACHE_BASEDIR=/ $CCACHE_COMPILE -I$(pwd)/../include -c $(pwd)/test.c -o $(pwd)/build/test.o - expect_stat 'cache hit (direct)' 0 - expect_stat 'cache miss' 1 + expect_stat direct_cache_hit 0 + expect_stat cache_miss 1 cd ../../dir2/src # Apparent CWD: CCACHE_BASEDIR=/ $CCACHE_COMPILE -I$(pwd)/../include -c $(pwd)/test.c -o $(pwd)/build/test.o - expect_stat 'cache hit (direct)' 1 - expect_stat 'cache miss' 1 + expect_stat direct_cache_hit 1 + expect_stat cache_miss 1 # Actual CWD (e.g. from $(CURDIR) in a Makefile): CCACHE_BASEDIR=/ $CCACHE_COMPILE -I$(pwd -P)/../include -c $(pwd -P)/test.c -o $(pwd -P)/build/test.o - expect_stat 'cache hit (direct)' 2 - expect_stat 'cache miss' 1 + expect_stat direct_cache_hit 2 + expect_stat cache_miss 1 fi # ------------------------------------------------------------------------- @@ -173,19 +173,19 @@ if ! $HOST_OS_WINDOWS && ! $HOST_OS_CYGWIN; then cd build1 CCACHE_BASEDIR=/ $CCACHE_COMPILE -I$(pwd)/src/include -c $(pwd)/src/src/test.c -o $(pwd)/test.o - expect_stat 'cache hit (direct)' 0 - expect_stat 'cache miss' 1 + expect_stat direct_cache_hit 0 + expect_stat cache_miss 1 cd ../build2 # Apparent CWD: CCACHE_BASEDIR=/ $CCACHE_COMPILE -I$(pwd)/src/include -c $(pwd)/src/src/test.c -o $(pwd)/test.o - expect_stat 'cache hit (direct)' 1 - expect_stat 'cache miss' 1 + expect_stat direct_cache_hit 1 + expect_stat cache_miss 1 # Actual CWD: CCACHE_BASEDIR=/ $CCACHE_COMPILE -I$(pwd -P)/src/include -c $(pwd -P)/src/src/test.c -o $(pwd -P)/test.o - expect_stat 'cache hit (direct)' 2 - expect_stat 'cache miss' 1 + expect_stat direct_cache_hit 2 + expect_stat cache_miss 1 fi # ------------------------------------------------------------------------- @@ -203,17 +203,17 @@ EOF EOF CCACHE_BASEDIR=`pwd` $CCACHE_COMPILE -Wall -W -I`pwd` -c `pwd`/stderr.c -o `pwd`/stderr.o 2>stderr.txt - expect_stat 'cache hit (direct)' 0 - expect_stat 'cache hit (preprocessed)' 0 - expect_stat 'cache miss' 1 + expect_stat direct_cache_hit 0 + expect_stat preprocessed_cache_hit 0 + expect_stat cache_miss 1 if grep `pwd` stderr.txt >/dev/null 2>&1; then test_failed "Base dir (`pwd`) found in stderr:\n`cat stderr.txt`" fi CCACHE_BASEDIR=`pwd` $CCACHE_COMPILE -Wall -W -I`pwd` -c `pwd`/stderr.c -o `pwd`/stderr.o 2>stderr.txt - expect_stat 'cache hit (direct)' 1 - expect_stat 'cache hit (preprocessed)' 0 - expect_stat 'cache miss' 1 + expect_stat direct_cache_hit 1 + expect_stat preprocessed_cache_hit 0 + expect_stat cache_miss 1 if grep `pwd` stderr.txt >/dev/null 2>&1; then test_failed "Base dir (`pwd`) found in stderr:\n`cat stderr.txt`" fi @@ -225,16 +225,16 @@ EOF clear_cache cd dir1 CCACHE_BASEDIR="`pwd`" $CCACHE_COMPILE -I`pwd`/include -MD -${option}`pwd`/test.d -c src/test.c - expect_stat 'cache hit (direct)' 0 - expect_stat 'cache hit (preprocessed)' 0 - expect_stat 'cache miss' 1 + expect_stat direct_cache_hit 0 + expect_stat preprocessed_cache_hit 0 + expect_stat cache_miss 1 cd .. cd dir2 CCACHE_BASEDIR="`pwd`" $CCACHE_COMPILE -I`pwd`/include -MD -${option}`pwd`/test.d -c src/test.c - expect_stat 'cache hit (direct)' 1 - expect_stat 'cache hit (preprocessed)' 0 - expect_stat 'cache miss' 1 + expect_stat direct_cache_hit 1 + expect_stat preprocessed_cache_hit 0 + expect_stat cache_miss 1 cd .. done @@ -248,9 +248,9 @@ EOF clear_cache cd dir1 CCACHE_BASEDIR="/" $CCACHE_COMPILE -I`pwd`/include -MD -${option}`pwd`/test.d -c src/test.c - expect_stat 'cache hit (direct)' 0 - expect_stat 'cache hit (preprocessed)' 0 - expect_stat 'cache miss' 1 + expect_stat direct_cache_hit 0 + expect_stat preprocessed_cache_hit 0 + expect_stat cache_miss 1 # Check that there is no absolute path in the dependency file: while read line; do for file in $line; do @@ -263,9 +263,9 @@ EOF cd dir2 CCACHE_BASEDIR="/" $CCACHE_COMPILE -I`pwd`/include -MD -${option}`pwd`/test.d -c src/test.c - expect_stat 'cache hit (direct)' 1 - expect_stat 'cache hit (preprocessed)' 0 - expect_stat 'cache miss' 1 + expect_stat direct_cache_hit 1 + expect_stat preprocessed_cache_hit 0 + expect_stat cache_miss 1 cd .. done @@ -285,30 +285,30 @@ EOF $REAL_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 'cache hit (direct)' 0 - expect_stat 'cache hit (preprocessed)' 0 - expect_stat 'cache miss' 1 + expect_stat direct_cache_hit 0 + expect_stat preprocessed_cache_hit 0 + expect_stat cache_miss 1 expect_equal_content reference.stderr ccache.stderr CCACHE_ABSSTDERR=1 CCACHE_BASEDIR="$pwd" $CCACHE_COMPILE -c $pwd/test.c 2>ccache.stderr - expect_stat 'cache hit (direct)' 1 - expect_stat 'cache hit (preprocessed)' 0 - expect_stat 'cache miss' 1 + expect_stat direct_cache_hit 1 + expect_stat preprocessed_cache_hit 0 + 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 CCACHE_ABSSTDERR=1 CCACHE_BASEDIR="$pwd" $CCACHE_COMPILE -fdiagnostics-color=always -c $pwd/test.c 2>ccache.stderr - expect_stat 'cache hit (direct)' 2 - expect_stat 'cache hit (preprocessed)' 0 - expect_stat 'cache miss' 1 + expect_stat direct_cache_hit 2 + expect_stat preprocessed_cache_hit 0 + expect_stat cache_miss 1 expect_equal_content reference.stderr ccache.stderr CCACHE_ABSSTDERR=1 CCACHE_BASEDIR="$pwd" $CCACHE_COMPILE -fdiagnostics-color=always -c $pwd/test.c 2>ccache.stderr - expect_stat 'cache hit (direct)' 3 - expect_stat 'cache hit (preprocessed)' 0 - expect_stat 'cache miss' 1 + expect_stat direct_cache_hit 3 + expect_stat preprocessed_cache_hit 0 + expect_stat cache_miss 1 expect_equal_content reference.stderr ccache.stderr fi @@ -317,15 +317,15 @@ EOF cd dir1 CCACHE_BASEDIR="$(pwd)" PWD=. $CCACHE_COMPILE -I$(pwd)/include -c src/test.c - expect_stat 'cache hit (direct)' 0 - expect_stat 'cache hit (preprocessed)' 0 - expect_stat 'cache miss' 1 + expect_stat direct_cache_hit 0 + expect_stat preprocessed_cache_hit 0 + expect_stat cache_miss 1 cd ../dir2 CCACHE_BASEDIR="$(pwd)" PWD=. $CCACHE_COMPILE -I$(pwd)/include -c src/test.c - expect_stat 'cache hit (direct)' 1 - expect_stat 'cache hit (preprocessed)' 0 - expect_stat 'cache miss' 1 + expect_stat direct_cache_hit 1 + expect_stat preprocessed_cache_hit 0 + expect_stat cache_miss 1 # ------------------------------------------------------------------------- TEST "Unset PWD" @@ -334,13 +334,13 @@ EOF cd dir1 CCACHE_BASEDIR="$(pwd)" $CCACHE_COMPILE -I$(pwd)/include -c src/test.c - expect_stat 'cache hit (direct)' 0 - expect_stat 'cache hit (preprocessed)' 0 - expect_stat 'cache miss' 1 + expect_stat direct_cache_hit 0 + expect_stat preprocessed_cache_hit 0 + expect_stat cache_miss 1 cd ../dir2 CCACHE_BASEDIR="$(pwd)" $CCACHE_COMPILE -I$(pwd)/include -c src/test.c - expect_stat 'cache hit (direct)' 1 - expect_stat 'cache hit (preprocessed)' 0 - expect_stat 'cache miss' 1 + expect_stat direct_cache_hit 1 + expect_stat preprocessed_cache_hit 0 + expect_stat cache_miss 1 } diff --git a/test/suites/cache_levels.bash b/test/suites/cache_levels.bash index ef2e8d576..90dbe20cc 100644 --- a/test/suites/cache_levels.bash +++ b/test/suites/cache_levels.bash @@ -29,16 +29,16 @@ SUITE_cache_levels() { TEST "Empty cache" $CCACHE_COMPILE -c test1.c - expect_stat 'cache hit (direct)' 0 - expect_stat 'cache miss' 1 - expect_stat 'files in cache' 2 + expect_stat direct_cache_hit 0 + expect_stat cache_miss 1 + expect_stat files_in_cache 2 expect_on_level R 2 expect_on_level M 2 $CCACHE_COMPILE -c test1.c - expect_stat 'cache hit (direct)' 1 - expect_stat 'cache miss' 1 - expect_stat 'files in cache' 2 + expect_stat direct_cache_hit 1 + expect_stat cache_miss 1 + expect_stat files_in_cache 2 expect_on_level R 2 expect_on_level M 2 @@ -49,16 +49,16 @@ SUITE_cache_levels() { add_fake_files_counters $files $CCACHE_COMPILE -c test1.c - expect_stat 'cache hit (direct)' 0 - expect_stat 'cache miss' 1 - expect_stat 'files in cache' $((files + 2)) + expect_stat direct_cache_hit 0 + expect_stat cache_miss 1 + expect_stat files_in_cache $((files + 2)) expect_on_level R 2 expect_on_level M 2 $CCACHE_COMPILE -c test1.c - expect_stat 'cache hit (direct)' 1 - expect_stat 'cache miss' 1 - expect_stat 'files in cache' $((files + 2)) + expect_stat direct_cache_hit 1 + expect_stat cache_miss 1 + expect_stat files_in_cache $((files + 2)) expect_on_level R 2 expect_on_level M 2 @@ -69,16 +69,16 @@ SUITE_cache_levels() { add_fake_files_counters $files $CCACHE_COMPILE -c test1.c - expect_stat 'cache hit (direct)' 0 - expect_stat 'cache miss' 1 - expect_stat 'files in cache' $((files + 2)) + expect_stat direct_cache_hit 0 + expect_stat cache_miss 1 + expect_stat files_in_cache $((files + 2)) expect_on_level R 3 expect_on_level M 3 $CCACHE_COMPILE -c test1.c - expect_stat 'cache hit (direct)' 1 - expect_stat 'cache miss' 1 - expect_stat 'files in cache' $((files + 2)) + expect_stat direct_cache_hit 1 + expect_stat cache_miss 1 + expect_stat files_in_cache $((files + 2)) expect_on_level R 3 expect_on_level M 3 @@ -89,16 +89,16 @@ SUITE_cache_levels() { add_fake_files_counters $files $CCACHE_COMPILE -c test1.c - expect_stat 'cache hit (direct)' 0 - expect_stat 'cache miss' 1 - expect_stat 'files in cache' $((files + 2)) + expect_stat direct_cache_hit 0 + expect_stat cache_miss 1 + expect_stat files_in_cache $((files + 2)) expect_on_level R 4 expect_on_level M 4 $CCACHE_COMPILE -c test1.c - expect_stat 'cache hit (direct)' 1 - expect_stat 'cache miss' 1 - expect_stat 'files in cache' $((files + 2)) + expect_stat direct_cache_hit 1 + expect_stat cache_miss 1 + expect_stat files_in_cache $((files + 2)) expect_on_level R 4 expect_on_level M 4 @@ -109,16 +109,16 @@ SUITE_cache_levels() { add_fake_files_counters $files $CCACHE_COMPILE -c test1.c - expect_stat 'cache hit (direct)' 0 - expect_stat 'cache miss' 1 - expect_stat 'files in cache' $((files + 2)) + expect_stat direct_cache_hit 0 + expect_stat cache_miss 1 + expect_stat files_in_cache $((files + 2)) expect_on_level R 4 expect_on_level M 4 $CCACHE_COMPILE -c test1.c - expect_stat 'cache hit (direct)' 1 - expect_stat 'cache miss' 1 - expect_stat 'files in cache' $((files + 2)) + expect_stat direct_cache_hit 1 + expect_stat cache_miss 1 + expect_stat files_in_cache $((files + 2)) expect_on_level R 4 expect_on_level M 4 } diff --git a/test/suites/cleanup.bash b/test/suites/cleanup.bash index b2c53a598..18c2055fe 100644 --- a/test/suites/cleanup.bash +++ b/test/suites/cleanup.bash @@ -20,8 +20,8 @@ SUITE_cleanup() { $CCACHE -C >/dev/null expect_file_count 0 '*R' $CCACHE_DIR - expect_stat 'files in cache' 0 - expect_stat 'cleanups performed' 1 + expect_stat files_in_cache 0 + expect_stat cleanups_performed 1 # ------------------------------------------------------------------------- TEST "Forced cache cleanup, no limits" @@ -31,8 +31,8 @@ SUITE_cleanup() { $CCACHE -F 0 -M 0 >/dev/null $CCACHE -c >/dev/null expect_file_count 10 '*R' $CCACHE_DIR - expect_stat 'files in cache' 10 - expect_stat 'cleanups performed' 0 + expect_stat files_in_cache 10 + expect_stat cleanups_performed 0 # ------------------------------------------------------------------------- TEST "Forced cache cleanup, file limit" @@ -45,8 +45,8 @@ SUITE_cleanup() { $CCACHE -F 160 -M 0 >/dev/null $CCACHE -c >/dev/null expect_file_count 10 '*R' $CCACHE_DIR - expect_stat 'files in cache' 10 - expect_stat 'cleanups performed' 0 + expect_stat files_in_cache 10 + expect_stat cleanups_performed 0 # Reduce file limit # @@ -54,8 +54,8 @@ SUITE_cleanup() { $CCACHE -F 112 -M 0 >/dev/null $CCACHE -c >/dev/null expect_file_count 7 '*R' $CCACHE_DIR - expect_stat 'files in cache' 7 - expect_stat 'cleanups performed' 1 + expect_stat files_in_cache 7 + expect_stat cleanups_performed 1 for i in 0 1 2; do file=$CCACHE_DIR/a/result${i}R expect_missing $CCACHE_DIR/a/result${i}R @@ -81,8 +81,8 @@ SUITE_cleanup() { $CCACHE -F 0 -M 256K >/dev/null $CCACHE -c >/dev/null expect_file_count 3 '*R' $CCACHE_DIR - expect_stat 'files in cache' 3 - expect_stat 'cleanups performed' 1 + expect_stat files_in_cache 3 + expect_stat cleanups_performed 1 for i in 0 1 2 3 4 5 6; do file=$CCACHE_DIR/a/result${i}R expect_missing $file @@ -102,14 +102,14 @@ SUITE_cleanup() { $CCACHE -F 160 -M 0 >/dev/null expect_file_count 160 '*R' $CCACHE_DIR - expect_stat 'files in cache' 160 - expect_stat 'cleanups performed' 0 + expect_stat files_in_cache 160 + expect_stat cleanups_performed 0 touch empty.c CCACHE_LIMIT_MULTIPLE=0.9 $CCACHE_COMPILE -c empty.c -o empty.o expect_file_count 159 '*R' $CCACHE_DIR - expect_stat 'files in cache' 159 - expect_stat 'cleanups performed' 1 + expect_stat files_in_cache 159 + expect_stat cleanups_performed 1 # ------------------------------------------------------------------------- TEST "Automatic cache cleanup, limit_multiple 0.7" @@ -121,14 +121,14 @@ SUITE_cleanup() { $CCACHE -F 160 -M 0 >/dev/null expect_file_count 160 '*R' $CCACHE_DIR - expect_stat 'files in cache' 160 - expect_stat 'cleanups performed' 0 + expect_stat files_in_cache 160 + expect_stat cleanups_performed 0 touch empty.c CCACHE_LIMIT_MULTIPLE=0.7 $CCACHE_COMPILE -c empty.c -o empty.o expect_file_count 157 '*R' $CCACHE_DIR - expect_stat 'files in cache' 157 - expect_stat 'cleanups performed' 1 + expect_stat files_in_cache 157 + expect_stat cleanups_performed 1 # ------------------------------------------------------------------------- TEST "No cleanup of new unknown file" @@ -137,12 +137,12 @@ SUITE_cleanup() { touch $CCACHE_DIR/a/abcd.unknown $CCACHE -F 0 -M 0 -c >/dev/null # update counters - expect_stat 'files in cache' 11 + expect_stat files_in_cache 11 $CCACHE -F 160 -M 0 >/dev/null $CCACHE -c >/dev/null expect_exists $CCACHE_DIR/a/abcd.unknown - expect_stat 'files in cache' 10 + expect_stat files_in_cache 10 # ------------------------------------------------------------------------- TEST "Cleanup of old unknown file" @@ -152,11 +152,11 @@ SUITE_cleanup() { touch $CCACHE_DIR/a/abcd.unknown backdate $CCACHE_DIR/a/abcd.unknown $CCACHE -F 0 -M 0 -c >/dev/null # update counters - expect_stat 'files in cache' 11 + expect_stat files_in_cache 11 $CCACHE -F 160 -M 0 -c >/dev/null expect_missing $CCACHE_DIR/a/abcd.unknown - expect_stat 'files in cache' 10 + expect_stat files_in_cache 10 # ------------------------------------------------------------------------- TEST "Cleanup of tmp file" @@ -164,11 +164,11 @@ SUITE_cleanup() { mkdir -p $CCACHE_DIR/a touch $CCACHE_DIR/a/abcd.tmp.efgh $CCACHE -c >/dev/null # update counters - expect_stat 'files in cache' 1 + expect_stat files_in_cache 1 backdate $CCACHE_DIR/a/abcd.tmp.efgh $CCACHE -c >/dev/null expect_missing $CCACHE_DIR/a/abcd.tmp.efgh - expect_stat 'files in cache' 0 + expect_stat files_in_cache 0 # ------------------------------------------------------------------------- TEST "No cleanup of .nfs* files" @@ -179,7 +179,7 @@ SUITE_cleanup() { $CCACHE -F 0 -M 0 >/dev/null $CCACHE -c >/dev/null expect_file_count 1 '.nfs*' $CCACHE_DIR - expect_stat 'files in cache' 10 + expect_stat files_in_cache 10 # ------------------------------------------------------------------------- TEST "Cleanup of old files by age" @@ -190,13 +190,13 @@ SUITE_cleanup() { $CCACHE --evict-older-than 1d >/dev/null expect_file_count 1 '*R' $CCACHE_DIR - expect_stat 'files in cache' 1 + expect_stat files_in_cache 1 $CCACHE --evict-older-than 1d >/dev/null expect_file_count 1 '*R' $CCACHE_DIR - expect_stat 'files in cache' 1 + expect_stat files_in_cache 1 backdate $CCACHE_DIR/a/nowR $CCACHE --evict-older-than 10s >/dev/null - expect_stat 'files in cache' 0 + expect_stat files_in_cache 0 } diff --git a/test/suites/color_diagnostics.bash b/test/suites/color_diagnostics.bash index 7c83714c4..b7264bde5 100644 --- a/test/suites/color_diagnostics.bash +++ b/test/suites/color_diagnostics.bash @@ -97,8 +97,8 @@ color_diagnostics_test() { # Check that subsequently running on a TTY generates a cache hit. color_diagnostics_run_on_pty test1.output "$CCACHE_COMPILE -Wreturn-type -c -o test1.o test1.c" color_diagnostics_expect_color test1.output - expect_stat 'cache miss' 1 - expect_stat 'cache hit (preprocessed)' 1 + expect_stat cache_miss 1 + expect_stat preprocessed_cache_hit 1 # ------------------------------------------------------------------------- TEST "Colored diagnostics automatically enabled when stderr is a TTY (run_second_cpp=$run_second_cpp)" @@ -110,8 +110,8 @@ color_diagnostics_test() { # Check that subsequently running without a TTY generates a cache hit. $CCACHE_COMPILE -Wreturn-type -c -o test1.o test1.c 2>test1.stderr color_diagnostics_expect_no_color test1.stderr - expect_stat 'cache miss' 1 - expect_stat 'cache hit (preprocessed)' 1 + expect_stat cache_miss 1 + expect_stat preprocessed_cache_hit 1 if $COMPILER_TYPE_GCC; then # --------------------------------------------------------------------- @@ -122,7 +122,7 @@ color_diagnostics_test() { if $CCACHE_COMPILE -fcolor-diagnostics -c test.c >&/dev/null; then test_failed "-fcolor-diagnostics unexpectedly accepted by GCC" fi - expect_stat 'unsupported compiler option' 1 + expect_stat unsupported_compiler_option 1 # --------------------------------------------------------------------- TEST "-fcolor-diagnostics not accepted for GCC for cached result" @@ -136,7 +136,7 @@ color_diagnostics_test() { if $CCACHE_COMPILE -fcolor-diagnostics -c test.c >&/dev/null; then test_failed "-fcolor-diagnostics unexpectedly accepted by GCC" fi - expect_stat 'unsupported compiler option' 1 + expect_stat unsupported_compiler_option 1 # --------------------------------------------------------------------- TEST "-fcolor-diagnostics passed to underlying compiler for unknown compiler type" @@ -150,7 +150,7 @@ color_diagnostics_test() { # Verify that -fcolor-diagnostics was passed to the compiler for the # unknown compiler case, i.e. ccache did not exit early with # "unsupported compiler option". - expect_stat 'compile failed' 1 + expect_stat compile_failed 1 fi if $COMPILER_TYPE_CLANG; then @@ -190,8 +190,8 @@ color_diagnostics_test() { ;; esac done - expect_stat 'cache miss' 1 - expect_stat 'cache hit (preprocessed)' 3 + expect_stat cache_miss 1 + expect_stat preprocessed_cache_hit 3 done < <( A=({color,nocolor},{tty,notty}) color_diagnostics_generate_permutations "${#A[@]}" diff --git a/test/suites/cpp1.bash b/test/suites/cpp1.bash index 6655778df..f2a83a3ab 100644 --- a/test/suites/cpp1.bash +++ b/test/suites/cpp1.bash @@ -41,25 +41,25 @@ SUITE_cpp1() { $REAL_COMPILER $cpp_flag -c -o reference_test1.o test1.c $CCACHE_COMPILE $cpp_flag -c test1.c - expect_stat 'cache hit (direct)' 0 - expect_stat 'cache hit (preprocessed)' 0 - expect_stat 'cache miss' 1 - expect_stat 'files in cache' 1 + expect_stat direct_cache_hit 0 + 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 unset CCACHE_NODIRECT $CCACHE_COMPILE $cpp_flag -c test1.c - expect_stat 'cache hit (direct)' 0 - expect_stat 'cache hit (preprocessed)' 1 - expect_stat 'cache miss' 1 - expect_stat 'files in cache' 2 + expect_stat direct_cache_hit 0 + expect_stat preprocessed_cache_hit 1 + expect_stat cache_miss 1 + expect_stat files_in_cache 2 expect_equal_object_files reference_test1.o test1.o $CCACHE_COMPILE $cpp_flag -c test1.c - expect_stat 'cache hit (direct)' 1 - expect_stat 'cache hit (preprocessed)' 1 - expect_stat 'cache miss' 1 - expect_stat 'files in cache' 2 + expect_stat direct_cache_hit 1 + expect_stat preprocessed_cache_hit 1 + expect_stat cache_miss 1 + expect_stat files_in_cache 2 expect_equal_object_files reference_test1.o test1.o } diff --git a/test/suites/debug_prefix_map.bash b/test/suites/debug_prefix_map.bash index ce36bfb5a..d0cc264bf 100644 --- a/test/suites/debug_prefix_map.bash +++ b/test/suites/debug_prefix_map.bash @@ -26,19 +26,19 @@ SUITE_debug_prefix_map() { cd dir1 CCACHE_BASEDIR=$(pwd) $CCACHE_COMPILE -I$(pwd)/include -g -fdebug-prefix-map=$(pwd)=some_name_not_likely_to_exist_in_path -c $(pwd)/src/test.c -o $(pwd)/test.o - expect_stat 'cache hit (direct)' 0 - expect_stat 'cache hit (preprocessed)' 0 - expect_stat 'cache miss' 1 - expect_stat 'files in cache' 2 + expect_stat direct_cache_hit 0 + expect_stat preprocessed_cache_hit 0 + expect_stat cache_miss 1 + expect_stat files_in_cache 2 expect_objdump_not_contains test.o "$(pwd)" expect_objdump_contains test.o some_name_not_likely_to_exist_in_path cd ../dir2 CCACHE_BASEDIR=$(pwd) $CCACHE_COMPILE -I$(pwd)/include -g -fdebug-prefix-map=$(pwd)=some_name_not_likely_to_exist_in_path -c $(pwd)/src/test.c -o $(pwd)/test.o - expect_stat 'cache hit (direct)' 1 - expect_stat 'cache hit (preprocessed)' 0 - expect_stat 'cache miss' 1 - expect_stat 'files in cache' 2 + expect_stat direct_cache_hit 1 + expect_stat preprocessed_cache_hit 0 + expect_stat cache_miss 1 + expect_stat files_in_cache 2 expect_objdump_not_contains test.o "$(pwd)" # ------------------------------------------------------------------------- @@ -46,18 +46,18 @@ SUITE_debug_prefix_map() { cd dir1 CCACHE_BASEDIR=$(pwd) $CCACHE_COMPILE -I$(pwd)/include -g -fdebug-prefix-map=$(pwd)=some_name_not_likely_to_exist_in_path -fdebug-prefix-map=foo=bar -c $(pwd)/src/test.c -o $(pwd)/test.o - expect_stat 'cache hit (direct)' 0 - expect_stat 'cache hit (preprocessed)' 0 - expect_stat 'cache miss' 1 - expect_stat 'files in cache' 2 + expect_stat direct_cache_hit 0 + expect_stat preprocessed_cache_hit 0 + expect_stat cache_miss 1 + expect_stat files_in_cache 2 expect_objdump_not_contains test.o "$(pwd)" expect_objdump_contains test.o some_name_not_likely_to_exist_in_path cd ../dir2 CCACHE_BASEDIR=$(pwd) $CCACHE_COMPILE -I$(pwd)/include -g -fdebug-prefix-map=$(pwd)=some_name_not_likely_to_exist_in_path -fdebug-prefix-map=foo=bar -c $(pwd)/src/test.c -o $(pwd)/test.o - expect_stat 'cache hit (direct)' 1 - expect_stat 'cache hit (preprocessed)' 0 - expect_stat 'cache miss' 1 - expect_stat 'files in cache' 2 + expect_stat direct_cache_hit 1 + expect_stat preprocessed_cache_hit 0 + expect_stat cache_miss 1 + expect_stat files_in_cache 2 expect_objdump_not_contains test.o "$(pwd)" } diff --git a/test/suites/depend.bash b/test/suites/depend.bash index 0d9fcc5be..66df696c1 100644 --- a/test/suites/depend.bash +++ b/test/suites/depend.bash @@ -96,32 +96,32 @@ SUITE_depend() { CCACHE_DEPEND=1 $CCACHE_COMPILE $DEPSFLAGS_CCACHE -c test.c expect_equal_object_files reference_test.o test.o - expect_stat 'cache hit (direct)' 0 - expect_stat 'cache hit (preprocessed)' 0 - expect_stat 'cache miss' 1 - expect_stat 'files in cache' 2 # result + manifest + expect_stat direct_cache_hit 0 + expect_stat preprocessed_cache_hit 0 + expect_stat cache_miss 1 + expect_stat files_in_cache 2 # result + manifest CCACHE_DEPEND=1 $CCACHE_COMPILE $DEPSFLAGS_CCACHE -c test.c expect_equal_object_files reference_test.o test.o - expect_stat 'cache hit (direct)' 1 - expect_stat 'cache hit (preprocessed)' 0 - expect_stat 'cache miss' 1 - expect_stat 'files in cache' 2 + expect_stat direct_cache_hit 1 + expect_stat preprocessed_cache_hit 0 + expect_stat cache_miss 1 + expect_stat files_in_cache 2 # ------------------------------------------------------------------------- TEST "No dependency file" CCACHE_DEPEND=1 $CCACHE_COMPILE -MP -MMD -MF /dev/null -c test.c - expect_stat 'cache hit (direct)' 0 - expect_stat 'cache hit (preprocessed)' 0 - expect_stat 'cache miss' 1 - expect_stat 'files in cache' 2 # result + manifest + expect_stat direct_cache_hit 0 + expect_stat preprocessed_cache_hit 0 + expect_stat cache_miss 1 + expect_stat files_in_cache 2 # result + manifest CCACHE_DEPEND=1 $CCACHE_COMPILE -MP -MMD -MF /dev/null -c test.c - expect_stat 'cache hit (direct)' 1 - expect_stat 'cache hit (preprocessed)' 0 - expect_stat 'cache miss' 1 - expect_stat 'files in cache' 2 + expect_stat direct_cache_hit 1 + expect_stat preprocessed_cache_hit 0 + expect_stat cache_miss 1 + expect_stat files_in_cache 2 # ------------------------------------------------------------------------- TEST "No explicit dependency file" @@ -130,17 +130,17 @@ SUITE_depend() { CCACHE_DEPEND=1 $CCACHE_COMPILE -MD -c test.c expect_equal_object_files reference_test.o test.o - expect_stat 'cache hit (direct)' 0 - expect_stat 'cache hit (preprocessed)' 0 - expect_stat 'cache miss' 1 - expect_stat 'files in cache' 2 # result + manifest + expect_stat direct_cache_hit 0 + expect_stat preprocessed_cache_hit 0 + expect_stat cache_miss 1 + expect_stat files_in_cache 2 # result + manifest CCACHE_DEPEND=1 $CCACHE_COMPILE -MD -c test.c expect_equal_object_files reference_test.o test.o - expect_stat 'cache hit (direct)' 1 - expect_stat 'cache hit (preprocessed)' 0 - expect_stat 'cache miss' 1 - expect_stat 'files in cache' 2 + expect_stat direct_cache_hit 1 + expect_stat preprocessed_cache_hit 0 + expect_stat cache_miss 1 + expect_stat files_in_cache 2 # ------------------------------------------------------------------------- TEST "Dependency file paths converted to relative if CCACHE_BASEDIR specified" @@ -165,15 +165,15 @@ EOF $REAL_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 'cache hit (direct)' 0 - expect_stat 'cache hit (preprocessed)' 0 - expect_stat 'cache miss' 1 + expect_stat direct_cache_hit 0 + expect_stat preprocessed_cache_hit 0 + expect_stat cache_miss 1 expect_content stderr-orig.txt "`cat stderr-baseline.txt`" CCACHE_DEPEND=1 $CCACHE_COMPILE -MD -Wall -W -c cpp-warning.c 2>stderr-mf.txt - expect_stat 'cache hit (direct)' 1 - expect_stat 'cache hit (preprocessed)' 0 - expect_stat 'cache miss' 1 + expect_stat direct_cache_hit 1 + expect_stat preprocessed_cache_hit 0 + expect_stat cache_miss 1 expect_content stderr-mf.txt "`cat stderr-baseline.txt`" # ------------------------------------------------------------------------- @@ -197,20 +197,20 @@ EOF CCACHE_DEPEND=1 CCACHE_BASEDIR=$BASEDIR1 $CCACHE_COMPILE $DEPFLAGS -c test.c expect_equal_object_files reference_test.o test.o expect_equal_content reference_test.d test.d - expect_stat 'cache hit (direct)' 0 - expect_stat 'cache hit (preprocessed)' 0 - expect_stat 'cache miss' 1 - expect_stat 'files in cache' 2 # result + manifest + expect_stat direct_cache_hit 0 + expect_stat preprocessed_cache_hit 0 + expect_stat cache_miss 1 + expect_stat files_in_cache 2 # result + manifest # Recompile dir1 first time. generate_reference_compiler_output CCACHE_DEPEND=1 CCACHE_BASEDIR=$BASEDIR1 $CCACHE_COMPILE $DEPFLAGS -c test.c expect_equal_object_files reference_test.o test.o expect_equal_content reference_test.d test.d - expect_stat 'cache hit (direct)' 1 - expect_stat 'cache hit (preprocessed)' 0 - expect_stat 'cache miss' 1 - expect_stat 'files in cache' 2 + expect_stat direct_cache_hit 1 + expect_stat preprocessed_cache_hit 0 + expect_stat cache_miss 1 + expect_stat files_in_cache 2 # Compile dir2. dir2 header changes the object file compared to dir1. cd $BASEDIR2 @@ -218,10 +218,10 @@ EOF CCACHE_DEPEND=1 CCACHE_BASEDIR=$BASEDIR2 $CCACHE_COMPILE $DEPFLAGS -c test.c expect_equal_object_files reference_test.o test.o expect_equal_content reference_test.d test.d - expect_stat 'cache hit (direct)' 1 - expect_stat 'cache hit (preprocessed)' 0 - expect_stat 'cache miss' 2 - expect_stat 'files in cache' 3 # 2x result, 1x manifest + expect_stat direct_cache_hit 1 + expect_stat preprocessed_cache_hit 0 + expect_stat cache_miss 2 + expect_stat files_in_cache 3 # 2x result, 1x manifest # Compile dir3. dir3 header change does not change object file compared to # dir1, but ccache still adds an additional .o/.d file in the cache due to @@ -231,10 +231,10 @@ EOF CCACHE_DEPEND=1 CCACHE_BASEDIR=$BASEDIR3 $CCACHE_COMPILE $DEPFLAGS -c test.c expect_equal_object_files reference_test.o test.o expect_equal_content reference_test.d test.d - expect_stat 'cache hit (direct)' 1 - expect_stat 'cache hit (preprocessed)' 0 - expect_stat 'cache miss' 3 - expect_stat 'files in cache' 4 # 3x result, 1x manifest + expect_stat direct_cache_hit 1 + expect_stat preprocessed_cache_hit 0 + expect_stat cache_miss 3 + expect_stat files_in_cache 4 # 3x result, 1x manifest # Compile dir4. dir4 header adds a new dependency. cd $BASEDIR4 @@ -243,10 +243,10 @@ EOF expect_equal_object_files reference_test.o test.o expect_equal_content reference_test.d test.d expect_different_content reference_test.d $BASEDIR1/test.d - expect_stat 'cache hit (direct)' 1 - expect_stat 'cache hit (preprocessed)' 0 - expect_stat 'cache miss' 4 - expect_stat 'files in cache' 5 # 4x result, 1x manifest + expect_stat direct_cache_hit 1 + expect_stat preprocessed_cache_hit 0 + expect_stat cache_miss 4 + expect_stat files_in_cache 5 # 4x result, 1x manifest # Recompile dir1 second time. cd $BASEDIR1 @@ -254,10 +254,10 @@ EOF CCACHE_DEPEND=1 CCACHE_BASEDIR=$BASEDIR1 $CCACHE_COMPILE $DEPFLAGS -c test.c expect_equal_object_files reference_test.o test.o expect_equal_content reference_test.d test.d - expect_stat 'cache hit (direct)' 2 - expect_stat 'cache hit (preprocessed)' 0 - expect_stat 'cache miss' 4 - expect_stat 'files in cache' 5 + expect_stat direct_cache_hit 2 + expect_stat preprocessed_cache_hit 0 + expect_stat cache_miss 4 + expect_stat files_in_cache 5 # Recompile dir2. cd $BASEDIR2 @@ -265,10 +265,10 @@ EOF CCACHE_DEPEND=1 CCACHE_BASEDIR=$BASEDIR2 $CCACHE_COMPILE $DEPFLAGS -c test.c expect_equal_object_files test.o test.o expect_equal_content reference_test.d test.d - expect_stat 'cache hit (direct)' 3 - expect_stat 'cache hit (preprocessed)' 0 - expect_stat 'cache miss' 4 - expect_stat 'files in cache' 5 + expect_stat direct_cache_hit 3 + expect_stat preprocessed_cache_hit 0 + expect_stat cache_miss 4 + expect_stat files_in_cache 5 # Recompile dir3. cd $BASEDIR3 @@ -276,10 +276,10 @@ EOF CCACHE_DEPEND=1 CCACHE_BASEDIR=$BASEDIR3 $CCACHE_COMPILE $DEPFLAGS -c test.c expect_equal_object_files reference_test.o test.o expect_equal_content reference_test.d test.d - expect_stat 'cache hit (direct)' 4 - expect_stat 'cache hit (preprocessed)' 0 - expect_stat 'cache miss' 4 - expect_stat 'files in cache' 5 + expect_stat direct_cache_hit 4 + expect_stat preprocessed_cache_hit 0 + expect_stat cache_miss 4 + expect_stat files_in_cache 5 # Recompile dir4. cd $BASEDIR4 @@ -288,10 +288,10 @@ EOF expect_equal_object_files reference_test.o test.o expect_equal_content reference_test.d test.d expect_different_content reference_test.d $BASEDIR1/test.d - expect_stat 'cache hit (direct)' 5 - expect_stat 'cache hit (preprocessed)' 0 - expect_stat 'cache miss' 4 - expect_stat 'files in cache' 5 + expect_stat direct_cache_hit 5 + expect_stat preprocessed_cache_hit 0 + expect_stat cache_miss 4 + expect_stat files_in_cache 5 # ------------------------------------------------------------------------- TEST "Source file with special characters" @@ -301,16 +301,16 @@ EOF mv 'file with$special#characters.d' reference.d CCACHE_DEPEND=1 $CCACHE_COMPILE -MMD -c 'file with$special#characters.c' - expect_stat 'cache hit (direct)' 0 - expect_stat 'cache hit (preprocessed)' 0 - expect_stat 'cache miss' 1 + expect_stat direct_cache_hit 0 + expect_stat preprocessed_cache_hit 0 + expect_stat cache_miss 1 expect_equal_content 'file with$special#characters.d' reference.d rm 'file with$special#characters.d' CCACHE_DEPEND=1 $CCACHE_COMPILE -MMD -c 'file with$special#characters.c' - expect_stat 'cache hit (direct)' 1 - expect_stat 'cache hit (preprocessed)' 0 - expect_stat 'cache miss' 1 + expect_stat direct_cache_hit 1 + expect_stat preprocessed_cache_hit 0 + expect_stat cache_miss 1 expect_equal_content 'file with$special#characters.d' reference.d } diff --git a/test/suites/direct.bash b/test/suites/direct.bash index 44f959fd3..616c03362 100644 --- a/test/suites/direct.bash +++ b/test/suites/direct.bash @@ -30,20 +30,20 @@ SUITE_direct() { $REAL_COMPILER -c -o reference_test.o test.c $CCACHE_COMPILE -c test.c - expect_stat 'cache hit (direct)' 0 - expect_stat 'cache hit (preprocessed)' 0 - expect_stat 'cache miss' 1 - expect_stat 'files in cache' 2 # result + manifest + expect_stat direct_cache_hit 0 + expect_stat preprocessed_cache_hit 0 + expect_stat cache_miss 1 + expect_stat files_in_cache 2 # result + manifest expect_equal_object_files reference_test.o test.o manifest_file=$(find $CCACHE_DIR -name '*M') backdate $manifest_file $CCACHE_COMPILE -c test.c - expect_stat 'cache hit (direct)' 1 - expect_stat 'cache hit (preprocessed)' 0 - expect_stat 'cache miss' 1 - expect_stat 'files in cache' 2 + expect_stat direct_cache_hit 1 + expect_stat preprocessed_cache_hit 0 + expect_stat cache_miss 1 + expect_stat files_in_cache 2 expect_equal_object_files reference_test.o test.o expect_newer_than $manifest_file test.c @@ -51,64 +51,64 @@ SUITE_direct() { TEST "Corrupt manifest file" $CCACHE_COMPILE -c test.c - expect_stat 'cache hit (direct)' 0 - expect_stat 'cache hit (preprocessed)' 0 - expect_stat 'cache miss' 1 + expect_stat direct_cache_hit 0 + expect_stat preprocessed_cache_hit 0 + expect_stat cache_miss 1 manifest_file=`find $CCACHE_DIR -name '*M'` rm $manifest_file touch $manifest_file $CCACHE_COMPILE -c test.c - expect_stat 'cache hit (direct)' 0 - expect_stat 'cache hit (preprocessed)' 1 - expect_stat 'cache miss' 1 + expect_stat direct_cache_hit 0 + expect_stat preprocessed_cache_hit 1 + expect_stat cache_miss 1 $CCACHE_COMPILE -c test.c - expect_stat 'cache hit (direct)' 1 - expect_stat 'cache hit (preprocessed)' 1 - expect_stat 'cache miss' 1 + expect_stat direct_cache_hit 1 + expect_stat preprocessed_cache_hit 1 + expect_stat cache_miss 1 # ------------------------------------------------------------------------- TEST "CCACHE_NODIRECT" CCACHE_NODIRECT=1 $CCACHE_COMPILE -c test.c - expect_stat 'cache hit (direct)' 0 - expect_stat 'cache hit (preprocessed)' 0 - expect_stat 'cache miss' 1 + expect_stat direct_cache_hit 0 + expect_stat preprocessed_cache_hit 0 + expect_stat cache_miss 1 CCACHE_NODIRECT=1 $CCACHE_COMPILE -c test.c - expect_stat 'cache hit (direct)' 0 - expect_stat 'cache hit (preprocessed)' 1 - expect_stat 'cache miss' 1 + expect_stat direct_cache_hit 0 + expect_stat preprocessed_cache_hit 1 + expect_stat cache_miss 1 # ------------------------------------------------------------------------- TEST "Modified include file" $CCACHE_COMPILE -c test.c - expect_stat 'cache hit (direct)' 0 - expect_stat 'cache hit (preprocessed)' 0 - expect_stat 'cache miss' 1 + expect_stat direct_cache_hit 0 + expect_stat preprocessed_cache_hit 0 + expect_stat cache_miss 1 echo "int test3_2;" >>test3.h backdate test3.h $CCACHE_COMPILE -c test.c - expect_stat 'cache hit (direct)' 0 - expect_stat 'cache hit (preprocessed)' 0 - expect_stat 'cache miss' 2 + expect_stat direct_cache_hit 0 + expect_stat preprocessed_cache_hit 0 + expect_stat cache_miss 2 $CCACHE_COMPILE -c test.c - expect_stat 'cache hit (direct)' 1 - expect_stat 'cache hit (preprocessed)' 0 - expect_stat 'cache miss' 2 + expect_stat direct_cache_hit 1 + expect_stat preprocessed_cache_hit 0 + expect_stat cache_miss 2 # ------------------------------------------------------------------------- TEST "Removed but previously compiled header file" $CCACHE_COMPILE -c test.c - expect_stat 'cache hit (direct)' 0 - expect_stat 'cache hit (preprocessed)' 0 - expect_stat 'cache miss' 1 + expect_stat direct_cache_hit 0 + expect_stat preprocessed_cache_hit 0 + expect_stat cache_miss 1 rm test3.h cat <test1.h @@ -118,14 +118,14 @@ EOF backdate test1.h $CCACHE_COMPILE -c test.c - expect_stat 'cache hit (direct)' 0 - expect_stat 'cache hit (preprocessed)' 0 - expect_stat 'cache miss' 2 + expect_stat direct_cache_hit 0 + expect_stat preprocessed_cache_hit 0 + expect_stat cache_miss 2 $CCACHE_COMPILE -c test.c - expect_stat 'cache hit (direct)' 1 - expect_stat 'cache hit (preprocessed)' 0 - expect_stat 'cache miss' 2 + expect_stat direct_cache_hit 1 + expect_stat preprocessed_cache_hit 0 + expect_stat cache_miss 2 # ------------------------------------------------------------------------- TEST "Calculation of dependency file names" @@ -138,13 +138,13 @@ EOF dep_file=testdir/`echo test$ext | sed 's/\.[^.]*\$//'`.d $CCACHE_COMPILE -MD -c test.c -o testdir/test$ext - expect_stat 'cache hit (direct)' $((3 * i)) - expect_stat 'cache miss' $((i + 1)) + expect_stat direct_cache_hit $((3 * i)) + expect_stat cache_miss $((i + 1)) rm -f $dep_file $CCACHE_COMPILE -MD -c test.c -o testdir/test$ext - expect_stat 'cache hit (direct)' $((3 * i + 1)) - expect_stat 'cache miss' $((i + 1)) + expect_stat direct_cache_hit $((3 * i + 1)) + expect_stat cache_miss $((i + 1)) expect_exists $dep_file if ! grep "test$ext:" $dep_file >/dev/null 2>&1; then test_failed "$dep_file does not contain \"test$ext:\"" @@ -152,13 +152,13 @@ EOF dep_target=foo.bar $CCACHE_COMPILE -MD -MQ $dep_target -c test.c -o testdir/test$ext - expect_stat 'cache hit (direct)' $((3 * i + 1)) - expect_stat 'cache miss' $((i + 2)) + expect_stat direct_cache_hit $((3 * i + 1)) + expect_stat cache_miss $((i + 2)) rm -f $dep_target $CCACHE_COMPILE -MD -MQ $dep_target -c test.c -o testdir/test$ext - expect_stat 'cache hit (direct)' $((3 * i + 2)) - expect_stat 'cache miss' $((i + 2)) + expect_stat direct_cache_hit $((3 * i + 2)) + expect_stat cache_miss $((i + 2)) expect_exists $dep_file if ! grep $dep_target $dep_file >/dev/null 2>&1; then test_failed "$dep_file does not contain $dep_target" @@ -166,7 +166,7 @@ EOF i=$((i + 1)) done - expect_stat 'files in cache' $((2 * i + 2)) + expect_stat files_in_cache $((2 * i + 2)) # ------------------------------------------------------------------------- TEST "-MMD for different source files" @@ -208,14 +208,14 @@ EOF # cache miss $CCACHE_COMPILE -c test.c $dep_args $obj_args - expect_stat 'cache hit (direct)' 0 - expect_stat 'cache miss' 1 + expect_stat direct_cache_hit 0 + expect_stat cache_miss 1 expect_equal_text_content $dep_file.real $dep_file # cache hit $CCACHE_COMPILE -c test.c $dep_args $obj_args - expect_stat 'cache hit (direct)' 1 - expect_stat 'cache miss' 1 + expect_stat direct_cache_hit 1 + expect_stat cache_miss 1 expect_equal_text_content $dep_file.real $dep_file # change object file name @@ -244,8 +244,8 @@ EOF $CCACHE_COMPILE $option -c test1.c -o $obj diff -u orig.d $dep expect_equal_content $dep orig.d - expect_stat 'cache hit (direct)' $i - expect_stat 'cache miss' 1 + expect_stat direct_cache_hit $i + expect_stat cache_miss 1 i=$((i + 1)) done @@ -272,8 +272,8 @@ EOF $CCACHE_COMPILE -MMD -c $src -o $obj dep=$(echo $obj | sed 's/\.o$/.d/') expect_content $dep "$obj: $src" - expect_stat 'cache hit (direct)' $hit - expect_stat 'cache miss' 1 + expect_stat direct_cache_hit $hit + expect_stat cache_miss 1 hit=$((hit + 1)) rm $orig_dep @@ -316,9 +316,9 @@ EOF TEST "-Wp,-MD" $CCACHE_COMPILE -c -Wp,-MD,other.d test.c - expect_stat 'cache hit (direct)' 0 - expect_stat 'cache hit (preprocessed)' 0 - expect_stat 'cache miss' 1 + expect_stat direct_cache_hit 0 + expect_stat preprocessed_cache_hit 0 + 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 @@ -326,16 +326,16 @@ EOF rm -f other.d $CCACHE_COMPILE -c -Wp,-MD,other.d test.c - expect_stat 'cache hit (direct)' 1 - expect_stat 'cache hit (preprocessed)' 0 - expect_stat 'cache miss' 1 + expect_stat direct_cache_hit 1 + expect_stat preprocessed_cache_hit 0 + expect_stat cache_miss 1 expect_equal_content other.d expected.d expect_equal_object_files reference_test.o test.o $CCACHE_COMPILE -c -Wp,-MD,different_name.d test.c - expect_stat 'cache hit (direct)' 2 - expect_stat 'cache hit (preprocessed)' 0 - expect_stat 'cache miss' 1 + expect_stat direct_cache_hit 2 + expect_stat preprocessed_cache_hit 0 + expect_stat cache_miss 1 expect_equal_content different_name.d expected.d expect_equal_object_files reference_test.o test.o @@ -343,9 +343,9 @@ EOF TEST "-Wp,-MMD" $CCACHE_COMPILE -c -Wp,-MMD,other.d test.c - expect_stat 'cache hit (direct)' 0 - expect_stat 'cache hit (preprocessed)' 0 - expect_stat 'cache miss' 1 + expect_stat direct_cache_hit 0 + expect_stat preprocessed_cache_hit 0 + 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 @@ -353,16 +353,16 @@ EOF rm -f other.d $CCACHE_COMPILE -c -Wp,-MMD,other.d test.c - expect_stat 'cache hit (direct)' 1 - expect_stat 'cache hit (preprocessed)' 0 - expect_stat 'cache miss' 1 + expect_stat direct_cache_hit 1 + expect_stat preprocessed_cache_hit 0 + expect_stat cache_miss 1 expect_equal_content other.d expected_mmd.d expect_equal_object_files reference_test.o test.o $CCACHE_COMPILE -c -Wp,-MMD,different_name.d test.c - expect_stat 'cache hit (direct)' 2 - expect_stat 'cache hit (preprocessed)' 0 - expect_stat 'cache miss' 1 + expect_stat direct_cache_hit 2 + expect_stat preprocessed_cache_hit 0 + expect_stat cache_miss 1 expect_equal_content different_name.d expected_mmd.d expect_equal_object_files reference_test.o test.o @@ -370,14 +370,14 @@ EOF TEST "-Wp,-D" $CCACHE_COMPILE -c -Wp,-DFOO test.c - expect_stat 'cache hit (direct)' 0 - expect_stat 'cache hit (preprocessed)' 0 - expect_stat 'cache miss' 1 + expect_stat direct_cache_hit 0 + expect_stat preprocessed_cache_hit 0 + expect_stat cache_miss 1 $CCACHE_COMPILE -c -DFOO test.c - expect_stat 'cache hit (direct)' 1 - expect_stat 'cache hit (preprocessed)' 0 - expect_stat 'cache miss' 1 + expect_stat direct_cache_hit 1 + expect_stat preprocessed_cache_hit 0 + expect_stat cache_miss 1 # ------------------------------------------------------------------------- TEST "-Wp, with multiple arguments" @@ -388,15 +388,15 @@ EOF touch source.c $CCACHE_COMPILE -c -Wp,-MMD,source.d,-MT,source.o source.c 2>/dev/null - expect_stat 'cache hit (direct)' 0 - expect_stat 'cache hit (preprocessed)' 0 - expect_stat 'cache miss' 1 + expect_stat direct_cache_hit 0 + expect_stat preprocessed_cache_hit 0 + expect_stat cache_miss 1 expect_content source.d "source.o: source.c" $CCACHE_COMPILE -c -Wp,-MMD,source.d,-MT,source.o source.c 2>/dev/null - expect_stat 'cache hit (direct)' 0 - expect_stat 'cache hit (preprocessed)' 1 - expect_stat 'cache miss' 1 + expect_stat direct_cache_hit 0 + expect_stat preprocessed_cache_hit 1 + expect_stat cache_miss 1 expect_content source.d "source.o: source.c" # ------------------------------------------------------------------------- @@ -422,17 +422,17 @@ EOF $CCACHE_COMPILE -c test.c $CCACHE_COMPILE -c test.c done - expect_stat 'cache hit (direct)' 5 - expect_stat 'cache hit (preprocessed)' 0 - expect_stat 'cache miss' 5 + expect_stat direct_cache_hit 5 + expect_stat preprocessed_cache_hit 0 + expect_stat cache_miss 5 # ------------------------------------------------------------------------- TEST "-MD" $CCACHE_COMPILE -c -MD test.c - expect_stat 'cache hit (direct)' 0 - expect_stat 'cache hit (preprocessed)' 0 - expect_stat 'cache miss' 1 + expect_stat direct_cache_hit 0 + 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 @@ -440,9 +440,9 @@ EOF rm -f test.d $CCACHE_COMPILE -c -MD test.c - expect_stat 'cache hit (direct)' 1 - expect_stat 'cache hit (preprocessed)' 0 - expect_stat 'cache miss' 1 + expect_stat direct_cache_hit 1 + expect_stat preprocessed_cache_hit 0 + expect_stat cache_miss 1 expect_equal_content test.d expected.d expect_equal_object_files reference_test.o test.o @@ -454,17 +454,17 @@ int test() { return 0; } EOF $CCACHE_COMPILE -c -fprofile-arcs -ftest-coverage code.c - expect_stat 'cache hit (direct)' 0 - expect_stat 'cache hit (preprocessed)' 0 - expect_stat 'cache miss' 1 + expect_stat direct_cache_hit 0 + expect_stat preprocessed_cache_hit 0 + expect_stat cache_miss 1 expect_exists code.gcno rm code.gcno $CCACHE_COMPILE -c -fprofile-arcs -ftest-coverage code.c - expect_stat 'cache hit (direct)' 1 - expect_stat 'cache hit (preprocessed)' 0 - expect_stat 'cache miss' 1 + expect_stat direct_cache_hit 1 + expect_stat preprocessed_cache_hit 0 + expect_stat cache_miss 1 expect_exists code.gcno # ------------------------------------------------------------------------- @@ -476,17 +476,17 @@ EOF if $REAL_COMPILER -c -fstack-usage code.c >/dev/null 2>&1; then $CCACHE_COMPILE -c -fstack-usage code.c - expect_stat 'cache hit (direct)' 0 - expect_stat 'cache hit (preprocessed)' 0 - expect_stat 'cache miss' 1 + expect_stat direct_cache_hit 0 + expect_stat preprocessed_cache_hit 0 + expect_stat cache_miss 1 expect_exists code.su rm code.su $CCACHE_COMPILE -c -fstack-usage code.c - expect_stat 'cache hit (direct)' 1 - expect_stat 'cache hit (preprocessed)' 0 - expect_stat 'cache miss' 1 + expect_stat direct_cache_hit 1 + expect_stat preprocessed_cache_hit 0 + expect_stat cache_miss 1 expect_exists code.su fi @@ -494,9 +494,9 @@ EOF TEST "Direct mode on cache created by ccache without direct mode support" CCACHE_NODIRECT=1 $CCACHE_COMPILE -c -MD test.c - expect_stat 'cache hit (direct)' 0 - expect_stat 'cache hit (preprocessed)' 0 - expect_stat 'cache miss' 1 + expect_stat direct_cache_hit 0 + 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 expect_equal_object_files reference_test.o test.o @@ -504,27 +504,27 @@ EOF rm -f test.d CCACHE_NODIRECT=1 $CCACHE_COMPILE -c -MD test.c - expect_stat 'cache hit (direct)' 0 - expect_stat 'cache hit (preprocessed)' 1 - expect_stat 'cache miss' 1 + expect_stat direct_cache_hit 0 + expect_stat preprocessed_cache_hit 1 + expect_stat cache_miss 1 expect_equal_content test.d expected.d expect_equal_object_files reference_test.o test.o rm -f test.d $CCACHE_COMPILE -c -MD test.c - expect_stat 'cache hit (direct)' 0 - expect_stat 'cache hit (preprocessed)' 2 - expect_stat 'cache miss' 1 + expect_stat direct_cache_hit 0 + expect_stat preprocessed_cache_hit 2 + expect_stat cache_miss 1 expect_equal_content test.d expected.d expect_equal_object_files reference_test.o test.o rm -f test.d $CCACHE_COMPILE -c -MD test.c - expect_stat 'cache hit (direct)' 1 - expect_stat 'cache hit (preprocessed)' 2 - expect_stat 'cache miss' 1 + expect_stat direct_cache_hit 1 + expect_stat preprocessed_cache_hit 2 + expect_stat cache_miss 1 expect_equal_content test.d expected.d expect_equal_object_files reference_test.o test.o @@ -532,9 +532,9 @@ EOF TEST "-MF" $CCACHE_COMPILE -c -MD -MF other.d test.c - expect_stat 'cache hit (direct)' 0 - expect_stat 'cache hit (preprocessed)' 0 - expect_stat 'cache miss' 1 + expect_stat direct_cache_hit 0 + 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 expect_equal_object_files reference_test.o test.o @@ -542,25 +542,25 @@ EOF rm -f other.d $CCACHE_COMPILE -c -MD -MF other.d test.c - expect_stat 'cache hit (direct)' 1 - expect_stat 'cache hit (preprocessed)' 0 - expect_stat 'cache miss' 1 + expect_stat direct_cache_hit 1 + expect_stat preprocessed_cache_hit 0 + expect_stat cache_miss 1 expect_equal_content other.d expected.d expect_equal_object_files reference_test.o test.o $CCACHE_COMPILE -c -MD -MF different_name.d test.c - expect_stat 'cache hit (direct)' 2 - expect_stat 'cache hit (preprocessed)' 0 - expect_stat 'cache miss' 1 + expect_stat direct_cache_hit 2 + expect_stat preprocessed_cache_hit 0 + expect_stat cache_miss 1 expect_equal_content different_name.d expected.d expect_equal_object_files reference_test.o test.o rm -f different_name.d $CCACHE_COMPILE -c -MD -MFthird_name.d test.c - expect_stat 'cache hit (direct)' 3 - expect_stat 'cache hit (preprocessed)' 0 - expect_stat 'cache miss' 1 + expect_stat direct_cache_hit 3 + expect_stat preprocessed_cache_hit 0 + expect_stat cache_miss 1 expect_equal_content third_name.d expected.d expect_equal_object_files reference_test.o test.o @@ -570,31 +570,31 @@ EOF TEST "MF /dev/null" $CCACHE_COMPILE -c -MD -MF /dev/null test.c - expect_stat 'cache hit (direct)' 0 - expect_stat 'cache hit (preprocessed)' 0 - expect_stat 'cache miss' 1 - expect_stat 'files in cache' 2 # result + manifest + expect_stat direct_cache_hit 0 + expect_stat preprocessed_cache_hit 0 + expect_stat cache_miss 1 + expect_stat files_in_cache 2 # result + manifest $CCACHE_COMPILE -c -MD -MF /dev/null test.c - expect_stat 'cache hit (direct)' 1 - expect_stat 'cache hit (preprocessed)' 0 - expect_stat 'cache miss' 1 - expect_stat 'files in cache' 2 + expect_stat direct_cache_hit 1 + expect_stat preprocessed_cache_hit 0 + expect_stat cache_miss 1 + expect_stat files_in_cache 2 $CCACHE_COMPILE -c -MD -MF test.d test.c - expect_stat 'cache hit (direct)' 1 - expect_stat 'cache hit (preprocessed)' 0 - expect_stat 'cache miss' 2 - expect_stat 'files in cache' 4 + expect_stat direct_cache_hit 1 + expect_stat preprocessed_cache_hit 0 + expect_stat cache_miss 2 + expect_stat files_in_cache 4 expect_equal_content test.d expected.d rm -f test.d $CCACHE_COMPILE -c -MD -MF test.d test.c - expect_stat 'cache hit (direct)' 2 - expect_stat 'cache hit (preprocessed)' 0 - expect_stat 'cache miss' 2 - expect_stat 'files in cache' 4 + expect_stat direct_cache_hit 2 + expect_stat preprocessed_cache_hit 0 + expect_stat cache_miss 2 + expect_stat files_in_cache 4 expect_equal_content test.d expected.d # ------------------------------------------------------------------------- @@ -610,20 +610,20 @@ int stderr(void) } EOF $CCACHE_COMPILE -Wall -W -c cpp-warning.c 2>stderr-orig.txt - expect_stat 'cache hit (direct)' 0 - expect_stat 'cache hit (preprocessed)' 0 - expect_stat 'cache miss' 1 + expect_stat direct_cache_hit 0 + expect_stat preprocessed_cache_hit 0 + expect_stat cache_miss 1 CCACHE_NODIRECT=1 $CCACHE_COMPILE -Wall -W -c cpp-warning.c 2>stderr-cpp.txt - expect_stat 'cache hit (direct)' 0 - expect_stat 'cache hit (preprocessed)' 1 - expect_stat 'cache miss' 1 + expect_stat direct_cache_hit 0 + expect_stat preprocessed_cache_hit 1 + expect_stat cache_miss 1 expect_content stderr-cpp.txt "`cat stderr-orig.txt`" $CCACHE_COMPILE -Wall -W -c cpp-warning.c 2>stderr-mf.txt - expect_stat 'cache hit (direct)' 1 - expect_stat 'cache hit (preprocessed)' 1 - expect_stat 'cache miss' 1 + expect_stat direct_cache_hit 1 + expect_stat preprocessed_cache_hit 1 + expect_stat cache_miss 1 expect_content stderr-mf.txt "`cat stderr-orig.txt`" # ------------------------------------------------------------------------- @@ -632,14 +632,14 @@ EOF touch empty.c $CCACHE_COMPILE -c empty.c - expect_stat 'cache hit (direct)' 0 - expect_stat 'cache hit (preprocessed)' 0 - expect_stat 'cache miss' 1 + expect_stat direct_cache_hit 0 + expect_stat preprocessed_cache_hit 0 + expect_stat cache_miss 1 $CCACHE_COMPILE -c empty.c - expect_stat 'cache hit (direct)' 1 - expect_stat 'cache hit (preprocessed)' 0 - expect_stat 'cache miss' 1 + expect_stat direct_cache_hit 1 + expect_stat preprocessed_cache_hit 0 + expect_stat cache_miss 1 # ------------------------------------------------------------------------- TEST "Empty include file" @@ -650,13 +650,13 @@ EOF EOF backdate empty.h $CCACHE_COMPILE -c include_empty.c - expect_stat 'cache hit (direct)' 0 - expect_stat 'cache hit (preprocessed)' 0 - expect_stat 'cache miss' 1 + expect_stat direct_cache_hit 0 + expect_stat preprocessed_cache_hit 0 + expect_stat cache_miss 1 $CCACHE_COMPILE -c include_empty.c - expect_stat 'cache hit (direct)' 1 - expect_stat 'cache hit (preprocessed)' 0 - expect_stat 'cache miss' 1 + expect_stat direct_cache_hit 1 + expect_stat preprocessed_cache_hit 0 + expect_stat cache_miss 1 # ------------------------------------------------------------------------- TEST "The source file path is included in the hash" @@ -668,34 +668,34 @@ EOF cp file.c file2.c $CCACHE_COMPILE -c file.c - expect_stat 'cache hit (direct)' 0 - expect_stat 'cache hit (preprocessed)' 0 - expect_stat 'cache miss' 1 + expect_stat direct_cache_hit 0 + expect_stat preprocessed_cache_hit 0 + expect_stat cache_miss 1 $CCACHE_COMPILE -c file.c - expect_stat 'cache hit (direct)' 1 - expect_stat 'cache hit (preprocessed)' 0 - expect_stat 'cache miss' 1 + expect_stat direct_cache_hit 1 + expect_stat preprocessed_cache_hit 0 + expect_stat cache_miss 1 $CCACHE_COMPILE -c file2.c - expect_stat 'cache hit (direct)' 1 - expect_stat 'cache hit (preprocessed)' 0 - expect_stat 'cache miss' 2 + expect_stat direct_cache_hit 1 + expect_stat preprocessed_cache_hit 0 + expect_stat cache_miss 2 $CCACHE_COMPILE -c file2.c - expect_stat 'cache hit (direct)' 2 - expect_stat 'cache hit (preprocessed)' 0 - expect_stat 'cache miss' 2 + expect_stat direct_cache_hit 2 + expect_stat preprocessed_cache_hit 0 + expect_stat cache_miss 2 $CCACHE_COMPILE -c $(pwd)/file.c - expect_stat 'cache hit (direct)' 2 - expect_stat 'cache hit (preprocessed)' 0 - expect_stat 'cache miss' 3 + expect_stat direct_cache_hit 2 + expect_stat preprocessed_cache_hit 0 + expect_stat cache_miss 3 $CCACHE_COMPILE -c $(pwd)/file.c - expect_stat 'cache hit (direct)' 3 - expect_stat 'cache hit (preprocessed)' 0 - expect_stat 'cache miss' 3 + expect_stat direct_cache_hit 3 + expect_stat preprocessed_cache_hit 0 + expect_stat cache_miss 3 # ------------------------------------------------------------------------- TEST "The source file path is included even if sloppiness = file_macro" @@ -707,34 +707,34 @@ EOF cp file.c file2.c CCACHE_SLOPPINESS="$DEFAULT_SLOPPINESS file_macro" $CCACHE_COMPILE -c file.c - expect_stat 'cache hit (direct)' 0 - expect_stat 'cache hit (preprocessed)' 0 - expect_stat 'cache miss' 1 + expect_stat direct_cache_hit 0 + expect_stat preprocessed_cache_hit 0 + expect_stat cache_miss 1 CCACHE_SLOPPINESS="$DEFAULT_SLOPPINESS file_macro" $CCACHE_COMPILE -c file.c - expect_stat 'cache hit (direct)' 1 - expect_stat 'cache hit (preprocessed)' 0 - expect_stat 'cache miss' 1 + expect_stat direct_cache_hit 1 + expect_stat preprocessed_cache_hit 0 + expect_stat cache_miss 1 CCACHE_SLOPPINESS="$DEFAULT_SLOPPINESS file_macro" $CCACHE_COMPILE -c file2.c - expect_stat 'cache hit (direct)' 1 - expect_stat 'cache hit (preprocessed)' 0 - expect_stat 'cache miss' 2 + expect_stat direct_cache_hit 1 + expect_stat preprocessed_cache_hit 0 + expect_stat cache_miss 2 CCACHE_SLOPPINESS="$DEFAULT_SLOPPINESS file_macro" $CCACHE_COMPILE -c file2.c - expect_stat 'cache hit (direct)' 2 - expect_stat 'cache hit (preprocessed)' 0 - expect_stat 'cache miss' 2 + expect_stat direct_cache_hit 2 + expect_stat preprocessed_cache_hit 0 + expect_stat cache_miss 2 CCACHE_SLOPPINESS="$DEFAULT_SLOPPINESS file_macro" $CCACHE_COMPILE -c $(pwd)/file.c - expect_stat 'cache hit (direct)' 2 - expect_stat 'cache hit (preprocessed)' 0 - expect_stat 'cache miss' 3 + expect_stat direct_cache_hit 2 + expect_stat preprocessed_cache_hit 0 + expect_stat cache_miss 3 CCACHE_SLOPPINESS="$DEFAULT_SLOPPINESS file_macro" $CCACHE_COMPILE -c $(pwd)/file.c - expect_stat 'cache hit (direct)' 3 - expect_stat 'cache hit (preprocessed)' 0 - expect_stat 'cache miss' 3 + expect_stat direct_cache_hit 3 + expect_stat preprocessed_cache_hit 0 + expect_stat cache_miss 3 # ------------------------------------------------------------------------- TEST "Relative includes for identical source code in different directories" @@ -758,24 +758,24 @@ EOF backdate b/file.h $CCACHE_COMPILE -c a/file.c - expect_stat 'cache hit (direct)' 0 - expect_stat 'cache hit (preprocessed)' 0 - expect_stat 'cache miss' 1 + expect_stat direct_cache_hit 0 + expect_stat preprocessed_cache_hit 0 + expect_stat cache_miss 1 $CCACHE_COMPILE -c a/file.c - expect_stat 'cache hit (direct)' 1 - expect_stat 'cache hit (preprocessed)' 0 - expect_stat 'cache miss' 1 + expect_stat direct_cache_hit 1 + expect_stat preprocessed_cache_hit 0 + expect_stat cache_miss 1 $CCACHE_COMPILE -c b/file.c - expect_stat 'cache hit (direct)' 1 - expect_stat 'cache hit (preprocessed)' 0 - expect_stat 'cache miss' 2 + expect_stat direct_cache_hit 1 + expect_stat preprocessed_cache_hit 0 + expect_stat cache_miss 2 $CCACHE_COMPILE -c b/file.c - expect_stat 'cache hit (direct)' 2 - expect_stat 'cache hit (preprocessed)' 0 - expect_stat 'cache miss' 2 + expect_stat direct_cache_hit 2 + expect_stat preprocessed_cache_hit 0 + expect_stat cache_miss 2 # ------------------------------------------------------------------------- TEST "__TIME__ in source file disables direct mode" @@ -786,14 +786,14 @@ int test; EOF $CCACHE_COMPILE -c time.c - expect_stat 'cache hit (direct)' 0 - expect_stat 'cache hit (preprocessed)' 0 - expect_stat 'cache miss' 1 + expect_stat direct_cache_hit 0 + expect_stat preprocessed_cache_hit 0 + expect_stat cache_miss 1 $CCACHE_COMPILE -c time.c - expect_stat 'cache hit (direct)' 0 - expect_stat 'cache hit (preprocessed)' 1 - expect_stat 'cache miss' 1 + expect_stat direct_cache_hit 0 + expect_stat preprocessed_cache_hit 1 + expect_stat cache_miss 1 # ------------------------------------------------------------------------- TEST "__TIME__ in include file disables direct mode" @@ -809,14 +809,14 @@ EOF EOF $CCACHE_COMPILE -c time_h.c - expect_stat 'cache hit (direct)' 0 - expect_stat 'cache hit (preprocessed)' 0 - expect_stat 'cache miss' 1 + expect_stat direct_cache_hit 0 + expect_stat preprocessed_cache_hit 0 + expect_stat cache_miss 1 $CCACHE_COMPILE -c time_h.c - expect_stat 'cache hit (direct)' 0 - expect_stat 'cache hit (preprocessed)' 1 - expect_stat 'cache miss' 1 + expect_stat direct_cache_hit 0 + expect_stat preprocessed_cache_hit 1 + expect_stat cache_miss 1 # ------------------------------------------------------------------------- TEST "__TIME__ in source file ignored if sloppy" @@ -827,14 +827,14 @@ int test; EOF CCACHE_SLOPPINESS="$DEFAULT_SLOPPINESS time_macros" $CCACHE_COMPILE -c time.c - expect_stat 'cache hit (direct)' 0 - expect_stat 'cache hit (preprocessed)' 0 - expect_stat 'cache miss' 1 + expect_stat direct_cache_hit 0 + expect_stat preprocessed_cache_hit 0 + expect_stat cache_miss 1 CCACHE_SLOPPINESS="$DEFAULT_SLOPPINESS time_macros" $CCACHE_COMPILE -c time.c - expect_stat 'cache hit (direct)' 1 - expect_stat 'cache hit (preprocessed)' 0 - expect_stat 'cache miss' 1 + expect_stat direct_cache_hit 1 + expect_stat preprocessed_cache_hit 0 + expect_stat cache_miss 1 # ------------------------------------------------------------------------- TEST "__TIME__ in include file ignored if sloppy" @@ -848,14 +848,14 @@ EOF #include "time.h" EOF CCACHE_SLOPPINESS="$DEFAULT_SLOPPINESS time_macros" $CCACHE_COMPILE -c time_h.c - expect_stat 'cache hit (direct)' 0 - expect_stat 'cache hit (preprocessed)' 0 - expect_stat 'cache miss' 1 + expect_stat direct_cache_hit 0 + expect_stat preprocessed_cache_hit 0 + expect_stat cache_miss 1 CCACHE_SLOPPINESS="$DEFAULT_SLOPPINESS time_macros" $CCACHE_COMPILE -c time_h.c - expect_stat 'cache hit (direct)' 1 - expect_stat 'cache hit (preprocessed)' 0 - expect_stat 'cache miss' 1 + expect_stat direct_cache_hit 1 + expect_stat preprocessed_cache_hit 0 + expect_stat cache_miss 1 # ------------------------------------------------------------------------- TEST "Too new include file disables direct mode" @@ -869,14 +869,14 @@ EOF touch -t 203801010000 new.h $CCACHE_COMPILE -c new.c - expect_stat 'cache hit (direct)' 0 - expect_stat 'cache hit (preprocessed)' 0 - expect_stat 'cache miss' 1 + expect_stat direct_cache_hit 0 + expect_stat preprocessed_cache_hit 0 + expect_stat cache_miss 1 $CCACHE_COMPILE -c new.c - expect_stat 'cache hit (direct)' 0 - expect_stat 'cache hit (preprocessed)' 1 - expect_stat 'cache miss' 1 + expect_stat direct_cache_hit 0 + expect_stat preprocessed_cache_hit 1 + expect_stat cache_miss 1 # ------------------------------------------------------------------------- TEST "__DATE__ in header file results in direct cache hit as the date remains the same" @@ -893,14 +893,14 @@ EOF backdate test_date2.c test_date2.h $CCACHE_COMPILE -MP -MMD -MF test_date2.d -c test_date2.c - expect_stat 'cache hit (direct)' 0 - expect_stat 'cache hit (preprocessed)' 0 - expect_stat 'cache miss' 1 + expect_stat direct_cache_hit 0 + expect_stat preprocessed_cache_hit 0 + expect_stat cache_miss 1 $CCACHE_COMPILE -MP -MMD -MF test_date2.d -c test_date2.c - expect_stat 'cache hit (direct)' 1 - expect_stat 'cache hit (preprocessed)' 0 - expect_stat 'cache miss' 1 + expect_stat direct_cache_hit 1 + expect_stat preprocessed_cache_hit 0 + expect_stat cache_miss 1 # ------------------------------------------------------------------------- TEST "New include file ignored if sloppy" @@ -914,27 +914,27 @@ EOF touch -t 203801010000 new.h CCACHE_SLOPPINESS="$DEFAULT_SLOPPINESS include_file_mtime" $CCACHE_COMPILE -c new.c - expect_stat 'cache hit (direct)' 0 - expect_stat 'cache hit (preprocessed)' 0 - expect_stat 'cache miss' 1 + expect_stat direct_cache_hit 0 + expect_stat preprocessed_cache_hit 0 + expect_stat cache_miss 1 CCACHE_SLOPPINESS="$DEFAULT_SLOPPINESS include_file_mtime" $CCACHE_COMPILE -c new.c - expect_stat 'cache hit (direct)' 1 - expect_stat 'cache hit (preprocessed)' 0 - expect_stat 'cache miss' 1 + expect_stat direct_cache_hit 1 + expect_stat preprocessed_cache_hit 0 + expect_stat cache_miss 1 # ------------------------------------------------------------------------- TEST "Sloppy Clang index store" CCACHE_SLOPPINESS="$DEFAULT_SLOPPINESS clang_index_store" $CCACHE_COMPILE -index-store-path foo -c test.c - expect_stat 'cache hit (direct)' 0 - expect_stat 'cache hit (preprocessed)' 0 - expect_stat 'cache miss' 1 + expect_stat direct_cache_hit 0 + expect_stat preprocessed_cache_hit 0 + expect_stat cache_miss 1 CCACHE_SLOPPINESS="$DEFAULT_SLOPPINESS clang_index_store" $CCACHE_COMPILE -index-store-path bar -c test.c - expect_stat 'cache hit (direct)' 1 - expect_stat 'cache hit (preprocessed)' 0 - expect_stat 'cache miss' 1 + expect_stat direct_cache_hit 1 + expect_stat preprocessed_cache_hit 0 + expect_stat cache_miss 1 # ------------------------------------------------------------------------- # Check that environment variables that affect the preprocessor are taken @@ -955,24 +955,24 @@ EOF backdate subdir1/foo.h subdir2/foo.h CPATH=subdir1 $CCACHE_COMPILE -c foo.c - expect_stat 'cache hit (direct)' 0 - expect_stat 'cache hit (preprocessed)' 0 - expect_stat 'cache miss' 1 + expect_stat direct_cache_hit 0 + expect_stat preprocessed_cache_hit 0 + expect_stat cache_miss 1 CPATH=subdir1 $CCACHE_COMPILE -c foo.c - expect_stat 'cache hit (direct)' 1 - expect_stat 'cache hit (preprocessed)' 0 - expect_stat 'cache miss' 1 + expect_stat direct_cache_hit 1 + expect_stat preprocessed_cache_hit 0 + expect_stat cache_miss 1 CPATH=subdir2 $CCACHE_COMPILE -c foo.c - expect_stat 'cache hit (direct)' 1 - expect_stat 'cache hit (preprocessed)' 0 - expect_stat 'cache miss' 2 # subdir2 is part of the preprocessor output + expect_stat direct_cache_hit 1 + expect_stat preprocessed_cache_hit 0 + expect_stat cache_miss 2 # subdir2 is part of the preprocessor output CPATH=subdir2 $CCACHE_COMPILE -c foo.c - expect_stat 'cache hit (direct)' 2 - expect_stat 'cache hit (preprocessed)' 0 - expect_stat 'cache miss' 2 + expect_stat direct_cache_hit 2 + expect_stat preprocessed_cache_hit 0 + expect_stat cache_miss 2 # ------------------------------------------------------------------------- TEST "Comment in strings" @@ -980,21 +980,21 @@ EOF echo 'const char *comment = " /* \\\\u" "foo" " */";' >comment.c $CCACHE_COMPILE -c comment.c - expect_stat 'cache hit (direct)' 0 - expect_stat 'cache hit (preprocessed)' 0 - expect_stat 'cache miss' 1 + expect_stat direct_cache_hit 0 + expect_stat preprocessed_cache_hit 0 + expect_stat cache_miss 1 $CCACHE_COMPILE -c comment.c - expect_stat 'cache hit (direct)' 1 - expect_stat 'cache hit (preprocessed)' 0 - expect_stat 'cache miss' 1 + expect_stat direct_cache_hit 1 + expect_stat preprocessed_cache_hit 0 + expect_stat cache_miss 1 echo 'const char *comment = " /* \\\\u" "goo" " */";' >comment.c $CCACHE_COMPILE -c comment.c - expect_stat 'cache hit (direct)' 1 - expect_stat 'cache hit (preprocessed)' 0 - expect_stat 'cache miss' 2 + expect_stat direct_cache_hit 1 + expect_stat preprocessed_cache_hit 0 + expect_stat cache_miss 2 # ------------------------------------------------------------------------- TEST "#line directives with troublesome files" @@ -1053,12 +1053,12 @@ int main(void) EOF $CCACHE_COMPILE -B -L -DFOO -c test.c - expect_stat 'cache hit (direct)' 0 - expect_stat 'cache miss' 1 + expect_stat direct_cache_hit 0 + expect_stat cache_miss 1 $CCACHE_COMPILE -B -L -DBAR -c test.c - expect_stat 'cache hit (direct)' 0 - expect_stat 'cache miss' 2 + expect_stat direct_cache_hit 0 + expect_stat cache_miss 2 # ------------------------------------------------------------------------- TEST "CCACHE_IGNOREHEADERS with filename" @@ -1104,40 +1104,40 @@ EOF TEST "CCACHE_IGNOREOPTIONS" CCACHE_IGNOREOPTIONS="-DTEST=1" $CCACHE_COMPILE -DTEST=1 -c test.c - expect_stat 'cache hit (direct)' 0 - expect_stat 'cache hit (preprocessed)' 0 - expect_stat 'cache miss' 1 + expect_stat direct_cache_hit 0 + expect_stat preprocessed_cache_hit 0 + expect_stat cache_miss 1 CCACHE_IGNOREOPTIONS="-DTEST=1*" $CCACHE_COMPILE -DTEST=1 -c test.c - expect_stat 'cache hit (direct)' 1 - expect_stat 'cache hit (preprocessed)' 0 - expect_stat 'cache miss' 1 + expect_stat direct_cache_hit 1 + expect_stat preprocessed_cache_hit 0 + expect_stat cache_miss 1 CCACHE_IGNOREOPTIONS="-DTEST=1*" $CCACHE_COMPILE -DTEST=12 -c test.c - expect_stat 'cache hit (direct)' 2 - expect_stat 'cache hit (preprocessed)' 0 - expect_stat 'cache miss' 1 + expect_stat direct_cache_hit 2 + expect_stat preprocessed_cache_hit 0 + expect_stat cache_miss 1 CCACHE_IGNOREOPTIONS="-DTEST=2*" $CCACHE_COMPILE -DTEST=12 -c test.c - expect_stat 'cache hit (direct)' 2 - expect_stat 'cache hit (preprocessed)' 1 - expect_stat 'cache miss' 1 + expect_stat direct_cache_hit 2 + expect_stat preprocessed_cache_hit 1 + expect_stat cache_miss 1 # ------------------------------------------------------------------------- TEST "CCACHE_RECACHE doesn't add a new manifest entry" $CCACHE_COMPILE -c test.c - expect_stat 'cache hit (direct)' 0 - expect_stat 'cache miss' 1 - expect_stat 'files in cache' 2 # result + manifest + expect_stat direct_cache_hit 0 + expect_stat cache_miss 1 + expect_stat files_in_cache 2 # result + manifest manifest_file=$(find $CCACHE_DIR -name '*M') cp $manifest_file saved.manifest CCACHE_RECACHE=1 $CCACHE_COMPILE -c test.c - expect_stat 'cache hit (direct)' 0 - expect_stat 'cache miss' 2 - expect_stat 'files in cache' 2 + expect_stat direct_cache_hit 0 + expect_stat cache_miss 2 + expect_stat files_in_cache 2 expect_equal_content $manifest_file saved.manifest } diff --git a/test/suites/direct_gcc.bash b/test/suites/direct_gcc.bash index 73b045b35..4e5109001 100644 --- a/test/suites/direct_gcc.bash +++ b/test/suites/direct_gcc.bash @@ -36,9 +36,9 @@ SUITE_direct_gcc() { TEST "DEPENDENCIES_OUTPUT environment variable" DEPENDENCIES_OUTPUT="other.d" $CCACHE_COMPILE -c test.c - expect_stat 'cache hit (direct)' 0 - expect_stat 'cache hit (preprocessed)' 0 - expect_stat 'cache miss' 1 + expect_stat direct_cache_hit 0 + expect_stat preprocessed_cache_hit 0 + 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 @@ -46,16 +46,16 @@ SUITE_direct_gcc() { rm -f other.d DEPENDENCIES_OUTPUT="other.d" $CCACHE_COMPILE -c test.c - expect_stat 'cache hit (direct)' 1 - expect_stat 'cache hit (preprocessed)' 0 - expect_stat 'cache miss' 1 + expect_stat direct_cache_hit 1 + expect_stat preprocessed_cache_hit 0 + expect_stat cache_miss 1 expect_equal_content other.d expected_dependencies_output.d expect_equal_object_files reference_test.o test.o DEPENDENCIES_OUTPUT="different_name.d" $CCACHE_COMPILE -c test.c - expect_stat 'cache hit (direct)' 2 - expect_stat 'cache hit (preprocessed)' 0 - expect_stat 'cache miss' 1 + expect_stat direct_cache_hit 2 + expect_stat preprocessed_cache_hit 0 + expect_stat cache_miss 1 expect_equal_content different_name.d expected_dependencies_output.d expect_equal_object_files reference_test.o test.o @@ -63,9 +63,9 @@ SUITE_direct_gcc() { TEST "DEPENDENCIES_OUTPUT environment variable with target" DEPENDENCIES_OUTPUT="other.d target.o" $CCACHE_COMPILE -c test.c - expect_stat 'cache hit (direct)' 0 - expect_stat 'cache hit (preprocessed)' 0 - expect_stat 'cache miss' 1 + expect_stat direct_cache_hit 0 + expect_stat preprocessed_cache_hit 0 + 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 @@ -73,16 +73,16 @@ SUITE_direct_gcc() { rm -f other.d DEPENDENCIES_OUTPUT="other.d target.o" $CCACHE_COMPILE -c test.c - expect_stat 'cache hit (direct)' 1 - expect_stat 'cache hit (preprocessed)' 0 - expect_stat 'cache miss' 1 + expect_stat direct_cache_hit 1 + expect_stat preprocessed_cache_hit 0 + expect_stat cache_miss 1 expect_equal_content other.d expected_dependencies_output_target.d expect_equal_object_files reference_test.o test.o DEPENDENCIES_OUTPUT="different_name.d target.o" $CCACHE_COMPILE -c test.c - expect_stat 'cache hit (direct)' 2 - expect_stat 'cache hit (preprocessed)' 0 - expect_stat 'cache miss' 1 + expect_stat direct_cache_hit 2 + expect_stat preprocessed_cache_hit 0 + expect_stat cache_miss 1 expect_equal_content different_name.d expected_dependencies_output_target.d expect_equal_object_files reference_test.o test.o @@ -90,9 +90,9 @@ SUITE_direct_gcc() { TEST "SUNPRO_DEPENDENCIES environment variable" SUNPRO_DEPENDENCIES="other.d" $CCACHE_COMPILE -c test.c - expect_stat 'cache hit (direct)' 0 - expect_stat 'cache hit (preprocessed)' 0 - expect_stat 'cache miss' 1 + expect_stat direct_cache_hit 0 + expect_stat preprocessed_cache_hit 0 + 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 @@ -100,16 +100,16 @@ SUITE_direct_gcc() { rm -f other.d SUNPRO_DEPENDENCIES="other.d" $CCACHE_COMPILE -c test.c - expect_stat 'cache hit (direct)' 1 - expect_stat 'cache hit (preprocessed)' 0 - expect_stat 'cache miss' 1 + expect_stat direct_cache_hit 1 + expect_stat preprocessed_cache_hit 0 + expect_stat cache_miss 1 expect_equal_content other.d expected_sunpro_dependencies.d expect_equal_object_files reference_test.o test.o SUNPRO_DEPENDENCIES="different_name.d" $CCACHE_COMPILE -c test.c - expect_stat 'cache hit (direct)' 2 - expect_stat 'cache hit (preprocessed)' 0 - expect_stat 'cache miss' 1 + expect_stat direct_cache_hit 2 + expect_stat preprocessed_cache_hit 0 + expect_stat cache_miss 1 expect_equal_content different_name.d expected_sunpro_dependencies.d expect_equal_object_files reference_test.o test.o @@ -117,9 +117,9 @@ SUITE_direct_gcc() { TEST "SUNPRO_DEPENDENCIES environment variable with target" SUNPRO_DEPENDENCIES="other.d target.o" $CCACHE_COMPILE -c test.c - expect_stat 'cache hit (direct)' 0 - expect_stat 'cache hit (preprocessed)' 0 - expect_stat 'cache miss' 1 + expect_stat direct_cache_hit 0 + expect_stat preprocessed_cache_hit 0 + 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 @@ -127,16 +127,16 @@ SUITE_direct_gcc() { rm -f other.d SUNPRO_DEPENDENCIES="other.d target.o" $CCACHE_COMPILE -c test.c - expect_stat 'cache hit (direct)' 1 - expect_stat 'cache hit (preprocessed)' 0 - expect_stat 'cache miss' 1 + expect_stat direct_cache_hit 1 + expect_stat preprocessed_cache_hit 0 + expect_stat cache_miss 1 expect_equal_content other.d expected_sunpro_dependencies_target.d expect_equal_object_files reference_test.o test.o SUNPRO_DEPENDENCIES="different_name.d target.o" $CCACHE_COMPILE -c test.c - expect_stat 'cache hit (direct)' 2 - expect_stat 'cache hit (preprocessed)' 0 - expect_stat 'cache miss' 1 + expect_stat direct_cache_hit 2 + expect_stat preprocessed_cache_hit 0 + expect_stat cache_miss 1 expect_equal_content different_name.d expected_sunpro_dependencies_target.d expect_equal_object_files reference_test.o test.o @@ -144,12 +144,12 @@ SUITE_direct_gcc() { TEST "DEPENDENCIES_OUTPUT environment variable set to /dev/null" DEPENDENCIES_OUTPUT="/dev/null" $CCACHE_COMPILE -c test.c - expect_stat 'cache hit (direct)' 0 - expect_stat 'cache hit (preprocessed)' 0 - expect_stat 'cache miss' 1 + expect_stat direct_cache_hit 0 + expect_stat preprocessed_cache_hit 0 + expect_stat cache_miss 1 DEPENDENCIES_OUTPUT="other.d" $CCACHE_COMPILE -c test.c - expect_stat 'cache hit (direct)' 0 - expect_stat 'cache hit (preprocessed)' 0 - expect_stat 'cache miss' 2 + expect_stat direct_cache_hit 0 + expect_stat preprocessed_cache_hit 0 + expect_stat cache_miss 2 } diff --git a/test/suites/fileclone.bash b/test/suites/fileclone.bash index 72d76d2bf..3ae1b462e 100644 --- a/test/suites/fileclone.bash +++ b/test/suites/fileclone.bash @@ -14,16 +14,16 @@ SUITE_fileclone() { $REAL_COMPILER -c -o reference_test.o test.c CCACHE_FILECLONE=1 $CCACHE_COMPILE -c test.c - expect_stat 'cache hit (preprocessed)' 0 - expect_stat 'cache miss' 1 - expect_stat 'files in cache' 2 + expect_stat preprocessed_cache_hit 0 + expect_stat cache_miss 1 + expect_stat files_in_cache 2 expect_equal_object_files reference_test.o test.o # Note: CCACHE_DEBUG=1 below is needed for the test case. CCACHE_FILECLONE=1 CCACHE_DEBUG=1 $CCACHE_COMPILE -c test.c - expect_stat 'cache hit (preprocessed)' 1 - expect_stat 'cache miss' 1 - expect_stat 'files in cache' 2 + expect_stat preprocessed_cache_hit 1 + expect_stat cache_miss 1 + expect_stat files_in_cache 2 expect_equal_object_files reference_test.o test.o if ! grep -q 'Cloning.*to test.o' test.o.ccache-log; then test_failed "Did not try to clone file" @@ -40,16 +40,16 @@ SUITE_fileclone() { $REAL_COMPILER -c -o reference_test.o test.c $CCACHE_COMPILE -c test.c - expect_stat 'cache hit (preprocessed)' 0 - expect_stat 'cache miss' 1 - expect_stat 'files in cache' 1 + expect_stat preprocessed_cache_hit 0 + expect_stat cache_miss 1 + expect_stat files_in_cache 1 expect_equal_object_files reference_test.o test.o # Note: CCACHE_DEBUG=1 below is needed for the test case. CCACHE_FILECLONE=1 CCACHE_DEBUG=1 $CCACHE_COMPILE -c test.c - expect_stat 'cache hit (preprocessed)' 1 - expect_stat 'cache miss' 1 - expect_stat 'files in cache' 1 + expect_stat preprocessed_cache_hit 1 + expect_stat cache_miss 1 + expect_stat files_in_cache 1 expect_equal_object_files reference_test.o test.o if grep -q 'Cloning' test.o.ccache-log; then test_failed "Tried to clone" diff --git a/test/suites/hardlink.bash b/test/suites/hardlink.bash index e37edce53..76b0f2948 100644 --- a/test/suites/hardlink.bash +++ b/test/suites/hardlink.bash @@ -16,17 +16,17 @@ SUITE_hardlink() { $REAL_COMPILER -c -o reference_test1.o test1.c CCACHE_HARDLINK=1 $CCACHE_COMPILE -c test1.c - expect_stat 'cache hit (preprocessed)' 0 - expect_stat 'cache miss' 1 - expect_stat 'files in cache' 2 + expect_stat preprocessed_cache_hit 0 + expect_stat cache_miss 1 + expect_stat files_in_cache 2 expect_equal_object_files reference_test1.o test1.o mv test1.o test1.o.saved CCACHE_HARDLINK=1 $CCACHE_COMPILE -c test1.c - expect_stat 'cache hit (preprocessed)' 1 - expect_stat 'cache miss' 1 - expect_stat 'files in cache' 2 + expect_stat preprocessed_cache_hit 1 + expect_stat cache_miss 1 + expect_stat files_in_cache 2 if [ ! test1.o -ef test1.o.saved ]; then test_failed "Object files not hard linked" fi @@ -37,16 +37,16 @@ SUITE_hardlink() { generate_code 1 test1.c CCACHE_HARDLINK=1 $CCACHE_COMPILE -c test1.c - expect_stat 'cache hit (preprocessed)' 0 - expect_stat 'cache miss' 1 - expect_stat 'files in cache' 2 + expect_stat preprocessed_cache_hit 0 + expect_stat cache_miss 1 + expect_stat files_in_cache 2 mv test1.o test1.o.saved CCACHE_HARDLINK=1 $CCACHE_COMPILE -c test1.c - expect_stat 'cache hit (preprocessed)' 1 - expect_stat 'cache miss' 1 - expect_stat 'files in cache' 2 + expect_stat preprocessed_cache_hit 1 + expect_stat cache_miss 1 + expect_stat files_in_cache 2 # ------------------------------------------------------------------------- TEST "Overwrite assembler" @@ -57,25 +57,25 @@ SUITE_hardlink() { $REAL_COMPILER -c -o reference_test1.o test1.s CCACHE_HARDLINK=1 $CCACHE_COMPILE -c test1.s - expect_stat 'cache hit (preprocessed)' 0 - expect_stat 'cache miss' 1 - expect_stat 'files in cache' 2 + expect_stat preprocessed_cache_hit 0 + expect_stat cache_miss 1 + expect_stat files_in_cache 2 generate_code 2 test1.c $REAL_COMPILER -S -o test1.s test1.c CCACHE_HARDLINK=1 $CCACHE_COMPILE -c test1.s - expect_stat 'cache hit (preprocessed)' 0 - expect_stat 'cache miss' 2 - expect_stat 'files in cache' 4 + expect_stat preprocessed_cache_hit 0 + expect_stat cache_miss 2 + expect_stat files_in_cache 4 generate_code 1 test1.c $REAL_COMPILER -S -o test1.s test1.c CCACHE_HARDLINK=1 $CCACHE_COMPILE -c test1.s - expect_stat 'cache hit (preprocessed)' 1 - expect_stat 'cache miss' 2 - expect_stat 'files in cache' 4 + expect_stat preprocessed_cache_hit 1 + expect_stat cache_miss 2 + expect_stat files_in_cache 4 expect_equal_object_files reference_test1.o test1.o # ------------------------------------------------------------------------- @@ -86,11 +86,11 @@ SUITE_hardlink() { generate_code 1 test1.c CCACHE_HARDLINK=1 CCACHE_DEPEND=1 $CCACHE_COMPILE -c -MMD -MF test1.d.tmp test1.c - expect_stat 'cache hit (direct)' 0 + expect_stat direct_cache_hit 0 mv test1.d.tmp test1.d || test_failed "first mv failed" CCACHE_HARDLINK=1 CCACHE_DEPEND=1 $CCACHE_COMPILE -c -MMD -MF test1.d.tmp test1.c - expect_stat 'cache hit (direct)' 1 + expect_stat direct_cache_hit 1 mv test1.d.tmp test1.d || test_failed "second mv failed" # ------------------------------------------------------------------------- @@ -103,22 +103,22 @@ SUITE_hardlink() { echo "int x;" >test1.c $CCACHE_COMPILE -c -MMD test1.c - expect_stat 'cache hit (direct)' 0 - expect_stat 'cache miss' 1 + expect_stat direct_cache_hit 0 + expect_stat cache_miss 1 expect_content test1.d "test1.o: test1.c" touch test1.h echo '#include "test1.h"' >>test1.c $CCACHE_COMPILE -c -MMD test1.c - expect_stat 'cache hit (direct)' 0 - expect_stat 'cache miss' 2 + expect_stat direct_cache_hit 0 + expect_stat cache_miss 2 expect_content test1.d "test1.o: test1.c test1.h" echo "int x;" >test1.c $CCACHE_COMPILE -c -MMD test1.c - expect_stat 'cache hit (direct)' 1 - expect_stat 'cache miss' 2 + expect_stat direct_cache_hit 1 + expect_stat cache_miss 2 expect_content test1.d "test1.o: test1.c" } diff --git a/test/suites/input_charset.bash b/test/suites/input_charset.bash index 4d527fba5..a7bb40511 100644 --- a/test/suites/input_charset.bash +++ b/test/suites/input_charset.bash @@ -12,18 +12,18 @@ SUITE_input_charset() { printf '#include \nwchar_t foo[] = L"\xbf";\n' >latin1.c $CCACHE_COMPILE -c -finput-charset=latin1 latin1.c - expect_stat 'cache hit (preprocessed)' 0 - expect_stat 'cache miss' 1 + expect_stat preprocessed_cache_hit 0 + expect_stat cache_miss 1 $CCACHE_COMPILE -c -finput-charset=latin1 latin1.c - expect_stat 'cache hit (preprocessed)' 1 - expect_stat 'cache miss' 1 + expect_stat preprocessed_cache_hit 1 + expect_stat cache_miss 1 CCACHE_NOCPP2=1 $CCACHE_COMPILE -c -finput-charset=latin1 latin1.c - expect_stat 'cache hit (preprocessed)' 1 - expect_stat 'cache miss' 2 + expect_stat preprocessed_cache_hit 1 + expect_stat cache_miss 2 CCACHE_NOCPP2=1 $CCACHE_COMPILE -c -finput-charset=latin1 latin1.c - expect_stat 'cache hit (preprocessed)' 2 - expect_stat 'cache miss' 2 + expect_stat preprocessed_cache_hit 2 + expect_stat cache_miss 2 } diff --git a/test/suites/ivfsoverlay.bash b/test/suites/ivfsoverlay.bash index eed47c30f..22bf0b52a 100644 --- a/test/suites/ivfsoverlay.bash +++ b/test/suites/ivfsoverlay.bash @@ -27,18 +27,18 @@ SUITE_ivfsoverlay() { TEST "without sloppy ivfsoverlay" $CCACHE_COMPILE -ivfsoverlay test.yaml -c test.c - expect_stat 'cache hit (direct)' 0 - expect_stat 'cache miss' 0 - expect_stat 'unsupported compiler option' 1 + expect_stat direct_cache_hit 0 + expect_stat cache_miss 0 + expect_stat unsupported_compiler_option 1 # ------------------------------------------------------------------------- TEST "with sloppy ivfsoverlay" CCACHE_SLOPPINESS="$DEFAULT_SLOPPINESS include_file_mtime ivfsoverlay" $CCACHE_COMPILE -ivfsoverlay test.yaml -c test.c - expect_stat 'cache hit (direct)' 0 - expect_stat 'cache miss' 1 + expect_stat direct_cache_hit 0 + expect_stat cache_miss 1 CCACHE_SLOPPINESS="$DEFAULT_SLOPPINESS include_file_mtime ivfsoverlay" $CCACHE_COMPILE -ivfsoverlay test.yaml -c test.c - expect_stat 'cache hit (direct)' 1 - expect_stat 'cache miss' 1 + expect_stat direct_cache_hit 1 + expect_stat cache_miss 1 } diff --git a/test/suites/masquerading.bash b/test/suites/masquerading.bash index dea151393..cf371318b 100644 --- a/test/suites/masquerading.bash +++ b/test/suites/masquerading.bash @@ -22,15 +22,15 @@ SUITE_masquerading() { $REAL_COMPILER -c -o reference_test1.o test1.c ./$COMPILER_BIN $COMPILER_ARGS -c test1.c - expect_stat 'cache hit (preprocessed)' 0 - expect_stat 'cache miss' 1 - expect_stat 'files in cache' 1 + 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 ./$COMPILER_BIN $COMPILER_ARGS -c test1.c - expect_stat 'cache hit (preprocessed)' 1 - expect_stat 'cache miss' 1 - expect_stat 'files in cache' 1 + expect_stat preprocessed_cache_hit 1 + expect_stat cache_miss 1 + expect_stat files_in_cache 1 expect_equal_object_files reference_test1.o test1.o # ------------------------------------------------------------------------- @@ -39,14 +39,14 @@ SUITE_masquerading() { $REAL_COMPILER -c -o reference_test1.o test1.c $PWD/$COMPILER_BIN $COMPILER_ARGS -c test1.c - expect_stat 'cache hit (preprocessed)' 0 - expect_stat 'cache miss' 1 - expect_stat 'files in cache' 1 + 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 $PWD/$COMPILER_BIN $COMPILER_ARGS -c test1.c - expect_stat 'cache hit (preprocessed)' 1 - expect_stat 'cache miss' 1 - expect_stat 'files in cache' 1 + expect_stat preprocessed_cache_hit 1 + expect_stat cache_miss 1 + expect_stat files_in_cache 1 expect_equal_object_files reference_test1.o test1.o } diff --git a/test/suites/modules.bash b/test/suites/modules.bash index 3f1631847..bd5ada924 100644 --- a/test/suites/modules.bash +++ b/test/suites/modules.bash @@ -35,10 +35,10 @@ SUITE_modules() { TEST "fall back to real compiler, no sloppiness" $CCACHE_COMPILE -x c++ -fmodules -fcxx-modules -c test1.cpp -MD - expect_stat "can't use modules" 1 + expect_stat could_not_use_modules 1 $CCACHE_COMPILE -x c++ -fmodules -fcxx-modules -c test1.cpp -MD - expect_stat "can't use modules" 2 + expect_stat could_not_use_modules 2 # ------------------------------------------------------------------------- TEST "fall back to real compiler, no depend mode" @@ -46,27 +46,27 @@ SUITE_modules() { unset CCACHE_DEPEND CCACHE_SLOPPINESS="$DEFAULT_SLOPPINESS modules" $CCACHE_COMPILE -x c++ -fmodules -fcxx-modules -c test1.cpp -MD - expect_stat "can't use modules" 1 + expect_stat could_not_use_modules 1 CCACHE_SLOPPINESS="$DEFAULT_SLOPPINESS modules" $CCACHE_COMPILE -x c++ -fmodules -fcxx-modules -c test1.cpp -MD - expect_stat "can't use modules" 2 + expect_stat could_not_use_modules 2 # ------------------------------------------------------------------------- TEST "cache hit" CCACHE_SLOPPINESS="$DEFAULT_SLOPPINESS modules" $CCACHE_COMPILE -x c++ -fmodules -fcxx-modules -c test1.cpp -MD - expect_stat 'cache hit (direct)' 0 - expect_stat 'cache miss' 1 + expect_stat direct_cache_hit 0 + expect_stat cache_miss 1 CCACHE_SLOPPINESS="$DEFAULT_SLOPPINESS modules" $CCACHE_COMPILE -x c++ -fmodules -fcxx-modules -c test1.cpp -MD - expect_stat 'cache hit (direct)' 1 - expect_stat 'cache miss' 1 + expect_stat direct_cache_hit 1 + expect_stat cache_miss 1 # ------------------------------------------------------------------------- TEST "cache miss" CCACHE_SLOPPINESS="$DEFAULT_SLOPPINESS modules" $CCACHE_COMPILE -MD -x c++ -fmodules -fcxx-modules -c test1.cpp -MD - expect_stat 'cache miss' 1 + expect_stat cache_miss 1 cat <test1.h #include @@ -75,11 +75,11 @@ EOF backdate test1.h CCACHE_SLOPPINESS="$DEFAULT_SLOPPINESS modules" $CCACHE_COMPILE -MD -x c++ -fmodules -fcxx-modules -c test1.cpp -MD - expect_stat 'cache miss' 2 + expect_stat cache_miss 2 echo >>module.modulemap backdate test1.h CCACHE_SLOPPINESS="$DEFAULT_SLOPPINESS modules" $CCACHE_COMPILE -MD -x c++ -fmodules -fcxx-modules -c test1.cpp -MD - expect_stat 'cache miss' 3 + expect_stat cache_miss 3 } diff --git a/test/suites/multi_arch.bash b/test/suites/multi_arch.bash index 650ac87ca..2f5c77bb2 100644 --- a/test/suites/multi_arch.bash +++ b/test/suites/multi_arch.bash @@ -16,34 +16,34 @@ SUITE_multi_arch() { # Different arches shouldn't affect each other $CCACHE_COMPILE -arch i386 -c test1.c - expect_stat 'cache hit (direct)' 0 - expect_stat 'cache miss' 1 + expect_stat direct_cache_hit 0 + expect_stat cache_miss 1 $CCACHE_COMPILE -arch x86_64 -c test1.c - expect_stat 'cache hit (direct)' 0 - expect_stat 'cache miss' 2 + expect_stat direct_cache_hit 0 + expect_stat cache_miss 2 $CCACHE_COMPILE -arch i386 -c test1.c - expect_stat 'cache hit (direct)' 1 - expect_stat 'cache miss' 2 + expect_stat direct_cache_hit 1 + expect_stat cache_miss 2 # Multiple arches should be cached too $CCACHE_COMPILE -arch i386 -arch x86_64 -c test1.c - expect_stat 'cache hit (direct)' 1 - expect_stat 'cache miss' 3 + expect_stat direct_cache_hit 1 + expect_stat cache_miss 3 $CCACHE_COMPILE -arch i386 -arch x86_64 -c test1.c - expect_stat 'cache hit (direct)' 2 - expect_stat 'cache miss' 3 + expect_stat direct_cache_hit 2 + expect_stat cache_miss 3 # A single -Xarch_* matching -arch is supported. $CCACHE_COMPILE -arch x86_64 -Xarch_x86_64 -I. -c test1.c - expect_stat 'cache hit (direct)' 2 - expect_stat 'cache miss' 4 + expect_stat direct_cache_hit 2 + expect_stat cache_miss 4 $CCACHE_COMPILE -arch x86_64 -Xarch_x86_64 -I. -c test1.c - expect_stat 'cache hit (direct)' 3 - expect_stat 'cache miss' 4 + expect_stat direct_cache_hit 3 + expect_stat cache_miss 4 # ------------------------------------------------------------------------- TEST "cache hit, preprocessor mode" @@ -51,23 +51,23 @@ SUITE_multi_arch() { export CCACHE_NODIRECT=1 $CCACHE_COMPILE -arch i386 -c test1.c - expect_stat 'cache hit (preprocessed)' 0 - expect_stat 'cache miss' 1 + expect_stat preprocessed_cache_hit 0 + expect_stat cache_miss 1 $CCACHE_COMPILE -arch x86_64 -c test1.c - expect_stat 'cache hit (preprocessed)' 0 - expect_stat 'cache miss' 2 + expect_stat preprocessed_cache_hit 0 + expect_stat cache_miss 2 $CCACHE_COMPILE -arch i386 -c test1.c - expect_stat 'cache hit (preprocessed)' 1 - expect_stat 'cache miss' 2 + expect_stat preprocessed_cache_hit 1 + expect_stat cache_miss 2 # Multiple arches should be cached too $CCACHE_COMPILE -arch i386 -arch x86_64 -c test1.c - expect_stat 'cache hit (preprocessed)' 1 - expect_stat 'cache miss' 3 + expect_stat preprocessed_cache_hit 1 + expect_stat cache_miss 3 $CCACHE_COMPILE -arch i386 -arch x86_64 -c test1.c - expect_stat 'cache hit (preprocessed)' 2 - expect_stat 'cache miss' 3 + expect_stat preprocessed_cache_hit 2 + expect_stat cache_miss 3 } diff --git a/test/suites/no_compression.bash b/test/suites/no_compression.bash index 60afe7182..a7cb7bbd6 100644 --- a/test/suites/no_compression.bash +++ b/test/suites/no_compression.bash @@ -12,15 +12,15 @@ SUITE_no_compression() { $REAL_COMPILER -c -o reference_test.o test.c $CCACHE_COMPILE -c test.c - expect_stat 'cache hit (direct)' 0 - expect_stat 'cache miss' 1 - expect_stat 'files in cache' 2 + expect_stat direct_cache_hit 0 + expect_stat cache_miss 1 + expect_stat files_in_cache 2 expect_equal_object_files reference_test.o test.o $CCACHE_COMPILE -c test.c - expect_stat 'cache hit (direct)' 1 - expect_stat 'cache miss' 1 - expect_stat 'files in cache' 2 + expect_stat direct_cache_hit 1 + expect_stat cache_miss 1 + expect_stat files_in_cache 2 expect_equal_object_files reference_test.o test.o # ------------------------------------------------------------------------- @@ -39,42 +39,42 @@ SUITE_no_compression() { TEST "Hash sum equal for compressed and uncompressed files" $CCACHE_COMPILE -c test.c - expect_stat 'cache hit (direct)' 0 - expect_stat 'cache hit (preprocessed)' 0 - expect_stat 'cache miss' 1 + expect_stat direct_cache_hit 0 + expect_stat preprocessed_cache_hit 0 + expect_stat cache_miss 1 $CCACHE_COMPILE -c test.c - expect_stat 'cache hit (direct)' 1 - expect_stat 'cache miss' 1 + expect_stat direct_cache_hit 1 + expect_stat cache_miss 1 unset CCACHE_NOCOMPRESS $CCACHE_COMPILE -c test.c - expect_stat 'cache hit (direct)' 2 - expect_stat 'cache miss' 1 + expect_stat direct_cache_hit 2 + expect_stat cache_miss 1 # ------------------------------------------------------------------------- TEST "Corrupt result file" $CCACHE_COMPILE -c test.c - expect_stat 'cache hit (direct)' 0 - expect_stat 'cache miss' 1 - expect_stat 'files in cache' 2 + expect_stat direct_cache_hit 0 + expect_stat cache_miss 1 + expect_stat files_in_cache 2 $CCACHE_COMPILE -c test.c - expect_stat 'cache hit (direct)' 1 - expect_stat 'cache miss' 1 - expect_stat 'files in cache' 2 + expect_stat direct_cache_hit 1 + expect_stat cache_miss 1 + expect_stat files_in_cache 2 result_file=$(find $CCACHE_DIR -name '*R') printf foo | dd of=$result_file bs=3 count=1 seek=20 conv=notrunc >&/dev/null $CCACHE_COMPILE -c test.c - expect_stat 'cache hit (direct)' 1 - expect_stat 'cache miss' 2 - expect_stat 'files in cache' 2 + expect_stat direct_cache_hit 1 + expect_stat cache_miss 2 + expect_stat files_in_cache 2 $CCACHE_COMPILE -c test.c - expect_stat 'cache hit (direct)' 2 - expect_stat 'cache miss' 2 - expect_stat 'files in cache' 2 + expect_stat direct_cache_hit 2 + expect_stat cache_miss 2 + expect_stat files_in_cache 2 } diff --git a/test/suites/nvcc.bash b/test/suites/nvcc.bash index 386015df9..bf435c718 100644 --- a/test/suites/nvcc.bash +++ b/test/suites/nvcc.bash @@ -67,15 +67,15 @@ nvcc_tests() { # First compile. $ccache_nvcc_cpp test_cpp.cu - expect_stat 'cache hit (preprocessed)' 0 - expect_stat 'cache miss' 1 - expect_stat 'files in cache' 1 + 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 test_cpp.cu - expect_stat 'cache hit (preprocessed)' 1 - expect_stat 'cache miss' 1 - expect_stat 'files in cache' 1 + expect_stat preprocessed_cache_hit 1 + expect_stat cache_miss 1 + expect_stat files_in_cache 1 expect_equal_content reference_test1.o test_cpp.o # ------------------------------------------------------------------------- @@ -92,39 +92,39 @@ nvcc_tests() { expect_different_content reference_test2.dump reference_test3.dump $ccache_nvcc_cuda test_cuda.cu - expect_stat 'cache hit (preprocessed)' 0 - expect_stat 'cache miss' 1 - expect_stat 'files in cache' 1 + expect_stat preprocessed_cache_hit 0 + expect_stat cache_miss 1 + expect_stat files_in_cache 1 $cuobjdump test_cuda.o > test1.dump expect_equal_content reference_test1.dump test1.dump # Other GPU. $ccache_nvcc_cuda $nvcc_opts_gpu1 test_cuda.cu - expect_stat 'cache hit (preprocessed)' 0 - expect_stat 'cache miss' 2 - expect_stat 'files in cache' 2 + expect_stat preprocessed_cache_hit 0 + expect_stat cache_miss 2 + expect_stat files_in_cache 2 $cuobjdump test_cuda.o > test1.dump expect_equal_content reference_test2.dump test1.dump $ccache_nvcc_cuda $nvcc_opts_gpu1 test_cuda.cu - expect_stat 'cache hit (preprocessed)' 1 - expect_stat 'cache miss' 2 - expect_stat 'files in cache' 2 + expect_stat preprocessed_cache_hit 1 + expect_stat cache_miss 2 + expect_stat files_in_cache 2 $cuobjdump test_cuda.o > test1.dump expect_equal_content reference_test2.dump test1.dump # Another GPU. $ccache_nvcc_cuda $nvcc_opts_gpu2 test_cuda.cu - expect_stat 'cache hit (preprocessed)' 1 - expect_stat 'cache miss' 3 - expect_stat 'files in cache' 3 + expect_stat preprocessed_cache_hit 1 + expect_stat cache_miss 3 + expect_stat files_in_cache 3 $cuobjdump test_cuda.o > test1.dump expect_equal_content reference_test3.dump test1.dump $ccache_nvcc_cuda $nvcc_opts_gpu2 test_cuda.cu - expect_stat 'cache hit (preprocessed)' 2 - expect_stat 'cache miss' 3 - expect_stat 'files in cache' 3 + expect_stat preprocessed_cache_hit 2 + expect_stat cache_miss 3 + expect_stat files_in_cache 3 $cuobjdump test_cuda.o > test1.dump expect_equal_content reference_test3.dump test1.dump @@ -135,16 +135,16 @@ nvcc_tests() { $cuobjdump reference_test4.o > reference_test4.dump $ccache_nvcc_cuda -dc -o test_cuda.o test_cuda.cu - expect_stat 'cache hit (preprocessed)' 0 - expect_stat 'cache miss' 1 - expect_stat 'files in cache' 1 + expect_stat preprocessed_cache_hit 0 + expect_stat cache_miss 1 + expect_stat files_in_cache 1 $cuobjdump test_cuda.o > test4.dump expect_equal_content test4.dump reference_test4.dump $ccache_nvcc_cuda -dc -o test_cuda.o test_cuda.cu - expect_stat 'cache hit (preprocessed)' 1 - expect_stat 'cache miss' 1 - expect_stat 'files in cache' 1 + expect_stat preprocessed_cache_hit 1 + expect_stat cache_miss 1 + expect_stat files_in_cache 1 $cuobjdump test_cuda.o > test4.dump expect_equal_content test4.dump reference_test4.dump @@ -156,29 +156,29 @@ nvcc_tests() { expect_different_content reference_test1.o reference_test2.o $ccache_nvcc_cpp test_cpp.cu - expect_stat 'cache hit (preprocessed)' 0 - expect_stat 'cache miss' 1 - expect_stat 'files in cache' 1 + 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 # Specified define, but unused. Can only be found by preprocessed mode. $ccache_nvcc_cpp -DDUMMYENV=1 test_cpp.cu - expect_stat "cache hit (preprocessed)" 1 - expect_stat 'cache miss' 1 - expect_stat 'files in cache' 1 + expect_stat preprocessed_cache_hit 1 + expect_stat cache_miss 1 + expect_stat files_in_cache 1 expect_equal_content reference_test1.o test_cpp.o # Specified used define. $ccache_nvcc_cpp -DNUM=10 test_cpp.cu - expect_stat "cache hit (preprocessed)" 1 - expect_stat 'cache miss' 2 - expect_stat 'files in cache' 2 + expect_stat preprocessed_cache_hit 1 + expect_stat cache_miss 2 + expect_stat files_in_cache 2 expect_equal_content reference_test2.o test_cpp.o $ccache_nvcc_cpp -DNUM=10 test_cpp.cu - expect_stat 'cache hit (preprocessed)' 2 - expect_stat 'cache miss' 2 - expect_stat 'files in cache' 2 + expect_stat preprocessed_cache_hit 2 + expect_stat cache_miss 2 + expect_stat files_in_cache 2 expect_equal_content reference_test2.o test_cpp.o # ------------------------------------------------------------------------- @@ -189,27 +189,27 @@ nvcc_tests() { expect_different_content reference_test1.o reference_test2.o $ccache_nvcc_cpp -optf test1.optf test_cpp.cu - expect_stat 'cache hit (preprocessed)' 0 - expect_stat 'cache miss' 1 - expect_stat 'files in cache' 1 + 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 -optf test1.optf test_cpp.cu - expect_stat 'cache hit (preprocessed)' 1 - expect_stat 'cache miss' 1 - expect_stat 'files in cache' 1 + expect_stat preprocessed_cache_hit 1 + expect_stat cache_miss 1 + expect_stat files_in_cache 1 expect_equal_content reference_test1.o test_cpp.o $ccache_nvcc_cpp -optf test2.optf test_cpp.cu - expect_stat 'cache hit (preprocessed)' 1 - expect_stat 'cache miss' 2 - expect_stat 'files in cache' 2 + expect_stat preprocessed_cache_hit 1 + expect_stat cache_miss 2 + expect_stat files_in_cache 2 expect_equal_content reference_test2.o test_cpp.o $ccache_nvcc_cpp -optf test2.optf test_cpp.cu - expect_stat 'cache hit (preprocessed)' 2 - expect_stat 'cache miss' 2 - expect_stat 'files in cache' 2 + expect_stat preprocessed_cache_hit 2 + expect_stat cache_miss 2 + expect_stat files_in_cache 2 expect_equal_content reference_test2.o test_cpp.o # ------------------------------------------------------------------------- @@ -220,15 +220,15 @@ nvcc_tests() { # First compile. $ccache_nvcc_cpp --compiler-bindir $REAL_COMPILER_BIN test_cpp.cu - expect_stat 'cache hit (preprocessed)' 0 - expect_stat 'cache miss' 1 - expect_stat 'files in cache' 1 + 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 - expect_stat 'cache hit (preprocessed)' 1 - expect_stat 'cache miss' 1 - expect_stat 'files in cache' 1 + expect_stat preprocessed_cache_hit 1 + expect_stat cache_miss 1 + expect_stat files_in_cache 1 expect_equal_content reference_test1.o test_cpp.o # ------------------------------------------------------------------------- @@ -239,15 +239,15 @@ nvcc_tests() { # First compile. $ccache_nvcc_cpp -ccbin $REAL_COMPILER_BIN test_cpp.cu - expect_stat 'cache hit (preprocessed)' 0 - expect_stat 'cache miss' 1 - expect_stat 'files in cache' 1 + 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 - expect_stat 'cache hit (preprocessed)' 1 - expect_stat 'cache miss' 1 - expect_stat 'files in cache' 1 + expect_stat preprocessed_cache_hit 1 + expect_stat cache_miss 1 + expect_stat files_in_cache 1 expect_equal_content reference_test1.o test_cpp.o # ------------------------------------------------------------------------- @@ -258,15 +258,15 @@ nvcc_tests() { # First compile. $ccache_nvcc_cpp --output-directory . test_cpp.cu - expect_stat 'cache hit (preprocessed)' 0 - expect_stat 'cache miss' 1 - expect_stat 'files in cache' 1 + 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 --output-directory . test_cpp.cu - expect_stat 'cache hit (preprocessed)' 1 - expect_stat 'cache miss' 1 - expect_stat 'files in cache' 1 + expect_stat preprocessed_cache_hit 1 + expect_stat cache_miss 1 + expect_stat files_in_cache 1 expect_equal_content reference_test1.o test_cpp.o # ------------------------------------------------------------------------- @@ -276,29 +276,29 @@ nvcc_tests() { # First compile. $ccache_nvcc_cpp -odir . test_cpp.cu - expect_stat 'cache hit (preprocessed)' 0 - expect_stat 'cache miss' 1 - expect_stat 'files in cache' 1 + 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 -odir . test_cpp.cu - expect_stat 'cache hit (preprocessed)' 1 - expect_stat 'cache miss' 1 - expect_stat 'files in cache' 1 + expect_stat preprocessed_cache_hit 1 + expect_stat cache_miss 1 + expect_stat files_in_cache 1 expect_equal_content reference_test1.o test_cpp.o # ------------------------------------------------------------------------- TEST "Option -Werror" $ccache_nvcc_cpp -Werror cross-execution-space-call test_cpp.cu - expect_stat 'cache hit (preprocessed)' 0 - expect_stat 'cache miss' 1 - expect_stat 'files in cache' 1 + expect_stat preprocessed_cache_hit 0 + expect_stat cache_miss 1 + expect_stat files_in_cache 1 $ccache_nvcc_cpp -Werror cross-execution-space-call test_cpp.cu - expect_stat 'cache hit (preprocessed)' 1 - expect_stat 'cache miss' 1 - expect_stat 'files in cache' 1 + expect_stat preprocessed_cache_hit 1 + expect_stat cache_miss 1 + expect_stat files_in_cache 1 } SUITE_nvcc_PROBE() { diff --git a/test/suites/nvcc_direct.bash b/test/suites/nvcc_direct.bash index 3762153a0..873e659cb 100644 --- a/test/suites/nvcc_direct.bash +++ b/test/suites/nvcc_direct.bash @@ -29,15 +29,15 @@ SUITE_nvcc_direct() { # First compile. $ccache_nvcc_cpp test_cpp.cu - expect_stat 'cache hit (direct)' 0 - expect_stat 'cache miss' 1 - expect_stat 'files in cache' 2 + expect_stat direct_cache_hit 0 + expect_stat cache_miss 1 + expect_stat files_in_cache 2 expect_equal_content reference_test1.o test_cpp.o $ccache_nvcc_cpp test_cpp.cu - expect_stat 'cache hit (direct)' 1 - expect_stat 'cache miss' 1 - expect_stat 'files in cache' 2 + expect_stat direct_cache_hit 1 + expect_stat cache_miss 1 + expect_stat files_in_cache 2 expect_equal_content reference_test1.o test_cpp.o # ------------------------------------------------------------------------- @@ -54,39 +54,39 @@ SUITE_nvcc_direct() { expect_different_content reference_test2.dump reference_test3.dump $ccache_nvcc_cuda test_cuda.cu - expect_stat 'cache hit (direct)' 0 - expect_stat 'cache miss' 1 - expect_stat 'files in cache' 2 + expect_stat direct_cache_hit 0 + expect_stat cache_miss 1 + expect_stat files_in_cache 2 $cuobjdump test_cuda.o > test1.dump expect_equal_content reference_test1.dump test1.dump # Other GPU. $ccache_nvcc_cuda $nvcc_opts_gpu1 test_cuda.cu - expect_stat 'cache hit (direct)' 0 - expect_stat 'cache miss' 2 - expect_stat 'files in cache' 4 + expect_stat direct_cache_hit 0 + expect_stat cache_miss 2 + expect_stat files_in_cache 4 $cuobjdump test_cuda.o > test1.dump expect_equal_content reference_test2.dump test1.dump $ccache_nvcc_cuda $nvcc_opts_gpu1 test_cuda.cu - expect_stat 'cache hit (direct)' 1 - expect_stat 'cache miss' 2 - expect_stat 'files in cache' 4 + expect_stat direct_cache_hit 1 + expect_stat cache_miss 2 + expect_stat files_in_cache 4 $cuobjdump test_cuda.o > test1.dump expect_equal_content reference_test2.dump test1.dump # Another GPU. $ccache_nvcc_cuda $nvcc_opts_gpu2 test_cuda.cu - expect_stat 'cache hit (direct)' 1 - expect_stat 'cache miss' 3 - expect_stat 'files in cache' 6 + expect_stat direct_cache_hit 1 + expect_stat cache_miss 3 + expect_stat files_in_cache 6 $cuobjdump test_cuda.o > test1.dump expect_equal_content reference_test3.dump test1.dump $ccache_nvcc_cuda $nvcc_opts_gpu2 test_cuda.cu - expect_stat 'cache hit (direct)' 2 - expect_stat 'cache miss' 3 - expect_stat 'files in cache' 6 + expect_stat direct_cache_hit 2 + expect_stat cache_miss 3 + expect_stat files_in_cache 6 $cuobjdump test_cuda.o > test1.dump expect_equal_content reference_test3.dump test1.dump @@ -98,30 +98,30 @@ SUITE_nvcc_direct() { expect_different_content reference_test1.o reference_test2.o $ccache_nvcc_cpp test_cpp.cu - expect_stat 'cache hit (direct)' 0 - expect_stat 'cache miss' 1 - expect_stat 'files in cache' 2 + expect_stat direct_cache_hit 0 + expect_stat cache_miss 1 + expect_stat files_in_cache 2 expect_equal_content reference_test1.o test_cpp.o # Specified define, but unused. Can only be found by preprocessed mode. $ccache_nvcc_cpp -DDUMMYENV=1 test_cpp.cu - expect_stat "cache hit (preprocessed)" 1 - expect_stat "cache hit (direct)" 0 - expect_stat 'cache miss' 1 - expect_stat 'files in cache' 3 + expect_stat preprocessed_cache_hit 1 + expect_stat direct_cache_hit 0 + expect_stat cache_miss 1 + expect_stat files_in_cache 3 expect_equal_content reference_test1.o test_cpp.o # Specified used define. $ccache_nvcc_cpp -DNUM=10 test_cpp.cu - expect_stat "cache hit (direct)" 0 - expect_stat 'cache miss' 2 - expect_stat 'files in cache' 5 + expect_stat direct_cache_hit 0 + expect_stat cache_miss 2 + expect_stat files_in_cache 5 expect_equal_content reference_test2.o test_cpp.o $ccache_nvcc_cpp -DNUM=10 test_cpp.cu - expect_stat 'cache hit (direct)' 1 - expect_stat 'cache miss' 2 - expect_stat 'files in cache' 5 + expect_stat direct_cache_hit 1 + expect_stat cache_miss 2 + expect_stat files_in_cache 5 expect_equal_content reference_test2.o test_cpp.o # ------------------------------------------------------------------------- @@ -132,26 +132,26 @@ SUITE_nvcc_direct() { expect_different_content reference_test1.o reference_test2.o $ccache_nvcc_cpp -optf test1.optf test_cpp.cu - expect_stat 'cache hit (direct)' 0 - expect_stat 'cache miss' 1 - expect_stat 'files in cache' 2 + expect_stat direct_cache_hit 0 + expect_stat cache_miss 1 + expect_stat files_in_cache 2 expect_equal_content reference_test1.o test_cpp.o $ccache_nvcc_cpp -optf test1.optf test_cpp.cu - expect_stat 'cache hit (direct)' 1 - expect_stat 'cache miss' 1 - expect_stat 'files in cache' 2 + expect_stat direct_cache_hit 1 + expect_stat cache_miss 1 + expect_stat files_in_cache 2 expect_equal_content reference_test1.o test_cpp.o $ccache_nvcc_cpp -optf test2.optf test_cpp.cu - expect_stat 'cache hit (direct)' 1 - expect_stat 'cache miss' 2 - expect_stat 'files in cache' 4 + expect_stat direct_cache_hit 1 + expect_stat cache_miss 2 + expect_stat files_in_cache 4 expect_equal_content reference_test2.o test_cpp.o $ccache_nvcc_cpp -optf test2.optf test_cpp.cu - expect_stat 'cache hit (direct)' 2 - expect_stat 'cache miss' 2 - expect_stat 'files in cache' 4 + expect_stat direct_cache_hit 2 + expect_stat cache_miss 2 + expect_stat files_in_cache 4 expect_equal_content reference_test2.o test_cpp.o } diff --git a/test/suites/nvcc_ldir.bash b/test/suites/nvcc_ldir.bash index 2090bed5f..e18c664fc 100644 --- a/test/suites/nvcc_ldir.bash +++ b/test/suites/nvcc_ldir.bash @@ -58,16 +58,16 @@ SUITE_nvcc_ldir() { # First compile. $ccache_nvcc_cuda $TEST_OPTS test_cuda.cu - expect_stat 'cache hit (preprocessed)' 0 - expect_stat 'cache miss' 1 - expect_stat 'files in cache' 1 + expect_stat preprocessed_cache_hit 0 + expect_stat cache_miss 1 + expect_stat files_in_cache 1 $cuobjdump test_cuda.o > test1.dump expect_equal_content reference_test1.dump test1.dump $ccache_nvcc_cuda $TEST_OPTS test_cuda.cu - expect_stat 'cache hit (preprocessed)' 1 - expect_stat 'cache miss' 1 - expect_stat 'files in cache' 1 + expect_stat preprocessed_cache_hit 1 + expect_stat cache_miss 1 + expect_stat files_in_cache 1 $cuobjdump test_cuda.o > test1.dump expect_equal_content reference_test1.dump test1.dump @@ -80,16 +80,16 @@ SUITE_nvcc_ldir() { # First compile. $ccache_nvcc_cuda $TEST_OPTS test_cuda.cu - expect_stat 'cache hit (preprocessed)' 0 - expect_stat 'cache miss' 1 - expect_stat 'files in cache' 1 + expect_stat preprocessed_cache_hit 0 + expect_stat cache_miss 1 + expect_stat files_in_cache 1 $cuobjdump test_cuda.o > test1.dump expect_equal_content reference_test1.dump test1.dump $ccache_nvcc_cuda $TEST_OPTS test_cuda.cu - expect_stat 'cache hit (preprocessed)' 1 - expect_stat 'cache miss' 1 - expect_stat 'files in cache' 1 + expect_stat preprocessed_cache_hit 1 + expect_stat cache_miss 1 + expect_stat files_in_cache 1 $cuobjdump test_cuda.o > test1.dump expect_equal_content reference_test1.dump test1.dump diff --git a/test/suites/pch.bash b/test/suites/pch.bash index 97a5c5e0a..ad77c8224 100644 --- a/test/suites/pch.bash +++ b/test/suites/pch.bash @@ -66,56 +66,56 @@ pch_suite_common() { TEST "Create .gch, -c, no -o, without opt-in" $CCACHE_COMPILE $SYSROOT -c pch.h - expect_stat 'cache hit (direct)' 0 - expect_stat 'cache hit (preprocessed)' 0 - expect_stat 'cache miss' 0 - expect_stat "can't use precompiled header" 1 + expect_stat direct_cache_hit 0 + expect_stat preprocessed_cache_hit 0 + expect_stat cache_miss 0 + expect_stat could_not_use_precompiled_header 1 # ------------------------------------------------------------------------- TEST "Create .gch, no -c, -o, without opt-in" $CCACHE_COMPILE pch.h -o pch.gch - expect_stat 'cache hit (direct)' 0 - expect_stat 'cache hit (preprocessed)' 0 - expect_stat 'cache miss' 0 - expect_stat "can't use precompiled header" 1 + expect_stat direct_cache_hit 0 + expect_stat preprocessed_cache_hit 0 + expect_stat cache_miss 0 + expect_stat could_not_use_precompiled_header 1 # ------------------------------------------------------------------------- TEST "Create .gch, -c, no -o, with opt-in" CCACHE_SLOPPINESS="$DEFAULT_SLOPPINESS pch_defines" $CCACHE_COMPILE $SYSROOT -c pch.h - expect_stat 'cache hit (direct)' 0 - expect_stat 'cache hit (preprocessed)' 0 - expect_stat 'cache miss' 1 + expect_stat direct_cache_hit 0 + expect_stat preprocessed_cache_hit 0 + expect_stat cache_miss 1 rm pch.h.gch CCACHE_SLOPPINESS="$DEFAULT_SLOPPINESS pch_defines" $CCACHE_COMPILE $SYSROOT -c pch.h - expect_stat 'cache hit (direct)' 1 - expect_stat 'cache hit (preprocessed)' 0 - expect_stat 'cache miss' 1 + expect_stat direct_cache_hit 1 + expect_stat preprocessed_cache_hit 0 + expect_stat cache_miss 1 expect_exists pch.h.gch echo '#include /*change pch*/' >>pch.h backdate pch.h rm pch.h.gch CCACHE_SLOPPINESS="$DEFAULT_SLOPPINESS pch_defines" $CCACHE_COMPILE $SYSROOT -c pch.h - expect_stat 'cache hit (direct)' 1 - expect_stat 'cache hit (preprocessed)' 0 - expect_stat 'cache miss' 2 + expect_stat direct_cache_hit 1 + expect_stat preprocessed_cache_hit 0 + expect_stat cache_miss 2 expect_exists pch.h.gch # ------------------------------------------------------------------------- TEST "Create .gch, no -c, -o, with opt-in" CCACHE_SLOPPINESS="$DEFAULT_SLOPPINESS pch_defines" $CCACHE_COMPILE $SYSROOT pch.h -o pch.gch - expect_stat 'cache hit (direct)' 0 - expect_stat 'cache hit (preprocessed)' 0 - expect_stat 'cache miss' 1 + expect_stat direct_cache_hit 0 + expect_stat preprocessed_cache_hit 0 + expect_stat cache_miss 1 CCACHE_SLOPPINESS="$DEFAULT_SLOPPINESS pch_defines" $CCACHE_COMPILE $SYSROOT pch.h -o pch.gch - expect_stat 'cache hit (direct)' 1 - expect_stat 'cache hit (preprocessed)' 0 - expect_stat 'cache miss' 1 + expect_stat direct_cache_hit 1 + expect_stat preprocessed_cache_hit 0 + expect_stat cache_miss 1 expect_exists pch.gch # ------------------------------------------------------------------------- @@ -126,12 +126,12 @@ pch_suite_common() { rm pch.h $CCACHE_COMPILE $SYSROOT -c pch.c 2>/dev/null - expect_stat 'cache hit (direct)' 0 - expect_stat 'cache hit (preprocessed)' 0 - expect_stat 'cache miss' 0 + expect_stat direct_cache_hit 0 + expect_stat preprocessed_cache_hit 0 + expect_stat cache_miss 0 # Preprocessor error because GCC can't find the real include file when # trying to preprocess (gcc -E will be called by ccache): - expect_stat 'preprocessor error' 1 + expect_stat preprocessor_error 1 # ------------------------------------------------------------------------- TEST "Use .gch, -include, no sloppiness" @@ -140,11 +140,11 @@ pch_suite_common() { backdate pch.h.gch $CCACHE_COMPILE $SYSROOT -c -include pch.h pch2.c - expect_stat 'cache hit (direct)' 0 - expect_stat 'cache hit (preprocessed)' 0 - expect_stat 'cache miss' 0 + expect_stat direct_cache_hit 0 + expect_stat preprocessed_cache_hit 0 + expect_stat cache_miss 0 # Must enable sloppy time macros: - expect_stat "can't use precompiled header" 1 + expect_stat could_not_use_precompiled_header 1 # ------------------------------------------------------------------------- TEST "Use .gch, -include" @@ -153,14 +153,14 @@ pch_suite_common() { backdate pch.h.gch CCACHE_SLOPPINESS="$DEFAULT_SLOPPINESS time_macros" $CCACHE_COMPILE $SYSROOT -c -include pch.h pch2.c - expect_stat 'cache hit (direct)' 0 - expect_stat 'cache hit (preprocessed)' 0 - expect_stat 'cache miss' 1 + expect_stat direct_cache_hit 0 + expect_stat preprocessed_cache_hit 0 + expect_stat cache_miss 1 CCACHE_SLOPPINESS="$DEFAULT_SLOPPINESS time_macros" $CCACHE_COMPILE $SYSROOT -c -include pch.h pch2.c - expect_stat 'cache hit (direct)' 1 - expect_stat 'cache hit (preprocessed)' 0 - expect_stat 'cache miss' 1 + expect_stat direct_cache_hit 1 + expect_stat preprocessed_cache_hit 0 + expect_stat cache_miss 1 echo '#include /*change pch*/' >>pch.h backdate pch.h @@ -168,14 +168,14 @@ pch_suite_common() { backdate pch.h.gch CCACHE_SLOPPINESS="$DEFAULT_SLOPPINESS time_macros" $CCACHE_COMPILE $SYSROOT -c -include pch.h pch2.c - expect_stat 'cache hit (direct)' 1 - expect_stat 'cache hit (preprocessed)' 0 - expect_stat 'cache miss' 2 + expect_stat direct_cache_hit 1 + expect_stat preprocessed_cache_hit 0 + expect_stat cache_miss 2 CCACHE_SLOPPINESS="$DEFAULT_SLOPPINESS time_macros" $CCACHE_COMPILE $SYSROOT -c -include pch.h pch2.c - expect_stat 'cache hit (direct)' 2 - expect_stat 'cache hit (preprocessed)' 0 - expect_stat 'cache miss' 2 + expect_stat direct_cache_hit 2 + expect_stat preprocessed_cache_hit 0 + expect_stat cache_miss 2 # ------------------------------------------------------------------------- TEST "Use .gch, preprocessor mode, -include" @@ -184,14 +184,14 @@ pch_suite_common() { backdate pch.h.gch CCACHE_NODIRECT=1 CCACHE_SLOPPINESS="$DEFAULT_SLOPPINESS time_macros" $CCACHE_COMPILE $SYSROOT -c -include pch.h pch.c - expect_stat 'cache hit (direct)' 0 - expect_stat 'cache hit (preprocessed)' 0 - expect_stat 'cache miss' 1 + expect_stat direct_cache_hit 0 + expect_stat preprocessed_cache_hit 0 + expect_stat cache_miss 1 CCACHE_NODIRECT=1 CCACHE_SLOPPINESS="$DEFAULT_SLOPPINESS time_macros" $CCACHE_COMPILE $SYSROOT -c -include pch.h pch.c - expect_stat 'cache hit (direct)' 0 - expect_stat 'cache hit (preprocessed)' 1 - expect_stat 'cache miss' 1 + expect_stat direct_cache_hit 0 + expect_stat preprocessed_cache_hit 1 + expect_stat cache_miss 1 echo '#include /*change pch*/' >>pch.h backdate pch.h @@ -199,28 +199,28 @@ pch_suite_common() { backdate pch.h.gch CCACHE_NODIRECT=1 CCACHE_SLOPPINESS="$DEFAULT_SLOPPINESS time_macros" $CCACHE_COMPILE $SYSROOT -c -include pch.h pch.c - expect_stat 'cache hit (direct)' 0 - expect_stat 'cache hit (preprocessed)' 1 - expect_stat 'cache miss' 2 + expect_stat direct_cache_hit 0 + expect_stat preprocessed_cache_hit 1 + expect_stat cache_miss 2 CCACHE_NODIRECT=1 CCACHE_SLOPPINESS="$DEFAULT_SLOPPINESS time_macros" $CCACHE_COMPILE $SYSROOT -c -include pch.h pch.c - expect_stat 'cache hit (direct)' 0 - expect_stat 'cache hit (preprocessed)' 2 - expect_stat 'cache miss' 2 + expect_stat direct_cache_hit 0 + expect_stat preprocessed_cache_hit 2 + expect_stat cache_miss 2 # ------------------------------------------------------------------------- TEST "Create .gch, -c, -o" CCACHE_SLOPPINESS="$DEFAULT_SLOPPINESS pch_defines" $CCACHE_COMPILE $SYSROOT -c pch.h -o pch.h.gch - expect_stat 'cache hit (direct)' 0 - expect_stat 'cache hit (preprocessed)' 0 - expect_stat 'cache miss' 1 + expect_stat direct_cache_hit 0 + expect_stat preprocessed_cache_hit 0 + expect_stat cache_miss 1 rm -f pch.h.gch CCACHE_SLOPPINESS="$DEFAULT_SLOPPINESS pch_defines" $CCACHE_COMPILE $SYSROOT -c pch.h -o pch.h.gch - expect_stat 'cache hit (direct)' 1 - expect_stat 'cache hit (preprocessed)' 0 - expect_stat 'cache miss' 1 + expect_stat direct_cache_hit 1 + expect_stat preprocessed_cache_hit 0 + expect_stat cache_miss 1 expect_exists pch.h.gch echo '#include /*change pch*/' >>pch.h @@ -228,9 +228,9 @@ pch_suite_common() { rm pch.h.gch CCACHE_SLOPPINESS="$DEFAULT_SLOPPINESS pch_defines" $CCACHE_COMPILE $SYSROOT -c pch.h -o pch.h.gch - expect_stat 'cache hit (direct)' 1 - expect_stat 'cache hit (preprocessed)' 0 - expect_stat 'cache miss' 2 + expect_stat direct_cache_hit 1 + expect_stat preprocessed_cache_hit 0 + expect_stat cache_miss 2 expect_exists pch.h.gch # ------------------------------------------------------------------------- @@ -242,26 +242,26 @@ pch_suite_common() { echo "original checksum" > pch.h.gch.sum CCACHE_PCH_EXTSUM=1 CCACHE_SLOPPINESS="$DEFAULT_SLOPPINESS time_macros" $CCACHE_COMPILE $SYSROOT -c -include pch.h pch2.c - expect_stat 'cache hit (direct)' 0 - expect_stat 'cache hit (preprocessed)' 0 - expect_stat 'cache miss' 1 + expect_stat direct_cache_hit 0 + expect_stat preprocessed_cache_hit 0 + expect_stat cache_miss 1 CCACHE_PCH_EXTSUM=1 CCACHE_SLOPPINESS="$DEFAULT_SLOPPINESS time_macros" $CCACHE_COMPILE $SYSROOT -c -include pch.h pch2.c - expect_stat 'cache hit (direct)' 1 - expect_stat 'cache hit (preprocessed)' 0 - expect_stat 'cache miss' 1 + expect_stat direct_cache_hit 1 + expect_stat preprocessed_cache_hit 0 + expect_stat cache_miss 1 echo "other checksum" > pch.h.gch.sum CCACHE_PCH_EXTSUM=1 CCACHE_SLOPPINESS="$DEFAULT_SLOPPINESS time_macros" $CCACHE_COMPILE $SYSROOT -c -include pch.h pch2.c - expect_stat 'cache hit (direct)' 1 - expect_stat 'cache hit (preprocessed)' 0 - expect_stat 'cache miss' 2 + expect_stat direct_cache_hit 1 + expect_stat preprocessed_cache_hit 0 + expect_stat cache_miss 2 echo "original checksum" > pch.h.gch.sum CCACHE_PCH_EXTSUM=1 CCACHE_SLOPPINESS="$DEFAULT_SLOPPINESS time_macros" $CCACHE_COMPILE $SYSROOT -c -include pch.h pch2.c - expect_stat 'cache hit (direct)' 2 - expect_stat 'cache hit (preprocessed)' 0 - expect_stat 'cache miss' 2 + expect_stat direct_cache_hit 2 + expect_stat preprocessed_cache_hit 0 + expect_stat cache_miss 2 # With GCC, a newly generated PCH is always different, even if the contents # should be exactly the same. And Clang stores file timestamps, so in this @@ -274,9 +274,9 @@ pch_suite_common() { backdate pch.h.gch CCACHE_PCH_EXTSUM=1 CCACHE_SLOPPINESS="$DEFAULT_SLOPPINESS time_macros" $CCACHE_COMPILE $SYSROOT -c -include pch.h pch2.c - expect_stat 'cache hit (direct)' 3 - expect_stat 'cache hit (preprocessed)' 0 - expect_stat 'cache miss' 2 + expect_stat direct_cache_hit 3 + expect_stat preprocessed_cache_hit 0 + expect_stat cache_miss 2 # ------------------------------------------------------------------------- TEST "Use .gch, -include, no PCH_EXTSUM" @@ -287,21 +287,21 @@ pch_suite_common() { echo "original checksum" > pch.h.gch.sum CCACHE_SLOPPINESS="$DEFAULT_SLOPPINESS time_macros" $CCACHE_COMPILE $SYSROOT -c -include pch.h pch.c - expect_stat 'cache hit (direct)' 0 - expect_stat 'cache hit (preprocessed)' 0 - expect_stat 'cache miss' 1 + expect_stat direct_cache_hit 0 + expect_stat preprocessed_cache_hit 0 + expect_stat cache_miss 1 CCACHE_SLOPPINESS="$DEFAULT_SLOPPINESS time_macros" $CCACHE_COMPILE $SYSROOT -c -include pch.h pch.c - expect_stat 'cache hit (direct)' 1 - expect_stat 'cache hit (preprocessed)' 0 - expect_stat 'cache miss' 1 + expect_stat direct_cache_hit 1 + expect_stat preprocessed_cache_hit 0 + expect_stat cache_miss 1 # external checksum not used, so no cache miss when changed echo "other checksum" > pch.h.gch.sum CCACHE_SLOPPINESS="$DEFAULT_SLOPPINESS time_macros" $CCACHE_COMPILE $SYSROOT -c -include pch.h pch.c - expect_stat 'cache hit (direct)' 2 - expect_stat 'cache hit (preprocessed)' 0 - expect_stat 'cache miss' 1 + expect_stat direct_cache_hit 2 + expect_stat preprocessed_cache_hit 0 + expect_stat cache_miss 1 # ------------------------------------------------------------------------- TEST "Use .gch, -include, other dir for .gch" @@ -312,14 +312,14 @@ pch_suite_common() { rm -f pch.h.gch CCACHE_SLOPPINESS="$DEFAULT_SLOPPINESS time_macros" $CCACHE_COMPILE $SYSROOT -c -include dir/pch.h pch2.c - expect_stat 'cache hit (direct)' 0 - expect_stat 'cache hit (preprocessed)' 0 - expect_stat 'cache miss' 1 + expect_stat direct_cache_hit 0 + expect_stat preprocessed_cache_hit 0 + expect_stat cache_miss 1 CCACHE_SLOPPINESS="$DEFAULT_SLOPPINESS time_macros" $CCACHE_COMPILE $SYSROOT -c -include dir/pch.h pch2.c - expect_stat 'cache hit (direct)' 1 - expect_stat 'cache hit (preprocessed)' 0 - expect_stat 'cache miss' 1 + expect_stat direct_cache_hit 1 + expect_stat preprocessed_cache_hit 0 + expect_stat cache_miss 1 echo '#include /*change pch*/' >>pch.h backdate pch.h @@ -327,14 +327,14 @@ pch_suite_common() { backdate dir/pch.h.gch CCACHE_SLOPPINESS="$DEFAULT_SLOPPINESS time_macros" $CCACHE_COMPILE $SYSROOT -c -include dir/pch.h pch2.c - expect_stat 'cache hit (direct)' 1 - expect_stat 'cache hit (preprocessed)' 0 - expect_stat 'cache miss' 2 + expect_stat direct_cache_hit 1 + expect_stat preprocessed_cache_hit 0 + expect_stat cache_miss 2 CCACHE_SLOPPINESS="$DEFAULT_SLOPPINESS time_macros" $CCACHE_COMPILE $SYSROOT -c -include dir/pch.h pch2.c - expect_stat 'cache hit (direct)' 2 - expect_stat 'cache hit (preprocessed)' 0 - expect_stat 'cache miss' 2 + expect_stat direct_cache_hit 2 + expect_stat preprocessed_cache_hit 0 + expect_stat cache_miss 2 rm -rf dir # ------------------------------------------------------------------------- @@ -346,14 +346,14 @@ pch_suite_common() { rm -f pch.h.gch CCACHE_NODIRECT=1 CCACHE_SLOPPINESS="$DEFAULT_SLOPPINESS time_macros" $CCACHE_COMPILE $SYSROOT -c -include dir/pch.h pch.c - expect_stat 'cache hit (direct)' 0 - expect_stat 'cache hit (preprocessed)' 0 - expect_stat 'cache miss' 1 + expect_stat direct_cache_hit 0 + expect_stat preprocessed_cache_hit 0 + expect_stat cache_miss 1 CCACHE_NODIRECT=1 CCACHE_SLOPPINESS="$DEFAULT_SLOPPINESS time_macros" $CCACHE_COMPILE $SYSROOT -c -include dir/pch.h pch.c - expect_stat 'cache hit (direct)' 0 - expect_stat 'cache hit (preprocessed)' 1 - expect_stat 'cache miss' 1 + expect_stat direct_cache_hit 0 + expect_stat preprocessed_cache_hit 1 + expect_stat cache_miss 1 echo '#include /*change pch*/' >>pch.h backdate pch.h @@ -361,14 +361,14 @@ pch_suite_common() { backdate dir/pch.h.gch CCACHE_NODIRECT=1 CCACHE_SLOPPINESS="$DEFAULT_SLOPPINESS time_macros" $CCACHE_COMPILE $SYSROOT -c -include dir/pch.h pch.c - expect_stat 'cache hit (direct)' 0 - expect_stat 'cache hit (preprocessed)' 1 - expect_stat 'cache miss' 2 + expect_stat direct_cache_hit 0 + expect_stat preprocessed_cache_hit 1 + expect_stat cache_miss 2 CCACHE_NODIRECT=1 CCACHE_SLOPPINESS="$DEFAULT_SLOPPINESS time_macros" $CCACHE_COMPILE $SYSROOT -c -include dir/pch.h pch.c - expect_stat 'cache hit (direct)' 0 - expect_stat 'cache hit (preprocessed)' 2 - expect_stat 'cache miss' 2 + expect_stat direct_cache_hit 0 + expect_stat preprocessed_cache_hit 2 + expect_stat cache_miss 2 rm -rf dir # ------------------------------------------------------------------------- @@ -378,14 +378,14 @@ pch_suite_common() { 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 - expect_stat 'cache hit (direct)' 0 - expect_stat 'cache hit (preprocessed)' 0 - expect_stat 'cache miss' 1 + expect_stat direct_cache_hit 0 + expect_stat preprocessed_cache_hit 0 + expect_stat cache_miss 1 CCACHE_DEPEND=1 CCACHE_SLOPPINESS="$DEFAULT_SLOPPINESS time_macros" $CCACHE_COMPILE $SYSROOT -c -include pch.h pch2.c -MD -MF pch.d - expect_stat 'cache hit (direct)' 1 - expect_stat 'cache hit (preprocessed)' 0 - expect_stat 'cache miss' 1 + expect_stat direct_cache_hit 1 + expect_stat preprocessed_cache_hit 0 + expect_stat cache_miss 1 echo '#include /*change pch*/' >>pch.h backdate pch.h @@ -393,14 +393,14 @@ pch_suite_common() { 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 - expect_stat 'cache hit (direct)' 1 - expect_stat 'cache hit (preprocessed)' 0 - expect_stat 'cache miss' 2 + expect_stat direct_cache_hit 1 + expect_stat preprocessed_cache_hit 0 + expect_stat cache_miss 2 CCACHE_DEPEND=1 CCACHE_SLOPPINESS="$DEFAULT_SLOPPINESS time_macros" $CCACHE_COMPILE $SYSROOT -c -include pch.h pch2.c -MD -MF pch.d - expect_stat 'cache hit (direct)' 2 - expect_stat 'cache hit (preprocessed)' 0 - expect_stat 'cache miss' 2 + expect_stat direct_cache_hit 2 + expect_stat preprocessed_cache_hit 0 + expect_stat cache_miss 2 } pch_suite_gcc() { @@ -412,14 +412,14 @@ pch_suite_gcc() { rm pch.h CCACHE_SLOPPINESS="$DEFAULT_SLOPPINESS time_macros" $CCACHE_COMPILE $SYSROOT -c -include pch.h pch2.c - expect_stat 'cache hit (direct)' 0 - expect_stat 'cache hit (preprocessed)' 0 - expect_stat 'cache miss' 1 + expect_stat direct_cache_hit 0 + expect_stat preprocessed_cache_hit 0 + expect_stat cache_miss 1 CCACHE_SLOPPINESS="$DEFAULT_SLOPPINESS time_macros" $CCACHE_COMPILE $SYSROOT -c -include pch.h pch2.c - expect_stat 'cache hit (direct)' 1 - expect_stat 'cache hit (preprocessed)' 0 - expect_stat 'cache miss' 1 + expect_stat direct_cache_hit 1 + expect_stat preprocessed_cache_hit 0 + expect_stat cache_miss 1 # ------------------------------------------------------------------------- TEST "Use .gch, #include, no sloppiness" @@ -429,10 +429,10 @@ pch_suite_gcc() { rm pch.h $CCACHE_COMPILE $SYSROOT -c -fpch-preprocess pch.c - expect_stat 'cache hit (direct)' 0 - expect_stat 'cache hit (preprocessed)' 0 + expect_stat direct_cache_hit 0 + expect_stat preprocessed_cache_hit 0 # Must enable sloppy time macros: - expect_stat "can't use precompiled header" 1 + expect_stat could_not_use_precompiled_header 1 # ------------------------------------------------------------------------- TEST "Use .gch, #include" @@ -442,14 +442,14 @@ pch_suite_gcc() { rm pch.h CCACHE_SLOPPINESS="$DEFAULT_SLOPPINESS time_macros" $CCACHE_COMPILE $SYSROOT -c -fpch-preprocess pch.c - expect_stat 'cache hit (direct)' 0 - expect_stat 'cache hit (preprocessed)' 0 - expect_stat 'cache miss' 1 + expect_stat direct_cache_hit 0 + expect_stat preprocessed_cache_hit 0 + expect_stat cache_miss 1 CCACHE_SLOPPINESS="$DEFAULT_SLOPPINESS time_macros" $CCACHE_COMPILE $SYSROOT -c -fpch-preprocess pch.c - expect_stat 'cache hit (direct)' 1 - expect_stat 'cache hit (preprocessed)' 0 - expect_stat 'cache miss' 1 + expect_stat direct_cache_hit 1 + expect_stat preprocessed_cache_hit 0 + expect_stat cache_miss 1 echo '#include /*change pch*/' >>pch.h backdate pch.h @@ -457,14 +457,14 @@ pch_suite_gcc() { backdate pch.h.gch CCACHE_SLOPPINESS="$DEFAULT_SLOPPINESS time_macros" $CCACHE_COMPILE $SYSROOT -c -fpch-preprocess pch.c - expect_stat 'cache hit (direct)' 1 - expect_stat 'cache hit (preprocessed)' 0 - expect_stat 'cache miss' 2 + expect_stat direct_cache_hit 1 + expect_stat preprocessed_cache_hit 0 + expect_stat cache_miss 2 CCACHE_SLOPPINESS="$DEFAULT_SLOPPINESS time_macros" $CCACHE_COMPILE $SYSROOT -c -fpch-preprocess pch.c - expect_stat 'cache hit (direct)' 2 - expect_stat 'cache hit (preprocessed)' 0 - expect_stat 'cache miss' 2 + expect_stat direct_cache_hit 2 + expect_stat preprocessed_cache_hit 0 + expect_stat cache_miss 2 # ------------------------------------------------------------------------- TEST "Use .gch, preprocessor mode, #include" @@ -474,14 +474,14 @@ pch_suite_gcc() { rm pch.h CCACHE_NODIRECT=1 CCACHE_SLOPPINESS="$DEFAULT_SLOPPINESS time_macros" $CCACHE_COMPILE $SYSROOT -c -fpch-preprocess pch.c - expect_stat 'cache hit (direct)' 0 - expect_stat 'cache hit (preprocessed)' 0 - expect_stat 'cache miss' 1 + expect_stat direct_cache_hit 0 + expect_stat preprocessed_cache_hit 0 + expect_stat cache_miss 1 CCACHE_NODIRECT=1 CCACHE_SLOPPINESS="$DEFAULT_SLOPPINESS time_macros" $CCACHE_COMPILE $SYSROOT -c -fpch-preprocess pch.c - expect_stat 'cache hit (direct)' 0 - expect_stat 'cache hit (preprocessed)' 1 - expect_stat 'cache miss' 1 + expect_stat direct_cache_hit 0 + expect_stat preprocessed_cache_hit 1 + expect_stat cache_miss 1 echo '#include /*change pch*/' >>pch.h backdate pch.h @@ -489,14 +489,14 @@ pch_suite_gcc() { backdate pch.h.gch CCACHE_NODIRECT=1 CCACHE_SLOPPINESS="$DEFAULT_SLOPPINESS time_macros" $CCACHE_COMPILE $SYSROOT -c -fpch-preprocess pch.c - expect_stat 'cache hit (direct)' 0 - expect_stat 'cache hit (preprocessed)' 1 - expect_stat 'cache miss' 2 + expect_stat direct_cache_hit 0 + expect_stat preprocessed_cache_hit 1 + expect_stat cache_miss 2 CCACHE_NODIRECT=1 CCACHE_SLOPPINESS="$DEFAULT_SLOPPINESS time_macros" $CCACHE_COMPILE $SYSROOT -c -fpch-preprocess pch.c - expect_stat 'cache hit (direct)' 0 - expect_stat 'cache hit (preprocessed)' 2 - expect_stat 'cache miss' 2 + expect_stat direct_cache_hit 0 + expect_stat preprocessed_cache_hit 2 + expect_stat cache_miss 2 # ------------------------------------------------------------------------- TEST "Create and use .gch directory" @@ -504,41 +504,41 @@ pch_suite_gcc() { mkdir pch.h.gch CCACHE_SLOPPINESS="$DEFAULT_SLOPPINESS pch_defines" $CCACHE_COMPILE $SYSROOT -x c-header -c pch.h -o pch.h.gch/foo - expect_stat 'cache hit (direct)' 0 - expect_stat 'cache hit (preprocessed)' 0 - expect_stat 'cache miss' 1 + expect_stat direct_cache_hit 0 + expect_stat preprocessed_cache_hit 0 + expect_stat cache_miss 1 rm pch.h.gch/foo CCACHE_SLOPPINESS="$DEFAULT_SLOPPINESS pch_defines" $CCACHE_COMPILE $SYSROOT -x c-header -c pch.h -o pch.h.gch/foo - expect_stat 'cache hit (direct)' 1 - expect_stat 'cache hit (preprocessed)' 0 - expect_stat 'cache miss' 1 + expect_stat direct_cache_hit 1 + expect_stat preprocessed_cache_hit 0 + expect_stat cache_miss 1 expect_exists pch.h.gch/foo backdate pch.h.gch/foo CCACHE_SLOPPINESS="$DEFAULT_SLOPPINESS time_macros" $CCACHE_COMPILE $SYSROOT -c -include pch.h pch2.c - expect_stat 'cache hit (direct)' 1 - expect_stat 'cache hit (preprocessed)' 0 - expect_stat 'cache miss' 2 + expect_stat direct_cache_hit 1 + expect_stat preprocessed_cache_hit 0 + expect_stat cache_miss 2 CCACHE_SLOPPINESS="$DEFAULT_SLOPPINESS time_macros" $CCACHE_COMPILE $SYSROOT -c -include pch.h pch2.c - expect_stat 'cache hit (direct)' 2 - expect_stat 'cache hit (preprocessed)' 0 - expect_stat 'cache miss' 2 + expect_stat direct_cache_hit 2 + expect_stat preprocessed_cache_hit 0 + expect_stat cache_miss 2 echo "updated" >>pch.h.gch/foo # GCC seems to cope with this... backdate pch.h.gch/foo CCACHE_SLOPPINESS="$DEFAULT_SLOPPINESS time_macros" $CCACHE_COMPILE $SYSROOT -c -include pch.h pch2.c - expect_stat 'cache hit (direct)' 2 - expect_stat 'cache hit (preprocessed)' 0 - expect_stat 'cache miss' 3 + expect_stat direct_cache_hit 2 + expect_stat preprocessed_cache_hit 0 + expect_stat cache_miss 3 CCACHE_SLOPPINESS="$DEFAULT_SLOPPINESS time_macros" $CCACHE_COMPILE $SYSROOT -c -include pch.h pch2.c - expect_stat 'cache hit (direct)' 3 - expect_stat 'cache hit (preprocessed)' 0 - expect_stat 'cache miss' 3 + expect_stat direct_cache_hit 3 + expect_stat preprocessed_cache_hit 0 + expect_stat cache_miss 3 # ------------------------------------------------------------------------- TEST "Use .gch, #include, PCH_EXTSUM=1" @@ -549,26 +549,26 @@ pch_suite_gcc() { echo "original checksum" > pch.h.gch.sum CCACHE_PCH_EXTSUM=1 CCACHE_SLOPPINESS="$DEFAULT_SLOPPINESS time_macros" $CCACHE_COMPILE $SYSROOT -c -fpch-preprocess pch.c - expect_stat 'cache hit (direct)' 0 - expect_stat 'cache hit (preprocessed)' 0 - expect_stat 'cache miss' 1 + expect_stat direct_cache_hit 0 + expect_stat preprocessed_cache_hit 0 + expect_stat cache_miss 1 CCACHE_PCH_EXTSUM=1 CCACHE_SLOPPINESS="$DEFAULT_SLOPPINESS time_macros" $CCACHE_COMPILE $SYSROOT -c -fpch-preprocess pch.c - expect_stat 'cache hit (direct)' 1 - expect_stat 'cache hit (preprocessed)' 0 - expect_stat 'cache miss' 1 + expect_stat direct_cache_hit 1 + expect_stat preprocessed_cache_hit 0 + expect_stat cache_miss 1 echo "other checksum" > pch.h.gch.sum CCACHE_PCH_EXTSUM=1 CCACHE_SLOPPINESS="$DEFAULT_SLOPPINESS time_macros" $CCACHE_COMPILE $SYSROOT -c -fpch-preprocess pch.c - expect_stat 'cache hit (direct)' 1 - expect_stat 'cache hit (preprocessed)' 0 - expect_stat 'cache miss' 2 + expect_stat direct_cache_hit 1 + expect_stat preprocessed_cache_hit 0 + expect_stat cache_miss 2 echo "original checksum" > pch.h.gch.sum CCACHE_PCH_EXTSUM=1 CCACHE_SLOPPINESS="$DEFAULT_SLOPPINESS time_macros" $CCACHE_COMPILE $SYSROOT -c -fpch-preprocess pch.c - expect_stat 'cache hit (direct)' 2 - expect_stat 'cache hit (preprocessed)' 0 - expect_stat 'cache miss' 2 + expect_stat direct_cache_hit 2 + expect_stat preprocessed_cache_hit 0 + expect_stat cache_miss 2 # With GCC, a newly generated PCH is always different, even if the contents # should be exactly the same. And Clang stores file timestamps, so in this @@ -581,9 +581,9 @@ pch_suite_gcc() { backdate pch.h.gch CCACHE_PCH_EXTSUM=1 CCACHE_SLOPPINESS="$DEFAULT_SLOPPINESS time_macros" $CCACHE_COMPILE $SYSROOT -c -fpch-preprocess pch.c - expect_stat 'cache hit (direct)' 3 - expect_stat 'cache hit (preprocessed)' 0 - expect_stat 'cache miss' 2 + expect_stat direct_cache_hit 3 + expect_stat preprocessed_cache_hit 0 + expect_stat cache_miss 2 # ------------------------------------------------------------------------- TEST "Use .gch, #include, no PCH_EXTSUM" @@ -594,21 +594,21 @@ pch_suite_gcc() { echo "original checksum" > pch.h.gch.sum CCACHE_SLOPPINESS="$DEFAULT_SLOPPINESS time_macros" $CCACHE_COMPILE $SYSROOT -c -fpch-preprocess pch.c - expect_stat 'cache hit (direct)' 0 - expect_stat 'cache hit (preprocessed)' 0 - expect_stat 'cache miss' 1 + expect_stat direct_cache_hit 0 + expect_stat preprocessed_cache_hit 0 + expect_stat cache_miss 1 CCACHE_SLOPPINESS="$DEFAULT_SLOPPINESS time_macros" $CCACHE_COMPILE $SYSROOT -c -fpch-preprocess pch.c - expect_stat 'cache hit (direct)' 1 - expect_stat 'cache hit (preprocessed)' 0 - expect_stat 'cache miss' 1 + expect_stat direct_cache_hit 1 + expect_stat preprocessed_cache_hit 0 + expect_stat cache_miss 1 # external checksum not used, so no cache miss when changed echo "other checksum" > pch.h.gch.sum CCACHE_SLOPPINESS="$DEFAULT_SLOPPINESS time_macros" $CCACHE_COMPILE $SYSROOT -c -fpch-preprocess pch.c - expect_stat 'cache hit (direct)' 2 - expect_stat 'cache hit (preprocessed)' 0 - expect_stat 'cache miss' 1 + expect_stat direct_cache_hit 2 + expect_stat preprocessed_cache_hit 0 + expect_stat cache_miss 1 # ------------------------------------------------------------------------- TEST "Too new PCH file" @@ -628,10 +628,10 @@ pch_suite_gcc() { 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 - expect_stat 'cache hit (direct)' 0 - expect_stat 'cache hit (preprocessed)' 0 - expect_stat 'cache miss' 0 - expect_stat "can't use precompiled header" 1 + expect_stat direct_cache_hit 0 + expect_stat preprocessed_cache_hit 0 + expect_stat cache_miss 0 + expect_stat could_not_use_precompiled_header 1 } pch_suite_clang() { @@ -649,25 +649,25 @@ EOF sleep 1 CCACHE_SLOPPINESS="$DEFAULT_SLOPPINESS pch_defines" $CCACHE_COMPILE $SYSROOT -c pch2.h - expect_stat 'cache hit (direct)' 0 - expect_stat 'cache hit (preprocessed)' 0 - expect_stat 'cache miss' 1 + expect_stat direct_cache_hit 0 + expect_stat preprocessed_cache_hit 0 + expect_stat cache_miss 1 touch test.h sleep 1 CCACHE_SLOPPINESS="$DEFAULT_SLOPPINESS pch_defines" $CCACHE_COMPILE $SYSROOT -c pch2.h - expect_stat 'cache hit (direct)' 0 - expect_stat 'cache hit (preprocessed)' 0 - expect_stat 'cache miss' 2 + expect_stat direct_cache_hit 0 + expect_stat preprocessed_cache_hit 0 + expect_stat cache_miss 2 $REAL_COMPILER $SYSROOT -c -include pch2.h pch2.c expect_exists pch2.o CCACHE_SLOPPINESS="$DEFAULT_SLOPPINESS pch_defines" $CCACHE_COMPILE $SYSROOT -c pch2.h - expect_stat 'cache hit (direct)' 1 - expect_stat 'cache hit (preprocessed)' 0 - expect_stat 'cache miss' 2 + expect_stat direct_cache_hit 1 + expect_stat preprocessed_cache_hit 0 + expect_stat cache_miss 2 # ------------------------------------------------------------------------- TEST "Use .pch, -include, no sloppiness" @@ -676,11 +676,11 @@ EOF backdate pch.h.pch $CCACHE_COMPILE $SYSROOT -c -include pch.h pch2.c - expect_stat 'cache hit (direct)' 0 - expect_stat 'cache hit (preprocessed)' 0 - expect_stat 'cache miss' 0 + expect_stat direct_cache_hit 0 + expect_stat preprocessed_cache_hit 0 + expect_stat cache_miss 0 # Must enable sloppy time macros: - expect_stat "can't use precompiled header" 1 + expect_stat could_not_use_precompiled_header 1 # ------------------------------------------------------------------------- TEST "Use .pch, -include" @@ -689,14 +689,14 @@ EOF backdate pch.h.pch CCACHE_SLOPPINESS="$DEFAULT_SLOPPINESS time_macros" $CCACHE_COMPILE $SYSROOT -c -include pch.h pch2.c - expect_stat 'cache hit (direct)' 0 - expect_stat 'cache hit (preprocessed)' 0 - expect_stat 'cache miss' 1 + expect_stat direct_cache_hit 0 + expect_stat preprocessed_cache_hit 0 + expect_stat cache_miss 1 CCACHE_SLOPPINESS="$DEFAULT_SLOPPINESS time_macros" $CCACHE_COMPILE $SYSROOT -c -include pch.h pch2.c - expect_stat 'cache hit (direct)' 1 - expect_stat 'cache hit (preprocessed)' 0 - expect_stat 'cache miss' 1 + expect_stat direct_cache_hit 1 + expect_stat preprocessed_cache_hit 0 + expect_stat cache_miss 1 echo '#include /*change pch*/' >>pch.h backdate pch.h @@ -704,9 +704,9 @@ EOF backdate pch.h.pch CCACHE_SLOPPINESS="$DEFAULT_SLOPPINESS time_macros" $CCACHE_COMPILE $SYSROOT -c -include pch.h pch2.c - expect_stat 'cache hit (direct)' 1 - expect_stat 'cache hit (preprocessed)' 0 - expect_stat 'cache miss' 2 + expect_stat direct_cache_hit 1 + expect_stat preprocessed_cache_hit 0 + expect_stat cache_miss 2 # ------------------------------------------------------------------------- TEST "Use .pch, preprocessor mode, -include" @@ -715,14 +715,14 @@ EOF backdate pch.h.pch CCACHE_NODIRECT=1 CCACHE_SLOPPINESS="$DEFAULT_SLOPPINESS time_macros" $CCACHE_COMPILE $SYSROOT -c -include pch.h pch.c - expect_stat 'cache hit (direct)' 0 - expect_stat 'cache hit (preprocessed)' 0 - expect_stat 'cache miss' 1 + expect_stat direct_cache_hit 0 + expect_stat preprocessed_cache_hit 0 + expect_stat cache_miss 1 CCACHE_NODIRECT=1 CCACHE_SLOPPINESS="$DEFAULT_SLOPPINESS time_macros" $CCACHE_COMPILE $SYSROOT -c -include pch.h pch.c - expect_stat 'cache hit (direct)' 0 - expect_stat 'cache hit (preprocessed)' 1 - expect_stat 'cache miss' 1 + expect_stat direct_cache_hit 0 + expect_stat preprocessed_cache_hit 1 + expect_stat cache_miss 1 echo '#include /*change pch*/' >>pch.h backdate pch.h @@ -730,14 +730,14 @@ EOF backdate pch.h.pch CCACHE_NODIRECT=1 CCACHE_SLOPPINESS="$DEFAULT_SLOPPINESS time_macros" $CCACHE_COMPILE $SYSROOT -c -include pch.h pch.c - expect_stat 'cache hit (direct)' 0 - expect_stat 'cache hit (preprocessed)' 1 - expect_stat 'cache miss' 2 + expect_stat direct_cache_hit 0 + expect_stat preprocessed_cache_hit 1 + expect_stat cache_miss 2 CCACHE_NODIRECT=1 CCACHE_SLOPPINESS="$DEFAULT_SLOPPINESS time_macros" $CCACHE_COMPILE $SYSROOT -c -include pch.h pch.c - expect_stat 'cache hit (direct)' 0 - expect_stat 'cache hit (preprocessed)' 2 - expect_stat 'cache miss' 2 + expect_stat direct_cache_hit 0 + expect_stat preprocessed_cache_hit 2 + expect_stat cache_miss 2 # ------------------------------------------------------------------------- TEST "Use .pch, -include-pch" @@ -746,14 +746,14 @@ EOF backdate pch.h.pch CCACHE_SLOPPINESS="$DEFAULT_SLOPPINESS time_macros" $CCACHE_COMPILE $SYSROOT -c -include-pch pch.h.pch pch2.c - expect_stat 'cache hit (direct)' 0 - expect_stat 'cache hit (preprocessed)' 0 - expect_stat 'cache miss' 1 + expect_stat direct_cache_hit 0 + expect_stat preprocessed_cache_hit 0 + expect_stat cache_miss 1 CCACHE_SLOPPINESS="$DEFAULT_SLOPPINESS time_macros" $CCACHE_COMPILE $SYSROOT -c -include-pch pch.h.pch pch2.c - expect_stat 'cache hit (direct)' 1 - expect_stat 'cache hit (preprocessed)' 0 - expect_stat 'cache miss' 1 + expect_stat direct_cache_hit 1 + expect_stat preprocessed_cache_hit 0 + expect_stat cache_miss 1 echo '#include /*change pch*/' >>pch.h backdate pch.h @@ -761,9 +761,9 @@ EOF backdate pch.h.pch CCACHE_SLOPPINESS="$DEFAULT_SLOPPINESS time_macros" $CCACHE_COMPILE $SYSROOT -c -include-pch pch.h.pch pch2.c - expect_stat 'cache hit (direct)' 1 - expect_stat 'cache hit (preprocessed)' 0 - expect_stat 'cache miss' 2 + expect_stat direct_cache_hit 1 + expect_stat preprocessed_cache_hit 0 + expect_stat cache_miss 2 # ------------------------------------------------------------------------- TEST "Use .pch, preprocessor mode, -include-pch" @@ -772,14 +772,14 @@ EOF backdate pch.h.pch CCACHE_NODIRECT=1 CCACHE_SLOPPINESS="$DEFAULT_SLOPPINESS time_macros" $CCACHE_COMPILE $SYSROOT -c -include-pch pch.h.pch pch.c - expect_stat 'cache hit (direct)' 0 - expect_stat 'cache hit (preprocessed)' 0 - expect_stat 'cache miss' 1 + expect_stat direct_cache_hit 0 + expect_stat preprocessed_cache_hit 0 + expect_stat cache_miss 1 CCACHE_NODIRECT=1 CCACHE_SLOPPINESS="$DEFAULT_SLOPPINESS time_macros" $CCACHE_COMPILE $SYSROOT -c -include-pch pch.h.pch pch.c - expect_stat 'cache hit (direct)' 0 - expect_stat 'cache hit (preprocessed)' 1 - expect_stat 'cache miss' 1 + expect_stat direct_cache_hit 0 + expect_stat preprocessed_cache_hit 1 + expect_stat cache_miss 1 echo '#include /*change pch*/' >>pch.h backdate pch.h @@ -787,37 +787,37 @@ EOF backdate pch.h.pch CCACHE_NODIRECT=1 CCACHE_SLOPPINESS="$DEFAULT_SLOPPINESS time_macros" $CCACHE_COMPILE $SYSROOT -c -include-pch pch.h.pch pch.c - expect_stat 'cache hit (direct)' 0 - expect_stat 'cache hit (preprocessed)' 1 - expect_stat 'cache miss' 2 + expect_stat direct_cache_hit 0 + expect_stat preprocessed_cache_hit 1 + expect_stat cache_miss 2 CCACHE_NODIRECT=1 CCACHE_SLOPPINESS="$DEFAULT_SLOPPINESS time_macros" $CCACHE_COMPILE $SYSROOT -c -include-pch pch.h.pch pch.c - expect_stat 'cache hit (direct)' 0 - expect_stat 'cache hit (preprocessed)' 2 - expect_stat 'cache miss' 2 + expect_stat direct_cache_hit 0 + expect_stat preprocessed_cache_hit 2 + expect_stat cache_miss 2 # ------------------------------------------------------------------------- TEST "Create .pch with -Xclang options" CCACHE_SLOPPINESS="$DEFAULT_SLOPPINESS pch_defines" $CCACHE_COMPILE $SYSROOT -Xclang -emit-pch -o pch.h.pch -c pch.h - expect_stat 'cache hit (direct)' 0 - expect_stat 'cache hit (preprocessed)' 0 - expect_stat 'cache miss' 1 + expect_stat direct_cache_hit 0 + expect_stat preprocessed_cache_hit 0 + expect_stat cache_miss 1 rm pch.h.pch CCACHE_SLOPPINESS="$DEFAULT_SLOPPINESS pch_defines" $CCACHE_COMPILE $SYSROOT -Xclang -emit-pch -o pch.h.pch -c pch.h - expect_stat 'cache hit (direct)' 1 - expect_stat 'cache hit (preprocessed)' 0 - expect_stat 'cache miss' 1 + expect_stat direct_cache_hit 1 + expect_stat preprocessed_cache_hit 0 + expect_stat cache_miss 1 expect_exists pch.h.pch echo '#include /*change pch*/' >>pch.h backdate pch.h rm pch.h.pch CCACHE_SLOPPINESS="$DEFAULT_SLOPPINESS pch_defines" $CCACHE_COMPILE $SYSROOT -Xclang -emit-pch -o pch.h.pch -c pch.h - expect_stat 'cache hit (direct)' 1 - expect_stat 'cache hit (preprocessed)' 0 - expect_stat 'cache miss' 2 + expect_stat direct_cache_hit 1 + expect_stat preprocessed_cache_hit 0 + expect_stat cache_miss 2 expect_exists pch.h.pch # ------------------------------------------------------------------------- @@ -827,14 +827,14 @@ EOF 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 - expect_stat 'cache hit (direct)' 0 - expect_stat 'cache hit (preprocessed)' 0 - expect_stat 'cache miss' 1 + expect_stat direct_cache_hit 0 + expect_stat preprocessed_cache_hit 0 + expect_stat cache_miss 1 CCACHE_SLOPPINESS="$DEFAULT_SLOPPINESS time_macros" $CCACHE_COMPILE $SYSROOT -Xclang -include-pch -Xclang pch.h.pch -Xclang -include -Xclang pch.h -c pch.c - expect_stat 'cache hit (direct)' 1 - expect_stat 'cache hit (preprocessed)' 0 - expect_stat 'cache miss' 1 + expect_stat direct_cache_hit 1 + expect_stat preprocessed_cache_hit 0 + expect_stat cache_miss 1 echo '#include /*change pch*/' >>pch.h backdate pch.h @@ -842,12 +842,12 @@ EOF 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 - expect_stat 'cache hit (direct)' 1 - expect_stat 'cache hit (preprocessed)' 0 - expect_stat 'cache miss' 2 + expect_stat direct_cache_hit 1 + expect_stat preprocessed_cache_hit 0 + expect_stat cache_miss 2 CCACHE_SLOPPINESS="$DEFAULT_SLOPPINESS time_macros" $CCACHE_COMPILE $SYSROOT -Xclang -include-pch -Xclang pch.h.pch -Xclang -include -Xclang pch.h -c pch.c - expect_stat 'cache hit (direct)' 2 - expect_stat 'cache hit (preprocessed)' 0 - expect_stat 'cache miss' 2 + expect_stat direct_cache_hit 2 + expect_stat preprocessed_cache_hit 0 + expect_stat cache_miss 2 } diff --git a/test/suites/profiling.bash b/test/suites/profiling.bash index f9e0cba3b..aa0c93ed0 100644 --- a/test/suites/profiling.bash +++ b/test/suites/profiling.bash @@ -21,32 +21,32 @@ SUITE_profiling() { TEST "-fprofile-use, missing file" $CCACHE_COMPILE -fprofile-use -c test.c 2>/dev/null - expect_stat 'cache hit (direct)' 0 - expect_stat 'cache miss' 0 - expect_stat 'no input file' 1 + expect_stat direct_cache_hit 0 + expect_stat cache_miss 0 + expect_stat no_input_file 1 # ------------------------------------------------------------------------- TEST "-fbranch-probabilities, missing file" $CCACHE_COMPILE -fbranch-probabilities -c test.c 2>/dev/null - expect_stat 'cache hit (direct)' 0 - expect_stat 'cache miss' 0 - expect_stat 'no input file' 1 + expect_stat direct_cache_hit 0 + expect_stat cache_miss 0 + expect_stat no_input_file 1 # ------------------------------------------------------------------------- TEST "-fprofile-use=file, missing file" $CCACHE_COMPILE -fprofile-use=data.gcda -c test.c 2>/dev/null - expect_stat 'cache hit (direct)' 0 - expect_stat 'cache miss' 0 - expect_stat 'no input file' 1 + expect_stat direct_cache_hit 0 + expect_stat cache_miss 0 + expect_stat no_input_file 1 # ------------------------------------------------------------------------- TEST "-fprofile-use" $CCACHE_COMPILE -fprofile-generate -c test.c - expect_stat 'cache hit (direct)' 0 - expect_stat 'cache miss' 1 + expect_stat direct_cache_hit 0 + expect_stat cache_miss 1 $COMPILER -fprofile-generate test.o -o test @@ -54,19 +54,19 @@ SUITE_profiling() { merge_profiling_data . $CCACHE_COMPILE -fprofile-use -c test.c - expect_stat 'cache hit (direct)' 0 - expect_stat 'cache miss' 2 + expect_stat direct_cache_hit 0 + expect_stat cache_miss 2 $CCACHE_COMPILE -fprofile-use -c test.c - expect_stat 'cache hit (direct)' 1 - expect_stat 'cache miss' 2 + expect_stat direct_cache_hit 1 + expect_stat cache_miss 2 ./test merge_profiling_data . $CCACHE_COMPILE -fprofile-use -c test.c - expect_stat 'cache hit (direct)' 1 - expect_stat 'cache miss' 3 + expect_stat direct_cache_hit 1 + expect_stat cache_miss 3 # ------------------------------------------------------------------------- TEST "-fprofile-use=dir" @@ -74,8 +74,8 @@ SUITE_profiling() { mkdir data $CCACHE_COMPILE -fprofile-generate=data -c test.c - expect_stat 'cache hit (direct)' 0 - expect_stat 'cache miss' 1 + expect_stat direct_cache_hit 0 + expect_stat cache_miss 1 $COMPILER -fprofile-generate test.o -o test @@ -83,19 +83,19 @@ SUITE_profiling() { merge_profiling_data data $CCACHE_COMPILE -fprofile-use=data -c test.c - expect_stat 'cache hit (direct)' 0 - expect_stat 'cache miss' 2 + expect_stat direct_cache_hit 0 + expect_stat cache_miss 2 $CCACHE_COMPILE -fprofile-use=data -c test.c - expect_stat 'cache hit (direct)' 1 - expect_stat 'cache miss' 2 + expect_stat direct_cache_hit 1 + expect_stat cache_miss 2 ./test merge_profiling_data data $CCACHE_COMPILE -fprofile-use=data -c test.c - expect_stat 'cache hit (direct)' 1 - expect_stat 'cache miss' 3 + expect_stat direct_cache_hit 1 + expect_stat cache_miss 3 # ------------------------------------------------------------------------- TEST "-fprofile-generate=dir in different directories" @@ -106,13 +106,13 @@ SUITE_profiling() { $CCACHE_COMPILE -Werror -fprofile-generate=data -c ../test.c \ || test_failed "compilation error" - expect_stat 'cache hit (direct)' 0 - expect_stat 'cache miss' 1 + expect_stat direct_cache_hit 0 + expect_stat cache_miss 1 $CCACHE_COMPILE -Werror -fprofile-generate=data -c ../test.c \ || test_failed "compilation error" - expect_stat 'cache hit (direct)' 1 - expect_stat 'cache miss' 1 + expect_stat direct_cache_hit 1 + expect_stat cache_miss 1 $COMPILER -Werror -fprofile-generate test.o -o test \ || test_failed "compilation error" @@ -122,20 +122,20 @@ SUITE_profiling() { $CCACHE_COMPILE -Werror -fprofile-use=data -c ../test.c \ || test_failed "compilation error" - expect_stat 'cache hit (direct)' 1 - expect_stat 'cache miss' 2 + expect_stat direct_cache_hit 1 + expect_stat cache_miss 2 cd ../dir2 $CCACHE_COMPILE -Werror -fprofile-generate=data -c ../test.c \ || test_failed "compilation error" - expect_stat 'cache hit (direct)' 1 - expect_stat 'cache miss' 3 + expect_stat direct_cache_hit 1 + expect_stat cache_miss 3 $CCACHE_COMPILE -Werror -fprofile-generate=data -c ../test.c \ || test_failed "compilation error" - expect_stat 'cache hit (direct)' 2 - expect_stat 'cache miss' 3 + expect_stat direct_cache_hit 2 + expect_stat cache_miss 3 $COMPILER -Werror -fprofile-generate test.o -o test \ || test_failed "compilation error" @@ -167,14 +167,14 @@ SUITE_profiling() { rm "$gcno_name" $CCACHE_COMPILE $flag -ftest-coverage -c $dir/test.c -o $dir/test.o - expect_stat 'cache hit (direct)' 0 - expect_stat 'cache miss' 1 + expect_stat direct_cache_hit 0 + expect_stat cache_miss 1 expect_exists "$gcno_name" rm "$gcno_name" $CCACHE_COMPILE $flag -ftest-coverage -c $dir/test.c -o $dir/test.o - expect_stat 'cache hit (direct)' 1 - expect_stat 'cache miss' 1 + expect_stat direct_cache_hit 1 + expect_stat cache_miss 1 expect_exists "$gcno_name" rm "$gcno_name" done @@ -186,22 +186,22 @@ SUITE_profiling() { mkdir obj1 obj2 $CCACHE_COMPILE -fprofile-arcs -c test.c -o obj1/test.o - expect_stat 'cache hit (direct)' 0 - expect_stat 'cache miss' 1 + expect_stat direct_cache_hit 0 + expect_stat cache_miss 1 $CCACHE_COMPILE -fprofile-arcs -c test.c -o obj1/test.o - expect_stat 'cache hit (direct)' 1 - expect_stat 'cache miss' 1 + expect_stat direct_cache_hit 1 + expect_stat cache_miss 1 $CCACHE_COMPILE -fprofile-arcs -c test.c -o obj2/test.o expect_different_content obj1/test.o obj2/test.o # different paths to .gcda file - expect_stat 'cache hit (direct)' 1 - expect_stat 'cache miss' 2 + expect_stat direct_cache_hit 1 + expect_stat cache_miss 2 $CCACHE_COMPILE -fprofile-arcs -c test.c -o obj2/test.o expect_different_content obj1/test.o obj2/test.o # different paths to .gcda file - expect_stat 'cache hit (direct)' 2 - expect_stat 'cache miss' 2 + expect_stat direct_cache_hit 2 + expect_stat cache_miss 2 } merge_profiling_data() { diff --git a/test/suites/profiling_clang.bash b/test/suites/profiling_clang.bash index 8f8073d79..a6ac5c972 100644 --- a/test/suites/profiling_clang.bash +++ b/test/suites/profiling_clang.bash @@ -22,8 +22,8 @@ SUITE_profiling_clang() { mkdir data $CCACHE_COMPILE -fprofile-generate=data -c test.c - expect_stat 'cache hit (direct)' 0 - expect_stat 'cache miss' 1 + expect_stat direct_cache_hit 0 + expect_stat cache_miss 1 $COMPILER -fprofile-generate=data test.o -o test @@ -31,19 +31,19 @@ SUITE_profiling_clang() { llvm-profdata$CLANG_VERSION_SUFFIX merge -output foo.profdata data/default_*.profraw $CCACHE_COMPILE -fprofile-use=foo.profdata -c test.c - expect_stat 'cache hit (direct)' 0 - expect_stat 'cache miss' 2 + expect_stat direct_cache_hit 0 + expect_stat cache_miss 2 $CCACHE_COMPILE -fprofile-use=foo.profdata -c test.c - expect_stat 'cache hit (direct)' 1 - expect_stat 'cache miss' 2 + expect_stat direct_cache_hit 1 + expect_stat cache_miss 2 ./test llvm-profdata$CLANG_VERSION_SUFFIX merge -output foo.profdata data/default_*.profraw $CCACHE_COMPILE -fprofile-use=foo.profdata -c test.c - expect_stat 'cache hit (direct)' 1 - expect_stat 'cache miss' 3 + expect_stat direct_cache_hit 1 + expect_stat cache_miss 3 # ------------------------------------------------------------------------- TEST "-fprofile-instr-use" @@ -51,8 +51,8 @@ SUITE_profiling_clang() { mkdir data $CCACHE_COMPILE -fprofile-instr-generate -c test.c - expect_stat 'cache hit (direct)' 0 - expect_stat 'cache miss' 1 + expect_stat direct_cache_hit 0 + expect_stat cache_miss 1 $COMPILER -fprofile-instr-generate test.o -o test @@ -60,25 +60,25 @@ SUITE_profiling_clang() { llvm-profdata$CLANG_VERSION_SUFFIX merge -output default.profdata default.profraw $CCACHE_COMPILE -fprofile-instr-use -c test.c - expect_stat 'cache hit (direct)' 0 - expect_stat 'cache miss' 2 + expect_stat direct_cache_hit 0 + expect_stat cache_miss 2 $CCACHE_COMPILE -fprofile-instr-use -c test.c - expect_stat 'cache hit (direct)' 1 - expect_stat 'cache miss' 2 + expect_stat direct_cache_hit 1 + expect_stat cache_miss 2 echo >>default.profdata # Dummy change to trigger modification $CCACHE_COMPILE -fprofile-instr-use -c test.c - expect_stat 'cache hit (direct)' 1 - expect_stat 'cache miss' 3 + expect_stat direct_cache_hit 1 + expect_stat cache_miss 3 # ------------------------------------------------------------------------- TEST "-fprofile-instr-use=file" $CCACHE_COMPILE -fprofile-instr-generate=foo.profraw -c test.c - expect_stat 'cache hit (direct)' 0 - expect_stat 'cache miss' 1 + expect_stat direct_cache_hit 0 + expect_stat cache_miss 1 $COMPILER -fprofile-instr-generate=data=foo.profraw test.o -o test @@ -86,18 +86,18 @@ SUITE_profiling_clang() { llvm-profdata$CLANG_VERSION_SUFFIX merge -output foo.profdata foo.profraw $CCACHE_COMPILE -fprofile-instr-use=foo.profdata -c test.c - expect_stat 'cache hit (direct)' 0 - expect_stat 'cache miss' 2 + expect_stat direct_cache_hit 0 + expect_stat cache_miss 2 $CCACHE_COMPILE -fprofile-instr-use=foo.profdata -c test.c - expect_stat 'cache hit (direct)' 1 - expect_stat 'cache miss' 2 + expect_stat direct_cache_hit 1 + expect_stat cache_miss 2 echo >>foo.profdata # Dummy change to trigger modification $CCACHE_COMPILE -fprofile-instr-use=foo.profdata -c test.c - expect_stat 'cache hit (direct)' 1 - expect_stat 'cache miss' 3 + expect_stat direct_cache_hit 1 + expect_stat cache_miss 3 # ------------------------------------------------------------------------- TEST "-fprofile-sample-use" @@ -105,30 +105,30 @@ SUITE_profiling_clang() { echo 'main:1:1' > sample.prof $CCACHE_COMPILE -fprofile-sample-use=sample.prof -c test.c - expect_stat 'cache hit (direct)' 0 - expect_stat 'cache miss' 1 + expect_stat direct_cache_hit 0 + expect_stat cache_miss 1 $CCACHE_COMPILE -fprofile-sample-use=sample.prof -fprofile-sample-accurate -c test.c - expect_stat 'cache hit (direct)' 0 - expect_stat 'cache miss' 2 + expect_stat direct_cache_hit 0 + expect_stat cache_miss 2 $CCACHE_COMPILE -fprofile-sample-use=sample.prof -c test.c - expect_stat 'cache hit (direct)' 1 - expect_stat 'cache miss' 2 + expect_stat direct_cache_hit 1 + expect_stat cache_miss 2 $CCACHE_COMPILE -fprofile-sample-use=sample.prof -fprofile-sample-accurate -c test.c - expect_stat 'cache hit (direct)' 2 - expect_stat 'cache miss' 2 + expect_stat direct_cache_hit 2 + expect_stat cache_miss 2 echo 'main:2:2' > sample.prof $CCACHE_COMPILE -fprofile-sample-use=sample.prof -c test.c - expect_stat 'cache hit (direct)' 2 - expect_stat 'cache miss' 3 + expect_stat direct_cache_hit 2 + expect_stat cache_miss 3 echo 'main:1:1' > sample.prof $CCACHE_COMPILE -fprofile-sample-use=sample.prof -c test.c - expect_stat 'cache hit (direct)' 3 - expect_stat 'cache miss' 3 + expect_stat direct_cache_hit 3 + expect_stat cache_miss 3 } diff --git a/test/suites/profiling_gcc.bash b/test/suites/profiling_gcc.bash index e67b6fa26..cd892c3ea 100644 --- a/test/suites/profiling_gcc.bash +++ b/test/suites/profiling_gcc.bash @@ -14,26 +14,26 @@ SUITE_profiling_gcc() { TEST "-fbranch-probabilities" $CCACHE_COMPILE -fprofile-generate -c test.c - expect_stat 'cache hit (direct)' 0 - expect_stat 'cache miss' 1 + expect_stat direct_cache_hit 0 + expect_stat cache_miss 1 $COMPILER -fprofile-generate test.o -o test ./test $CCACHE_COMPILE -fbranch-probabilities -c test.c 2>/dev/null - expect_stat 'cache hit (direct)' 0 - expect_stat 'cache miss' 2 + expect_stat direct_cache_hit 0 + expect_stat cache_miss 2 $CCACHE_COMPILE -fbranch-probabilities -c test.c 2>/dev/null - expect_stat 'cache hit (direct)' 1 - expect_stat 'cache miss' 2 + expect_stat direct_cache_hit 1 + expect_stat cache_miss 2 ./test $CCACHE_COMPILE -fbranch-probabilities -c test.c 2>/dev/null - expect_stat 'cache hit (direct)' 1 - expect_stat 'cache miss' 3 + expect_stat direct_cache_hit 1 + expect_stat cache_miss 3 # ------------------------------------------------------------------------- TEST "-fprofile-dir=dir + -fprofile-use" @@ -41,26 +41,26 @@ SUITE_profiling_gcc() { mkdir data $CCACHE_COMPILE -fprofile-dir=data -fprofile-generate -c test.c - expect_stat 'cache hit (direct)' 0 - expect_stat 'cache miss' 1 + expect_stat direct_cache_hit 0 + expect_stat cache_miss 1 $COMPILER -fprofile-generate test.o -o test ./test $CCACHE_COMPILE -fprofile-dir=data -fprofile-use -c test.c - expect_stat 'cache hit (direct)' 0 - expect_stat 'cache miss' 2 + expect_stat direct_cache_hit 0 + expect_stat cache_miss 2 $CCACHE_COMPILE -fprofile-dir=data -fprofile-use -c test.c - expect_stat 'cache hit (direct)' 1 - expect_stat 'cache miss' 2 + expect_stat direct_cache_hit 1 + expect_stat cache_miss 2 ./test $CCACHE_COMPILE -fprofile-dir=data -fprofile-use -c test.c - expect_stat 'cache hit (direct)' 1 - expect_stat 'cache miss' 3 + expect_stat direct_cache_hit 1 + expect_stat cache_miss 3 # ------------------------------------------------------------------------- TEST "-fprofile-use + -fprofile-dir=dir" @@ -68,26 +68,26 @@ SUITE_profiling_gcc() { mkdir data $CCACHE_COMPILE -fprofile-generate -fprofile-dir=data -c test.c - expect_stat 'cache hit (direct)' 0 - expect_stat 'cache miss' 1 + expect_stat direct_cache_hit 0 + expect_stat cache_miss 1 $COMPILER -fprofile-generate test.o -o test ./test $CCACHE_COMPILE -fprofile-use -fprofile-dir=data -c test.c - expect_stat 'cache hit (direct)' 0 - expect_stat 'cache miss' 2 + expect_stat direct_cache_hit 0 + expect_stat cache_miss 2 $CCACHE_COMPILE -fprofile-use -fprofile-dir=data -c test.c - expect_stat 'cache hit (direct)' 1 - expect_stat 'cache miss' 2 + expect_stat direct_cache_hit 1 + expect_stat cache_miss 2 ./test $CCACHE_COMPILE -fprofile-use -fprofile-dir=data -c test.c - expect_stat 'cache hit (direct)' 1 - expect_stat 'cache miss' 3 + expect_stat direct_cache_hit 1 + expect_stat cache_miss 3 # ------------------------------------------------------------------------- TEST "-fprofile-dir=path1 + -fprofile-use=path2" @@ -95,24 +95,24 @@ SUITE_profiling_gcc() { mkdir data $CCACHE_COMPILE -fprofile-dir=data2 -fprofile-generate=data -c test.c - expect_stat 'cache hit (direct)' 0 - expect_stat 'cache miss' 1 + expect_stat direct_cache_hit 0 + expect_stat cache_miss 1 $COMPILER -fprofile-generate test.o -o test ./test $CCACHE_COMPILE -fprofile-dir=data2 -fprofile-use=data -c test.c - expect_stat 'cache hit (direct)' 0 - expect_stat 'cache miss' 2 + expect_stat direct_cache_hit 0 + expect_stat cache_miss 2 $CCACHE_COMPILE -fprofile-dir=data2 -fprofile-use=data -c test.c - expect_stat 'cache hit (direct)' 1 - expect_stat 'cache miss' 2 + expect_stat direct_cache_hit 1 + expect_stat cache_miss 2 ./test $CCACHE_COMPILE -fprofile-dir=data2 -fprofile-use=data -c test.c - expect_stat 'cache hit (direct)' 1 - expect_stat 'cache miss' 3 + expect_stat direct_cache_hit 1 + expect_stat cache_miss 3 } diff --git a/test/suites/profiling_hip_clang.bash b/test/suites/profiling_hip_clang.bash index fa4418bd5..c54060d41 100644 --- a/test/suites/profiling_hip_clang.bash +++ b/test/suites/profiling_hip_clang.bash @@ -19,37 +19,37 @@ SUITE_profiling_hip_clang() { hip_opts="-x hip --cuda-gpu-arch=gfx900 -nogpulib" $CCACHE_COMPILE $hip_opts -c test1.hip - expect_stat 'cache hit (preprocessed)' 0 - expect_stat 'cache hit (direct)' 0 - expect_stat 'cache miss' 1 + expect_stat preprocessed_cache_hit 0 + expect_stat direct_cache_hit 0 + expect_stat cache_miss 1 $CCACHE_COMPILE $hip_opts -c test1.hip - expect_stat 'cache hit (preprocessed)' 0 - expect_stat 'cache hit (direct)' 1 - expect_stat 'cache miss' 1 + expect_stat preprocessed_cache_hit 0 + expect_stat direct_cache_hit 1 + expect_stat cache_miss 1 $CCACHE_COMPILE $hip_opts --cuda-gpu-arch=gfx906 -c test1.hip - expect_stat 'cache hit (preprocessed)' 0 - expect_stat 'cache hit (direct)' 1 - expect_stat 'cache miss' 2 + expect_stat preprocessed_cache_hit 0 + expect_stat direct_cache_hit 1 + expect_stat cache_miss 2 $CCACHE_COMPILE $hip_opts -c test2.hip - expect_stat 'cache hit (preprocessed)' 0 - expect_stat 'cache hit (direct)' 1 - expect_stat 'cache miss' 3 + expect_stat preprocessed_cache_hit 0 + expect_stat direct_cache_hit 1 + expect_stat cache_miss 3 $CCACHE_COMPILE $hip_opts -c test2.hip - expect_stat 'cache hit (preprocessed)' 0 - expect_stat 'cache hit (direct)' 2 - expect_stat 'cache miss' 3 + expect_stat preprocessed_cache_hit 0 + expect_stat direct_cache_hit 2 + expect_stat cache_miss 3 $CCACHE_COMPILE $hip_opts -Dx=x -c test2.hip - expect_stat 'cache hit (preprocessed)' 1 - expect_stat 'cache hit (direct)' 2 - expect_stat 'cache miss' 3 + expect_stat preprocessed_cache_hit 1 + expect_stat direct_cache_hit 2 + expect_stat cache_miss 3 $CCACHE_COMPILE $hip_opts -Dx=y -c test2.hip - expect_stat 'cache hit (preprocessed)' 1 - expect_stat 'cache hit (direct)' 2 - expect_stat 'cache miss' 4 + expect_stat preprocessed_cache_hit 1 + expect_stat direct_cache_hit 2 + expect_stat cache_miss 4 } diff --git a/test/suites/readonly.bash b/test/suites/readonly.bash index 200f5c0de..fa673d8ed 100644 --- a/test/suites/readonly.bash +++ b/test/suites/readonly.bash @@ -18,8 +18,8 @@ SUITE_readonly() { # Cache a compilation. $CCACHE_COMPILE -c test.c - expect_stat 'cache hit (preprocessed)' 0 - expect_stat 'cache miss' 1 + expect_stat preprocessed_cache_hit 0 + expect_stat cache_miss 1 rm test.o # Make the cache read-only. @@ -53,9 +53,9 @@ SUITE_readonly() { if [ $? -ne 0 ]; then test_failed "Failure when compiling test2.c read-only" fi - expect_stat 'cache hit (preprocessed)' 0 - expect_stat 'cache miss' 1 - expect_stat 'files in cache' 0 + expect_stat preprocessed_cache_hit 0 + expect_stat cache_miss 1 + expect_stat files_in_cache 0 # ------------------------------------------------------------------------- # Check that read-only mode and direct mode work together. @@ -63,8 +63,8 @@ SUITE_readonly() { # Cache a compilation. $CCACHE_COMPILE -c test.c - expect_stat 'cache hit (preprocessed)' 0 - expect_stat 'cache miss' 1 + expect_stat preprocessed_cache_hit 0 + expect_stat cache_miss 1 rm test.o # Make the cache read-only. diff --git a/test/suites/readonly_direct.bash b/test/suites/readonly_direct.bash index be07104ff..684767232 100644 --- a/test/suites/readonly_direct.bash +++ b/test/suites/readonly_direct.bash @@ -18,25 +18,25 @@ SUITE_readonly_direct() { TEST "Direct hit" $CCACHE_COMPILE -c test.c -o test.o - expect_stat 'cache hit (direct)' 0 - expect_stat 'cache hit (preprocessed)' 0 - expect_stat 'cache miss' 1 + expect_stat direct_cache_hit 0 + expect_stat preprocessed_cache_hit 0 + expect_stat cache_miss 1 CCACHE_READONLY_DIRECT=1 $CCACHE_COMPILE -c test.c -o test.o - expect_stat 'cache hit (direct)' 1 - expect_stat 'cache hit (preprocessed)' 0 - expect_stat 'cache miss' 1 + expect_stat direct_cache_hit 1 + expect_stat preprocessed_cache_hit 0 + expect_stat cache_miss 1 # ------------------------------------------------------------------------- TEST "Direct miss doesn't lead to preprocessed hit" $CCACHE_COMPILE -c test.c -o test.o - expect_stat 'cache hit (direct)' 0 - expect_stat 'cache hit (preprocessed)' 0 - expect_stat 'cache miss' 1 + expect_stat direct_cache_hit 0 + expect_stat preprocessed_cache_hit 0 + expect_stat cache_miss 1 CCACHE_READONLY_DIRECT=1 $CCACHE_COMPILE -DFOO -c test.c -o test.o - expect_stat 'cache hit (direct)' 0 - expect_stat 'cache hit (preprocessed)' 0 - expect_stat 'cache miss' 2 + expect_stat direct_cache_hit 0 + expect_stat preprocessed_cache_hit 0 + expect_stat cache_miss 2 } diff --git a/test/suites/sanitize_blacklist.bash b/test/suites/sanitize_blacklist.bash index de135f99d..8ca436263 100644 --- a/test/suites/sanitize_blacklist.bash +++ b/test/suites/sanitize_blacklist.bash @@ -21,26 +21,26 @@ SUITE_sanitize_blacklist() { $REAL_COMPILER -c -fsanitize-blacklist=blacklist.txt test1.c $CCACHE_COMPILE -c -fsanitize-blacklist=blacklist.txt test1.c - expect_stat 'cache hit (direct)' 0 - expect_stat 'cache miss' 1 - expect_stat 'files in cache' 2 + expect_stat direct_cache_hit 0 + expect_stat cache_miss 1 + expect_stat files_in_cache 2 $CCACHE_COMPILE -c -fsanitize-blacklist=blacklist.txt test1.c - expect_stat 'cache hit (direct)' 1 - expect_stat 'cache miss' 1 - expect_stat 'files in cache' 2 + expect_stat direct_cache_hit 1 + expect_stat cache_miss 1 + expect_stat files_in_cache 2 echo "fun:bar" >blacklist.txt $CCACHE_COMPILE -c -fsanitize-blacklist=blacklist.txt test1.c - expect_stat 'cache hit (direct)' 1 - expect_stat 'cache miss' 2 - expect_stat 'files in cache' 4 + expect_stat direct_cache_hit 1 + expect_stat cache_miss 2 + expect_stat files_in_cache 4 $CCACHE_COMPILE -c -fsanitize-blacklist=blacklist.txt test1.c - expect_stat 'cache hit (direct)' 2 - expect_stat 'cache miss' 2 - expect_stat 'files in cache' 4 + expect_stat direct_cache_hit 2 + expect_stat cache_miss 2 + expect_stat files_in_cache 4 # ------------------------------------------------------------------------- TEST "Unsuccessful compilation" @@ -55,7 +55,7 @@ SUITE_sanitize_blacklist() { test_failed "Expected an error compiling test1.c" fi - expect_stat 'error hashing extra file' 1 + expect_stat error_hashing_extra_file 1 # ------------------------------------------------------------------------- TEST "Multiple -fsanitize-blacklist" @@ -63,24 +63,24 @@ SUITE_sanitize_blacklist() { $REAL_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 'cache hit (direct)' 0 - expect_stat 'cache miss' 1 - expect_stat 'files in cache' 2 + expect_stat direct_cache_hit 0 + expect_stat cache_miss 1 + expect_stat files_in_cache 2 $CCACHE_COMPILE -c -fsanitize-blacklist=blacklist2.txt -fsanitize-blacklist=blacklist.txt test1.c - expect_stat 'cache hit (direct)' 1 - expect_stat 'cache miss' 1 - expect_stat 'files in cache' 2 + expect_stat direct_cache_hit 1 + expect_stat cache_miss 1 + expect_stat files_in_cache 2 echo "fun_2:foo" >blacklist2.txt $CCACHE_COMPILE -c -fsanitize-blacklist=blacklist2.txt -fsanitize-blacklist=blacklist.txt test1.c - expect_stat 'cache hit (direct)' 1 - expect_stat 'cache miss' 2 - expect_stat 'files in cache' 4 + expect_stat direct_cache_hit 1 + expect_stat cache_miss 2 + expect_stat files_in_cache 4 $CCACHE_COMPILE -c -fsanitize-blacklist=blacklist2.txt -fsanitize-blacklist=blacklist.txt test1.c - expect_stat 'cache hit (direct)' 2 - expect_stat 'cache miss' 2 - expect_stat 'files in cache' 4 + expect_stat direct_cache_hit 2 + expect_stat cache_miss 2 + expect_stat files_in_cache 4 } diff --git a/test/suites/secondary_file.bash b/test/suites/secondary_file.bash index 6fce2966e..0ddebb320 100644 --- a/test/suites/secondary_file.bash +++ b/test/suites/secondary_file.bash @@ -10,9 +10,9 @@ SUITE_secondary_file() { TEST "Subdirs layout" $CCACHE_COMPILE -c test.c - expect_stat 'cache hit (direct)' 0 - expect_stat 'cache miss' 1 - expect_stat 'files in cache' 2 + expect_stat direct_cache_hit 0 + expect_stat cache_miss 1 + expect_stat files_in_cache 2 expect_exists secondary/CACHEDIR.TAG subdirs=$(find secondary -type d | wc -l) if [ "${subdirs}" -lt 2 ]; then # "secondary" itself counts as one @@ -21,19 +21,19 @@ SUITE_secondary_file() { expect_file_count 3 '*' secondary # CACHEDIR.TAG + result + manifest $CCACHE_COMPILE -c test.c - expect_stat 'cache hit (direct)' 1 - expect_stat 'cache miss' 1 - expect_stat 'files in cache' 2 + expect_stat direct_cache_hit 1 + expect_stat cache_miss 1 + expect_stat files_in_cache 2 expect_file_count 3 '*' secondary # CACHEDIR.TAG + result + manifest $CCACHE -C >/dev/null - expect_stat 'files in cache' 0 + expect_stat files_in_cache 0 expect_file_count 3 '*' secondary # CACHEDIR.TAG + result + manifest $CCACHE_COMPILE -c test.c - expect_stat 'cache hit (direct)' 2 - expect_stat 'cache miss' 1 - expect_stat 'files in cache' 2 # fetched from secondary + expect_stat direct_cache_hit 2 + expect_stat cache_miss 1 + expect_stat files_in_cache 2 # fetched from secondary expect_file_count 3 '*' secondary # CACHEDIR.TAG + result + manifest # ------------------------------------------------------------------------- @@ -42,9 +42,9 @@ SUITE_secondary_file() { CCACHE_SECONDARY_STORAGE+="|layout=flat" $CCACHE_COMPILE -c test.c - expect_stat 'cache hit (direct)' 0 - expect_stat 'cache miss' 1 - expect_stat 'files in cache' 2 + expect_stat direct_cache_hit 0 + expect_stat cache_miss 1 + expect_stat files_in_cache 2 expect_exists secondary/CACHEDIR.TAG subdirs=$(find secondary -type d | wc -l) if [ "${subdirs}" -ne 1 ]; then # "secondary" itself counts as one @@ -53,19 +53,19 @@ SUITE_secondary_file() { expect_file_count 3 '*' secondary # CACHEDIR.TAG + result + manifest $CCACHE_COMPILE -c test.c - expect_stat 'cache hit (direct)' 1 - expect_stat 'cache miss' 1 - expect_stat 'files in cache' 2 + expect_stat direct_cache_hit 1 + expect_stat cache_miss 1 + expect_stat files_in_cache 2 expect_file_count 3 '*' secondary # CACHEDIR.TAG + result + manifest $CCACHE -C >/dev/null - expect_stat 'files in cache' 0 + expect_stat files_in_cache 0 expect_file_count 3 '*' secondary # CACHEDIR.TAG + result + manifest $CCACHE_COMPILE -c test.c - expect_stat 'cache hit (direct)' 2 - expect_stat 'cache miss' 1 - expect_stat 'files in cache' 2 # fetched from secondary + expect_stat direct_cache_hit 2 + expect_stat cache_miss 1 + expect_stat files_in_cache 2 # fetched from secondary expect_file_count 3 '*' secondary # CACHEDIR.TAG + result + manifest # ------------------------------------------------------------------------- @@ -75,34 +75,34 @@ SUITE_secondary_file() { mkdir secondary_2 $CCACHE_COMPILE -c test.c - expect_stat 'cache hit (direct)' 0 - expect_stat 'cache miss' 1 - expect_stat 'files in cache' 2 + expect_stat direct_cache_hit 0 + expect_stat cache_miss 1 + expect_stat files_in_cache 2 expect_file_count 3 '*' secondary # CACHEDIR.TAG + result + manifest expect_file_count 3 '*' secondary_2 # CACHEDIR.TAG + result + manifest $CCACHE -C >/dev/null - expect_stat 'files in cache' 0 + expect_stat files_in_cache 0 expect_file_count 3 '*' secondary # CACHEDIR.TAG + result + manifest expect_file_count 3 '*' secondary_2 # CACHEDIR.TAG + result + manifest $CCACHE_COMPILE -c test.c - expect_stat 'cache hit (direct)' 1 - expect_stat 'cache miss' 1 - expect_stat 'files in cache' 2 # fetched from secondary + expect_stat direct_cache_hit 1 + expect_stat cache_miss 1 + expect_stat files_in_cache 2 # fetched from secondary expect_file_count 3 '*' secondary # CACHEDIR.TAG + result + manifest expect_file_count 3 '*' secondary_2 # CACHEDIR.TAG + result + manifest $CCACHE -C >/dev/null - expect_stat 'files in cache' 0 + expect_stat files_in_cache 0 rm -r secondary/?? expect_file_count 1 '*' secondary # CACHEDIR.TAG $CCACHE_COMPILE -c test.c - expect_stat 'cache hit (direct)' 2 - expect_stat 'cache miss' 1 - expect_stat 'files in cache' 2 # fetched from secondary_2 + expect_stat direct_cache_hit 2 + expect_stat cache_miss 1 + expect_stat files_in_cache 2 # fetched from secondary_2 expect_file_count 1 '*' secondary # CACHEDIR.TAG expect_file_count 3 '*' secondary_2 # CACHEDIR.TAG + result + manifest @@ -110,28 +110,28 @@ SUITE_secondary_file() { TEST "Read-only" $CCACHE_COMPILE -c test.c - expect_stat 'cache hit (direct)' 0 - expect_stat 'cache miss' 1 - expect_stat 'files in cache' 2 + expect_stat direct_cache_hit 0 + expect_stat cache_miss 1 + expect_stat files_in_cache 2 expect_file_count 3 '*' secondary # CACHEDIR.TAG + result + manifest $CCACHE -C >/dev/null - expect_stat 'files in cache' 0 + expect_stat files_in_cache 0 expect_file_count 3 '*' secondary # CACHEDIR.TAG + result + manifest CCACHE_SECONDARY_STORAGE+="|read-only" $CCACHE_COMPILE -c test.c - expect_stat 'cache hit (direct)' 1 - expect_stat 'cache miss' 1 - expect_stat 'files in cache' 2 # fetched from secondary + expect_stat direct_cache_hit 1 + expect_stat cache_miss 1 + expect_stat files_in_cache 2 # fetched from secondary expect_file_count 3 '*' secondary # CACHEDIR.TAG + result + manifest echo 'int x;' >> test.c $CCACHE_COMPILE -c test.c - expect_stat 'cache hit (direct)' 1 - expect_stat 'cache miss' 2 - expect_stat 'files in cache' 4 + expect_stat direct_cache_hit 1 + expect_stat cache_miss 2 + expect_stat files_in_cache 4 expect_file_count 3 '*' secondary # CACHEDIR.TAG + result + manifest # ------------------------------------------------------------------------- @@ -156,9 +156,9 @@ SUITE_secondary_file() { CCACHE_SECONDARY_STORAGE="file://$PWD/secondary/*|shards=a,b(2)" $CCACHE_COMPILE -c test.c - expect_stat 'cache hit (direct)' 0 - expect_stat 'cache miss' 1 - expect_stat 'files in cache' 2 + expect_stat direct_cache_hit 0 + expect_stat cache_miss 1 + expect_stat files_in_cache 2 if [ ! -d secondary/a ] && [ ! -d secondary/b ]; then test_failed "Expected secondary/a or secondary/b to exist" fi diff --git a/test/suites/secondary_http.bash b/test/suites/secondary_http.bash index f4377980a..25c793909 100644 --- a/test/suites/secondary_http.bash +++ b/test/suites/secondary_http.bash @@ -46,9 +46,9 @@ SUITE_secondary_http() { export CCACHE_SECONDARY_STORAGE="http://localhost:12780" $CCACHE_COMPILE -c test.c - expect_stat 'cache hit (direct)' 0 - expect_stat 'cache miss' 1 - expect_stat 'files in cache' 2 + expect_stat direct_cache_hit 0 + expect_stat cache_miss 1 + expect_stat files_in_cache 2 expect_file_count 2 '*' secondary # result + manifest subdirs=$(find secondary -type d | wc -l) if [ "${subdirs}" -lt 2 ]; then # "secondary" itself counts as one @@ -56,19 +56,19 @@ SUITE_secondary_http() { fi $CCACHE_COMPILE -c test.c - expect_stat 'cache hit (direct)' 1 - expect_stat 'cache miss' 1 - expect_stat 'files in cache' 2 + expect_stat direct_cache_hit 1 + expect_stat cache_miss 1 + expect_stat files_in_cache 2 expect_file_count 2 '*' secondary # result + manifest $CCACHE -C >/dev/null - expect_stat 'files in cache' 0 + expect_stat files_in_cache 0 expect_file_count 2 '*' secondary # result + manifest $CCACHE_COMPILE -c test.c - expect_stat 'cache hit (direct)' 2 - expect_stat 'cache miss' 1 - expect_stat 'files in cache' 2 # fetched from secondary + expect_stat direct_cache_hit 2 + expect_stat cache_miss 1 + expect_stat files_in_cache 2 # fetched from secondary expect_file_count 2 '*' secondary # result + manifest # ------------------------------------------------------------------------- @@ -78,9 +78,9 @@ SUITE_secondary_http() { export CCACHE_SECONDARY_STORAGE="http://localhost:12780|layout=flat" $CCACHE_COMPILE -c test.c - expect_stat 'cache hit (direct)' 0 - expect_stat 'cache miss' 1 - expect_stat 'files in cache' 2 + expect_stat direct_cache_hit 0 + expect_stat cache_miss 1 + expect_stat files_in_cache 2 expect_file_count 2 '*' secondary # result + manifest subdirs=$(find secondary -type d | wc -l) if [ "${subdirs}" -ne 1 ]; then # "secondary" itself counts as one @@ -88,19 +88,19 @@ SUITE_secondary_http() { fi $CCACHE_COMPILE -c test.c - expect_stat 'cache hit (direct)' 1 - expect_stat 'cache miss' 1 - expect_stat 'files in cache' 2 + expect_stat direct_cache_hit 1 + expect_stat cache_miss 1 + expect_stat files_in_cache 2 expect_file_count 2 '*' secondary # result + manifest $CCACHE -C >/dev/null - expect_stat 'files in cache' 0 + expect_stat files_in_cache 0 expect_file_count 2 '*' secondary # result + manifest $CCACHE_COMPILE -c test.c - expect_stat 'cache hit (direct)' 2 - expect_stat 'cache miss' 1 - expect_stat 'files in cache' 2 # fetched from secondary + expect_stat direct_cache_hit 2 + expect_stat cache_miss 1 + expect_stat files_in_cache 2 # fetched from secondary expect_file_count 2 '*' secondary # result + manifest # ------------------------------------------------------------------------- @@ -111,28 +111,28 @@ SUITE_secondary_http() { export CCACHE_SECONDARY_STORAGE="http://localhost:12780|layout=bazel" $CCACHE_COMPILE -c test.c - expect_stat 'cache hit (direct)' 0 - expect_stat 'cache miss' 1 - expect_stat 'files in cache' 2 + expect_stat direct_cache_hit 0 + expect_stat cache_miss 1 + expect_stat files_in_cache 2 expect_file_count 2 '*' secondary/ac # result + manifest if [ "$(ls secondary/ac | grep -Ec '^[0-9a-f]{64}$')" -ne 2 ]; then test_failed "Bazel layout filenames not as expected" fi $CCACHE_COMPILE -c test.c - expect_stat 'cache hit (direct)' 1 - expect_stat 'cache miss' 1 - expect_stat 'files in cache' 2 + expect_stat direct_cache_hit 1 + expect_stat cache_miss 1 + expect_stat files_in_cache 2 expect_file_count 2 '*' secondary/ac # result + manifest $CCACHE -C >/dev/null - expect_stat 'files in cache' 0 + expect_stat files_in_cache 0 expect_file_count 2 '*' secondary/ac # result + manifest $CCACHE_COMPILE -c test.c - expect_stat 'cache hit (direct)' 2 - expect_stat 'cache miss' 1 - expect_stat 'files in cache' 2 # fetched from secondary + expect_stat direct_cache_hit 2 + expect_stat cache_miss 1 + expect_stat files_in_cache 2 # fetched from secondary expect_file_count 2 '*' secondary/ac # result + manifest # ------------------------------------------------------------------------- @@ -142,9 +142,9 @@ SUITE_secondary_http() { export CCACHE_SECONDARY_STORAGE="http://somebody:secret123@localhost:12780" CCACHE_DEBUG=1 $CCACHE_COMPILE -c test.c - expect_stat 'cache hit (direct)' 0 - expect_stat 'cache miss' 1 - expect_stat 'files in cache' 2 + expect_stat direct_cache_hit 0 + expect_stat cache_miss 1 + expect_stat files_in_cache 2 expect_file_count 2 '*' secondary # result + manifest expect_not_contains test.o.ccache-log secret123 @@ -156,9 +156,9 @@ SUITE_secondary_http() { export CCACHE_SECONDARY_STORAGE="http://localhost:12780" CCACHE_DEBUG=1 $CCACHE_COMPILE -c test.c - expect_stat 'cache hit (direct)' 0 - expect_stat 'cache miss' 1 - expect_stat 'files in cache' 2 + expect_stat direct_cache_hit 0 + expect_stat cache_miss 1 + expect_stat files_in_cache 2 expect_file_count 0 '*' secondary # result + manifest expect_contains test.o.ccache-log "status code: 401" @@ -169,9 +169,9 @@ SUITE_secondary_http() { export CCACHE_SECONDARY_STORAGE="http://somebody:wrong@localhost:12780" CCACHE_DEBUG=1 $CCACHE_COMPILE -c test.c - expect_stat 'cache hit (direct)' 0 - expect_stat 'cache miss' 1 - expect_stat 'files in cache' 2 + expect_stat direct_cache_hit 0 + expect_stat cache_miss 1 + expect_stat files_in_cache 2 expect_file_count 0 '*' secondary # result + manifest expect_not_contains test.o.ccache-log secret123 expect_contains test.o.ccache-log "status code: 401" @@ -183,25 +183,25 @@ SUITE_secondary_http() { export CCACHE_SECONDARY_STORAGE="http://[::1]:12780" $CCACHE_COMPILE -c test.c - expect_stat 'cache hit (direct)' 0 - expect_stat 'cache miss' 1 - expect_stat 'files in cache' 2 + expect_stat direct_cache_hit 0 + expect_stat cache_miss 1 + expect_stat files_in_cache 2 expect_file_count 2 '*' secondary # result + manifest $CCACHE_COMPILE -c test.c - expect_stat 'cache hit (direct)' 1 - expect_stat 'cache miss' 1 - expect_stat 'files in cache' 2 + expect_stat direct_cache_hit 1 + expect_stat cache_miss 1 + expect_stat files_in_cache 2 expect_file_count 2 '*' secondary # result + manifest $CCACHE -C >/dev/null - expect_stat 'files in cache' 0 + expect_stat files_in_cache 0 expect_file_count 2 '*' secondary # result + manifest $CCACHE_COMPILE -c test.c - expect_stat 'cache hit (direct)' 2 - expect_stat 'cache miss' 1 - expect_stat 'files in cache' 2 # fetched from secondary + expect_stat direct_cache_hit 2 + expect_stat cache_miss 1 + expect_stat files_in_cache 2 # fetched from secondary expect_file_count 2 '*' secondary # result + manifest fi } diff --git a/test/suites/secondary_redis.bash b/test/suites/secondary_redis.bash index 1894412f4..3e703841b 100644 --- a/test/suites/secondary_redis.bash +++ b/test/suites/secondary_redis.bash @@ -58,25 +58,25 @@ SUITE_secondary_redis() { start_redis_server "${port}" $CCACHE_COMPILE -c test.c - expect_stat 'cache hit (direct)' 0 - expect_stat 'cache miss' 1 - expect_stat 'files in cache' 2 + expect_stat direct_cache_hit 0 + expect_stat cache_miss 1 + expect_stat files_in_cache 2 expect_number_of_redis_cache_entries 2 "$redis_url" # result + manifest $CCACHE_COMPILE -c test.c - expect_stat 'cache hit (direct)' 1 - expect_stat 'cache miss' 1 - expect_stat 'files in cache' 2 + expect_stat direct_cache_hit 1 + expect_stat cache_miss 1 + expect_stat files_in_cache 2 expect_number_of_redis_cache_entries 2 "$redis_url" # result + manifest $CCACHE -C >/dev/null - expect_stat 'files in cache' 0 + expect_stat files_in_cache 0 expect_number_of_redis_cache_entries 2 "$redis_url" # result + manifest $CCACHE_COMPILE -c test.c - expect_stat 'cache hit (direct)' 2 - expect_stat 'cache miss' 1 - expect_stat 'files in cache' 2 # fetched from secondary + expect_stat direct_cache_hit 2 + expect_stat cache_miss 1 + expect_stat files_in_cache 2 # fetched from secondary expect_number_of_redis_cache_entries 2 "$redis_url" # result + manifest # ------------------------------------------------------------------------- @@ -90,25 +90,25 @@ SUITE_secondary_redis() { start_redis_server "${port}" "${password}" CCACHE_DEBUG=1 $CCACHE_COMPILE -c test.c - expect_stat 'cache hit (direct)' 0 - expect_stat 'cache miss' 1 - expect_stat 'files in cache' 2 + expect_stat direct_cache_hit 0 + expect_stat cache_miss 1 + expect_stat files_in_cache 2 expect_number_of_redis_cache_entries 2 "$redis_url" # result + manifest expect_not_contains test.o.ccache-log "${password}" $CCACHE_COMPILE -c test.c - expect_stat 'cache hit (direct)' 1 - expect_stat 'cache miss' 1 - expect_stat 'files in cache' 2 + expect_stat direct_cache_hit 1 + expect_stat cache_miss 1 + expect_stat files_in_cache 2 expect_number_of_redis_cache_entries 2 "$redis_url" # result + manifest $CCACHE -C >/dev/null - expect_stat 'files in cache' 0 + expect_stat files_in_cache 0 expect_number_of_redis_cache_entries 2 "$redis_url" # result + manifest $CCACHE_COMPILE -c test.c - expect_stat 'cache hit (direct)' 2 - expect_stat 'cache miss' 1 - expect_stat 'files in cache' 2 # fetched from secondary + expect_stat direct_cache_hit 2 + expect_stat cache_miss 1 + expect_stat files_in_cache 2 # fetched from secondary expect_number_of_redis_cache_entries 2 "$redis_url" # result + manifest } diff --git a/test/suites/serialize_diagnostics.bash b/test/suites/serialize_diagnostics.bash index 9ec2eb8af..6163da73e 100644 --- a/test/suites/serialize_diagnostics.bash +++ b/test/suites/serialize_diagnostics.bash @@ -17,17 +17,17 @@ SUITE_serialize_diagnostics() { $REAL_COMPILER -c --serialize-diagnostics expected.dia test1.c $CCACHE_COMPILE -c --serialize-diagnostics test.dia test1.c - expect_stat 'cache hit (preprocessed)' 0 - expect_stat 'cache miss' 1 - expect_stat 'files in cache' 1 + expect_stat preprocessed_cache_hit 0 + expect_stat cache_miss 1 + expect_stat files_in_cache 1 expect_equal_content expected.dia test.dia rm test.dia $CCACHE_COMPILE -c --serialize-diagnostics test.dia test1.c - expect_stat 'cache hit (preprocessed)' 1 - expect_stat 'cache miss' 1 - expect_stat 'files in cache' 1 + expect_stat preprocessed_cache_hit 1 + expect_stat cache_miss 1 + expect_stat files_in_cache 1 expect_equal_content expected.dia test.dia # ------------------------------------------------------------------------- @@ -39,10 +39,10 @@ SUITE_serialize_diagnostics() { fi $CCACHE_COMPILE -c --serialize-diagnostics test.dia error.c 2>test.stderr - expect_stat 'compile failed' 1 - expect_stat 'cache hit (preprocessed)' 0 - expect_stat 'cache miss' 0 - expect_stat 'files in cache' 0 + expect_stat compile_failed 1 + expect_stat preprocessed_cache_hit 0 + expect_stat cache_miss 0 + expect_stat files_in_cache 0 expect_equal_content expected.dia test.dia expect_equal_content expected.stderr test.stderr @@ -71,15 +71,15 @@ EOF cd dir1 CCACHE_BASEDIR=`pwd` $CCACHE_COMPILE -w -MD -MF `pwd`/test.d -I`pwd`/include --serialize-diagnostics `pwd`/test.dia -c src/test.c -o `pwd`/test.o - expect_stat 'cache hit (direct)' 0 - expect_stat 'cache hit (preprocessed)' 0 - expect_stat 'cache miss' 1 - expect_stat 'files in cache' 2 + expect_stat direct_cache_hit 0 + expect_stat preprocessed_cache_hit 0 + expect_stat cache_miss 1 + expect_stat files_in_cache 2 cd ../dir2 CCACHE_BASEDIR=`pwd` $CCACHE_COMPILE -w -MD -MF `pwd`/test.d -I`pwd`/include --serialize-diagnostics `pwd`/test.dia -c src/test.c -o `pwd`/test.o - expect_stat 'cache hit (direct)' 1 - expect_stat 'cache hit (preprocessed)' 0 - expect_stat 'cache miss' 1 - expect_stat 'files in cache' 2 + expect_stat direct_cache_hit 1 + expect_stat preprocessed_cache_hit 0 + expect_stat cache_miss 1 + expect_stat files_in_cache 2 } diff --git a/test/suites/source_date_epoch.bash b/test/suites/source_date_epoch.bash index d9d11bac0..c5efdc7af 100644 --- a/test/suites/source_date_epoch.bash +++ b/test/suites/source_date_epoch.bash @@ -18,19 +18,19 @@ SUITE_source_date_epoch() { unset CCACHE_NODIRECT SOURCE_DATE_EPOCH=1 $CCACHE_COMPILE -c without_temporal_macros.c - expect_stat 'cache hit (direct)' 0 - expect_stat 'cache hit (preprocessed)' 0 - expect_stat 'cache miss' 1 + expect_stat direct_cache_hit 0 + expect_stat preprocessed_cache_hit 0 + expect_stat cache_miss 1 SOURCE_DATE_EPOCH=1 $CCACHE_COMPILE -c without_temporal_macros.c - expect_stat 'cache hit (direct)' 1 - expect_stat 'cache hit (preprocessed)' 0 - expect_stat 'cache miss' 1 + expect_stat direct_cache_hit 1 + expect_stat preprocessed_cache_hit 0 + expect_stat cache_miss 1 SOURCE_DATE_EPOCH=2 $CCACHE_COMPILE -c without_temporal_macros.c - expect_stat 'cache hit (direct)' 2 - expect_stat 'cache hit (preprocessed)' 0 - expect_stat 'cache miss' 1 + expect_stat direct_cache_hit 2 + expect_stat preprocessed_cache_hit 0 + expect_stat cache_miss 1 # ------------------------------------------------------------------------- TEST "With __DATE__ macro" @@ -38,19 +38,19 @@ SUITE_source_date_epoch() { unset CCACHE_NODIRECT SOURCE_DATE_EPOCH=1 $CCACHE_COMPILE -c with_date_macro.c - expect_stat 'cache hit (direct)' 0 - expect_stat 'cache hit (preprocessed)' 0 - expect_stat 'cache miss' 1 + expect_stat direct_cache_hit 0 + expect_stat preprocessed_cache_hit 0 + expect_stat cache_miss 1 SOURCE_DATE_EPOCH=1 $CCACHE_COMPILE -c with_date_macro.c - expect_stat 'cache hit (direct)' 1 - expect_stat 'cache hit (preprocessed)' 0 - expect_stat 'cache miss' 1 + expect_stat direct_cache_hit 1 + expect_stat preprocessed_cache_hit 0 + expect_stat cache_miss 1 SOURCE_DATE_EPOCH=2 $CCACHE_COMPILE -c with_date_macro.c - expect_stat 'cache hit (direct)' 1 - expect_stat 'cache hit (preprocessed)' 1 - expect_stat 'cache miss' 1 + expect_stat direct_cache_hit 1 + expect_stat preprocessed_cache_hit 1 + expect_stat cache_miss 1 # ------------------------------------------------------------------------- TEST "With __TIME__ macro" @@ -58,19 +58,19 @@ SUITE_source_date_epoch() { unset CCACHE_NODIRECT SOURCE_DATE_EPOCH=1 $CCACHE_COMPILE -c with_time_macro.c - expect_stat 'cache hit (direct)' 0 - expect_stat 'cache hit (preprocessed)' 0 - expect_stat 'cache miss' 1 + expect_stat direct_cache_hit 0 + expect_stat preprocessed_cache_hit 0 + expect_stat cache_miss 1 SOURCE_DATE_EPOCH=1 $CCACHE_COMPILE -c with_time_macro.c - expect_stat 'cache hit (direct)' 0 - expect_stat 'cache hit (preprocessed)' 1 - expect_stat 'cache miss' 1 + expect_stat direct_cache_hit 0 + expect_stat preprocessed_cache_hit 1 + expect_stat cache_miss 1 SOURCE_DATE_EPOCH=2 $CCACHE_COMPILE -c with_time_macro.c - expect_stat 'cache hit (direct)' 0 - expect_stat 'cache hit (preprocessed)' 1 - expect_stat 'cache miss' 2 + expect_stat direct_cache_hit 0 + expect_stat preprocessed_cache_hit 1 + expect_stat cache_miss 2 # ------------------------------------------------------------------------- TEST "With __TIME__ and time_macros sloppiness" @@ -78,22 +78,22 @@ SUITE_source_date_epoch() { unset CCACHE_NODIRECT CCACHE_SLOPPINESS=time_macros SOURCE_DATE_EPOCH=1 $CCACHE_COMPILE -c with_time_macro.c - expect_stat 'cache hit (direct)' 0 - expect_stat 'cache hit (preprocessed)' 0 - expect_stat 'cache miss' 1 + expect_stat direct_cache_hit 0 + expect_stat preprocessed_cache_hit 0 + expect_stat cache_miss 1 CCACHE_SLOPPINESS=time_macros SOURCE_DATE_EPOCH=1 $CCACHE_COMPILE -c with_time_macro.c - expect_stat 'cache hit (direct)' 1 - expect_stat 'cache hit (preprocessed)' 0 - expect_stat 'cache miss' 1 + expect_stat direct_cache_hit 1 + expect_stat preprocessed_cache_hit 0 + expect_stat cache_miss 1 CCACHE_SLOPPINESS=time_macros SOURCE_DATE_EPOCH=2 $CCACHE_COMPILE -c with_time_macro.c - expect_stat 'cache hit (direct)' 2 - expect_stat 'cache hit (preprocessed)' 0 - expect_stat 'cache miss' 1 + expect_stat direct_cache_hit 2 + expect_stat preprocessed_cache_hit 0 + expect_stat cache_miss 1 SOURCE_DATE_EPOCH=1 $CCACHE_COMPILE -c with_time_macro.c - expect_stat 'cache hit (direct)' 2 - expect_stat 'cache hit (preprocessed)' 1 - expect_stat 'cache miss' 1 + expect_stat direct_cache_hit 2 + expect_stat preprocessed_cache_hit 1 + expect_stat cache_miss 1 } diff --git a/test/suites/split_dwarf.bash b/test/suites/split_dwarf.bash index 28a329345..7b77ca8eb 100644 --- a/test/suites/split_dwarf.bash +++ b/test/suites/split_dwarf.bash @@ -31,19 +31,19 @@ SUITE_split_dwarf() { cd dir1 $CCACHE_COMPILE -I$(pwd)/include -c src/test.c -gsplit-dwarf - expect_stat 'cache hit (direct)' 0 - expect_stat 'cache miss' 1 + expect_stat direct_cache_hit 0 + expect_stat cache_miss 1 $CCACHE_COMPILE -I$(pwd)/include -c src/test.c -gsplit-dwarf - expect_stat 'cache hit (direct)' 1 - expect_stat 'cache miss' 1 + expect_stat direct_cache_hit 1 + expect_stat cache_miss 1 cd ../dir2 $CCACHE_COMPILE -I$(pwd)/include -c src/test.c -gsplit-dwarf - expect_stat 'cache hit (direct)' 1 - expect_stat 'cache miss' 2 + expect_stat direct_cache_hit 1 + expect_stat cache_miss 2 $CCACHE_COMPILE -I$(pwd)/include -c src/test.c -gsplit-dwarf - expect_stat 'cache hit (direct)' 2 - expect_stat 'cache miss' 2 + expect_stat direct_cache_hit 2 + expect_stat cache_miss 2 # ------------------------------------------------------------------------- TEST "Output filename is hashed if using -gsplit-dwarf" @@ -62,18 +62,18 @@ SUITE_split_dwarf() { $CCACHE_COMPILE -I$(pwd)/include -c src/test.c -o test.o -gsplit-dwarf expect_equal_object_files reference.o test.o expect_equal_object_files reference.dwo test.dwo - expect_stat 'cache hit (direct)' 0 - expect_stat 'cache hit (preprocessed)' 0 - expect_stat 'cache miss' 1 - expect_stat 'files in cache' 2 + expect_stat direct_cache_hit 0 + expect_stat preprocessed_cache_hit 0 + expect_stat cache_miss 1 + expect_stat files_in_cache 2 $CCACHE_COMPILE -I$(pwd)/include -c src/test.c -o test.o -gsplit-dwarf expect_equal_object_files reference.o test.o expect_equal_object_files reference.dwo test.dwo - expect_stat 'cache hit (direct)' 1 - expect_stat 'cache hit (preprocessed)' 0 - expect_stat 'cache miss' 1 - expect_stat 'files in cache' 2 + expect_stat direct_cache_hit 1 + expect_stat preprocessed_cache_hit 0 + 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 mv test2.o reference2.o @@ -82,18 +82,18 @@ SUITE_split_dwarf() { $CCACHE_COMPILE -I$(pwd)/include -c src/test.c -o test2.o -gsplit-dwarf expect_equal_object_files reference2.o test2.o expect_equal_object_files reference2.dwo test2.dwo - expect_stat 'cache hit (direct)' 1 - expect_stat 'cache hit (preprocessed)' 0 - expect_stat 'cache miss' 2 - expect_stat 'files in cache' 4 + expect_stat direct_cache_hit 1 + expect_stat preprocessed_cache_hit 0 + expect_stat cache_miss 2 + expect_stat files_in_cache 4 $CCACHE_COMPILE -I$(pwd)/include -c src/test.c -o test2.o -gsplit-dwarf expect_equal_object_files reference2.o test2.o expect_equal_object_files reference2.dwo test2.dwo - expect_stat 'cache hit (direct)' 2 - expect_stat 'cache hit (preprocessed)' 0 - expect_stat 'cache miss' 2 - expect_stat 'files in cache' 4 + expect_stat direct_cache_hit 2 + expect_stat preprocessed_cache_hit 0 + expect_stat cache_miss 2 + expect_stat files_in_cache 4 fi # Else: Compiler does not produce stable object file output when compiling # the same source to the same output filename twice (DW_AT_GNU_dwo_id @@ -104,18 +104,18 @@ SUITE_split_dwarf() { cd dir1 CCACHE_BASEDIR=$(pwd) $CCACHE_COMPILE -I$(pwd)/include -gsplit-dwarf -fdebug-prefix-map=$(pwd)=. -c $(pwd)/src/test.c -o $(pwd)/test.o - expect_stat 'cache hit (direct)' 0 - expect_stat 'cache hit (preprocessed)' 0 - expect_stat 'cache miss' 1 - expect_stat 'files in cache' 2 + expect_stat direct_cache_hit 0 + expect_stat preprocessed_cache_hit 0 + expect_stat cache_miss 1 + expect_stat files_in_cache 2 expect_objdump_not_contains test.o "$(pwd)" cd ../dir2 CCACHE_BASEDIR=$(pwd) $CCACHE_COMPILE -I$(pwd)/include -gsplit-dwarf -fdebug-prefix-map=$(pwd)=. -c $(pwd)/src/test.c -o $(pwd)/test.o - expect_stat 'cache hit (direct)' 1 - expect_stat 'cache hit (preprocessed)' 0 - expect_stat 'cache miss' 1 - expect_stat 'files in cache' 2 + expect_stat direct_cache_hit 1 + expect_stat preprocessed_cache_hit 0 + expect_stat cache_miss 1 + expect_stat files_in_cache 2 expect_objdump_not_contains test.o "$(pwd)" # ------------------------------------------------------------------------- @@ -127,15 +127,15 @@ SUITE_split_dwarf() { $REAL_COMPILER -gsplit-dwarf -g1 -c test.c -o reference.o $CCACHE_COMPILE -gsplit-dwarf -g1 -c test.c - expect_stat 'cache hit (direct)' 0 - expect_stat 'cache hit (preprocessed)' 0 - expect_stat 'cache miss' 1 + expect_stat direct_cache_hit 0 + expect_stat preprocessed_cache_hit 0 + expect_stat cache_miss 1 rm -f test.dwo $CCACHE_COMPILE -gsplit-dwarf -g1 -c test.c - expect_stat 'cache hit (direct)' 1 - expect_stat 'cache hit (preprocessed)' 0 - expect_stat 'cache miss' 1 + expect_stat direct_cache_hit 1 + expect_stat preprocessed_cache_hit 0 + expect_stat cache_miss 1 if [ -f reference.dwo ] && [ ! -f test.dwo ]; then test_failed ".dwo missing" @@ -147,33 +147,33 @@ SUITE_split_dwarf() { TEST "Object file without dot" $CCACHE_COMPILE -gsplit-dwarf -c test.c -o test - expect_stat 'cache hit (direct)' 0 - expect_stat 'cache hit (preprocessed)' 0 - expect_stat 'cache miss' 1 + expect_stat direct_cache_hit 0 + expect_stat preprocessed_cache_hit 0 + expect_stat cache_miss 1 expect_exists test.dwo rm test.dwo $CCACHE_COMPILE -gsplit-dwarf -c test.c -o test - expect_stat 'cache hit (direct)' 1 - expect_stat 'cache hit (preprocessed)' 0 - expect_stat 'cache miss' 1 + expect_stat direct_cache_hit 1 + expect_stat preprocessed_cache_hit 0 + expect_stat cache_miss 1 expect_exists test.dwo # ------------------------------------------------------------------------- TEST "Object file with two dots" $CCACHE_COMPILE -gsplit-dwarf -c test.c -o test.x.y - expect_stat 'cache hit (direct)' 0 - expect_stat 'cache hit (preprocessed)' 0 - expect_stat 'cache miss' 1 + expect_stat direct_cache_hit 0 + expect_stat preprocessed_cache_hit 0 + expect_stat cache_miss 1 expect_exists test.x.dwo rm test.x.dwo $CCACHE_COMPILE -gsplit-dwarf -c test.c -o test.x.y - expect_stat 'cache hit (direct)' 1 - expect_stat 'cache hit (preprocessed)' 0 - expect_stat 'cache miss' 1 + expect_stat direct_cache_hit 1 + expect_stat preprocessed_cache_hit 0 + expect_stat cache_miss 1 expect_exists test.x.dwo } diff --git a/test/suites/stats_log.bash b/test/suites/stats_log.bash index cc9b69384..54a09a6c6 100644 --- a/test/suites/stats_log.bash +++ b/test/suites/stats_log.bash @@ -9,12 +9,12 @@ SUITE_stats_log() { TEST "CCACHE_STATSLOG" $CCACHE_COMPILE -c test.c - expect_stat 'cache hit (direct)' 0 - expect_stat 'cache miss' 1 + expect_stat direct_cache_hit 0 + expect_stat cache_miss 1 $CCACHE_COMPILE -c test.c - expect_stat 'cache hit (direct)' 1 - expect_stat 'cache miss' 1 + expect_stat direct_cache_hit 1 + expect_stat cache_miss 1 expect_content stats.log "# test.c cache_miss -- 2.47.2