blob: 8395b9b908dd62f4f455dc0e0f8e69de46ca690d [file] [log] [blame]
Patrick Williamsc124f4f2015-09-15 14:41:29 -05001import unittest
2import os
3import shutil
4from oeqa.oetest import oeSDKTest, skipModule
5from oeqa.utils.decorators import *
6
7def 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
13class GccCompileTest(oeSDKTest):
14
15 @classmethod
16 def setUpClass(self):
Patrick Williamsf1e5d692016-03-30 15:21:19 -050017 for f in ['test.c', 'test.cpp', 'testsdkmakefile']:
Patrick Williamsc124f4f2015-09-15 14:41:29 -050018 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 Williamsf1e5d692016-03-30 15:21:19 -050030 self._run('cd %s; make -f testsdkmakefile' % self.tc.sdktestdir)
Patrick Williamsc124f4f2015-09-15 14:41:29 -050031
32 @classmethod
33 def tearDownClass(self):
Patrick Williamsf1e5d692016-03-30 15:21:19 -050034 files = [self.tc.sdktestdir + f for f in ['test.c', 'test.cpp', 'test.o', 'test', 'testsdkmakefile']]
Patrick Williamsc124f4f2015-09-15 14:41:29 -050035 for f in files:
36 bb.utils.remove(f)