]> git.ipfire.org Git - thirdparty/ccache.git/commitdiff
test: Only run -fprofile-generate tests for compilers that support it
authorJoel Rosdahl <joel@rosdahl.net>
Sun, 8 Apr 2012 15:30:40 +0000 (17:30 +0200)
committerJoel Rosdahl <joel@rosdahl.net>
Sun, 8 Apr 2012 15:30:40 +0000 (17:30 +0200)
test.sh

diff --git a/test.sh b/test.sh
index f1ea65c46a0e7014508706fac8eca8cb065f7971..ff9af36b3eefc4a4d4395fa2967b897792a3e18e 100755 (executable)
--- a/test.sh
+++ b/test.sh
@@ -502,36 +502,38 @@ EOF
     $CCACHE -C > /dev/null
     checkstat 'files in cache' 0
 
-    testname="profile-generate"
-    $CCACHE -Cz > /dev/null
-    $CCACHE_COMPILE -c -fprofile-generate test1.c
-    checkstat 'cache hit (preprocessed)' 0
-    checkstat 'cache miss' 1
-    checkstat 'files in cache' 1
-    $CCACHE_COMPILE -c -fprofile-generate test1.c
-    checkstat 'cache hit (preprocessed)' 1
-    checkstat 'cache miss' 1
-    checkstat 'files in cache' 1
-
-    testname="profile-arcs"
-    $CCACHE_COMPILE -c -fprofile-arcs test1.c
-    checkstat 'cache hit (preprocessed)' 1
-    checkstat 'cache miss' 2
-    checkstat 'files in cache' 2
-    $CCACHE_COMPILE -c -fprofile-arcs test1.c
-    checkstat 'cache hit (preprocessed)' 2
-    checkstat 'cache miss' 2
-    checkstat 'files in cache' 2
-
-    testname="profile-use"
-    $CCACHE_COMPILE -c -fprofile-use test1.c 2> /dev/null
-    checkstat 'cache hit (preprocessed)' 2
-    checkstat 'cache miss' 3
-    checkstat 'files in cache' 4
-    $CCACHE_COMPILE -c -fprofile-use test1.c 2> /dev/null
-    checkstat 'cache hit (preprocessed)' 3
-    checkstat 'cache miss' 3
-    checkstat 'files in cache' 4
+    if $COMPILER -c -fprofile-generate test1.c 2>/dev/null; then
+        testname="profile-generate"
+        $CCACHE -Cz > /dev/null
+        $CCACHE_COMPILE -c -fprofile-generate test1.c
+        checkstat 'cache hit (preprocessed)' 0
+        checkstat 'cache miss' 1
+        checkstat 'files in cache' 1
+        $CCACHE_COMPILE -c -fprofile-generate test1.c
+        checkstat 'cache hit (preprocessed)' 1
+        checkstat 'cache miss' 1
+        checkstat 'files in cache' 1
+
+        testname="profile-arcs"
+        $CCACHE_COMPILE -c -fprofile-arcs test1.c
+        checkstat 'cache hit (preprocessed)' 1
+        checkstat 'cache miss' 2
+        checkstat 'files in cache' 2
+        $CCACHE_COMPILE -c -fprofile-arcs test1.c
+        checkstat 'cache hit (preprocessed)' 2
+        checkstat 'cache miss' 2
+        checkstat 'files in cache' 2
+
+        testname="profile-use"
+        $CCACHE_COMPILE -c -fprofile-use test1.c 2> /dev/null
+        checkstat 'cache hit (preprocessed)' 2
+        checkstat 'cache miss' 3
+        checkstat 'files in cache' 4
+        $CCACHE_COMPILE -c -fprofile-use test1.c 2> /dev/null
+        checkstat 'cache hit (preprocessed)' 3
+        checkstat 'cache miss' 3
+        checkstat 'files in cache' 4
+    fi
 
     rm -f test1.c
 }