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 | from oeqa.runtime.decorator.package import OEHasPackage |
| 10 | |
| 11 | class USB_HID_Test(OERuntimeTestCase): |
| 12 | |
| 13 | def keyboard_mouse_simulation(self): |
| 14 | (status, output) = self.target.run('export DISPLAY=:0 && xdotool key F2 && xdotool mousemove 100 100') |
| 15 | return self.assertEqual(status, 0, msg = 'Failed to simulate keyboard/mouse input event, output : %s' % output) |
| 16 | |
| 17 | def set_suspend(self): |
| 18 | (status, output) = self.target.run('sudo rtcwake -m mem -s 10') |
| 19 | return self.assertEqual(status, 0, msg = 'Failed to suspends your system to RAM, output : %s' % output) |
| 20 | |
| 21 | @OEHasPackage(['xdotool']) |
Patrick Williams | 4585273 | 2022-04-02 08:58:32 -0500 | [diff] [blame] | 22 | @skipIfQemu() |
Andrew Geissler | d1e8949 | 2021-02-12 15:35:20 -0600 | [diff] [blame] | 23 | @OETestDepends(['ssh.SSHTest.test_ssh']) |
| 24 | def test_USB_Hid_input(self): |
| 25 | self.keyboard_mouse_simulation() |
| 26 | self.set_suspend() |
| 27 | self.keyboard_mouse_simulation() |