Merge pull request #21 from frdeso/kprobe_fuzzing_pr
authorJonathan Rajotte Julien <jonathan.rajotte-julien@efficios.com>
Thu, 17 Aug 2017 15:04:50 +0000 (11:04 -0400)
committerGitHub <noreply@github.com>
Thu, 17 Aug 2017 15:04:50 +0000 (11:04 -0400)
Move kprobe fuzzing lava test to its own lava job.

jobs/lttng-baremetal-tests.yaml
scripts/lttng-baremetal-tests/kprobe-fuzzing.sh
scripts/lttng-baremetal-tests/lava-submit.py
scripts/lttng-baremetal-tests/run-kvm-fuzzing-tests.sh [new file with mode: 0644]

index 60594b14e47656da2278d52378d24ebfdde3b663..b13ff54d3228ee80a2be170cd2f6724f1dfa2a13 100644 (file)
           properties-file: properties.txt
       - shell: !include-raw-escape: scripts/lttng-baremetal-tests/run-kvm-tests.sh
 
+- defaults:
+    name: vm_tests_kmainline
+    defaults: vm_tests
+    triggers:
+      - pollscm:
+          cron: "0 1 * * 1-5"
+    wrappers:
+      - workspace-cleanup
+      - timestamps
+      - ansicolor
+      - credentials-binding:
+          - text:
+              credential-id: jenkins_lava_key
+              variable: LAVA_JENKINS_TOKEN
+      - inject:
+          properties-content: |
+            TOOLS_BRANCH={toolsversion}
+            MODULES_BRANCH={modulesversion}
+            UST_BRANCH={ustversion}
+            BUILD_DEVICE=baremetal
+    scm:
+      - git:
+          url: git://git-mirror.internal.efficios.com/lttng/lttng-tools.git
+          branches:
+            - "{toolsversion}"
+          shallow-clone: true
+          skip-tag: true
+          fastpoll: true
+          basedir: src/lttng-tools
+      - git:
+          url: git://git-mirror.internal.efficios.com/lttng/lttng-modules.git
+          branches:
+            - "{modulesversion}"
+          shallow-clone: true
+          skip-tag: true
+          fastpoll: true
+          basedir: src/lttng-modules
+      - git:
+          url: git://git-mirror.internal.efficios.com/kernel/torvalds/linux.git
+          refspec: "+refs/tags/*:refs/remotes/origin/tags/*"
+          branches:
+            - "master"
+          fastpoll: true
+          basedir: src/linux
+
 - defaults:
     name: baremetal_tests
     description: |
     defaults: baremetal_benchmarks
     triggers:
       - timed: "0 1 * * 1-5"
-
 - job-template:
     name: vm_tests_kmainline_t{toolsversion}_m{modulesversion}_u{ustversion}
-    defaults: vm_tests
-    triggers:
-      - pollscm:
-          cron: "0 1 * * 1-5"
-    wrappers:
-      - workspace-cleanup
-      - timestamps
-      - ansicolor
-      - credentials-binding:
-          - text:
-              credential-id: jenkins_lava_key
-              variable: LAVA_JENKINS_TOKEN
+    defaults: vm_tests_kmainline
+
+- job-template:
+    name: vm_tests_fuzzing_kmainline_t{toolsversion}_m{modulesversion}_u{ustversion}
+    defaults: vm_tests_kmainline
+
+    builders:
+      - shell: !include-raw-escape: scripts/lttng-baremetal-tests/generate-properties-master.sh
+      - trigger-builds:
+        - project: "build_kernel_PARAM"
+          property-file: 'properties.txt'
+          block: true
       - inject:
