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