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

Proposed by Kevin Becker
Status: Merged
Approved by: Po-Hsu Lin
Approved revision: 0fcd7302167d9c6ed52405a57bae5f7afbf07c54
Merge reported by: Po-Hsu Lin
Merged at revision: 0fcd7302167d9c6ed52405a57bae5f7afbf07c54
Proposed branch: ~kevinbecker/+git/autotest-client-tests:kevinbecker/ptsematest
Merge into: ~canonical-kernel-team/+git/autotest-client-tests:master
Diff against target: 167 lines (+117/-2)
4 files modified
rt_tests_cyclictest/rt_tests_cyclictest.py (+2/-1)
rt_tests_ptsematest/control (+19/-0)
rt_tests_ptsematest/rt_tests_ptsematest.py (+94/-0)
rteval/rteval.py (+2/-1)
Reviewer Review Type Date Requested Status
Po-Hsu Lin Approve
Sean Feole Pending
Joseph Salisbury Pending
Francis Ginther Pending
Review via email: mp+460965@code.launchpad.net

Commit message

UBUNTU: SAUCE: Add ptsematest from upstream

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

Description of the change

Runs ptsematest and expects a max latency of 100us or less for the realtime kernel.

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

Hello Kevin,

For a SUT in our network (kernel team VLAN) to access repository hosted on git.kernel.org we will need to setup a proxy.

Please find inline comment.
This implies to rteval and cyclictest as well.

review: Needs Fixing
Revision history for this message
Kevin Becker (kevinbecker) wrote :

> Hello Kevin,
>
> For a SUT in our network (kernel team VLAN) to access repository hosted on
> git.kernel.org we will need to setup a proxy.
>
> Please find inline comment.
> This implies to rteval and cyclictest as well.

Thanks. I wasn't aware of that canonical module. I assumed the proxy was configured outside the test. I'll implement your suggestion.

0fcd730... by Kevin Becker

UBUNTU: SAUCE: Configure proxy for rt_tests_cyclictest, rt_tests_ptsematest and rteval

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

Revision history for this message
Kevin Becker (kevinbecker) wrote :

I made the change to support the proxy and applied it to rt_tests_cyclictest and rteval too. I tested the changes on starlow. They all work without setting up the proxy prior to running the test.

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

LGTM, thanks!

The proxy was indeed configured by our infrastructure tool (the runner script in CKCT) before running the test.

