summaryrefslogtreecommitdiffstats
path: root/meta
diff options
context:
space:
mode:
Diffstat (limited to 'meta')
-rw-r--r--meta/lib/oeqa/core/tests/cases/loader/threaded/threaded.py12
-rw-r--r--meta/lib/oeqa/core/tests/cases/loader/threaded/threaded_alone.py8
-rw-r--r--meta/lib/oeqa/core/tests/cases/loader/threaded/threaded_depends.py10
-rw-r--r--meta/lib/oeqa/core/tests/cases/loader/threaded/threaded_module.py12
-rw-r--r--meta/lib/oeqa/core/tests/common.py10
-rwxr-xr-xmeta/lib/oeqa/core/tests/test_decorators.py12
-rwxr-xr-xmeta/lib/oeqa/core/tests/test_loader.py30
7 files changed, 93 insertions, 1 deletions
diff --git a/meta/lib/oeqa/core/tests/cases/loader/threaded/threaded.py b/meta/lib/oeqa/core/tests/cases/loader/threaded/threaded.py
new file mode 100644
index 0000000000..0fe4cb3f11
--- /dev/null
+++ b/meta/lib/oeqa/core/tests/cases/loader/threaded/threaded.py
@@ -0,0 +1,12 @@
1# Copyright (C) 2017 Intel Corporation
2# Released under the MIT license (see COPYING.MIT)
3
4from oeqa.core.case import OETestCase
5
6class ThreadedTest(OETestCase):
7 def test_threaded_no_depends(self):
8 self.assertTrue(True, msg='How is this possible?')
9
10class ThreadedTest2(OETestCase):
11 def test_threaded_same_module(self):
12 self.assertTrue(True, msg='How is this possible?')
diff --git a/meta/lib/oeqa/core/tests/cases/loader/threaded/threaded_alone.py b/meta/lib/oeqa/core/tests/cases/loader/threaded/threaded_alone.py
new file mode 100644
index 0000000000..905f397846
--- /dev/null
+++ b/meta/lib/oeqa/core/tests/cases/loader/threaded/threaded_alone.py
@@ -0,0 +1,8 @@
1# Copyright (C) 2017 Intel Corporation
2# Released under the MIT license (see COPYING.MIT)
3
4from oeqa.core.case import OETestCase
5
6class ThreadedTestAlone(OETestCase):
7 def test_threaded_alone(self):
8 self.assertTrue(True, msg='How is this possible?')
diff --git a/meta/lib/oeqa/core/tests/cases/loader/threaded/threaded_depends.py b/meta/lib/oeqa/core/tests/cases/loader/threaded/threaded_depends.py
new file mode 100644
index 0000000000..0c158d3bac
--- /dev/null
+++ b/meta/lib/oeqa/core/tests/cases/loader/threaded/threaded_depends.py
@@ -0,0 +1,10 @@
1# Copyright (C) 2017 Intel Corporation
2# Released under the MIT license (see COPYING.MIT)
3
4from oeqa.core.case import OETestCase
5from oeqa.core.decorator.depends import OETestDepends
6
7class ThreadedTest3(OETestCase):
8 @OETestDepends(['threaded.ThreadedTest.test_threaded_no_depends'])
9 def test_threaded_depends(self):
10 self.assertTrue(True, msg='How is this possible?')
diff --git a/meta/lib/oeqa/core/tests/cases/loader/threaded/threaded_module.py b/meta/lib/oeqa/core/tests/cases/loader/threaded/threaded_module.py
new file mode 100644
index 0000000000..63d17e0401
--- /dev/null
+++ b/meta/lib/oeqa/core/tests/cases/loader/threaded/threaded_module.py
@@ -0,0 +1,12 @@
1# Copyright (C) 2017 Intel Corporation
2# Released under the MIT license (see COPYING.MIT)
3
4from oeqa.core.case import OETestCase
5
6class ThreadedTestModule(OETestCase):
7 def test_threaded_module(self):
8 self.assertTrue(True, msg='How is this possible?')
9
10class ThreadedTestModule2(OETestCase):
11 def test_threaded_module2(self):
12 self.assertTrue(True, msg='How is this possible?')
diff --git a/meta/lib/oeqa/core/tests/common.py b/meta/lib/oeqa/core/tests/common.py
index 52b18a1c3e..1932323409 100644
--- a/meta/lib/oeqa/core/tests/common.py
+++ b/meta/lib/oeqa/core/tests/common.py
@@ -33,3 +33,13 @@ class TestBase(unittest.TestCase):
33 tc.loadTests(self.cases_path, modules=modules, tests=tests, 33 tc.loadTests(self.cases_path, modules=modules, tests=tests,
34 filters=filters) 34 filters=filters)
35 return tc 35 return tc
36
37 def _testLoaderThreaded(self, d={}, modules=[],
38 tests=[], filters={}):
39 from oeqa.core.threaded import OETestContextThreaded
40
41 tc = OETestContextThreaded(d, self.logger)
42 tc.loadTests(self.cases_path, modules=modules, tests=tests,
43 filters=filters)
44
45 return tc
diff --git a/meta/lib/oeqa/core/tests/test_decorators.py b/meta/lib/oeqa/core/tests/test_decorators.py
index f7d11e885a..cf99e0d72d 100755
--- a/meta/lib/oeqa/core/tests/test_decorators.py
+++ b/meta/lib/oeqa/core/tests/test_decorators.py
@@ -131,5 +131,17 @@ class TestTimeoutDecorator(TestBase):
131 msg = "OETestTimeout didn't restore SIGALRM" 131 msg = "OETestTimeout didn't restore SIGALRM"
132 self.assertIs(alarm_signal, signal.getsignal(signal.SIGALRM), msg=msg) 132 self.assertIs(alarm_signal, signal.getsignal(signal.SIGALRM), msg=msg)
133 133
134 def test_timeout_thread(self):
135 tests = ['timeout.TimeoutTest.testTimeoutPass']
136 msg = 'Failed to run test using OETestTimeout'
137 tc = self._testLoaderThreaded(modules=self.modules, tests=tests)
138 self.assertTrue(tc.runTests().wasSuccessful(), msg=msg)
139
140 def test_timeout_threaded_fail(self):
141 tests = ['timeout.TimeoutTest.testTimeoutFail']
142 msg = "OETestTimeout test didn't timeout as expected"
143 tc = self._testLoaderThreaded(modules=self.modules, tests=tests)
144 self.assertFalse(tc.runTests().wasSuccessful(), msg=msg)
145
134if __name__ == '__main__': 146if __name__ == '__main__':
135 unittest.main() 147 unittest.main()
diff --git a/meta/lib/oeqa/core/tests/test_loader.py b/meta/lib/oeqa/core/tests/test_loader.py
index b79b8bad4d..e0d917d317 100755
--- a/meta/lib/oeqa/core/tests/test_loader.py
+++ b/meta/lib/oeqa/core/tests/test_loader.py
@@ -1,6 +1,6 @@
1#!/usr/bin/env python3 1#!/usr/bin/env python3
2 2
3# Copyright (C) 2016 Intel Corporation 3# Copyright (C) 2016-2017 Intel Corporation
4# Released under the MIT license (see COPYING.MIT) 4# Released under the MIT license (see COPYING.MIT)
5 5
6import os 6import os
@@ -82,5 +82,33 @@ class TestLoader(TestBase):
82 msg = 'Expected modules from two different paths' 82 msg = 'Expected modules from two different paths'
83 self.assertEqual(modules, expected_modules, msg=msg) 83 self.assertEqual(modules, expected_modules, msg=msg)
84 84
85 def test_loader_threaded(self):
86 cases_path = self.cases_path
87
88 self.cases_path = [os.path.join(self.cases_path, 'loader', 'threaded')]
89
90 tc = self._testLoaderThreaded()
91 self.assertEqual(len(tc.suites), 3, "Expected to be 3 suites")
92
93 case_ids = ['threaded.ThreadedTest.test_threaded_no_depends',
94 'threaded.ThreadedTest2.test_threaded_same_module',
95 'threaded_depends.ThreadedTest3.test_threaded_depends']
96 for case in tc.suites[0]._tests:
97 self.assertEqual(case.id(),
98 case_ids[tc.suites[0]._tests.index(case)])
99
100 case_ids = ['threaded_alone.ThreadedTestAlone.test_threaded_alone']
101 for case in tc.suites[1]._tests:
102 self.assertEqual(case.id(),
103 case_ids[tc.suites[1]._tests.index(case)])
104
105 case_ids = ['threaded_module.ThreadedTestModule.test_threaded_module',
106 'threaded_module.ThreadedTestModule2.test_threaded_module2']
107 for case in tc.suites[2]._tests:
108 self.assertEqual(case.id(),
109 case_ids[tc.suites[2]._tests.index(case)])
110
111 self.cases_path = cases_path
112
85if __name__ == '__main__': 113if __name__ == '__main__':
86 unittest.main() 114 unittest.main()