system-tests: refactor to allow easier test suites management across lttng versions
authorJonathan Rajotte <jonathan.rajotte-julien@efficios.com>
Fri, 5 Mar 2021 01:59:07 +0000 (20:59 -0500)
committerJonathan Rajotte <jonathan.rajotte-julien@efficios.com>
Fri, 5 Mar 2021 02:01:07 +0000 (21:01 -0500)
Signed-off-by: Jonathan Rajotte <jonathan.rajotte-julien@efficios.com>
lava/system-tests/destructive-tests.yml
lava/system-tests/kernel-tests.yml
lava/system-tests/perf-tests.yml
scripts/system-tests/lava2-submit.py
scripts/system-tests/run-test-suites.sh [new file with mode: 0755]
scripts/system-tests/template_lava_job.jinja2

index e43b0f2d70a407483acd76fd1c287371c255e1ee..f8a325ae4c901b508b300bd0b6211b00afb2938c 100644 (file)
@@ -4,6 +4,7 @@ metadata:
         description: "Run root destructive test suite"
 params:
   JENKINS_BUILD_ID: "invalid_jenkins_build_id"
+  LTTNG_VERSION_STRING: "invalid_version_string"
 run:
         steps:
                 - apt install -y curl
index a155e1668b90904e8a8e898f42db2d9846ed05ca..cee21bb3bccfe7bf9af5fa3b52e5b357654af916 100644 (file)
@@ -4,6 +4,7 @@ metadata:
         description: "Run kernel test suite"
 params:
     JENKINS_BUILD_ID: "invalid_jenkins_build_id"
+    LTTNG_VERSION_STRING: "invalid_version_string"
 run:
         steps:
                 - apt install -y curl
@@ -15,8 +16,6 @@ run:
                 - source /root/lttngvenv/activate
                 - pushd /root/lttngvenv/src/lttng-tools
                 - lava-test-case build-test-suite --shell "make"
-                - cd tests
-                - lava-test-case run-tests --shell "prove --nocolor --verbose --merge --exec '' - < root_regression"
-                - popd
+                - lava-test-case run-tests --shell "./ci/scripts/system-tests/run-test-suites.sh ${LTTNG_VERSION_STRING}"
                 - tar czf coredump.tar.gz coredump
                 - ./ci/lava/upload_artifact.sh coredump.tar.gz coredump.tar.gz "results/${JENKINS_BUILD_ID}/${TESTRUN_ID}-coredump.tar.gz"
index 6306be3ce4650d9f3baf9cb2104410addca0bd4c..026ccaf69c9a05096fcb543a7cb672879f9a9bd7 100644 (file)
@@ -4,6 +4,7 @@ metadata:
         description: "Run perf regression test suite"
 params:
     JENKINS_BUILD_ID: "invalid_jenkins_build_id"
+    LTTNG_VERSION_STRING: "invalid_version_string"
 run:
         steps:
                 - apt install -y libpfm4-dev curl
index 536b4b126aaea6bf62dec5285f0067b6f3bb7623..c6c131961e1aad60a121dda82799620ea9c6338d 100644 (file)
@@ -31,6 +31,19 @@ USERNAME = 'lava-jenkins'
 HOSTNAME = 'lava-master-02.internal.efficios.com'
 OBJSTORE_URL = "https://obj.internal.efficios.com/lava/results/"
 
+def parse_stable_version(stable_version_string):
+    # Get the major and minor version numbers from the lttng version string.
+    version_match = re.search('stable-(\d).(\d\d)', stable_version_string)
+
+    if version_match is not None:
+        major_version = int(version_match.group(1))
+        minor_version = int(version_match.group(2))
+    else:
+        # Setting to zero to make the comparison below easier.
+        major_version = 0
+        minor_version = 0
+    return major_version, minor_version
+
 
 class TestType:
     """ Enum like for test type """
@@ -139,17 +152,7 @@ def get_vlttng_cmd(
             + ' --profile lttng-ust-no-man-pages'
         )
 
-
-    # Get the major and minor version numbers from the lttng version string.
-    version_match = re.search('stable-(\d).(\d\d)', lttng_version)
-
-    if version_match is not None:
-        major_version = int(version_match.group(1))
-        minor_version = int(version_match.group(2))
-    else:
-        # Setting to zero to make the comparison below easier.
-        major_version = 0
-        minor_version = 0
+    major_version, minor_version = parse_stable_version(lttng_version)
 
     if lttng_version == 'master' or (major_version >= 2 and minor_version >= 11):
         vlttng_cmd += (
@@ -215,6 +218,13 @@ def main():
         args.lttng_version, args.tools_url, args.tools_commit, args.ust_url, args.ust_commit
     )
 