-          properties-content: |
-            TOOLS_BRANCH={toolsversion}
-            MODULES_BRANCH={modulesversion}
-            UST_BRANCH={ustversion}
-            BUILD_DEVICE=baremetal
-    scm:
-      - git:
-          url: git://git-mirror.internal.efficios.com/lttng/lttng-tools.git
-          branches:
-            - "{toolsversion}"
-          shallow-clone: true
-          skip-tag: true
-          fastpoll: true
-          basedir: src/lttng-tools
-      - git:
-          url: git://git-mirror.internal.efficios.com/lttng/lttng-modules.git
-          branches:
-            - "{modulesversion}"
-          shallow-clone: true
-          skip-tag: true
-          fastpoll: true
-          basedir: src/lttng-modules
-      - git:
-          url: git://git-mirror.internal.efficios.com/kernel/torvalds/linux.git
-          refspec: "+refs/tags/*:refs/remotes/origin/tags/*"
-          branches:
-            - "master"
-          fastpoll: true
-          basedir: src/linux
+          properties-file: properties.txt
+      - shell: !include-raw-escape: scripts/lttng-baremetal-tests/run-kvm-fuzzing-tests.sh
 
 - job-template:
     name: baremetal_tests_kmainline_t{toolsversion}_m{modulesversion}_u{ustversion}
       - stable-2.9
     jobs:
       - 'vm_tests_kmainline_t{toolsversion}_m{modulesversion}_u{ustversion}'
+      - 'vm_tests_fuzzing_kmainline_t{toolsversion}_m{modulesversion}_u{ustversion}'
       - 'baremetal_tests_kmainline_t{toolsversion}_m{modulesversion}_u{ustversion}'
       - 'baremetal_benchmarks_kmainline_t{toolsversion}_m{modulesversion}_u{ustversion}'
index 254123cc12d9bc69fe9655cfc79d793344191186..fab987bbf7d2e0e8b2407e849884d979be7b7ce8 100755 (executable)
@@ -26,6 +26,10 @@ set -x
 # Loop over the list of symbols and enable the symbols in groups of
 # $NB_KPROBE_PER_ITER
 for i in $(seq 0 "$NB_KPROBE_PER_ITER" "$nb_syms"); do
+       # Print time in UTC at each iteration to easily see when the script
+       # hangs
+       date --utc
+
        # Pick $NB_KPROBE_PER_ITER symbols to instrument, craft enable-event
        # command and save them to a file. We craft the commands and executed
        # them in two steps so that the pipeline can be done without the bash
index fc8cd3f267d9b5ce4f36a57e33f2229224ed8cbe..a2d721ab6cf66b4b7925bd66db95b0220eb5c127 100644 (file)
@@ -32,6 +32,7 @@ class TestType(Enum):
     baremetal_benchmarks=1
     baremetal_tests=2
     kvm_tests=3
+    kvm_fuzzing_tests=4
 
 def get_job_bundle_content(server, job):
     try:
@@ -137,9 +138,9 @@ def create_new_job(name, build_device):
     job = OrderedDict({
         'health_check': False,
         'job_name': name,
-        'device_type':build_device,
+        'device_type': build_device,
         'tags': [ ],
-        'timeout': 18000,
+        'timeout': 7200,
         'actions': []
     })
     if build_device in 'x86':
@@ -224,7 +225,7 @@ def get_baremetal_benchmarks_cmd():
                     'testdef': 'lava/baremetal-tests/lttng-test-filter.yml'
                 }
                 ],
-            'timeout': 18000
+            'timeout': 7200
             }
         })
     return command
@@ -240,7 +241,7 @@ def get_baremetal_tests_cmd():
                     'testdef': 'lava/baremetal-tests/perf-tests.yml'
                 }
                 ],
-            'timeout': 18000
+            'timeout': 3600
             }
         })
     return command
@@ -259,14 +260,24 @@ def get_kvm_tests_cmd():
                     'git-repo': 'https://github.com/lttng/lttng-ci.git',
                     'revision': 'master',
                     'testdef': 'lava/baremetal-tests/destructive-tests.yml'
-                },
+                }
+                ],
+            'timeout': 3600
+            }
+        })
+    return command
+def get_kprobes_test_cmd():
+    command = OrderedDict({
+        'command': 'lava_test_shell',
+        'parameters': {
+            'testdef_repos': [
                 {
                     'git-repo': 'https://github.com/lttng/lttng-ci.git',
                     'revision': 'master',
                     'testdef': 'lava/baremetal-tests/kprobe-fuzzing-tests.yml'
                 }
                 ],
-            'timeout': 18000
+            'timeout': 7200
             }
         })
     return command
@@ -334,7 +345,7 @@ def get_env_setup_cmd(build_device, lttng_tools_commit, lttng_ust_commit=None):
                 'git clone https://github.com/frdeso/syscall-bench-it.git bm',
                 'pip3 install vlttng',
                         ],
-            'timeout': 18000
+            'timeout': 3600
             }
         })
 
@@ -384,6 +395,8 @@ def main():
         test_type = TestType.baremetal_tests
     elif args.type in 'kvm-tests':
         test_type = TestType.kvm_tests
+    elif args.type in 'kvm-fuzzing-tests':
+        test_type = TestType.kvm_fuzzing_tests
     else:
         print('argument -t/--type {} unrecognized. Exiting...'.format(args.type))
         return -1
@@ -401,7 +414,7 @@ def main():
     elif test_type is TestType.baremetal_tests:
         j = create_new_job(args.jobname, build_device='x86')
         j['actions'].append(get_deploy_cmd_x86(args.jobname, args.kernel, args.kmodule, args.lmodule))
-    elif test_type  is TestType.kvm_tests:
+    elif test_type  is TestType.kvm_tests or test_type is TestType.kvm_fuzzing_tests:
         j = create_new_job(args.jobname, build_device='kvm')
         j['actions'].append(get_deploy_cmd_kvm(args.jobname, args.kernel, args.kmodule, args.lmodule))
 
@@ -428,6 +441,14 @@ def main():
         j['actions'].append(get_env_setup_cmd('kvm', args.tools_commit, args.ust_commit))
         j['actions'].append(get_kvm_tests_cmd())
         j['actions'].append(get_results_cmd(stream_name='tests-kernel'))
+    elif test_type is TestType.kvm_fuzzing_tests:
+        if args.ust_commit is None:
+            print('Tests runs need -uc/--ust-commit options. Exiting...')
+            return -1
+        j['actions'].append(get_config_cmd('kvm'))
+        j['actions'].append(get_env_setup_cmd('kvm', args.tools_commit, args.ust_commit))
+        j['actions'].append(get_kprobes_test_cmd())
+        j['actions'].append(get_results_cmd(stream_name='tests-kernel'))
     else:
         assert False, 'Unknown test type'
 
diff --git a/scripts/lttng-baremetal-tests/run-kvm-fuzzing-tests.sh b/scripts/lttng-baremetal-tests/run-kvm-fuzzing-tests.sh
new file mode 100644 (file)
index 0000000..a7ba525
--- /dev/null
@@ -0,0 +1,28 @@
+#!/bin/bash -xeu
+# Copyright (C) 2017 - Francis Deslauriers <francis.deslauriers@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/>.
+
+echo 'At this point, we built the modules and kernel if we needed to.'
+echo 'We can now launch the lava job using those artefacts'
+git clone https://github.com/lttng/lttng-ci "$LTTNG_CI_PATH"
+
+python3 -u "$LTTNG_CI_PATH"/scripts/lttng-baremetal-tests/lava-submit.py \
+                          -t kvm-fuzzing-tests \
+                          -j "$JOB_NAME" \
+                          -k "$STORAGE_KERNEL_IMAGE" \
+                          -km "$STORAGE_LINUX_MODULES" \
+                          -lm "$STORAGE_LTTNG_MODULES" \
+                          -tc "$LTTNG_TOOLS_COMMIT_ID" \
+                          -uc "$LTTNG_UST_COMMIT_ID"
This page took 0.028189 seconds and 4 git commands to generate.