]> git.ipfire.org Git - thirdparty/ccache.git/commitdiff
Make it possible to specify test suites to run on the command line
authorJoel Rosdahl <joel@rosdahl.net>
Thu, 10 Dec 2009 21:19:00 +0000 (22:19 +0100)
committerJoel Rosdahl <joel@rosdahl.net>
Tue, 5 Jan 2010 17:53:03 +0000 (18:53 +0100)
NEWS
test.sh

diff --git a/NEWS b/NEWS
index 90ba116c42468a03053a7fd5ce96e7529858cb57..0b589b0657e6f2162ede5aa4401c391e5dcca2e6 100644 (file)
--- a/NEWS
+++ b/NEWS
@@ -42,6 +42,9 @@ New features and improvements:
   - By default, ccache now puts temporary files in CCACHE_DIR/tmp to avoid
     cluttering the top directory.
 
+  - Improved the test suite and added tests for most of the new functionality.
+    It's now also possible to specify a subset of tests to run.
+
 Bug fixes:
 
   - Fixed build on FreeBSD.
diff --git a/test.sh b/test.sh
index e800c2959267ddfe8a91e7a4c17f236a36569f8d..22a95e6b8aede183e2fc51192fc25bb185909caa 100755 (executable)
--- a/test.sh
+++ b/test.sh
@@ -60,8 +60,13 @@ checkfile() {
     fi
 }
 
-basetests() {
-    echo "starting testsuite $testsuite"
+run_suite() {
+    echo "starting testsuite $1"
+    testsuite=$1
+    ${1}_suite
+}
+
+base_tests() {
     rm -rf $CCACHE_DIR
     checkstat 'cache hit (preprocessed)' 0
     checkstat 'cache miss' 0
@@ -257,8 +262,50 @@ basetests() {
     rm -f test1.c
 }
 
-direct_tests() {
-    echo "starting testsuite $testsuite"
+base_suite() {
+    CCACHE_COMPILE="$CCACHE $COMPILER"
+    base_tests
+}
+
+link_suite() {
+    ln -s ../ccache $COMPILER
+    CCACHE_COMPILE="./$COMPILER"
+    base_tests
+}
+
+hardlink_suite() {
+    CCACHE_COMPILE="$CCACHE $COMPILER"
+    CCACHE_HARDLINK=1
+    export CCACHE_HARDLINK
+    base_tests
+    unset CCACHE_HARDLINK
+}
+
+cpp2_suite() {
+    CCACHE_COMPILE="$CCACHE $COMPILER"
+    CCACHE_CPP2=1
+    export CCACHE_CPP2
+    base_tests
+    unset CCACHE_CPP2
+}
+
+nlevels4_suite() {
+    CCACHE_COMPILE="$CCACHE $COMPILER"
+    CCACHE_NLEVELS=4
+    export CCACHE_NLEVELS
+    base_tests
+    unset CCACHE_NLEVELS
+}
+
+nlevels1_suite() {
+    CCACHE_COMPILE="$CCACHE $COMPILER"
+    CCACHE_NLEVELS=1
+    export CCACHE_NLEVELS
+    base_tests
+    unset CCACHE_NLEVELS
+}
+
+direct_suite() {
     rm -rf $CCACHE_DIR
     unset CCACHE_NODIRECT
 
@@ -515,8 +562,7 @@ EOF
     $CCACHE -C >/dev/null
 }
 
-basedir_tests() {
-    echo "starting testsuite $testsuite"
+basedir_suite() {
     rm -rf $CCACHE_DIR
 
     ##################################################################
@@ -640,8 +686,10 @@ EOF
     fi
 }
 
-######
+######################################################################
 # main program
+
+suites="$*"
 rm -rf $TESTDIR
 mkdir $TESTDIR
 cd $TESTDIR || exit 1
@@ -657,48 +705,14 @@ mkdir $CCACHE_DIR
 
 # ---------------------------------------
 
-testsuite="base"
-CCACHE_COMPILE="$CCACHE $COMPILER"
-basetests
-
-testsuite="link"
-ln -s ../ccache $COMPILER
-CCACHE_COMPILE="./$COMPILER"
-basetests
-
-testsuite="hardlink"
-CCACHE_COMPILE="$CCACHE $COMPILER"
-CCACHE_HARDLINK=1
-export CCACHE_HARDLINK
-basetests
-unset CCACHE_HARDLINK
-
-testsuite="cpp2"
-CCACHE_COMPILE="$CCACHE $COMPILER"
-CCACHE_CPP2=1
-export CCACHE_CPP2
-basetests
-unset CCACHE_CPP2
-
-testsuite="nlevels4"
-CCACHE_COMPILE="$CCACHE $COMPILER"
-CCACHE_NLEVELS=4
-export CCACHE_NLEVELS
-basetests
-unset CCACHE_NLEVELS
-
-testsuite="nlevels1"
-CCACHE_COMPILE="$CCACHE $COMPILER"
-CCACHE_NLEVELS=1
-export CCACHE_NLEVELS
-basetests
-unset CCACHE_NLEVELS
-
-testsuite="direct"
-direct_tests
-
-testsuite="basedir"
-basedir_tests
+all_suites="base link hardlink cpp2 nlevels4 nlevels1 direct basedir"
+if [ -z "$suites" ]; then
+    suites="$all_suites"
+fi
+
+for suite in $suites; do
+    run_suite $suite
+done
 
 # ---------------------------------------