diff options
Diffstat (limited to 'lib/oeqa/sdkmingw/cases/binutils.py')
-rw-r--r-- | lib/oeqa/sdkmingw/cases/binutils.py | 55 |
1 files changed, 55 insertions, 0 deletions
diff --git a/lib/oeqa/sdkmingw/cases/binutils.py b/lib/oeqa/sdkmingw/cases/binutils.py new file mode 100644 index 0000000..fdd5a47 --- /dev/null +++ b/lib/oeqa/sdkmingw/cases/binutils.py | |||
@@ -0,0 +1,55 @@ | |||
1 | # Copyright 2018 by Garmin Ltd. or its subsidiaries | ||
2 | # Released under the MIT license (see COPYING.MIT) | ||
3 | |||
4 | import os | ||
5 | import unittest | ||
6 | |||
7 | from oeqa.sdkmingw.case import OESDKMinGWTestCase | ||
8 | |||
9 | class BinutilsTest(OESDKMinGWTestCase): | ||
10 | td_vars = ['MACHINE'] | ||
11 | |||
12 | def setUp(self): | ||
13 | super().setUp() | ||
14 | |||
15 | self.copyTestFile(os.path.join(self.tc.files_dir, 'test.c')) | ||
16 | |||
17 | machine = self.td.get("MACHINE") | ||
18 | if not (self.tc.hasHostPackage("packagegroup-cross-canadian-%s" % machine) or | ||
19 | self.tc.hasHostPackage("^gcc-", regex=True)): | ||
20 | raise unittest.SkipTest(self.__class__.__name__ + " class: SDK doesn't contain a cross-canadian toolchain") | ||
21 | if not (self.tc.hasHostPackage("packagegroup-cross-canadian-%s" % machine) or | ||
22 | self.tc.hasHostPackage('binutils-cross-canadian-%s' % machine)): | ||
23 | raise unittest.SkipTest(self.__class__.__name__ + " class: SDK doesn't contain a binutils") | ||
24 | |||
25 | self._run('%CC% -c -g test.c -o test.o') | ||
26 | self._run('%CC% -o test test.o -lm') | ||
27 | |||
28 | def test_strip(self): | ||
29 | self._run('%STRIP% -s test') | ||
30 | self.assertIsTargetElf(os.path.join(self.test_dir, 'test')) | ||
31 | |||
32 | def test_ar(self): | ||
33 | self._run('%AR% -rcs lib.a test.o') | ||
34 | self._run('%CC% -o test lib.a -lm') | ||
35 | self.assertIsTargetElf(os.path.join(self.test_dir, 'test')) | ||
36 | |||
37 | def test_ranlib(self): | ||
38 | self._run('%AR% -rc lib.a test.o') | ||
39 | self._run('%RANLIB% lib.a') | ||
40 | self._run('%CC% -o test lib.a -lm') | ||
41 | self.assertIsTargetElf(os.path.join(self.test_dir, 'test')) | ||
42 | |||
43 | def test_objcopy(self): | ||
44 | self._run('%OBJCOPY% -g test.o test_no_debug.o') | ||
45 | self.assertIsTargetElf(os.path.join(self.test_dir, 'test_no_debug.o')) | ||
46 | self._run('%CC% -o test test_no_debug.o -lm') | ||
47 | self.assertIsTargetElf(os.path.join(self.test_dir, 'test')) | ||
48 | |||
49 | def test_objdump(self): | ||
50 | self._run('%OBJDUMP% -S test.o') | ||
51 | |||
52 | def test_nm(self): | ||
53 | self._run('%NM% test.o') | ||
54 | |||
55 | |||