From: Teoh Jay Shen <[email protected]> This test is checking the cpu utilization before and after standby state. The check_CPU_utilization_after_standby manual test case from oeqa/manual/bsp-hw can be replace by this runtime test.
Signed-off-by: Teoh Jay Shen <[email protected]> --- .../lib/oeqa/runtime/cases/cpu_utilization_test.py | 23 ++++++++++++++++++++++ 1 file changed, 23 insertions(+) create mode 100644 meta/lib/oeqa/runtime/cases/cpu_utilization_test.py diff --git a/meta/lib/oeqa/runtime/cases/cpu_utilization_test.py b/meta/lib/oeqa/runtime/cases/cpu_utilization_test.py new file mode 100644 index 0000000..a44b4ec --- /dev/null +++ b/meta/lib/oeqa/runtime/cases/cpu_utilization_test.py @@ -0,0 +1,23 @@ +from oeqa.runtime.case import OERuntimeTestCase +from oeqa.core.decorator.depends import OETestDepends +from oeqa.core.decorator.data import skipIfQemu + + +class CPU_utilization_test(OERuntimeTestCase): + + def set_standby(self): + (status, output) = self.target.run('rtcwake -m mem -s 10') + self.assertEqual(status, 0, msg = 'Failed to set your system into standby mode, output : %s' % output) + + @skipIfQemu('qemuall', 'Test only runs on real hardware') + @OETestDepends(['ssh.SSHTest.test_ssh']) + def test_CPU_utilization_after_standby(self): + (status, cpu_usage_before_standby) = self.target.run("export TERM=xterm && top -b -n2 | grep 'Cpu(s)' | tail -n 1 | awk '{print $2 + $6}'") + self.assertEqual(status, 0, msg = 'Failed to run the top command, output : %s' % cpu_usage_before_standby) + self.set_standby() + (status, cpu_usage_after_standby) = self.target.run("export TERM=xterm && top -b -n2 | grep 'Cpu(s)' | tail -n 1 | awk '{print $2 + $6}'") + self.assertEqual(status, 0, msg = 'Failed to run the top command, output : %s' % cpu_usage_after_standby) + cpu_usage_before_standby = int(float(cpu_usage_before_standby)) + cpu_usage_after_standby = int(float(cpu_usage_after_standby)) + cpu_usage_comparison = ((cpu_usage_before_standby - 5) <= cpu_usage_after_standby <= (cpu_usage_before_standby + 5)) + self.assertTrue(cpu_usage_comparison, msg='There should be no big difference in the cpu utilization before/after standby, cpu usage before standby : % s, cpu usage after standby : % s' % (cpu_usage_before_standby , cpu_usage_after_standby)) -- 2.7.4
-=-=-=-=-=-=-=-=-=-=-=- Links: You receive all messages sent to this group. View/Reply Online (#146574): https://lists.openembedded.org/g/openembedded-core/message/146574 Mute This Topic: https://lists.openembedded.org/mt/79586454/21656 Group Owner: [email protected] Unsubscribe: https://lists.openembedded.org/g/openembedded-core/unsub [[email protected]] -=-=-=-=-=-=-=-=-=-=-=-
