]> 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:04:26 +0000 (20:04 +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.

test/suites/base.bash

index 12b874f30ca589ea8850fbfcd5428a86c682b85d..9b53237eb90764d279f2d1c39a424d04b73813aa 100644 (file)
@@ -1194,22 +1194,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"