diff options
author | Tim Orling <timothy.t.orling@linux.intel.com> | 2019-06-07 16:47:54 -0700 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2019-06-08 16:01:41 +0100 |
commit | 716dff0b2fcf578a01c1aa247df0a4c9697fa9d3 (patch) | |
tree | 1c3318b6cb61b1b4e56b43513ab574a4ab7eee04 /meta/lib | |
parent | 2209af86ed356c007cb140ac12f79bc4efca21f5 (diff) | |
download | poky-716dff0b2fcf578a01c1aa247df0a4c9697fa9d3.tar.gz |
oeqa/runtime: add simple test for scons
This test simply compiles a hello world program using scons.
(From OE-Core rev: bf6e3f0f3a7a134e8e3cb16366ef01b8c956e4c8)
Signed-off-by: Tim Orling <timothy.t.orling@linux.intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta/lib')
-rw-r--r-- | meta/lib/oeqa/runtime/cases/scons.py | 37 | ||||
-rw-r--r-- | meta/lib/oeqa/runtime/files/SConstruct | 1 | ||||
-rw-r--r-- | meta/lib/oeqa/runtime/files/hello.c | 5 |
3 files changed, 43 insertions, 0 deletions
diff --git a/meta/lib/oeqa/runtime/cases/scons.py b/meta/lib/oeqa/runtime/cases/scons.py new file mode 100644 index 0000000000..3c7c7f7270 --- /dev/null +++ b/meta/lib/oeqa/runtime/cases/scons.py | |||
@@ -0,0 +1,37 @@ | |||
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) | ||
diff --git a/meta/lib/oeqa/runtime/files/SConstruct b/meta/lib/oeqa/runtime/files/SConstruct new file mode 100644 index 0000000000..d2cb6dd122 --- /dev/null +++ b/meta/lib/oeqa/runtime/files/SConstruct | |||
@@ -0,0 +1 @@ | |||
Program('hello.c') | |||
diff --git a/meta/lib/oeqa/runtime/files/hello.c b/meta/lib/oeqa/runtime/files/hello.c new file mode 100644 index 0000000000..b0697a3304 --- /dev/null +++ b/meta/lib/oeqa/runtime/files/hello.c | |||
@@ -0,0 +1,5 @@ | |||
1 | int | ||
2 | main() | ||
3 | { | ||
4 | printf("Hello, world!\n"); | ||
5 | } | ||