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

Proposed by Kevin Becker
Status: Merged
Approved by: Francis Ginther
Approved revision: 4d42e79a299a11eb42b40347533b7bd6b4286343
Merged at revision: 4b771939da1a2422c732b4932a7fda0e9de342be
Proposed branch: ~kevinbecker/+git/autotest-client-tests:kevinbecker/rteval
Merge into: ~canonical-kernel-team/+git/autotest-client-tests:master
Diff against target: 207 lines (+189/-0)
3 files modified
rteval/control (+18/-0)
rteval/rteval.conf (+32/-0)
rteval/rteval.py (+139/-0)
Reviewer Review Type Date Requested Status
Francis Ginther Approve
Joseph Salisbury Pending
Po-Hsu Lin Pending
Review via email: mp+460532@code.launchpad.net

Commit message

UBUNTU: SAUCE: Add rteval from upstream

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

Description of the change

Runs rteval with loads of cyclictest, kcompile, stressng, and dbench. Expects a max latency of 200us or less for the realtime kernel.

To post a comment you must log in.
Revision history for this message
Francis Ginther (fginther) wrote :

+1

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1diff --git a/rteval/control b/rteval/control
2new file mode 100644
3index 0000000..c041963
4--- /dev/null
5+++ b/rteval/control
6@@ -0,0 +1,18 @@
7+AUTHOR = '''
8+Clark Williams <williams@redhat.com>
9+ '''
10+NAME = "rteval"
11+DOC = '''
12+URL https://git.kernel.org/pub/scm/utils/rteval/rteval.git
13+'''
14+SUITE = "None"
15+TIME = "MEDIUM"
16+TEST_CLASS = 'kernel'
17+TEST_CATEGORY = 'Functional'
18+TEST_TYPE = 'client'
19+
20+result = job.run_test_detail('rteval', test_name='setup', tag='setup', timeout=60*5)
21+if result == 'GOOD':
22+ job.run_test('rteval', test_name='rteval', tag='rteval')
23+else:
24+ print("ERROR: test failed to build")
25diff --git a/rteval/rteval.conf b/rteval/rteval.conf
26new file mode 100644
27index 0000000..f85f1cf
28--- /dev/null
29+++ b/rteval/rteval.conf
30@@ -0,0 +1,32 @@
31+[rteval]
32+verbose: True
33+keepdata: True
34+debugging: False
35+duration: 60.0
36+report_interval: 600
37+
38+[cyclictest]
39+interval: 200
40+distance: 0
41+priority: 95
42+
43+[loads]
44+kcompile: module
45+hackbench: module
46+dbench: external
47+stressng: module
48+
49+[kcompile]
50+jobspercore: 2
51+
52+[hackbench]
53+jobspercore: 2
54+
55+[dbench]
56+source: dbench.tar.gz
57+setup: tar -xvf dbench.tar.gz
58+build: ./configure && make
59+runload: dbench -c ./client.txt 10
60+
61+[measurement]
62+cyclictest: module
63diff --git a/rteval/rteval.py b/rteval/rteval.py
64new file mode 100644
65index 0000000..2105747
66--- /dev/null
67+++ b/rteval/rteval.py
68@@ -0,0 +1,139 @@
69+import multiprocessing
70+import os
71+import platform
72+import re
73+import shutil
74+import xml.etree.ElementTree as ET
75+from datetime import datetime
76+from autotest.client import test, utils
77+from autotest.client.shared import error
78+
79+class rteval(test.test):
80+ version = 1
81+
82+ def initialize(self):
83+ self.flavour = re.split('-\d*-', platform.uname()[2])[-1]
84+ self.arch = platform.processor()
85+
86+ def install_required_pkgs(self):
87+ try:
88+ series = platform.dist()[2]
89+ except AttributeError:
90+ import distro
91+ series = distro.codename()
92+
93+ pkgs = [
94+ 'build-essential',
95+ 'git',
96+ 'libnuma-dev',
97+ 'python3-distutils',
98+ 'python3-dmidecode',
99+ 'python3-lxml',
100+ 'python3-ethtool',
101+ 'python3-requests',
102+ 'flex',
103+ 'bison',
104+ 'libelf-dev',
105+ 'libncurses-dev',
106+ 'gawk',
107+ 'openssl',
108+ 'libssl-dev',
109+ 'dkms',
110+ 'libudev-dev',
111+ 'libpci-dev',
112+ 'libiberty-dev',
113+ 'autoconf',
114+ 'llvm',
115+ 'rt-tests'
116+ ]
117+ gcc = 'gcc' if self.arch in ['ppc64le', 'aarch64', 's390x', 'riscv64'] else 'gcc-multilib'
118+ pkgs.append(gcc)
119+
120+ cmd = 'yes "" | DEBIAN_FRONTEND=noninteractive apt-get install --yes --force-yes ' + ' '.join(pkgs)
121+ self.results = utils.system_output(cmd, retain_output=True)
122+
123+ # setup
124+ #
125+ # Automatically run when there is no autotest/client/tmp/<test-suite> directory
126+ #
127+ def setup(self):
128+ self.install_required_pkgs()
129+ self.job.require_gcc()
130+ os.chdir(self.srcdir)
131+ shutil.rmtree('rteval', ignore_errors=True)
132+ branch = 'main'
133+ cmd = 'git clone -b {} https://git.kernel.org/pub/scm/utils/rteval/rteval.git'.format(branch)
134+ utils.system_output(cmd, retain_output=True)
135+
136+ # Print test suite HEAD SHA1 commit id for future reference
137+ os.chdir(os.path.join(self.srcdir, 'rteval'))
138+ title_local = utils.system_output("git log --oneline -1 | sed 's/(.*)//'", retain_output=False, verbose=False)
139+ title_upstream = utils.system_output("git log --oneline | grep -v SAUCE | head -1", retain_output=False, verbose=False)
140+ print("Latest commit in '{}' branch: {}".format(branch, title_local))
141+ print("Latest upstream commit: {}".format(title_upstream))
142+ os.mkdir("install")
143+
144+ # Download Linux tarball referenced in the Makefile
145+ with open("Makefile", mode="rt", encoding="utf-8") as makefile:
146+ makefile_content = makefile.read()
147+ linux_version_match = re.search(r'KLOAD\s*:=\s*\$\(LOADDIR\)\/linux-(\d+\.\d+(\.\d+)?)\.tar\.xz', makefile_content)
148+ if linux_version_match:
149+ linux_version = linux_version_match.group(1)
150+ print("Linux version download used in testing:", linux_version)
151+ cmd = 'wget -nv -P loadsource https://cdn.kernel.org/pub/linux/kernel/v'+linux_version.split('.')[0]+'.x/linux-'+linux_version+'.tar.xz'
152+ utils.system_output(cmd, retain_output=True)
153+ else:
154+ print("Linux version download for testing not found.")
155+
156+ # Build test
157+ try:
158+ nprocs = 'install -j' + str(multiprocessing.cpu_count())
159+ except:
160+ nprocs = 'install'
161+ utils.make(nprocs)
162+
163+ # Copy in config file
164+ shutil.copy2( self.bindir+"/rteval.conf", self.srcdir+"/rteval/" )
165+
166+
167+ # run_once
168+ #
169+ # Driven by the control file for each individual test.
170+ #
171+ # Runs rteval. Test passes if max latency is not over 200us.
172+ #
173+ def run_once(self, test_name, args='', exit_on_error=True):
174+ if test_name == 'setup':
175+ return
176+
177+ # Run rteval
178+ os.chdir(self.srcdir+"/rteval")
179+ utils.make('runit')
180+
181+ # Find the summary XML results
182+ results_count = 0
183+ subfolders = [ f.name for f in os.scandir(self.srcdir+"/rteval/run/") if f.is_dir() ]
184+ for folder in subfolders:
185+ folder_match = re.search(r"rteval-"+datetime.now().strftime('%Y%m%d')+"-(\d)+[^(.tar.bz2)]?", folder)
186+ if folder_match:
187+ results_count += 1
188+
189+ if 0 == results_count:
190+ raise error.TestError('FAIL: rteval results not found.')
191+
192+ xml_path = self.srcdir+"/rteval/run/rteval-"+datetime.now().strftime('%Y%m%d')+"-"+str(results_count)+"/summary.xml"
193+
194+ # Parse the XML results and find the first "maximum" tag, which gives
195+ # max system latency
196+ with open(xml_path, 'r') as results_file:
197+ results_string = results_file.read()
198+
199+ xml_root = ET.fromstring(results_string)
200+ maximum_tag = xml_root.find(".//maximum")
201+ latency = maximum_tag.text
202+ print("Maximum latency: "+latency+"us")
203+
204+ if int(latency) > 200:
205+ raise error.TestError('FAIL: Max latency too high.')
206+
207+ return

Subscribers

People subscribed via source and target branches