Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 1 | import unittest |
| 2 | import os |
| 3 | import shutil |
| 4 | from oeqa.oetest import oeSDKTest, skipModule |
| 5 | from oeqa.utils.decorators import * |
| 6 | |
| 7 | def setUpModule(): |
| 8 | machine = oeSDKTest.tc.d.getVar("MACHINE", True) |
| 9 | if not oeSDKTest.hasHostPackage("packagegroup-cross-canadian-" + machine): |
| 10 | skipModule("SDK doesn't contain a cross-canadian toolchain") |
| 11 | |
| 12 | |
| 13 | class GccCompileTest(oeSDKTest): |
| 14 | |
| 15 | @classmethod |
| 16 | def setUpClass(self): |
Patrick Williams | f1e5d69 | 2016-03-30 15:21:19 -0500 | [diff] [blame] | 17 | for f in ['test.c', 'test.cpp', 'testsdkmakefile']: |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 18 | shutil.copyfile(os.path.join(self.tc.filesdir, f), self.tc.sdktestdir + f) |
| 19 | |
| 20 | def test_gcc_compile(self): |
| 21 | self._run('$CC %s/test.c -o %s/test -lm' % (self.tc.sdktestdir, self.tc.sdktestdir)) |
| 22 | |
| 23 | def test_gpp_compile(self): |
| 24 | self._run('$CXX %s/test.c -o %s/test -lm' % (self.tc.sdktestdir, self.tc.sdktestdir)) |
| 25 | |
| 26 | def test_gpp2_compile(self): |
| 27 | self._run('$CXX %s/test.cpp -o %s/test -lm' % (self.tc.sdktestdir, self.tc.sdktestdir)) |
| 28 | |
| 29 | def test_make(self): |
Patrick Williams | f1e5d69 | 2016-03-30 15:21:19 -0500 | [diff] [blame] | 30 | self._run('cd %s; make -f testsdkmakefile' % self.tc.sdktestdir) |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 31 | |
| 32 | @classmethod |
| 33 | def tearDownClass(self): |
Patrick Williams | f1e5d69 | 2016-03-30 15:21:19 -0500 | [diff] [blame] | 34 | files = [self.tc.sdktestdir + f for f in ['test.c', 'test.cpp', 'test.o', 'test', 'testsdkmakefile']] |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 35 | for f in files: |
| 36 | bb.utils.remove(f) |