+    if args.lttng_version == "master":
+        lttng_version_string = "master"
+    else:
+        major, minor = parse_stable_version(args.lttng_version)
+        lttng_version_string = str(major) + "." + str(minor)
+
+
     context = dict()
     context['DeviceType'] = DeviceType
     context['TestType'] = TestType
@@ -226,6 +236,7 @@ def main():
 
     context['vlttng_cmd'] = vlttng_cmd
     context['vlttng_path'] = vlttng_path
+    context['lttng_version_string'] = lttng_version_string
 
     context['kernel_url'] = args.kernel
     context['nfsrootfs_url'] = nfsrootfs
diff --git a/scripts/system-tests/run-test-suites.sh b/scripts/system-tests/run-test-suites.sh
new file mode 100755 (executable)
index 0000000..44b6a90
--- /dev/null
@@ -0,0 +1,96 @@
+#!/bin/bash -xeu
+#
+# Copyright (C) 2021 - Jonathan Rajotte <jonathan.rajotte-julien@efficios.com>
+#
+# This program is free software: you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation, either version 3 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program.  If not, see <http://www.gnu.org/licenses/>.
+
+# Version compare functions
+vercomp () {
+    set +u
+    if [[ "$1" == "$2" ]]; then
+        return 0
+    fi
+    local IFS=.
+    local i ver1=($1) ver2=($2)
+    # fill empty fields in ver1 with zeros
+    for ((i=${#ver1[@]}; i<${#ver2[@]}; i++)); do
+        ver1[i]=0
+    done
+    for ((i=0; i<${#ver1[@]}; i++)); do
+        if [[ -z ${ver2[i]} ]]; then
+            # fill empty fields in ver2 with zeros
+            ver2[i]=0
+        fi
+        if ((10#${ver1[i]} > 10#${ver2[i]})); then
+            return 1
+        fi
+        if ((10#${ver1[i]} < 10#${ver2[i]})); then
+            return 2
+        fi
+    done
+    set -u
+    return 0
+}
+
+verlte() {
+    vercomp "$1" "$2"; local res="$?"
+    [ "$res" -eq "0" ] || [ "$res" -eq "2" ]
+}
+
+verlt() {
+    vercomp "$1" "$2"; local res="$?"
+    [ "$res" -eq "2" ]
+}
+
+vergte() {
+    vercomp "$1" "$2"; local res="$?"
+    [ "$res" -eq "0" ] || [ "$res" -eq "1" ]
+}
+
+vergt() {
+    vercomp "$1" "$2"; local res="$?"
+    [ "$res" -eq "1" ]
+}
+
+verne() {
+    vercomp "$1" "$2"; local res="$?"
+    [ "$res" -ne "0" ]
+}
+
+lttng_version="$1"
+failed_tests=0
+
+if [[ "$lttng_version" == "master" ]]; then
+       make --keep-going check || failed_tests=1
+       # TODO: remove when root regression tests are merged with make check or
+       # in another make command.
+       if [ -f "./tests/long_regression" ]; then
+               cd "./tests" || exit 1
+               prove --nocolor --verbose --merge --exec '' - < root_regression || failed_tests=1
+               cd ..
+       fi
+elif vergte "$lttng_version" "2.13"; then
+       # All root regression are now part of the make check
+       make --keep-going check || failed_tests=1
+else
+       make --keep-going check || failed_tests=1
+       cd "./tests" || exit 1
+       prove --nocolor --verbose --merge --exec '' - < root_regression || failed_tests=1
+       cd ..
+fi
+
+exit $failed_tests
+
+
+
index b3b9c1e2aa9b1270f48fc7df58eaf1e665b71607..ded42e93a8e89d21082d435a6025d29d993755c1 100644 (file)
@@ -102,6 +102,7 @@ actions:
               path: lava/system-tests/perf-tests.yml
               name: perf-tests
               params:
+                LTTNG_VERSION_STRING: {{ lttng_version_string }}
                 JENKINS_BUILD_ID: {{ jenkins_build_id }}
           {% elif test_type == TestType.kvm_tests %}
             - repository: https://github.com/lttng/lttng-ci.git
@@ -109,11 +110,13 @@ actions:
               path: lava/system-tests/kernel-tests.yml
               name: kernel-tests
               params:
+                LTTNG_VERSION_STRING: {{ lttng_version_string }}
                 JENKINS_BUILD_ID: {{ jenkins_build_id }}
             - repository: https://github.com/lttng/lttng-ci.git
               from: git
               path: lava/system-tests/destructive-tests.yml
               name: destructive-tests
               params:
+                LTTNG_VERSION_STRING: {{ lttng_version_string }}
                 JENKINS_BUILD_ID: {{ jenkins_build_id }}
           {% endif %}
This page took 0.026679 seconds and 4 git commands to generate.