However having proxy configured in the test can make things easier if we're running tests manually.

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_cyclictest/rt_tests_cyclictest.py b/rt_tests_cyclictest/rt_tests_cyclictest.py
2index 78b3854..ac8d2ac 100644
3--- a/rt_tests_cyclictest/rt_tests_cyclictest.py
4+++ b/rt_tests_cyclictest/rt_tests_cyclictest.py
5@@ -3,7 +3,7 @@ import os
6 import platform
7 import re
8 import shutil
9-from autotest.client import test, utils
10+from autotest.client import canonical, test, utils
11 from autotest.client.shared import error
12
13 class rt_tests_cyclictest(test.test):
14@@ -40,6 +40,7 @@ class rt_tests_cyclictest(test.test):
15 self.job.require_gcc()
16 os.chdir(self.srcdir)
17 shutil.rmtree('rt-tests', ignore_errors=True)
18+ canonical.setup_proxy()
19 branch = 'main'
20 cmd = 'git clone -b {} https://git.kernel.org/pub/scm/utils/rt-tests/rt-tests.git'.format(branch)
21 utils.system_output(cmd, retain_output=True)
22diff --git a/rt_tests_ptsematest/control b/rt_tests_ptsematest/control
23new file mode 100644
24index 0000000..dd6bbec
25--- /dev/null
26+++ b/rt_tests_ptsematest/control
27@@ -0,0 +1,19 @@
28+AUTHOR = '''
29+Carsten Emde <C.Emde@osadl.org>
30+ '''
31+NAME = "rt_tests_ptsematest"
32+DOC = '''
33+description rt test utils
34+URL https://git.kernel.org/pub/scm/utils/rt-tests/rt-tests.git
35+'''
36+SUITE = "None"
37+TIME = "MEDIUM"
38+TEST_CLASS = 'kernel'
39+TEST_CATEGORY = 'Functional'
40+TEST_TYPE = 'client'
41+
42+result = job.run_test_detail('rt_tests_ptsematest', test_name='setup', tag='setup', timeout=60*5)
43+if result == 'GOOD':
44+ job.run_test('rt_tests_ptsematest', test_name='rt_tests_ptsematest', tag='rt_tests_ptsematest')
45+else:
46+ print("ERROR: test failed to build")
47diff --git a/rt_tests_ptsematest/rt_tests_ptsematest.py b/rt_tests_ptsematest/rt_tests_ptsematest.py
48new file mode 100644
49index 0000000..4bd6456
50--- /dev/null
51+++ b/rt_tests_ptsematest/rt_tests_ptsematest.py
52@@ -0,0 +1,94 @@
53+import multiprocessing
54+import os
55+import platform
56+import re
57+import shutil
58+from autotest.client import canonical, test, utils
59+from autotest.client.shared import error
60+
61+class rt_tests_ptsematest(test.test):
62+ version = 1
63+
64+ def initialize(self):
65+ self.flavour = re.split('-\d*-', platform.uname()[2])[-1]
66+ self.arch = platform.processor()
67+
68+ def install_required_pkgs(self):
69+ try:
70+ series = platform.dist()[2]
71+ except AttributeError:
72+ import distro
73+ series = distro.codename()
74+
75+ pkgs = [
76+ 'build-essential',
77+ 'git',
78+ 'libnuma-dev',
79+ ]
80+ gcc = 'gcc' if self.arch in ['ppc64le', 'aarch64', 's390x', 'riscv64'] else 'gcc-multilib'
81+ pkgs.append(gcc)
82+
83+ cmd = 'yes "" | DEBIAN_FRONTEND=noninteractive apt-get install --yes --force-yes ' + ' '.join(pkgs)
84+ self.results = utils.system_output(cmd, retain_output=True)
85+
86+ # setup
87+ #
88+ # Automatically run when there is no autotest/client/tmp/<test-suite> directory
89+ #
90+ def setup(self):
91+ self.install_required_pkgs()
92+ self.job.require_gcc()
93+ os.chdir(self.srcdir)
94+ shutil.rmtree('rt-tests', ignore_errors=True)
95+ canonical.setup_proxy()
96+ branch = 'main'
97+ cmd = 'git clone -b {} https://git.kernel.org/pub/scm/utils/rt-tests/rt-tests.git'.format(branch)
98+ utils.system_output(cmd, retain_output=True)
99+
100+ # Print test suite HEAD SHA1 commit id for future reference
101+ os.chdir(os.path.join(self.srcdir, 'rt-tests'))
102+ title_local = utils.system_output("git log --oneline -1 | sed 's/(.*)//'", retain_output=False, verbose=False)
103+ title_upstream = utils.system_output("git log --oneline | grep -v SAUCE | head -1", retain_output=False, verbose=False)
104+ print("Latest commit in '{}' branch: {}".format(branch, title_local))
105+ print("Latest upstream commit: {}".format(title_upstream))
106+
107+ try:
108+ nprocs = '-j' + str(multiprocessing.cpu_count())
109+ except:
110+ nprocs = ''
111+ utils.make(nprocs)
112+
113+
114+ # run_once
115+ #
116+ # Driven by the control file for each individual test.
117+ #
118+ # Runs ptsematest with one thread per processor, for 100000 loops, and
119+ # priority set to 80. It will fail if the max latency goes over 100us.
120+ #
121+ def run_once(self, test_name, args='-l 100000 -p 80 -S -q', exit_on_error=True):
122+ if test_name == 'setup':
123+ return
124+
125+ self.results = utils.system_output(self.srcdir + '/rt-tests/ptsematest ' + args, retain_output=True)
126+
127+ # Parse results
128+ max_values = []
129+ lines = self.results.split('\n')
130+
131+ for line in lines:
132+ components = line.split(',')
133+ for component in components:
134+ if 'Max' in component:
135+ # Extract the max latency for each thread
136+ max_value = int(component.strip().split()[-1])
137+ max_values.append(max_value)
138+
139+ # Find the highest "Max" latency
140+ highest_max = max(max_values)
141+ print("Highest Max Latency:", highest_max)
142+
143+ if highest_max > 100:
144+ raise error.TestError('FAIL: Max latency over 100us.')
145+
146+ return
147diff --git a/rteval/rteval.py b/rteval/rteval.py
148index 2105747..0508567 100644
149--- a/rteval/rteval.py
150+++ b/rteval/rteval.py
151@@ -5,7 +5,7 @@ import re
152 import shutil
153 import xml.etree.ElementTree as ET
154 from datetime import datetime
155-from autotest.client import test, utils
156+from autotest.client import canonical, test, utils
157 from autotest.client.shared import error
158
159 class rteval(test.test):
160@@ -61,6 +61,7 @@ class rteval(test.test):
161 self.job.require_gcc()
162 os.chdir(self.srcdir)
163 shutil.rmtree('rteval', ignore_errors=True)
164+ canonical.setup_proxy()
165 branch = 'main'
166 cmd = 'git clone -b {} https://git.kernel.org/pub/scm/utils/rteval/rteval.git'.format(branch)
167 utils.system_output(cmd, retain_output=True)

Subscribers

People subscribed via source and target branches