]> git.ipfire.org Git - thirdparty/ccache.git/commitdiff
test: Add test for tricky preprocessed cache hit case master
authorJoel Rosdahl <joel@rosdahl.net>
Thu, 26 Jun 2025 19:16:57 +0000 (21:16 +0200)
committerJoel Rosdahl <joel@rosdahl.net>
Thu, 26 Jun 2025 19:39:09 +0000 (21:39 +0200)
See PR #1594.

test/suites/base.bash

index 6cbbaaeb6f33fd154c68c90a68a8a2bd6e6a4613..ac7bc1571f45a6e87a6e6eb1a65df825280ef286 100644 (file)
@@ -1341,6 +1341,38 @@ EOF
     $CCACHE_COMPILE -Wall -W -c stderr.c 2>stderr.txt
     expect_equal_text_content reference_stderr.txt stderr.txt
 
+    # -------------------------------------------------------------------------
+    TEST "Line number in compiler warning"
+
+    cat <<'EOF' >hello.h
+#define A a
+
+// comment
+
+#define B \
+  x \
+  y \
+  z
+
+int hello(void) {
+  // trigger warning by having no return statement
+}
+EOF
+    cat <<'EOF' >hello.c
+#include "hello.h"
+EOF
+
+    export CCACHE_DEBUG=1
+    $COMPILER -c -Wall -c hello.c 2>stderr_1_ref.txt
+    $CCACHE_COMPILE -Wall -c hello.c 2>stderr_1.txt
+    expect_equal_text_content stderr_1_ref.txt stderr_1.txt
+
+    sed -i 's/comment/comment\n/' hello.h
+
+    $COMPILER -c -Wall -c hello.c 2>stderr_2_ref.txt
+    $CCACHE_COMPILE -Wall -c hello.c 2>stderr_2.txt
+    expect_equal_text_content stderr_2_ref.txt stderr_2.txt
+
     # -------------------------------------------------------------------------
     TEST "Merging stderr"