summaryrefslogtreecommitdiffstats
path: root/lib/oeqa/runtime/cases/cyclictest.py
diff options
context:
space:
mode:
Diffstat (limited to 'lib/oeqa/runtime/cases/cyclictest.py')
-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))