1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102
|
SUITE_multi_arch_PROBE() {
if ! $HOST_OS_APPLE; then
echo "multiple -arch options not supported on $(uname -s)"
return
fi
}
SUITE_multi_arch_SETUP() {
generate_code 1 test1.c
unset CCACHE_NODIRECT
}
SUITE_multi_arch() {
# -------------------------------------------------------------------------
TEST "cache hit, direct mode"
# Different arches shouldn't affect each other
$CCACHE_COMPILE -arch i386 -c test1.c
expect_stat direct_cache_hit 0
expect_stat cache_miss 1
$CCACHE_COMPILE -arch x86_64 -c test1.c
expect_stat direct_cache_hit 0
expect_stat cache_miss 2
$CCACHE_COMPILE -arch i386 -c test1.c
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 direct_cache_hit 1
expect_stat cache_miss 3
$CCACHE_COMPILE -arch i386 -arch x86_64 -c test1.c
expect_stat direct_cache_hit 2
expect_stat cache_miss 3
CCACHE_DEBUG=1 $CCACHE_COMPILE -arch x86_64 -Xarch_x86_64 -I. -c test1.c
expect_stat direct_cache_hit 2
expect_stat cache_miss 4
expect_contains test1.o.*.ccache-log "clang -arch x86_64 -Xarch_x86_64 -I. -E"
expect_not_contains test1.o.*.ccache-log "clang -arch x86_64 -Xarch_x86_64 -I. -I. -E"
$CCACHE_COMPILE -arch x86_64 -Xarch_x86_64 -I. -c test1.c
expect_stat direct_cache_hit 3
expect_stat cache_miss 4
# -------------------------------------------------------------------------
TEST "cache hit, direct mode, multiple -Xarch_* arguments"
CCACHE_DEBUG=1 $CCACHE_COMPILE -arch x86_64 -arch arm64 -Xarch_x86_64 -I. -Xarch_arm64 -I. -c test1.c
expect_stat direct_cache_hit 0
expect_stat cache_miss 1
expect_contains test1.o.*.ccache-log "clang -arch x86_64 -Xarch_x86_64 -I. -E"
expect_not_contains test1.o.*.ccache-log "clang -arch x86_64 -Xarch_x86_64 -I. -I. -E"
expect_contains test1.o.*.ccache-log "clang -arch arm64 -Xarch_arm64 -I. -E"
expect_not_contains test1.o.*.ccache-log "clang -arch arm64 -Xarch_arm64 -I. -I. -E"
$CCACHE_COMPILE -arch x86_64 -arch arm64 -Xarch_x86_64 -I. -Xarch_arm64 -I. -c test1.c
expect_stat direct_cache_hit 1
expect_stat cache_miss 1
# -------------------------------------------------------------------------
TEST "cache hit, direct mode, multiple -Xarch_* arguments for single arch"
CCACHE_DEBUG=1 $CCACHE_COMPILE -arch x86_64 -Xarch_x86_64 -I. -Xarch_x86_64 -Ifoo -c test1.c
expect_stat direct_cache_hit 0
expect_stat cache_miss 1
expect_contains test1.o.*.ccache-log "clang -arch x86_64 -Xarch_x86_64 -I. -Xarch_x86_64 -Ifoo -E"
expect_not_contains test1.o.*.ccache-log "clang -arch x86_64 -Xarch_x86_64 -I. -I. -Xarch_x86_64 -Ifoo -E"
$CCACHE_COMPILE -arch x86_64 -Xarch_x86_64 -I. -Xarch_x86_64 -Ifoo -c test1.c
expect_stat direct_cache_hit 1
expect_stat cache_miss 1
# -------------------------------------------------------------------------
TEST "cache hit, preprocessor mode"
export CCACHE_NODIRECT=1
$CCACHE_COMPILE -arch i386 -c test1.c
expect_stat preprocessed_cache_hit 0
expect_stat cache_miss 1
$CCACHE_COMPILE -arch x86_64 -c test1.c
expect_stat preprocessed_cache_hit 0
expect_stat cache_miss 2
$CCACHE_COMPILE -arch i386 -c test1.c
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 preprocessed_cache_hit 1
expect_stat cache_miss 3
$CCACHE_COMPILE -arch i386 -arch x86_64 -c test1.c
expect_stat preprocessed_cache_hit 2
expect_stat cache_miss 3
}
|