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

Subscribers

People subscribed via source and target branches