]> git.ipfire.org Git - thirdparty/ccache.git/commitdiff
Add tests for verifying dependency file content
authorJoel Rosdahl <joel@rosdahl.net>
Wed, 1 Jan 2020 21:17:11 +0000 (22:17 +0100)
committerJoel Rosdahl <joel@rosdahl.net>
Sun, 5 Jan 2020 19:02:21 +0000 (20:02 +0100)
test/suites/base.bash
test/suites/direct.bash

index 5df538c530ef939b1a77d50dac84929475a5dbcd..00664a9c6401a454b902429ac3207c72ebc0bc4a 100644 (file)
@@ -984,6 +984,20 @@ EOF
     expect_stat 'cache miss' 2
     expect_stat 'files in cache' 2
 
+    # -------------------------------------------------------------------------
+    TEST "Dependency file content"
+
+    mkdir build
+    cp test1.c build
+
+    for src in test1.c build/test1.c; do
+        for obj in test1.o build/test1.o; do
+            $CCACHE_COMPILE -c -MMD $src -o $obj
+            dep=$(echo $obj | sed 's/\.o$/.d/')
+            expect_file_content $dep "$obj: $src"
+        done
+    done
+
     # -------------------------------------------------------------------------
     TEST "Buggy GCC 6 cpp"
 
index fca072f7574f69c6b4d85ab2ed80e5c13bbdd401..e766af5a83415e15799e0b78e439e8959177e83b 100644 (file)
@@ -159,14 +159,29 @@ EOF
     mkdir a b
     touch a/source.c b/source.c
     backdate a/source.h b/source.h
-    $CCACHE_COMPILE -MMD -c a/source.c
-    expect_file_content source.d "source.o: a/source.c"
+    $CCACHE_COMPILE -MMD -c a/source.c -o a/source.o
+    expect_file_content a/source.d "a/source.o: a/source.c"
 
-    $CCACHE_COMPILE -MMD -c b/source.c
-    expect_file_content source.d "source.o: b/source.c"
+    $CCACHE_COMPILE -MMD -c b/source.c -o b/source.o
+    expect_file_content b/source.d "b/source.o: b/source.c"
 
-    $CCACHE_COMPILE -MMD -c a/source.c
-    expect_file_content source.d "source.o: a/source.c"
+    $CCACHE_COMPILE -MMD -c a/source.c -o a/source.o
+    expect_file_content a/source.d "a/source.o: a/source.c"
+
+    # -------------------------------------------------------------------------
+    TEST "Dependency file content"
+
+    mkdir build
+    touch test1.c
+    cp test1.c build
+
+    for src in test1.c build/test1.c; do
+        for obj in test1.o build/test1.o; do
+            $CCACHE_COMPILE -c -MMD $src -o $obj
+            dep=$(echo $obj | sed 's/\.o$/.d/')
+            expect_file_content $dep "$obj: $src"
+        done
+    done
 
     # -------------------------------------------------------------------------
     TEST "-MMD for different include file paths"