Brad Bishop | 15ae250 | 2019-06-18 21:44:24 -0400 | [diff] [blame] | 1 | # |
| 2 | # SPDX-License-Identifier: MIT |
| 3 | # |
| 4 | |
| 5 | import os |
| 6 | |
| 7 | from oeqa.runtime.case import OERuntimeTestCase |
| 8 | from oeqa.core.decorator.depends import OETestDepends |
| 9 | from oeqa.runtime.decorator.package import OEHasPackage |
| 10 | |
| 11 | class SconsCompileTest(OERuntimeTestCase): |
| 12 | |
| 13 | @classmethod |
| 14 | def setUp(cls): |
| 15 | dst = '/tmp/' |
| 16 | src = os.path.join(cls.tc.runtime_files_dir, 'hello.c') |
| 17 | cls.tc.target.copyTo(src, dst) |
| 18 | |
| 19 | src = os.path.join(cls.tc.runtime_files_dir, 'SConstruct') |
| 20 | cls.tc.target.copyTo(src, dst) |
| 21 | |
| 22 | @classmethod |
| 23 | def tearDown(cls): |
| 24 | files = '/tmp/hello.c /tmp/hello.o /tmp/hello /tmp/SConstruct' |
| 25 | cls.tc.target.run('rm %s' % files) |
| 26 | |
| 27 | @OETestDepends(['ssh.SSHTest.test_ssh']) |
| 28 | @OEHasPackage(['gcc']) |
| 29 | @OEHasPackage(['python3-scons']) |
| 30 | def test_scons_compile(self): |
| 31 | status, output = self.target.run('cd /tmp/ && scons') |
| 32 | msg = 'scons compile failed, output: %s' % output |
| 33 | self.assertEqual(status, 0, msg=msg) |
| 34 | |
| 35 | status, output = self.target.run('/tmp/hello') |
| 36 | msg = 'running compiled file failed, output: %s' % output |
| 37 | self.assertEqual(status, 0, msg=msg) |