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
printf "$ansi_boldred%s$ansi_reset\n" "$*"
}
+yellow() {
+ printf "$ansi_boldyellow%s$ansi_reset\n" "$*"
+}
+
bold() {
printf "$ansi_bold%s$ansi_reset\n" "$*"
}
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
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
}
$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
# -------------------------------------------------------------------------
$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
# -------------------------------------------------------------------------
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
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
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
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"
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"
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"
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
# -------------------------------------------------------------------------
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
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
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
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"
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"
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
# -------------------------------------------------------------------------
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
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"
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"
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"
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"
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"
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"
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
# -------------------------------------------------------------------------
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
# -------------------------------------------------------------------------
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"
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"
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"
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"
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"
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
# -------------------------------------------------------------------------
$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
# -------------------------------------------------------------------------
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"
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"
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"
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"
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 <<EOF >foobar.sh
#!/bin/sh
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"
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
# -------------------------------------------------------------------------
$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"))
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:
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"))
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"
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
# -------------------------------------------------------------------------
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"
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]"
# -------------------------------------------------------------------------
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
$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"
# 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"
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
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
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 <<EOF >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
# -------------------------------------------------------------------------
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
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
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
# -------------------------------------------------------------------------
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
# -------------------------------------------------------------------------
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
# -------------------------------------------------------------------------
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
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
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
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
$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
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"
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 "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
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
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
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
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
}
$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"
$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"
$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
#
$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
$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
$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"
$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"
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"
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"
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"
$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"
$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
}
# 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)"
# 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
# ---------------------------------------------------------------------
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"
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"
# 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
;;
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[@]}"
$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
}
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)"
# -------------------------------------------------------------------------
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)"
}
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"
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"
$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`"
# -------------------------------------------------------------------------
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
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
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
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
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
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
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
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"
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
}
$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
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 <<EOF >test1.h
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"
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:\""
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"
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"
# 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
$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
$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
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
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
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
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
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"
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"
# -------------------------------------------------------------------------
$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
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
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
# -------------------------------------------------------------------------
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
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
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
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
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
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
# -------------------------------------------------------------------------
}
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`"
# -------------------------------------------------------------------------
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"
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"
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"
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"
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"
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"
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"
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"
#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"
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"
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"
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
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"
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"
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"
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
}
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
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
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
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
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
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
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
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
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
}
$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"
$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"
$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
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"
$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
# -------------------------------------------------------------------------
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"
# -------------------------------------------------------------------------
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"
}
printf '#include <wchar.h>\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
}
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
}
$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
# -------------------------------------------------------------------------
$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
}
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"
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 <<EOF >test1.h
#include <string>
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
}
# 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"
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
}
$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
# -------------------------------------------------------------------------
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
}
# 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
# -------------------------------------------------------------------------
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
$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
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
# -------------------------------------------------------------------------
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
# -------------------------------------------------------------------------
# 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
# -------------------------------------------------------------------------
# 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
# -------------------------------------------------------------------------
# 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
# -------------------------------------------------------------------------
# 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() {
# 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
# -------------------------------------------------------------------------
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
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
# -------------------------------------------------------------------------
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
}
# 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
# 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
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 <string.h> /*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
# -------------------------------------------------------------------------
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"
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"
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 <string.h> /*change pch*/' >>pch.h
backdate pch.h
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"
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 <string.h> /*change pch*/' >>pch.h
backdate pch.h
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 <string.h> /*change pch*/' >>pch.h
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
# -------------------------------------------------------------------------
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
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"
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"
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 <string.h> /*change pch*/' >>pch.h
backdate pch.h
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
# -------------------------------------------------------------------------
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 <string.h> /*change pch*/' >>pch.h
backdate pch.h
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
# -------------------------------------------------------------------------
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 <string.h> /*change pch*/' >>pch.h
backdate pch.h
backdate pch.h.gch
CCACHE_DEPEND=1 CCACHE_SLOPPINESS="$DEFAULT_SLOPPINESS time_macros" $CCACHE_COMPILE $SYSROOT -c -include pch.h pch2.c -MD -MF pch.d
- 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() {
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"
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"
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 <string.h> /*change pch*/' >>pch.h
backdate pch.h
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"
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 <string.h> /*change pch*/' >>pch.h
backdate pch.h
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"
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"
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
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"
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"
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() {
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"
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"
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 <string.h> /*change pch*/' >>pch.h
backdate pch.h
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"
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 <string.h> /*change pch*/' >>pch.h
backdate pch.h
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"
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 <string.h> /*change pch*/' >>pch.h
backdate pch.h
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"
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 <string.h> /*change pch*/' >>pch.h
backdate pch.h
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 <string.h> /*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
# -------------------------------------------------------------------------
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 <string.h> /*change pch*/' >>pch.h
backdate pch.h
backdate pch.h.pch
CCACHE_SLOPPINESS="$DEFAULT_SLOPPINESS time_macros" $CCACHE_COMPILE $SYSROOT -Xclang -include-pch -Xclang pch.h.pch -Xclang -include -Xclang pch.h -c pch.c
- 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
}
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
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"
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
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"
$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"
$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"
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
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() {
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
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"
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
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
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"
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
}
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"
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"
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"
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
}
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
}
# 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.
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.
# 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.
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
}
$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"
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"
$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
}
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
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
# -------------------------------------------------------------------------
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
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
# -------------------------------------------------------------------------
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
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
# -------------------------------------------------------------------------
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
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
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
# -------------------------------------------------------------------------
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
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
# -------------------------------------------------------------------------
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
# -------------------------------------------------------------------------
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
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"
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"
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
}
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
# -------------------------------------------------------------------------
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
}
$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
# -------------------------------------------------------------------------
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
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
}
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"
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"
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"
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
}
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"
$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
$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
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)"
# -------------------------------------------------------------------------
$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"
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
}
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