Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 1 | import unittest |
| 2 | import os |
| 3 | from oeqa.oetest import oeRuntimeTest, skipModule |
| 4 | from oeqa.utils.decorators import * |
| 5 | |
| 6 | def setUpModule(): |
| 7 | if not oeRuntimeTest.hasFeature("tools-sdk"): |
| 8 | skipModule("Image doesn't have tools-sdk in IMAGE_FEATURES") |
| 9 | |
| 10 | |
| 11 | class KernelModuleTest(oeRuntimeTest): |
| 12 | |
Patrick Williams | f1e5d69 | 2016-03-30 15:21:19 -0500 | [diff] [blame^] | 13 | def setUpLocal(self): |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 14 | self.target.copy_to(os.path.join(oeRuntimeTest.tc.filesdir, "hellomod.c"), "/tmp/hellomod.c") |
| 15 | self.target.copy_to(os.path.join(oeRuntimeTest.tc.filesdir, "hellomod_makefile"), "/tmp/Makefile") |
| 16 | |
| 17 | @testcase('316') |
| 18 | @skipUnlessPassed('test_ssh') |
| 19 | @skipUnlessPassed('test_gcc_compile') |
| 20 | def test_kernel_module(self): |
| 21 | cmds = [ |
| 22 | 'cd /usr/src/kernel && make scripts', |
| 23 | 'cd /tmp && make', |
| 24 | 'cd /tmp && insmod hellomod.ko', |
| 25 | 'lsmod | grep hellomod', |
| 26 | 'dmesg | grep Hello', |
| 27 | 'rmmod hellomod', 'dmesg | grep "Cleaning up hellomod"' |
| 28 | ] |
| 29 | for cmd in cmds: |
| 30 | (status, output) = self.target.run(cmd, 900) |
| 31 | self.assertEqual(status, 0, msg="\n".join([cmd, output])) |
| 32 | |
Patrick Williams | f1e5d69 | 2016-03-30 15:21:19 -0500 | [diff] [blame^] | 33 | def tearDownLocal(self): |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 34 | self.target.run('rm -f /tmp/Makefile /tmp/hellomod.c') |