diff options
Diffstat (limited to 'meta/lib/oeqa/runtime/cases/kernelmodule.py')
-rw-r--r-- | meta/lib/oeqa/runtime/cases/kernelmodule.py | 40 |
1 files changed, 40 insertions, 0 deletions
diff --git a/meta/lib/oeqa/runtime/cases/kernelmodule.py b/meta/lib/oeqa/runtime/cases/kernelmodule.py new file mode 100644 index 0000000000..11ad7b7f01 --- /dev/null +++ b/meta/lib/oeqa/runtime/cases/kernelmodule.py | |||
@@ -0,0 +1,40 @@ | |||
1 | import os | ||
2 | |||
3 | from oeqa.runtime.case import OERuntimeTestCase | ||
4 | from oeqa.core.decorator.depends import OETestDepends | ||
5 | from oeqa.core.decorator.oeid import OETestID | ||
6 | from oeqa.core.decorator.data import skipIfNotFeature | ||
7 | |||
8 | class KernelModuleTest(OERuntimeTestCase): | ||
9 | |||
10 | @classmethod | ||
11 | def setUpClass(cls): | ||
12 | src = os.path.join(cls.tc.runtime_files_dir, 'hellomod.c') | ||
13 | dst = '/tmp/hellomod.c' | ||
14 | cls.tc.target.copyTo(src, dst) | ||
15 | |||
16 | src = os.path.join(cls.tc.runtime_files_dir, 'hellomod_makefile') | ||
17 | dst = '/tmp/Makefile' | ||
18 | cls.tc.target.copyTo(src, dst) | ||
19 | |||
20 | @classmethod | ||
21 | def tearDownClass(cls): | ||
22 | files = '/tmp/Makefile /tmp/hellomod.c' | ||
23 | cls.tc.target.run('rm %s' % files) | ||
24 | |||
25 | @OETestID(1541) | ||
26 | @skipIfNotFeature('tools-sdk', | ||
27 | 'Test requires tools-sdk to be in IMAGE_FEATURES') | ||
28 | @OETestDepends(['gcc.GccCompileTest.test_gcc_compile']) | ||
29 | def test_kernel_module(self): | ||
30 | cmds = [ | ||
31 | 'cd /usr/src/kernel && make scripts', | ||
32 | 'cd /tmp && make', | ||
33 | 'cd /tmp && insmod hellomod.ko', | ||
34 | 'lsmod | grep hellomod', | ||
35 | 'dmesg | grep Hello', | ||
36 | 'rmmod hellomod', 'dmesg | grep "Cleaning up hellomod"' | ||
37 | ] | ||
38 | for cmd in cmds: | ||
39 | status, output = self.target.run(cmd, 900) | ||
40 | self.assertEqual(status, 0, msg='\n'.join([cmd, output])) | ||