summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJoel Rosdahl <joel@rosdahl.net>2018-01-28 16:06:36 +0100
committerJoel Rosdahl <joel@rosdahl.net>2018-01-28 16:06:36 +0100
commit313e6f4c7b28ddff49bfaa406d8aa5ab55737bc6 (patch)
tree56b89f3f49b1f95a9dda5a3dca9586e29dcef995
parent7a67b2a9b20a3934b0248026fb4d78bc3815be33 (diff)
downloadccache-313e6f4c7b28ddff49bfaa406d8aa5ab55737bc6.tar.gz
test: Verify that UNCACHED_ERR_FD works
-rwxr-xr-xtest.sh32
1 files changed, 32 insertions, 0 deletions
diff --git a/test.sh b/test.sh
index b2d6bf9f..d750afeb 100755
--- a/test.sh
+++ b/test.sh
@@ -1076,6 +1076,38 @@ EOF
expect_stat 'cache hit (preprocessed)' 0
expect_stat 'cache miss' 0
expect_stat 'unsupported code directive' 1
+
+ # -------------------------------------------------------------------------
+ TEST "UNCACHED_ERR_FD"
+
+ cat >compiler.sh <<'EOF'
+#!/bin/sh
+if [ "$1" = "-E" ]; then
+ echo preprocessed
+ printf ${N}Pu >&$UNCACHED_ERR_FD
+else
+ echo compiled >test1.o
+ printf ${N}Cc >&2
+ printf ${N}Cu >&$UNCACHED_ERR_FD
+fi
+EOF
+ chmod +x compiler.sh
+
+ 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
+ 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
+ if [ "$stderr" != "2Pu1Cc" ]; then
+ test_failed "Unexpected stderr: $stderr != 2Pu1Cc"
+ fi
}
# =============================================================================