Andrew Geissler | c9f7865 | 2020-09-18 14:11:35 -0500 | [diff] [blame] | 1 | from oeqa.runtime.case import OERuntimeTestCase |
| 2 | from oeqa.core.decorator.depends import OETestDepends |
| 3 | from oeqa.runtime.decorator.package import OEHasPackage |
| 4 | |
| 5 | import threading |
| 6 | import time |
| 7 | |
| 8 | class TerminalTest(OERuntimeTestCase): |
| 9 | |
| 10 | @OEHasPackage(['matchbox-terminal']) |
| 11 | @OETestDepends(['ssh.SSHTest.test_ssh']) |
| 12 | def test_terminal_running(self): |
Andrew Geissler | c723b72 | 2021-01-08 16:14:09 -0600 | [diff] [blame^] | 13 | t_thread = threading.Thread(target=self.target.run, args=("export DISPLAY=:0 && matchbox-terminal -e 'sh -c \"uname -a && exec sh\"'",)) |
Andrew Geissler | c9f7865 | 2020-09-18 14:11:35 -0500 | [diff] [blame] | 14 | t_thread.start() |
| 15 | time.sleep(2) |
Andrew Geissler | c723b72 | 2021-01-08 16:14:09 -0600 | [diff] [blame^] | 16 | |
Andrew Geissler | c9f7865 | 2020-09-18 14:11:35 -0500 | [diff] [blame] | 17 | status, output = self.target.run('pidof matchbox-terminal') |
Andrew Geissler | c723b72 | 2021-01-08 16:14:09 -0600 | [diff] [blame^] | 18 | number_of_terminal = len(output.split()) |
| 19 | self.assertEqual(number_of_terminal, 1, msg='There should be only one terminal being launched. Number of terminal launched : %s' % number_of_terminal) |
Andrew Geissler | c9f7865 | 2020-09-18 14:11:35 -0500 | [diff] [blame] | 20 | self.target.run('kill -9 %s' % output) |
Andrew Geissler | c723b72 | 2021-01-08 16:14:09 -0600 | [diff] [blame^] | 21 | self.assertEqual(status, 0, msg='Not able to find process that runs terminal.') |