summaryrefslogtreecommitdiff
path: root/test.sh
diff options
context:
space:
mode:
authorJoel Rosdahl <joel@rosdahl.net>2010-01-05 20:43:18 +0100
committerJoel Rosdahl <joel@rosdahl.net>2010-01-06 22:23:10 +0100
commit42273c937f72802ad3b21abcd8886b5d5012368c (patch)
treec0e6bdbf674d55ed3a773c8c9aa2c2197485bf28 /test.sh
parentf98719bc9048dc72072c55cd5b5432493cc8a3b1 (diff)
downloadccache-42273c937f72802ad3b21abcd8886b5d5012368c.tar.gz
Let compressed files get different hash sums than uncompressed
This is to avoid problems when older ccache versions (without compression support) access the cache.
Diffstat (limited to 'test.sh')
-rwxr-xr-xtest.sh35
1 files changed, 35 insertions, 0 deletions
diff --git a/test.sh b/test.sh
index e5787686..c5436c74 100755
--- a/test.sh
+++ b/test.sh
@@ -792,6 +792,40 @@ EOF
fi
}
+compression_suite() {
+ rm -rf $CCACHE_DIR
+
+ ##################################################################
+ # Create some code to compile.
+ cat <<EOF >test.c
+int test;
+EOF
+
+ ##################################################################
+ # Check that compressed and uncompressed files get different hash sums in
+ # order to maintain forward compatibility of previous ccache versions.
+ testname="compression hash sum"
+ $CCACHE $COMPILER -c test.c
+ checkstat 'cache hit (direct)' 0
+ checkstat 'cache hit (preprocessed)' 0
+ checkstat 'cache miss' 1
+
+ $CCACHE $COMPILER -c test.c
+ checkstat 'cache hit (direct)' 0
+ checkstat 'cache hit (preprocessed)' 1
+ checkstat 'cache miss' 1
+
+ CCACHE_NOCOMPRESS=1 $CCACHE $COMPILER -c test.c
+ checkstat 'cache hit (direct)' 0
+ checkstat 'cache hit (preprocessed)' 1
+ checkstat 'cache miss' 2
+
+ CCACHE_NOCOMPRESS=1 $CCACHE $COMPILER -c test.c
+ checkstat 'cache hit (direct)' 0
+ checkstat 'cache hit (preprocessed)' 2
+ checkstat 'cache miss' 2
+}
+
######################################################################
# main program
@@ -820,6 +854,7 @@ nlevels4
nlevels1
direct
basedir
+compression
"
if [ -z "$suites" ]; then