summaryrefslogtreecommitdiffstats
path: root/lib/oeqa
diff options
context:
space:
mode:
authorYeoh Ee Peng <ee.peng.yeoh@intel.com>2020-04-01 14:50:33 +0800
committerAnuj Mittal <anuj.mittal@intel.com>2020-04-02 00:18:46 +0800
commit9756afd47aa87593e382b8843337889ec7c31408 (patch)
treef932faffacd9166d19c689113af8ae3dbc37db43 /lib/oeqa
parent47659db192f1c397a906babc79edea7f7ec6c8cf (diff)
downloadmeta-intel-9756afd47aa87593e382b8843337889ec7c31408.tar.gz
runtime/cyclictest: Enable cyclictest for image with rt kernel
Enable cyclictest: - test execute cyclictest, retrieve the maximum latency captured inside log and compare it to the target latency - cyclictest arguments based on public cyclictest arguments used for intel corei7 https://www.osadl.org/Latency-plot-of-system-in-rack-9-slot.qa-latencyplot-r9s5.0.html?shadow=1 - set default target latency based on 24 us (captured from public cyclictest execution) multiple by 1.2 (buffer) - enable user defined target latency by configuring 'RTKERNEL_TARGET_LATENCY' as bitbake config example, inside local.conf: RTKERNEL_TARGET_LATENCY = "25" Signed-off-by: Yeoh Ee Peng <ee.peng.yeoh@intel.com> Signed-off-by: Anuj Mittal <anuj.mittal@intel.com>
Diffstat (limited to 'lib/oeqa')
-rw-r--r--lib/oeqa/runtime/cases/cyclictest.py39
1 files changed, 39 insertions, 0 deletions
diff --git a/lib/oeqa/runtime/cases/cyclictest.py b/lib/oeqa/runtime/cases/cyclictest.py
new file mode 100644
index 00000000..8890651a
--- /dev/null
+++ b/lib/oeqa/runtime/cases/cyclictest.py
@@ -0,0 +1,39 @@
1from oeqa.runtime.case import OERuntimeTestCase
2from oeqa.core.decorator.depends import OETestDepends
3from oeqa.runtime.decorator.package import OEHasPackage
4import os
5import subprocess
6import datetime
7
8class CyclicTest(OERuntimeTestCase):
9
10 @OEHasPackage(['rt-tests'])
11 @OETestDepends(['ssh.SSHTest.test_ssh'])
12 def test_cyclic(self):
13 # Cyclictest command and argument based on public setup for Intel(R) Core(TM) i7-6700
14 # https://www.osadl.org/Latency-plot-of-system-in-rack-9-slot.qa-latencyplot-r9s5.0.html?shadow=1
15 # Command line: cyclictest -l100000000 -m -Sp99 -i200 -h400 -q
16 status, output = self.target.run('cyclictest -l100000000 -m -Sp99 -i200 -h400')
17 self.assertEqual(status, 0, msg='status and output: %s and %s' % (status, output))
18 test_log_dir = self.td.get('TEST_LOG_DIR', '')
19
20 if not test_log_dir:
21 test_log_dir = os.path.join(self.td.get('WORKDIR', ''), 'testimage')
22
23 cyclic_log_dir = os.path.join(test_log_dir, '%s.%s' % ('cyclic_test', datetime.datetime.now().strftime('%Y%m%d%H%M%S')))
24 os.makedirs(cyclic_log_dir)
25 log_path = os.path.join(cyclic_log_dir, 'cyclic_log')
26 with open(log_path, 'w') as f:
27 f.write(output)
28
29 max_latency = subprocess.check_output(('grep "Max Latencies" %s | tr " " "\n" | sort -n | tail -1 | sed s/^0*//') % log_path, shell=True).strip()
30 max_latency = int(max_latency)
31
32 # Default target latency based on max latency (24us) captured at public execution multiple by 1.2 (20% buffer)
33 # https://www.osadl.org/Latency-plot-of-system-in-rack-9-slot.qa-latencyplot-r9s5.0.html?shadow=1
34 target_latency = 1.2*24
35 user_defined_target_latency = self.tc.td.get("RTKERNEL_TARGET_LATENCY")
36 if user_defined_target_latency:
37 target_latency = int(user_defined_target_latency)
38 self.assertTrue(max_latency < target_latency,
39 msg="Max latency (%sus) is greater than target (%sus)." % (max_latency, target_latency))