Run multiple test suites in a single Travis CI job helps to avoid
job bloating and save build time.

When RUN_TESTS is set, TEST_SUITES includes a list of suites that
need to run in the job, otherwise fast-tests is run by default.

Suggested-by: David Marchand <david.march...@redhat.com>
Signed-off-by: Ruifeng Wang <ruifeng.w...@arm.com>
Reviewed-by: Gavin Hu <gavin...@arm.com>
---
 .ci/linux-build.sh |  4 +++-
 .ci/linux-setup.sh | 16 +++++++++++-----
 2 files changed, 14 insertions(+), 6 deletions(-)

diff --git a/.ci/linux-build.sh b/.ci/linux-build.sh
index d500c4c00..ddb925418 100755
--- a/.ci/linux-build.sh
+++ b/.ci/linux-build.sh
@@ -90,5 +90,7 @@ if [ "$ABI_CHECKS" = "1" ]; then
 fi
 
 if [ "$RUN_TESTS" = "1" ]; then
-    sudo meson test -C build --suite fast-tests -t 3
+    for testsuite in ${TEST_SUITES:-fast-tests}; do
+        sudo meson test -C build --suite $testsuite -t 3
+    done
 fi
diff --git a/.ci/linux-setup.sh b/.ci/linux-setup.sh
index 2b07d1e0b..4c5ddeb96 100755
--- a/.ci/linux-setup.sh
+++ b/.ci/linux-setup.sh
@@ -3,10 +3,16 @@
 # need to install as 'root' since some of the unit tests won't run without it
 sudo python3 -m pip install --upgrade 'meson==0.47.1'
 
-# skip hugepage settings if tests will not run
+# set up hugepage if fast-tests suite (default) will run
 if [ "$RUN_TESTS" = "1" ]; then
-    # setup hugepages
-    cat /proc/meminfo
-    sudo sh -c 'echo 1024 > /proc/sys/vm/nr_hugepages'
-    cat /proc/meminfo
+    for testsuite in ${TEST_SUITES:-fast-tests}; do
+        if [ "$testsuite" = "fast-tests" ]; then
+            # setup hugepages
+            cat /proc/meminfo
+            sudo sh -c 'echo 1024 > /proc/sys/vm/nr_hugepages'
+            cat /proc/meminfo
+
+            break
+        fi
+    done
 fi
-- 
2.17.1

Reply via email to