summaryrefslogtreecommitdiff
path: root/test/suites/base.bash
diff options
context:
space:
mode:
authorAlexander Lanin <alex@lanin.de>2020-11-16 18:45:44 +0100
committerGitHub <noreply@github.com>2020-11-16 18:45:44 +0100
commitf258b70e5ae3be5789ff07f6281bbfcfeb9bf37c (patch)
treec4d96bf271436ccb6702d414c2779ab79ebded65 /test/suites/base.bash
parentac13fb9a0ef7aabcf94ef7fdba1fc92f8e31c0a0 (diff)
downloadccache-f258b70e5ae3be5789ff07f6281bbfcfeb9bf37c.tar.gz
Cache -fsyntax-only result (#685)
Diffstat (limited to 'test/suites/base.bash')
-rw-r--r--test/suites/base.bash29
1 files changed, 28 insertions, 1 deletions
diff --git a/test/suites/base.bash b/test/suites/base.bash
index b41138f7..75e2768f 100644
--- a/test/suites/base.bash
+++ b/test/suites/base.bash
@@ -1030,7 +1030,7 @@ EOF
umask $saved_umask
# -------------------------------------------------------------------------
- TEST "No object file"
+ TEST "No object file due to bad prefix"
cat <<'EOF' >test_no_obj.c
int test_no_obj;
@@ -1043,6 +1043,33 @@ EOF
CCACHE_PREFIX=$(pwd)/no-object-prefix $CCACHE_COMPILE -c test_no_obj.c
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
+
+ # -------------------------------------------------------------------------
+ TEST "No object file due to -fsyntax-only"
+
+ echo '#warning This triggers a compiler warning' >stderr.c
+
+ $REAL_COMPILER -Wall -c stderr.c -fsyntax-only 2>reference_stderr.txt
+
+ 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_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_equal_text_content reference_stderr.txt stderr.txt
+
# -------------------------------------------------------------------------
TEST "Empty object file"