Merge ~canonical-kernel-team/+git/autotest-client-tests:phlin/cyclictest-build into ~canonical-kernel-team/+git/autotest-client-tests:master

Proposed by Po-Hsu Lin
Status: Merged
Merge reported by: Po-Hsu Lin
Merged at revision: a9a29c0fc4ea3b26e5196fa2a8f27d39a51bfdb6
Proposed branch: ~canonical-kernel-team/+git/autotest-client-tests:phlin/cyclictest-build
Merge into: ~canonical-kernel-team/+git/autotest-client-tests:master
Diff against target: 54 lines (+25/-2)
2 files modified
cyclictest/control (+3/-1)
cyclictest/cyclictest.py (+22/-1)
Reviewer Review Type Date Requested Status
Sean Feole Approve
Review via email: mp+455127@code.launchpad.net

Commit message

BugLink: https://bugs.launchpad.net/bugs/2036687

This test will need gcc to run. Also add a setup task to separate
test build phase and actual test phase.

To post a comment you must log in.
Revision history for this message
Sean Feole (sfeole) wrote :

+1

review: Approve
Revision history for this message
Po-Hsu Lin (cypressyew) wrote :

Applied and pushed, thanks!

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1diff --git a/cyclictest/control b/cyclictest/control
2index 51ce596..45ffc4c 100644
3--- a/cyclictest/control
4+++ b/cyclictest/control
5@@ -10,4 +10,6 @@ TEST_CLASS = 'kernel'
6 TEST_CATEGORY = 'Functional'
7 TEST_TYPE = 'client'
8
9-job.run_test('cyclictest')
10+result = job.run_test_detail('cyclictest', test_name='setup', tag='setup', timeout=60*5)
11+if result == 'GOOD':
12+ job.run_test('cyclictest', test_name='cyclictest', tag='cyclictest')
13diff --git a/cyclictest/cyclictest.py b/cyclictest/cyclictest.py
14index 29bb48b..eabc6fe 100644
15--- a/cyclictest/cyclictest.py
16+++ b/cyclictest/cyclictest.py
17@@ -1,4 +1,5 @@
18 import os
19+import platform
20 from autotest.client import test
21 from autotest.client.shared import utils
22
23@@ -11,10 +12,30 @@ class cyclictest(test.test):
24 def initialize(self):
25 pass
26
27+ def install_required_pkgs(self):
28+ arch = platform.processor()
29+ try:
30+ series = platform.dist()[2]
31+ except AttributeError:
32+ import distro
33+ series = distro.codename()
34+
35+ pkgs = [
36+ 'build-essential',
37+ ]
38+ gcc = 'gcc' if arch in ['ppc64le', 'aarch64', 's390x', 'riscv64'] else 'gcc-multilib'
39+ pkgs.append(gcc)
40+
41+ cmd = 'yes "" | DEBIAN_FRONTEND=noninteractive apt-get install --yes --force-yes ' + ' '.join(pkgs)
42+ self.results = utils.system_output(cmd, retain_output=True)
43+
44 def setup(self):
45+ self.install_required_pkgs()
46 self.job.require_gcc()
47 os.chdir(self.srcdir)
48 utils.make()
49
50- def execute(self, args='-t 10 -l 100000'):
51+ def run_once(self, test_name, args='-t 10 -l 100000'):
52+ if test_name == 'setup':
53+ return
54 utils.system(self.srcdir + '/cyclictest ' + args)

Subscribers

People subscribed via source and target branches

to all changes: