]> git.ipfire.org Git - thirdparty/ccache.git/commitdiff
test: Disable "output file failure" test for unsupported filesystem
authorJoel Rosdahl <joel@rosdahl.net>
Sat, 27 Aug 2022 18:04:26 +0000 (20:04 +0200)
committerJoel Rosdahl <joel@rosdahl.net>
Sat, 27 Aug 2022 18:08:21 +0000 (20:08 +0200)
The "Failure to write output file" test assumes that the filesystem
supports read-only directories. Improve this by probing this assumption
before running the test.

Fixes #1150.

(cherry picked from commit 553fc98f846bf6de1566e8526f4a779b70d814c8)

test/suites/base.bash

index 2ec443ebda54ae15135b7837964efc185501b135..42709dde0766149c159ae336682574475a608d6d 100644 (file)
@@ -1182,22 +1182,27 @@ EOF
     expect_stat cache_miss 1
 
     # -------------------------------------------------------------------------
-    TEST "Failure to write output file"
 
     mkdir dir
+    chmod a-w dir
+    if ! touch dir/test 2>/dev/null; then
+        TEST "Failure to write output file"
 
-    $CCACHE_COMPILE -c test1.c -o dir/test1.o
-    expect_stat preprocessed_cache_hit 0
-    expect_stat cache_miss 1
-    expect_stat bad_output_file 0
+        mkdir dir
 
-    rm dir/test1.o
-    chmod a-w dir
+        $CCACHE_COMPILE -c test1.c -o dir/test1.o
+        expect_stat preprocessed_cache_hit 0
+        expect_stat cache_miss 1
+        expect_stat bad_output_file 0
 
-    $CCACHE_COMPILE -c test1.c -o dir/test1.o 2>/dev/null
-    expect_stat preprocessed_cache_hit 0
-    expect_stat cache_miss 1
-    expect_stat bad_output_file 1
+        rm dir/test1.o
+        chmod a-w dir
+
+        $CCACHE_COMPILE -c test1.c -o dir/test1.o 2>/dev/null
+        expect_stat preprocessed_cache_hit 0
+        expect_stat cache_miss 1
+        expect_stat bad_output_file 1
+    fi
 
     # -------------------------------------------------------------------------
     TEST "Caching stderr"