Merge ~kevinbecker/+git/autotest-client-tests:kevinbecker/pmqtest into ~canonical-kernel-team/+git/autotest-client-tests:master

Proposed by Kevin Becker
Status: Merged
Approved by: Po-Hsu Lin
Approved revision: 1ee1ed78a017ee8f00d9ee8d794936b15083a7f2
Merge reported by: Po-Hsu Lin
Merged at revision: 1ee1ed78a017ee8f00d9ee8d794936b15083a7f2
Proposed branch: ~kevinbecker/+git/autotest-client-tests:kevinbecker/pmqtest
Merge into: ~canonical-kernel-team/+git/autotest-client-tests:master
Diff against target: 117 lines (+105/-0)
2 files modified
rt_tests_pmqtest/control (+20/-0)
rt_tests_pmqtest/rt_tests_pmqtest.py (+85/-0)
Reviewer Review Type Date Requested Status
Po-Hsu Lin Approve
Sean Feole Pending
Francis Ginther Pending
Canonical Kernel Team Pending
Review via email: mp+463310@code.launchpad.net

Commit message

UBUNTU: SAUCE: Added pmqtest from upstream

Signed-off-by: Kevin Becker <email address hidden>

To post a comment you must log in.
Revision history for this message
Po-Hsu Lin (cypressyew) wrote :

Looking good.

One small nit is that we can check Max > 100 when parsing test output:

  for line in lines:
      if 'Max' in line:
          # Check if any max value is over 100
          if int(line.split()[-1]) > 100
              raise error.TestError('FAIL: Max latency over 100us.')

But this is rather trivial.

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

Applied and pushed.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1diff --git a/rt_tests_pmqtest/control b/rt_tests_pmqtest/control
2new file mode 100644
3index 0000000..9248a47
4--- /dev/null
5+++ b/rt_tests_pmqtest/control
6@@ -0,0 +1,20 @@
7+AUTHOR = '''
8+Authors:
9+Carsten Emde <C.Emde@osadl.org>
10+ '''
11+NAME = "pmqtest"
12+DOC = '''
13+description rt test utils
14+URL https://git.kernel.org/pub/scm/utils/rt-tests/rt-tests.git
15+'''
16+SUITE = "None"
17+TIME = "MEDIUM"
18+TEST_CLASS = 'kernel'
19+TEST_CATEGORY = 'Functional'
20+TEST_TYPE = 'client'
21+
22+result = job.run_test_detail('rt_tests_pmqtest', test_name='setup', tag='setup', timeout=60*5)
23+if result == 'GOOD':
24+ job.run_test('rt_tests_pmqtest', test_name='rt_tests_pmqtest', tag='rt_tests_pmqtest')
25+else:
26+ print("ERROR: test failed to build")
27diff --git a/rt_tests_pmqtest/rt_tests_pmqtest.py b/rt_tests_pmqtest/rt_tests_pmqtest.py
28new file mode 100644
29index 0000000..d9e3fda
30--- /dev/null
31+++ b/rt_tests_pmqtest/rt_tests_pmqtest.py
32@@ -0,0 +1,85 @@
33+import multiprocessing
34+import os
35+import platform
36+import re
37+import shutil
38+from autotest.client import canonical, test, utils
39+from autotest.client.shared import error
40+
41+class rt_tests_pmqtest(test.test):
42+ version = 1
43+
44+ def initialize(self):
45+ self.flavour = re.split('-\d*-', platform.uname()[2])[-1]
46+ self.arch = platform.processor()
47+
48+ def install_required_pkgs(self):
49+ try:
50+ series = platform.dist()[2]
51+ except AttributeError:
52+ import distro
53+ series = distro.codename()
54+
55+ pkgs = [
56+ 'build-essential',
57+ 'git',
58+ 'libnuma-dev',
59+ ]
60+ gcc = 'gcc' if self.arch in ['ppc64le', 'aarch64', 's390x', 'riscv64'] else 'gcc-multilib'
61+ pkgs.append(gcc)
62+
63+ cmd = 'yes "" | DEBIAN_FRONTEND=noninteractive apt-get install --yes --force-yes ' + ' '.join(pkgs)
64+ self.results = utils.system_output(cmd, retain_output=True)
65+
66+ # setup
67+ #
68+ # Automatically run when there is no autotest/client/tmp/<test-suite> directory
69+ #
70+ def setup(self):
71+ self.install_required_pkgs()
72+ self.job.require_gcc()
73+ os.chdir(self.srcdir)
74+ shutil.rmtree('rt-tests', ignore_errors=True)
75+ canonical.setup_proxy()
76+ branch = 'main'
77+ cmd = 'git clone -b {} https://git.kernel.org/pub/scm/utils/rt-tests/rt-tests.git'.format(branch)
78+ utils.system_output(cmd, retain_output=True)
79+
80+ # Print test suite HEAD SHA1 commit id for future reference
81+ os.chdir(os.path.join(self.srcdir, 'rt-tests'))
82+ title_local = utils.system_output("git log --oneline -1 | sed 's/(.*)//'", retain_output=False, verbose=False)
83+ title_upstream = utils.system_output("git log --oneline | grep -v SAUCE | head -1", retain_output=False, verbose=False)
84+ print("Latest commit in '{}' branch: {}".format(branch, title_local))
85+ print("Latest upstream commit: {}".format(title_upstream))
86+
87+ try:
88+ nprocs = '-j' + str(multiprocessing.cpu_count())
89+ except:
90+ nprocs = ''
91+ utils.make(nprocs)
92+
93+
94+ # run_once
95+ #
96+ # Driven by the control file for each individual test.
97+ #
98+ # Runs pmqtest for 60 seconds. This will fail if the max latency is over 100us.
99+ #
100+ def run_once(self, test_name, args='-Sp80 -i100 -d0 -b100 -q -D60', exit_on_error=True):
101+ if test_name == 'setup':
102+ return
103+
104+ self.results = utils.system_output(self.srcdir + '/rt-tests/pmqtest ' + args, retain_output=True)
105+
106+ lines = self.results.split('\n')
107+
108+ max_latencies = []
109+ for line in lines:
110+ if 'Max' in line:
111+ max_latencies.append(int(line.split()[-1]))
112+
113+ # Check if any max value is over 100
114+ if any(value > 100 for value in max_latencies):
115+ raise error.TestError('FAIL: Max latency over 100us.')
116+
117+ return

Subscribers

People subscribed via source and target branches