summaryrefslogtreecommitdiffstats
path: root/meta/lib/oeqa/runtime
diff options
context:
space:
mode:
authorTim Orling <timothy.t.orling@linux.intel.com>2019-06-07 16:47:54 -0700
committerRichard Purdie <richard.purdie@linuxfoundation.org>2019-06-08 16:01:36 +0100
commitbf6e3f0f3a7a134e8e3cb16366ef01b8c956e4c8 (patch)
tree526705f4a1983f12cc821a1c235de31d77e4747a /meta/lib/oeqa/runtime
parente1de553bb2c1885f8323d9ce31b35175d5da3ef2 (diff)
downloadopenembedded-core-contrib-bf6e3f0f3a7a134e8e3cb16366ef01b8c956e4c8.tar.gz
oeqa/runtime: add simple test for scons
This test simply compiles a hello world program using scons. 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/oeqa/runtime')
-rw-r--r--meta/lib/oeqa/runtime/cases/scons.py37
-rw-r--r--meta/lib/oeqa/runtime/files/SConstruct1
-rw-r--r--meta/lib/oeqa/runtime/files/hello.c5
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 @@
+#
+# SPDX-License-Identifier: MIT
+#
+
+import os
+
+from oeqa.runtime.case import OERuntimeTestCase
+from oeqa.core.decorator.depends import OETestDepends
+from oeqa.runtime.decorator.package import OEHasPackage
+
+class SconsCompileTest(OERuntimeTestCase):
+
+ @classmethod
+ def setUp(cls):
+ dst = '/tmp/'
+ src = os.path.join(cls.tc.runtime_files_dir, 'hello.c')
+ cls.tc.target.copyTo(src, dst)
+
+ src = os.path.join(cls.tc.runtime_files_dir, 'SConstruct')
+ cls.tc.target.copyTo(src, dst)
+
+ @classmethod
+ def tearDown(cls):
+ files = '/tmp/hello.c /tmp/hello.o /tmp/hello /tmp/SConstruct'
+ cls.tc.target.run('rm %s' % files)
+
+ @OETestDepends(['ssh.SSHTest.test_ssh'])
+ @OEHasPackage(['gcc'])
+ @OEHasPackage(['python3-scons'])
+ def test_scons_compile(self):
+ status, output = self.target.run('cd /tmp/ && scons')
+ msg = 'scons compile failed, output: %s' % output
+ self.assertEqual(status, 0, msg=msg)
+
+ status, output = self.target.run('/tmp/hello')
+ msg = 'running compiled file failed, output: %s' % output
+ 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 @@
+int
+ main()
+ {
+ printf("Hello, world!\n");
+ }