diff options
author | Joshua Watt <JPEWhacker@gmail.com> | 2018-11-15 10:53:02 -0600 |
---|---|---|
committer | Joshua Watt <JPEWhacker@gmail.com> | 2018-11-21 11:11:42 -0600 |
commit | 2ccb4d55e7676452a3138ed8abfce56d1fb26a72 (patch) | |
tree | 5a08069c7a9bc7e84614570cdd8f8f444b9f83e2 /lib/oeqa/sdkmingw/cases/gcc.py | |
parent | 7d1abb4b93851ca3923f75a3c4bfd121a3ed1ed1 (diff) | |
download | meta-mingw-2ccb4d55e7676452a3138ed8abfce56d1fb26a72.tar.gz |
oeqa/sdkmingw: Add test cases
Adds test cases to verify that gcc, binutils, gdb, and pkg-config are
functioning in the MinGW SDK
[YOCTO #13020]
Signed-off-by: Joshua Watt <JPEWhacker@gmail.com>
Diffstat (limited to 'lib/oeqa/sdkmingw/cases/gcc.py')
-rw-r--r-- | lib/oeqa/sdkmingw/cases/gcc.py | 47 |
1 files changed, 47 insertions, 0 deletions
diff --git a/lib/oeqa/sdkmingw/cases/gcc.py b/lib/oeqa/sdkmingw/cases/gcc.py new file mode 100644 index 0000000..7294bf5 --- /dev/null +++ b/lib/oeqa/sdkmingw/cases/gcc.py | |||
@@ -0,0 +1,47 @@ | |||
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 GccCompileTest(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 | self.copyTestFile(os.path.join(self.tc.files_dir, 'test.cpp')) | ||
17 | self.copyTestFile(os.path.join(self.tc.sdk_files_dir, 'testsdkmakefile')) | ||
18 | |||
19 | machine = self.td.get("MACHINE") | ||
20 | if not (self.tc.hasHostPackage("packagegroup-cross-canadian-%s" % machine) or | ||
21 | self.tc.hasHostPackage("^gcc-", regex=True)): | ||
22 | raise unittest.SkipTest(self.__class__.__name__ + " class: SDK doesn't contain a cross-canadian toolchain") | ||
23 | |||
24 | def test_gcc_compile(self): | ||
25 | self._run('%CC% %CFLAGS% %LDFLAGS% test.c -o test -lm') | ||
26 | self.assertIsTargetElf(os.path.join(self.test_dir, 'test')) | ||
27 | |||
28 | def test_gcc_compile_and_link(self): | ||
29 | self._run('%CC% %CFLAGS% -c test.c -o test.o') | ||
30 | self._run('%CC% %LDFLAGS% -o test test.o -lm') | ||
31 | self.assertIsTargetElf(os.path.join(self.test_dir, 'test.o')) | ||
32 | self.assertIsTargetElf(os.path.join(self.test_dir, 'test')) | ||
33 | |||
34 | def test_gpp_compile(self): | ||
35 | self._run('%CXX% %CXXFLAGS% %LDFLAGS% test.c -o test -lm') | ||
36 | self.assertIsTargetElf(os.path.join(self.test_dir, 'test')) | ||
37 | |||
38 | def test_gpp2_compile(self): | ||
39 | self._run('%CXX% %CXXFLAGS% %LDFLAGS% test.cpp -o test -lm') | ||
40 | self.assertIsTargetElf(os.path.join(self.test_dir, 'test')) | ||
41 | |||
42 | def test_make(self): | ||
43 | if not self.tc.hasHostPackage('nativesdk-make'): | ||
44 | raise unittest.SkipTest(self.__class__.__name__ + " class: SDK doesn't contain make") | ||
45 | self._run('make -f testsdkmakefile') | ||
46 | self.assertIsTargetElf(os.path.join(self.test_dir, 'test')) | ||
47 | |||