From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga03.intel.com (mga03.intel.com [134.134.136.65]) by mail.openembedded.org (Postfix) with ESMTP id 77A6A7E53E for ; Fri, 7 Jun 2019 23:48:25 +0000 (UTC) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga005.jf.intel.com ([10.7.209.41]) by orsmga103.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 07 Jun 2019 16:48:26 -0700 X-ExtLoop1: 1 Received: from chiron.jf.intel.com ([10.54.74.38]) by orsmga005.jf.intel.com with ESMTP; 07 Jun 2019 16:48:26 -0700 From: Tim Orling To: openembedded-core@lists.openembedded.org Date: Fri, 7 Jun 2019 16:47:54 -0700 Message-Id: X-Mailer: git-send-email 2.20.1 In-Reply-To: References: MIME-Version: 1.0 Subject: [PATCH 4/4] oeqa/runtime: add simple test for scons X-BeenThere: openembedded-core@lists.openembedded.org X-Mailman-Version: 2.1.12 Precedence: list List-Id: Patches and discussions about the oe-core layer List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 07 Jun 2019 23:48:25 -0000 Content-Transfer-Encoding: 8bit This test simply compiles a hello world program using scons. Signed-off-by: Tim Orling --- meta/lib/oeqa/runtime/cases/scons.py | 37 ++++++++++++++++++++++++++ meta/lib/oeqa/runtime/files/SConstruct | 1 + meta/lib/oeqa/runtime/files/hello.c | 5 ++++ 3 files changed, 43 insertions(+) create mode 100644 meta/lib/oeqa/runtime/cases/scons.py create mode 100644 meta/lib/oeqa/runtime/files/SConstruct create mode 100644 meta/lib/oeqa/runtime/files/hello.c 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"); + } -- 2.20.1