blob: a625cc59019cc0ef19d68a594eeae2bbccc0ebff [file] [log] [blame]
Patrick Williams92b42cb2022-09-03 06:53:57 -05001#
2# Copyright OpenEmbedded Contributors
3#
4# SPDX-License-Identifier: MIT
5#
Andrew Geisslerd1e89492021-02-12 15:35:20 -06006from oeqa.runtime.case import OERuntimeTestCase
7from oeqa.core.decorator.depends import OETestDepends
8from oeqa.core.decorator.data import skipIfQemu
9import threading
10import time
11
12class Suspend_Test(OERuntimeTestCase):
13
14 def test_date(self):
15 (status, output) = self.target.run('date')
16 self.assertEqual(status, 0, msg = 'Failed to run date command, output : %s' % output)
17
18 def test_ping(self):
19 t_thread = threading.Thread(target=self.target.run, args=("ping 8.8.8.8",))
20 t_thread.start()
21 time.sleep(2)
22
23 status, output = self.target.run('pidof ping')
24 self.target.run('kill -9 %s' % output)
25 self.assertEqual(status, 0, msg = 'Not able to find process that runs ping, output : %s' % output)
26
27 def set_suspend(self):
28 (status, output) = self.target.run('sudo rtcwake -m mem -s 10')
29 self.assertEqual(status, 0, msg = 'Failed to suspends your system to RAM, output : %s' % output)
30
Patrick Williams45852732022-04-02 08:58:32 -050031 @skipIfQemu()
Andrew Geisslerd1e89492021-02-12 15:35:20 -060032 @OETestDepends(['ssh.SSHTest.test_ssh'])
33 def test_suspend(self):
34 self.test_date()
35 self.test_ping()
36 self.set_suspend()
37 self.test_date()
38 self.test_ping()