]> git.ipfire.org Git - thirdparty/ccache.git/commitdiff
Add test for prefix_command
authorJoel Rosdahl <joel@rosdahl.net>
Mon, 13 Feb 2012 19:12:44 +0000 (20:12 +0100)
committerJoel Rosdahl <joel@rosdahl.net>
Mon, 13 Feb 2012 19:12:44 +0000 (20:12 +0100)
test.sh

diff --git a/test.sh b/test.sh
index 982fbbd3bbe03d2c3eb8f1601155c689d7a1f4e4..8c0118a7c6b45b308810e063a209b99bb1a51904 100755 (executable)
--- a/test.sh
+++ b/test.sh
@@ -1863,6 +1863,38 @@ upgrade_suite() {
     checkstat 'max cache size' '2.1 GB'
 }
 
+prefix_suite() {
+    testname="prefix"
+    $CCACHE -Cz >/dev/null
+    rm -f prefix.result
+    cat <<'EOF' >prefix-a
+#!/bin/sh
+echo a >>prefix.result
+exec "$@"
+EOF
+    cat <<'EOF' >prefix-b
+#!/bin/sh
+echo b >>prefix.result
+exec "$@"
+EOF
+    chmod +x prefix-a prefix-b
+    cat <<'EOF' >file.c
+int foo;
+EOF
+    PATH=.:$PATH CCACHE_PREFIX="prefix-a prefix-b" $CCACHE $COMPILER -c file.c
+    checkstat 'cache hit (direct)' 0
+    checkstat 'cache hit (preprocessed)' 0
+    checkstat 'cache miss' 1
+    checkfile prefix.result "a
+b"
+    PATH=.:$PATH CCACHE_PREFIX="prefix-a prefix-b" $CCACHE $COMPILER -c file.c
+    checkstat 'cache hit (direct)' 0
+    checkstat 'cache hit (preprocessed)' 1
+    checkstat 'cache miss' 1
+    checkfile prefix.result "a
+b"
+}
+
 ######################################################################
 # main program
 
@@ -1916,6 +1948,7 @@ extrafiles
 cleanup
 pch
 upgrade
+prefix
 "
 
 host_os="`uname -s`"