public inbox for isar-users@googlegroups.com
 help / color / mirror / Atom feed
From: Anton Mikanovich <amikan@ilbers.de>
To: isar-users@googlegroups.com
Cc: Anton Mikanovich <amikan@ilbers.de>
Subject: [PATCH v4 11/14] vm_boot_test: Add automatic bitbake init
Date: Wed, 21 Apr 2021 19:05:02 +0300	[thread overview]
Message-ID: <20210421160505.67194-12-amikan@ilbers.de> (raw)
In-Reply-To: <20210421160505.67194-1-amikan@ilbers.de>

Implement source of isar-init-build-env in case there is no bitbake
command found.

Signed-off-by: Anton Mikanovich <amikan@ilbers.de>
---
 testsuite/vm_boot_test/vm_boot_test.py | 14 ++++++++++++++
 1 file changed, 14 insertions(+)

diff --git a/testsuite/vm_boot_test/vm_boot_test.py b/testsuite/vm_boot_test/vm_boot_test.py
index 6e580d0..deb5b1d 100644
--- a/testsuite/vm_boot_test/vm_boot_test.py
+++ b/testsuite/vm_boot_test/vm_boot_test.py
@@ -13,12 +13,24 @@ sys.path.append(dirname(__file__) + '/..')
 import start_vm
 
 from avocado import Test
+from avocado.utils import process
+from avocado.utils import path
 
 class CanBeFinished(Exception):
     pass
 
 class VmBase(Test):
 
+    def check_bitbake(self, build_dir):
+        try:
+            path.find_command('bitbake')
+        except path.CmdNotFoundError:
+            out = process.getoutput('/bin/bash -c "cd ../.. && \
+                                    source isar-init-build-env \
+                                    %s 2>&1 >/dev/null; env"' % build_dir)
+            env = dict((x.split("=", 1) for x in out.splitlines() if x != ''))
+            os.environ.update(env)
+
     def vm_start(self, arch='amd64', distro='buster'):
         build_dir = self.params.get('build_dir', default='.')
         time_to_wait = self.params.get('time_to_wait', default=60)
@@ -28,6 +40,8 @@ class VmBase(Test):
         self.log.info('Isar build folder is: ' + build_dir)
         self.log.info('===================================================')
 
+        self.check_bitbake(build_dir)
+
         fd, output_file = tempfile.mkstemp(suffix='_log.txt',
                                            prefix='vm_start_' + distro + '_' +
                                            arch + '_', dir=build_dir, text=True)
-- 
2.25.1


  parent reply	other threads:[~2021-04-21 16:05 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-04-21 16:04 [PATCH v4 00/14] Update Avocado testsuite Anton Mikanovich
2021-04-21 16:04 ` [PATCH v4 01/14] start_vm.py: Fix target name handling Anton Mikanovich
2021-04-21 16:04 ` [PATCH v4 02/14] start_vm.py: Add output and PID file vm_start.py options Anton Mikanovich
2021-04-21 16:04 ` [PATCH v4 03/14] start_vm.py: Add MIPS support Anton Mikanovich
2021-04-21 16:04 ` [PATCH v4 04/14] vm_boot_test: Fix log file path in vm_boot_test Anton Mikanovich
2021-04-21 16:04 ` [PATCH v4 05/14] vm_boot_test: Remove external varianter Anton Mikanovich
2021-04-21 16:04 ` [PATCH v4 06/14] vm_boot_test: Improve QEMU images checking Anton Mikanovich
2021-04-21 16:04 ` [PATCH v4 07/14] build_test: Refactoring build tests cases Anton Mikanovich
2021-04-21 16:04 ` [PATCH v4 08/14] testsuite: Add Python generations for testsuite in gitignore Anton Mikanovich
2021-04-21 16:05 ` [PATCH v4 09/14] testsuite: Fix test suite prepare guide Anton Mikanovich
2021-04-21 16:05 ` [PATCH v4 10/14] gitlab-ci: Add Avocado build artifacts Anton Mikanovich
2021-04-21 16:05 ` Anton Mikanovich [this message]
2021-04-21 16:05 ` [PATCH v4 12/14] ci_build: Migrate to Avocado Anton Mikanovich
2021-04-21 16:05 ` [PATCH v4 13/14] vm_smoke_test: " Anton Mikanovich
2021-04-21 16:05 ` [PATCH v4 14/14] ci_build: Install Avocado if needed Anton Mikanovich

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20210421160505.67194-12-amikan@ilbers.de \
    --to=amikan@ilbers.de \
    --cc=isar-users@googlegroups.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox