From 1ac7fa2c66721cf6fd701a2bfa48101f78b2dddf Mon Sep 17 00:00:00 2001 From: Francis Deslauriers Date: Thu, 1 Dec 2016 12:25:04 -0500 Subject: [PATCH] Lava: More clearly split baremetal and kvm tests Signed-off-by: Francis Deslauriers --- jobs/lttng-baremetal-tests.yaml | 185 ++++++++++++++---- scripts/lttng-baremetal-tests/lava-submit.py | 59 ++++-- ...chmarks.sh => run-baremetal-benchmarks.sh} | 2 +- .../run-baremetal-tests.sh | 30 +++ .../{run-tests.sh => run-kvm-tests.sh} | 2 +- 5 files changed, 224 insertions(+), 54 deletions(-) rename scripts/lttng-baremetal-tests/{run-benchmarks.sh => run-baremetal-benchmarks.sh} (96%) create mode 100644 scripts/lttng-baremetal-tests/run-baremetal-tests.sh rename scripts/lttng-baremetal-tests/{run-tests.sh => run-kvm-tests.sh} (97%) diff --git a/jobs/lttng-baremetal-tests.yaml b/jobs/lttng-baremetal-tests.yaml index 14972be..8583cdc 100644 --- a/jobs/lttng-baremetal-tests.yaml +++ b/jobs/lttng-baremetal-tests.yaml @@ -1,22 +1,20 @@ - defaults: - name: baremetal_tests + name: baremetal_benchmarks description: | Runs baremetal kernel tests over different combination of kernel and lttng configurations. - logrotate: - numToKeep: 5 triggers: - pollscm: cron: "@hourly" + logrotate: + numToKeep: 10 - project-type: freestyle - node: 'master' properties: - throttle: max-total: 2 option: 'category' categories: - - 'kvm-tests' + - 'baremetal-tests' project-type: freestyle node: 'master' wrappers: @@ -31,7 +29,7 @@ properties-content: | TOOLS_BRANCH={lttngversion} UST_BRANCH={lttngversion} - BUILD_DEVICE=kvm + BUILD_DEVICE=baremetal publishers: - email: recipients: 'francis.deslauriers@efficios.com' @@ -69,35 +67,97 @@ block: true - inject: properties-file: properties.txt - - shell: !include-raw-escape: scripts/lttng-baremetal-tests/run-tests.sh + - shell: !include-raw-escape: scripts/lttng-baremetal-tests/run-baremetal-benchmarks.sh + - defaults: - name: baremetal_benchmarks - defaults: lttng-baremetal-tests + name: kvm_tests description: | - Runs baremetal kernel benchmarks over different combination of kernel and lttng configurations. - - logrotate: - numToKeep: 5 - + Runs baremetal kernel tests over different combination of kernel and lttng configurations. + project-type: freestyle + node: 'master' + properties: + - throttle: + max-total: 2 + option: 'category' + categories: + - 'kvm-tests' triggers: - pollscm: cron: "@hourly" + logrotate: + numToKeep: 10 - project-type: freestyle - node: 'master' + wrappers: + - workspace-cleanup + - timestamps + - ansicolor + - credentials-binding: + - text: + credential-id: jenkins_lava_key + variable: LAVA_FRDESO_TOKEN + - inject: + properties-content: | + BUILD_DEVICE=kvm + TOOLS_BRANCH={lttngversion} + UST_BRANCH={lttngversion} + scm: + - git: + url: git://git-mirror.internal.efficios.com/lttng/lttng-tools.git + branches: + - "{lttngversion}" + 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: + - "{lttngversion}" + shallow-clone: true + skip-tag: true + fastpoll: true + basedir: src/lttng-modules + - git: + url: git://git-mirror.internal.efficios.com/kernel/stable/linux-stable.git + branches: + - "{kversion}" + shallow-clone: true + skip-tag: true + fastpoll: true + basedir: src/linux -## Templates -- job-template: - name: baremetal_tests_k{kversion}_l{lttngversion} + publishers: + - email: + recipients: 'francis.deslauriers@efficios.com' + 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-file: properties.txt + - shell: !include-raw-escape: scripts/lttng-baremetal-tests/run-kvm-tests.sh + +- defaults: + name: baremetal_tests description: | Runs baremetal kernel tests over different combination of kernel and lttng configurations. + project-type: freestyle + node: 'master' properties: - throttle: max-total: 2 option: 'category' categories: - 'baremetal-tests' + triggers: + - pollscm: + cron: "@hourly" + logrotate: + numToKeep: 10 + wrappers: - workspace-cleanup - timestamps @@ -108,6 +168,7 @@ variable: LAVA_FRDESO_TOKEN - inject: properties-content: | + UST_BRANCH={lttngversion} BUILD_DEVICE=baremetal scm: - git: @@ -146,28 +207,59 @@ block: true - inject: properties-file: properties.txt - - shell: !include-raw-escape: scripts/lttng-baremetal-tests/run-benchmarks.sh + - shell: !include-raw-escape: scripts/lttng-baremetal-tests/run-baremetal-tests.sh - job-template: name: baremetal_benchmarks_k{kversion}_l{lttngversion} - description: | - Runs baremetal kernel benchmarks over different combination of kernel and lttng configurations. - defaults: lttng-baremetal-tests - logrotate: - numToKeep: 5 + defaults: baremetal_benchmarks +- job-template: + name: kvm_tests_k{kversion}_l{lttngversion} + defaults: kvm_tests +- job-template: + name: baremetal_tests_k{kversion}_l{lttngversion} + defaults: baremetal_tests - job-template: name: baremetal_tests_k{kversion}_l{lttngversion}_canary defaults: baremetal_tests +- job-template: + name: kvm_tests_k{kversion}_l{lttngversion}_canary + defaults: kvm_tests - job-template: name: baremetal_benchmarks_k{kversion}_l{lttngversion}_canary defaults: baremetal_benchmarks + - job-template: - name: baremetal_tests_k{kversion}_l{lttngversion} - defaults: baremetal_tests -- job-template: - name: baremetal_benchmarks_k{kversion}_l{lttngversion} - defaults: baremetal_benchmarks + name: kvm_tests_kmainline_l{lttngversion} + defaults: kvm_tests + triggers: + - pollscm: + cron: "@daily" + scm: + - git: + url: git://git-mirror.internal.efficios.com/lttng/lttng-tools.git + branches: + - "{lttngversion}" + 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: + - "{lttngversion}" + shallow-clone: true + skip-tag: true + fastpoll: true + basedir: src/lttng-modules + - git: + url: git://git-mirror.internal.efficios.com/kernel/stable/linux-stable.git + refspec: "+refs/tags/*:refs/remotes/origin/tags/*" + branches: + - "master" + fastpoll: true + basedir: src/linux + - job-template: name: baremetal_tests_kmainline_l{lttngversion} defaults: baremetal_tests @@ -198,7 +290,26 @@ - "master" fastpoll: true basedir: src/linux - + wrappers: + - workspace-cleanup + - timestamps + - ansicolor + - credentials-binding: + - text: + credential-id: jenkins_lava_key + variable: LAVA_FRDESO_TOKEN + - inject: + properties-content: | + BUILD_DEVICE=baremetal + 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-file: properties.txt + - shell: !include-raw-escape: scripts/lttng-baremetal-tests/run-baremetal-benchmarks.sh - job-template: name: baremetal_benchmarks_kmainline_l{lttngversion} defaults: baremetal_benchmarks @@ -248,7 +359,7 @@ block: true - inject: properties-file: properties.txt - - shell: !include-raw-escape: scripts/lttng-baremetal-tests/run-benchmarks.sh + - shell: !include-raw-escape: scripts/lttng-baremetal-tests/run-baremetal-benchmarks.sh - job: name: build_kernel_PARAM @@ -258,7 +369,7 @@ concurrent: true logrotate: - numToKeep: 2 + numToKeep: 20 node: 'x86-64' wrappers: @@ -329,8 +440,9 @@ - stable-2.8 - stable-2.9 jobs: - - 'baremetal_tests_k{kversion}_l{lttngversion}' + - 'kvm_tests_k{kversion}_l{lttngversion}' - 'baremetal_benchmarks_k{kversion}_l{lttngversion}' + - 'baremetal_tests_k{kversion}_l{lttngversion}' - project: name: lttng-kernel-tests-oldkernel @@ -340,6 +452,7 @@ lttngversion: - stable-2.7 jobs: + - 'kvm_tests_k{kversion}_l{lttngversion}': - 'baremetal_tests_k{kversion}_l{lttngversion}': - 'baremetal_benchmarks_k{kversion}_l{lttngversion}': @@ -350,6 +463,7 @@ lttngversion: - v2.8.1 jobs: + - 'kvm_tests_k{kversion}_l{lttngversion}_canary' - 'baremetal_tests_k{kversion}_l{lttngversion}_canary' - 'baremetal_benchmarks_k{kversion}_l{lttngversion}_canary' @@ -358,5 +472,6 @@ lttngversion: - v2.8.1 jobs: + - 'kvm_tests_kmainline_l{lttngversion}' - 'baremetal_tests_kmainline_l{lttngversion}' - 'baremetal_benchmarks_kmainline_l{lttngversion}' diff --git a/scripts/lttng-baremetal-tests/lava-submit.py b/scripts/lttng-baremetal-tests/lava-submit.py index 5b71da8..b440733 100644 --- a/scripts/lttng-baremetal-tests/lava-submit.py +++ b/scripts/lttng-baremetal-tests/lava-submit.py @@ -29,8 +29,9 @@ HOSTNAME = 'lava-master.internal.efficios.com' SCP_PATH = 'scp://jenkins-lava@storage.internal.efficios.com' class TestType(Enum): - benchmarks=1 - tests=2 + baremetal_benchmarks=1 + baremetal_tests=2 + kvm_tests=3 def get_job_bundle_content(server, job): bundle_sha = server.scheduler.job_status(str(job))['bundle_sha1'] @@ -121,7 +122,7 @@ def get_boot_cmd(): def get_config_cmd(build_device): packages=['bsdtar', 'psmisc', 'wget', 'python3', 'python3-pip', \ 'libglib2.0-dev', 'libffi-dev', 'elfutils', 'libdw-dev', \ - 'libelf-dev', 'libmount-dev', 'libxml2'] + 'libelf-dev', 'libmount-dev', 'libxml2', 'libpfm4-dev'] command = OrderedDict({ 'command': 'lava_command_run', 'parameters': { @@ -146,7 +147,7 @@ def get_config_cmd(build_device): ]) return command -def get_benchmarks_cmd(): +def get_baremetal_benchmarks_cmd(): command = OrderedDict({ 'command': 'lava_test_shell', 'parameters': { @@ -165,7 +166,18 @@ def get_benchmarks_cmd(): 'git-repo': 'https://github.com/lttng/lttng-ci.git', 'revision': 'master', 'testdef': 'lava/baremetal-tests/failing-open-enoent.yml' - }, + } + ], + 'timeout': 18000 + } + }) + return command + +def get_baremetal_tests_cmd(): + command = OrderedDict({ + 'command': 'lava_test_shell', + 'parameters': { + 'testdef_repos': [ { 'git-repo': 'https://github.com/lttng/lttng-ci.git', 'revision': 'master', @@ -177,7 +189,7 @@ def get_benchmarks_cmd(): }) return command -def get_tests_cmd(): +def get_kvm_tests_cmd(): command = OrderedDict({ 'command': 'lava_test_shell', 'parameters': { @@ -298,35 +310,48 @@ def main(): parser.add_argument('-uc', '--ust-commit', required=False) args = parser.parse_args() - if args.type in 'benchmarks': - test_type = TestType.benchmarks - elif args.type in 'tests': - test_type = TestType.tests + if args.type in 'baremetal-benchmarks': + test_type = TestType.baremetal_benchmarks + elif args.type in 'baremetal-tests': + test_type = TestType.baremetal_tests + elif args.type in 'kvm-tests': + test_type = TestType.kvm_tests else: print('argument -t/--type {} unrecognized. Exiting...'.format(args.type)) return -1 - if test_type is TestType.benchmarks: + if test_type is TestType.baremetal_benchmarks: 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.tests: + 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: j = create_new_job(args.jobname, build_device='kvm') j['actions'].append(get_deploy_cmd_kvm(args.jobname, args.kernel, args.kmodule, args.lmodule)) j['actions'].append(get_boot_cmd()) - if test_type is TestType.benchmarks: + if test_type is TestType.baremetal_benchmarks: j['actions'].append(get_config_cmd('x86')) j['actions'].append(get_env_setup_cmd('x86', args.tools_commit)) - j['actions'].append(get_benchmarks_cmd()) + j['actions'].append(get_baremetal_benchmarks_cmd()) j['actions'].append(get_results_cmd(stream_name='benchmark-kernel')) - elif test_type is TestType.tests: + elif test_type is TestType.baremetal_tests: + if args.ust_commit is None: + print('Tests runs need -uc/--ust-commit options. Exiting...') + return -1 + j['actions'].append(get_config_cmd('x86')) + j['actions'].append(get_env_setup_cmd('x86', args.tools_commit, args.ust_commit)) + j['actions'].append(get_baremetal_tests_cmd()) + j['actions'].append(get_results_cmd(stream_name='tests-kernel')) + elif test_type is TestType.kvm_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_tests_cmd()) + j['actions'].append(get_kvm_tests_cmd()) j['actions'].append(get_results_cmd(stream_name='tests-kernel')) else: assert False, 'Unknown test type' @@ -345,7 +370,7 @@ def main(): passed, failed=check_job_all_test_cases_state_count(server, jobid) - if test_type is TestType.tests: + if test_type is TestType.kvm_tests: print_test_output(server, jobid) print('Job ended with {} status.'.format(jobstatus)) diff --git a/scripts/lttng-baremetal-tests/run-benchmarks.sh b/scripts/lttng-baremetal-tests/run-baremetal-benchmarks.sh similarity index 96% rename from scripts/lttng-baremetal-tests/run-benchmarks.sh rename to scripts/lttng-baremetal-tests/run-baremetal-benchmarks.sh index 7029812..4e2a1ee 100644 --- a/scripts/lttng-baremetal-tests/run-benchmarks.sh +++ b/scripts/lttng-baremetal-tests/run-baremetal-benchmarks.sh @@ -20,7 +20,7 @@ git clone https://github.com/lttng/lttng-ci set +x python lttng-ci/scripts/lttng-baremetal-tests/lava-submit.py \ - -t benchmarks \ + -t baremetal-benchmarks \ -j "$JOB_NAME" \ -l "$LAVA_FRDESO_TOKEN" \ -k "$STORAGE_KERNEL_IMAGE" \ diff --git a/scripts/lttng-baremetal-tests/run-baremetal-tests.sh b/scripts/lttng-baremetal-tests/run-baremetal-tests.sh new file mode 100644 index 0000000..abe5619 --- /dev/null +++ b/scripts/lttng-baremetal-tests/run-baremetal-tests.sh @@ -0,0 +1,30 @@ +#!/bin/bash -xeu +# Copyright (C) 2016 - Francis Deslauriers +# +# 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 . + +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 + +set +x +python lttng-ci/scripts/lttng-baremetal-tests/lava-submit.py \ + -t baremetal-tests \ + -j "$JOB_NAME" \ + -l "$LAVA_FRDESO_TOKEN" \ + -k "$STORAGE_KERNEL_IMAGE" \ + -km "$STORAGE_LINUX_MODULES" \ + -lm "$STORAGE_LTTNG_MODULES" \ + -tc "$LTTNG_TOOLS_COMMIT_ID" \ + -uc "$LTTNG_UST_COMMIT_ID" diff --git a/scripts/lttng-baremetal-tests/run-tests.sh b/scripts/lttng-baremetal-tests/run-kvm-tests.sh similarity index 97% rename from scripts/lttng-baremetal-tests/run-tests.sh rename to scripts/lttng-baremetal-tests/run-kvm-tests.sh index 6219ad1..417a5e5 100644 --- a/scripts/lttng-baremetal-tests/run-tests.sh +++ b/scripts/lttng-baremetal-tests/run-kvm-tests.sh @@ -20,7 +20,7 @@ git clone https://github.com/lttng/lttng-ci set +x python lttng-ci/scripts/lttng-baremetal-tests/lava-submit.py \ - -t tests \ + -t kvm-tests \ -j "$JOB_NAME" \ -l "$LAVA_FRDESO_TOKEN" \ -k "$STORAGE_KERNEL_IMAGE" \ -- 2.34.1