diff options
author | Aníbal Limón <anibal.limon@linux.intel.com> | 2016-11-27 17:51:53 -0600 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2017-01-23 12:05:19 +0000 |
commit | c9fe59d7c5e815fb6453f50d0f15699ea6799129 (patch) | |
tree | 4e7715c04b705eb78f49e55d421b25483c594f9c /meta/lib/oeqa/sdk/cases/gcc.py | |
parent | 51be1880631435627e8ff490d71b024c2683244a (diff) | |
download | poky-c9fe59d7c5e815fb6453f50d0f15699ea6799129.tar.gz |
oeqa/sdk/cases: Migrate tests to the new OEQA framework
Summary of the changes:
- Remove auto extend_path using pkgutil at __init__, is not needed.
- Change base class to OESDKTestCase.
- Add td_vars attr to set dependencies of certain variables in test
data.
- Change skips from module level to class level because Test context
(tc)
now isn't at module level.
- Variable names changes to be consistent (i.e. sdktestdir ->
sdk_dir).
[YOCTO #10599]
- Don't use bb.utils functions use instead remove_safe and shutil
for copy files.
- SDKBuildProject pass test data variables instead of call getVar
inside.
[YOCTO #10231]
(From OE-Core rev: 91cd1ed19a3f34c29cd77eb136036975fe465444)
Signed-off-by: Aníbal Limón <anibal.limon@linux.intel.com>
Signed-off-by: Mariano Lopez <mariano.lopez@linux.intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta/lib/oeqa/sdk/cases/gcc.py')
-rw-r--r-- | meta/lib/oeqa/sdk/cases/gcc.py | 41 |
1 files changed, 24 insertions, 17 deletions
diff --git a/meta/lib/oeqa/sdk/cases/gcc.py b/meta/lib/oeqa/sdk/cases/gcc.py index f3f4341a20..e06af4c247 100644 --- a/meta/lib/oeqa/sdk/cases/gcc.py +++ b/meta/lib/oeqa/sdk/cases/gcc.py | |||
@@ -1,36 +1,43 @@ | |||
1 | import unittest | ||
2 | import os | 1 | import os |
3 | import shutil | 2 | import shutil |
4 | from oeqa.oetest import oeSDKTest, skipModule | 3 | import unittest |
5 | from oeqa.utils.decorators import * | ||
6 | |||
7 | def setUpModule(): | ||
8 | machine = oeSDKTest.tc.d.getVar("MACHINE") | ||
9 | if not oeSDKTest.hasHostPackage("packagegroup-cross-canadian-" + machine): | ||
10 | skipModule("SDK doesn't contain a cross-canadian toolchain") | ||
11 | 4 | ||
5 | from oeqa.core.utils.path import remove_safe | ||
6 | from oeqa.sdk.case import OESDKTestCase | ||
12 | 7 | ||
13 | class GccCompileTest(oeSDKTest): | 8 | class GccCompileTest(OESDKTestCase): |
9 | td_vars = ['MACHINE'] | ||
14 | 10 | ||
15 | @classmethod | 11 | @classmethod |
16 | def setUpClass(self): | 12 | def setUpClass(self): |
17 | for f in ['test.c', 'test.cpp', 'testsdkmakefile']: | 13 | files = {'test.c' : self.tc.files_dir, 'test.cpp' : self.tc.files_dir, |
18 | shutil.copyfile(os.path.join(self.tc.filesdir, f), self.tc.sdktestdir + f) | 14 | 'testsdkmakefile' : self.tc.sdk_files_dir} |
15 | for f in files: | ||
16 | shutil.copyfile(os.path.join(files[f], f), | ||
17 | os.path.join(self.tc.sdk_dir, f)) | ||
18 | |||
19 | def setUp(self): | ||
20 | machine = self.td.get("MACHINE") | ||
21 | if not self.tc.hasHostPackage("packagegroup-cross-canadian-%s" % machine): | ||
22 | raise unittest.SkipTest("%s class: SDK doesn't contain a cross-canadian toolchain", | ||
23 | self.__name__) | ||
19 | 24 | ||
20 | def test_gcc_compile(self): | 25 | def test_gcc_compile(self): |
21 | self._run('$CC %s/test.c -o %s/test -lm' % (self.tc.sdktestdir, self.tc.sdktestdir)) | 26 | self._run('$CC %s/test.c -o %s/test -lm' % (self.tc.sdk_dir, self.tc.sdk_dir)) |
22 | 27 | ||
23 | def test_gpp_compile(self): | 28 | def test_gpp_compile(self): |
24 | self._run('$CXX %s/test.c -o %s/test -lm' % (self.tc.sdktestdir, self.tc.sdktestdir)) | 29 | self._run('$CXX %s/test.c -o %s/test -lm' % (self.tc.sdk_dir, self.tc.sdk_dir)) |
25 | 30 | ||
26 | def test_gpp2_compile(self): | 31 | def test_gpp2_compile(self): |
27 | self._run('$CXX %s/test.cpp -o %s/test -lm' % (self.tc.sdktestdir, self.tc.sdktestdir)) | 32 | self._run('$CXX %s/test.cpp -o %s/test -lm' % (self.tc.sdk_dir, self.tc.sdk_dir)) |
28 | 33 | ||
29 | def test_make(self): | 34 | def test_make(self): |
30 | self._run('cd %s; make -f testsdkmakefile' % self.tc.sdktestdir) | 35 | self._run('cd %s; make -f testsdkmakefile' % self.tc.sdk_dir) |
31 | 36 | ||
32 | @classmethod | 37 | @classmethod |
33 | def tearDownClass(self): | 38 | def tearDownClass(self): |
34 | files = [self.tc.sdktestdir + f for f in ['test.c', 'test.cpp', 'test.o', 'test', 'testsdkmakefile']] | 39 | files = [os.path.join(self.tc.sdk_dir, f) \ |
40 | for f in ['test.c', 'test.cpp', 'test.o', 'test', | ||
41 | 'testsdkmakefile']] | ||
35 | for f in files: | 42 | for f in files: |
36 | bb.utils.remove(f) | 43 | remove_safe(f) |