blob: 3c7c7f7270a2a35c381391a38d9477a2abb25936 [file] [log] [blame]
Brad Bishop15ae2502019-06-18 21:44:24 -04001#
2# SPDX-License-Identifier: MIT
3#
4
5import os
6
7from oeqa.runtime.case import OERuntimeTestCase
8from oeqa.core.decorator.depends import OETestDepends
9from oeqa.runtime.decorator.package import OEHasPackage
10
11class 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)