Patrick Williams | 92b42cb | 2022-09-03 06:53:57 -0500 | [diff] [blame] | 1 | # |
| 2 | # Copyright OpenEmbedded Contributors |
| 3 | # |
| 4 | # SPDX-License-Identifier: MIT |
| 5 | # |
Andrew Geissler | d1e8949 | 2021-02-12 15:35:20 -0600 | [diff] [blame] | 6 | from oeqa.runtime.case import OERuntimeTestCase |
| 7 | from oeqa.core.decorator.depends import OETestDepends |
| 8 | from oeqa.core.decorator.data import skipIfQemu |
| 9 | import threading |
| 10 | import time |
| 11 | |
| 12 | class 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 Williams | 4585273 | 2022-04-02 08:58:32 -0500 | [diff] [blame] | 31 | @skipIfQemu() |
Andrew Geissler | d1e8949 | 2021-02-12 15:35:20 -0600 | [diff] [blame] | 32 | @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() |