]> 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:20:02 +0000 (20:20 +0100)
(cherry picked from commit c972eb6e824624956444e945bdfd9768c7e74123)

test/suites/base.bash
test/suites/direct.bash

index f5cc1fecf59f00887029e6d1433baaf95c268044..36a99747979a2915437199d77edbb2f02104aed6 100644 (file)
@@ -1008,6 +1008,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 f60a4b4e7b4769c666c6aa21b56ab3f90d86affe..6acdde24a5422736dd399ff8f09cdc4c80844693 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"