* [PATCH v3 01/11] start_vm.py: Fix target name handling
2021-03-17 14:52 [PATCH v3 00/11] Update Avocado testsuite Anton Mikanovich
@ 2021-03-17 14:52 ` Anton Mikanovich
2021-03-17 14:52 ` [PATCH v3 02/11] start_vm.py: Add output and PID file vm_start.py options Anton Mikanovich
` (9 subsequent siblings)
10 siblings, 0 replies; 15+ messages in thread
From: Anton Mikanovich @ 2021-03-17 14:52 UTC (permalink / raw)
To: isar-users; +Cc: Roman Pletnev, Anton Mikanovich
From: Roman Pletnev <rpletnev@ilbers.de>
This patch fix bb_output search (issue with wrong arch name being
selected for qemu) which caused qemu-system-riscv64 to be used for all
the targets:
>ERROR: [Errno 2] No such file or directory: u'qemu-system-riscv64' (1.05 s)
Signed-off-by: Roman Pletnev <rpletnev@ilbers.de>
Signed-off-by: Anton Mikanovich <amikan@ilbers.de>
---
testsuite/start_vm.py | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/testsuite/start_vm.py b/testsuite/start_vm.py
index a3e32ac..c10db67 100755
--- a/testsuite/start_vm.py
+++ b/testsuite/start_vm.py
@@ -17,7 +17,7 @@ def get_bitbake_env(arch, distro):
def get_bitbake_var(output, var):
ret = ''
for line in output.splitlines():
- if line.startswith(var):
+ if line.startswith(var + '='):
ret = line.split('"')[1]
return ret
--
2.25.1
^ permalink raw reply [flat|nested] 15+ messages in thread
* [PATCH v3 02/11] start_vm.py: Add output and PID file vm_start.py options
2021-03-17 14:52 [PATCH v3 00/11] Update Avocado testsuite Anton Mikanovich
2021-03-17 14:52 ` [PATCH v3 01/11] start_vm.py: Fix target name handling Anton Mikanovich
@ 2021-03-17 14:52 ` Anton Mikanovich
2021-03-17 14:52 ` [PATCH v3 03/11] start_vm.py: Add MIPS support Anton Mikanovich
` (8 subsequent siblings)
10 siblings, 0 replies; 15+ messages in thread
From: Anton Mikanovich @ 2021-03-17 14:52 UTC (permalink / raw)
To: isar-users; +Cc: Roman Pletnev, Anton Mikanovich
From: Roman Pletnev <rpletnev@ilbers.de>
This patch adds options -o (output file) and -p (pid file).
Signed-off-by: Roman Pletnev <rpletnev@ilbers.de>
Signed-off-by: Anton Mikanovich <amikan@ilbers.de>
---
testsuite/start_vm.py | 16 ++++++++++++----
testsuite/vm_boot_test/vm_boot_test.py | 3 ++-
2 files changed, 14 insertions(+), 5 deletions(-)
diff --git a/testsuite/start_vm.py b/testsuite/start_vm.py
index c10db67..0abb9d5 100755
--- a/testsuite/start_vm.py
+++ b/testsuite/start_vm.py
@@ -21,7 +21,7 @@ def get_bitbake_var(output, var):
ret = line.split('"')[1]
return ret
-def format_qemu_cmdline(arch, build, distro):
+def format_qemu_cmdline(arch, build, distro, out, pid):
bb_output = get_bitbake_env(arch, distro).decode()
rootfs_image = ''
@@ -57,6 +57,11 @@ def format_qemu_cmdline(arch, build, distro):
qemu_cpu = get_bitbake_var(bb_output, 'QEMU_CPU')
qemu_disk_args = get_bitbake_var(bb_output, 'QEMU_DISK_ARGS')
+ if out:
+ extra_args.extend(['-serial', out])
+ if pid:
+ extra_args.extend(['-pidfile', pid])
+
qemu_disk_args = qemu_disk_args.replace('##ROOTFS_IMAGE##', deploy_dir_image + '/' + rootfs_image).split()
cmd = ['qemu-system-' + qemu_arch, '-m', '1024M']
@@ -72,10 +77,11 @@ def format_qemu_cmdline(arch, build, distro):
return cmd
-def start_qemu(arch, build, distro):
- cmdline = format_qemu_cmdline(arch, build, distro)
+def start_qemu(arch, build, distro, out, pid):
+ cmdline = format_qemu_cmdline(arch, build, distro, out, pid)
cmdline.insert(1, '-nographic')
+ print(cmdline)
p1 = subprocess.call(cmdline)
if __name__ == "__main__":
@@ -83,6 +89,8 @@ if __name__ == "__main__":
parser.add_argument('-a', '--arch', choices=['arm', 'arm64', 'amd64', 'i386'], help='set isar machine architecture.', default='arm')
parser.add_argument('-b', '--build', help='set path to build directory.', default=os.getcwd())
parser.add_argument('-d', '--distro', choices=['jessie', 'stretch'], help='set isar Debian distribution.', default='stretch')
+ parser.add_argument('-o', '--out', help='Route QEMU console output to specified file.')
+ parser.add_argument('-p', '--pid', help='Store QEMU pid to specified file.')
args = parser.parse_args()
- start_qemu(args.arch, args.build, args.distro)
+ start_qemu(args.arch, args.build, args.distro, args.out, args.pid)
diff --git a/testsuite/vm_boot_test/vm_boot_test.py b/testsuite/vm_boot_test/vm_boot_test.py
index d4849c7..f1b7b1f 100644
--- a/testsuite/vm_boot_test/vm_boot_test.py
+++ b/testsuite/vm_boot_test/vm_boot_test.py
@@ -30,7 +30,8 @@ class VmBootTest(Test):
if os.path.exists(output_file):
os.remove(output_file)
- cmdline = start_vm.format_qemu_cmdline(arch, build_dir, distro)
+ cmdline = start_vm.format_qemu_cmdline(arch, build_dir, distro,
+ None, None)
cmdline.insert(1, '-nographic')
cmdline.append('-serial')
cmdline.append('file:' + output_file)
--
2.25.1
^ permalink raw reply [flat|nested] 15+ messages in thread
* [PATCH v3 03/11] start_vm.py: Add MIPS support
2021-03-17 14:52 [PATCH v3 00/11] Update Avocado testsuite Anton Mikanovich
2021-03-17 14:52 ` [PATCH v3 01/11] start_vm.py: Fix target name handling Anton Mikanovich
2021-03-17 14:52 ` [PATCH v3 02/11] start_vm.py: Add output and PID file vm_start.py options Anton Mikanovich
@ 2021-03-17 14:52 ` Anton Mikanovich
2021-03-17 14:52 ` [PATCH v3 04/11] vm_boot_test: Fix log file path in vm_boot_test Anton Mikanovich
` (7 subsequent siblings)
10 siblings, 0 replies; 15+ messages in thread
From: Anton Mikanovich @ 2021-03-17 14:52 UTC (permalink / raw)
To: isar-users; +Cc: Roman Pletnev, Anton Mikanovich
From: Roman Pletnev <rpletnev@ilbers.de>
This patch adds mipsel to the list of supported architectures.
Signed-off-by: Roman Pletnev <rpletnev@ilbers.de>
Signed-off-by: Anton Mikanovich <amikan@ilbers.de>
---
testsuite/start_vm.py | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/testsuite/start_vm.py b/testsuite/start_vm.py
index 0abb9d5..dce140e 100755
--- a/testsuite/start_vm.py
+++ b/testsuite/start_vm.py
@@ -86,7 +86,7 @@ def start_qemu(arch, build, distro, out, pid):
if __name__ == "__main__":
parser = argparse.ArgumentParser()
- parser.add_argument('-a', '--arch', choices=['arm', 'arm64', 'amd64', 'i386'], help='set isar machine architecture.', default='arm')
+ parser.add_argument('-a', '--arch', choices=['arm', 'arm64', 'amd64', 'i386', 'mipsel'], help='set isar machine architecture.', default='arm')
parser.add_argument('-b', '--build', help='set path to build directory.', default=os.getcwd())
parser.add_argument('-d', '--distro', choices=['jessie', 'stretch'], help='set isar Debian distribution.', default='stretch')
parser.add_argument('-o', '--out', help='Route QEMU console output to specified file.')
--
2.25.1
^ permalink raw reply [flat|nested] 15+ messages in thread
* [PATCH v3 04/11] vm_boot_test: Fix log file path in vm_boot_test
2021-03-17 14:52 [PATCH v3 00/11] Update Avocado testsuite Anton Mikanovich
` (2 preceding siblings ...)
2021-03-17 14:52 ` [PATCH v3 03/11] start_vm.py: Add MIPS support Anton Mikanovich
@ 2021-03-17 14:52 ` Anton Mikanovich
2021-03-17 14:52 ` [PATCH v3 05/11] vm_boot_test: Remove external varianter Anton Mikanovich
` (6 subsequent siblings)
10 siblings, 0 replies; 15+ messages in thread
From: Anton Mikanovich @ 2021-03-17 14:52 UTC (permalink / raw)
To: isar-users; +Cc: Anton Mikanovich
Make log filename random and store it in build folder.
Signed-off-by: Anton Mikanovich <amikan@ilbers.de>
---
testsuite/vm_boot_test/vm_boot_test.py | 7 ++++---
1 file changed, 4 insertions(+), 3 deletions(-)
diff --git a/testsuite/vm_boot_test/vm_boot_test.py b/testsuite/vm_boot_test/vm_boot_test.py
index f1b7b1f..c937a16 100644
--- a/testsuite/vm_boot_test/vm_boot_test.py
+++ b/testsuite/vm_boot_test/vm_boot_test.py
@@ -4,6 +4,7 @@ import os
import subprocess32
import sys
import time
+import tempfile
from os.path import dirname
sys.path.append(dirname(__file__) + '/..')
@@ -26,9 +27,9 @@ class VmBootTest(Test):
self.log.info('Isar build folder is: ' + build_dir)
self.log.info('===================================================')
- output_file = '/tmp/vm_boot_test.log'
- if os.path.exists(output_file):
- os.remove(output_file)
+ fd, output_file = tempfile.mkstemp(suffix='_log.txt',
+ prefix='vm_start_' + distro + '_' +
+ arch + '_', dir=build_dir, text=True)
cmdline = start_vm.format_qemu_cmdline(arch, build_dir, distro,
None, None)
--
2.25.1
^ permalink raw reply [flat|nested] 15+ messages in thread
* [PATCH v3 05/11] vm_boot_test: Remove external varianter
2021-03-17 14:52 [PATCH v3 00/11] Update Avocado testsuite Anton Mikanovich
` (3 preceding siblings ...)
2021-03-17 14:52 ` [PATCH v3 04/11] vm_boot_test: Fix log file path in vm_boot_test Anton Mikanovich
@ 2021-03-17 14:52 ` Anton Mikanovich
2021-03-17 14:52 ` [PATCH v3 06/11] vm_boot_test: Improve QEMU images checking Anton Mikanovich
` (5 subsequent siblings)
10 siblings, 0 replies; 15+ messages in thread
From: Anton Mikanovich @ 2021-03-17 14:52 UTC (permalink / raw)
To: isar-users; +Cc: Anton Mikanovich
To get rid of avocado-framework-plugin-varianter-yaml-to-mux pip
dependency we should not use yaml-to-mux parameters.
Signed-off-by: Anton Mikanovich <amikan@ilbers.de>
---
testsuite/vm_boot_test/run.sh | 3 --
testsuite/vm_boot_test/run_fast.sh | 3 ++
testsuite/vm_boot_test/run_full.sh | 3 ++
testsuite/vm_boot_test/variant.yaml | 22 -------------
testsuite/vm_boot_test/vm_boot_test.py | 45 +++++++++++++++++++++++---
5 files changed, 46 insertions(+), 30 deletions(-)
delete mode 100755 testsuite/vm_boot_test/run.sh
create mode 100755 testsuite/vm_boot_test/run_fast.sh
create mode 100755 testsuite/vm_boot_test/run_full.sh
delete mode 100644 testsuite/vm_boot_test/variant.yaml
diff --git a/testsuite/vm_boot_test/run.sh b/testsuite/vm_boot_test/run.sh
deleted file mode 100755
index 9fdda95..0000000
--- a/testsuite/vm_boot_test/run.sh
+++ /dev/null
@@ -1,3 +0,0 @@
-#!/bin/bash
-
-avocado run vm_boot_test.py --mux-yaml test:variant.yaml --mux-inject build_dir:$BUILDDIR time_to_wait:300
diff --git a/testsuite/vm_boot_test/run_fast.sh b/testsuite/vm_boot_test/run_fast.sh
new file mode 100755
index 0000000..0fc77b3
--- /dev/null
+++ b/testsuite/vm_boot_test/run_fast.sh
@@ -0,0 +1,3 @@
+#!/bin/bash
+
+avocado run vm_boot_test.py -t fast -p build_dir="$BUILDDIR" -p time_to_wait=300
diff --git a/testsuite/vm_boot_test/run_full.sh b/testsuite/vm_boot_test/run_full.sh
new file mode 100755
index 0000000..a561a36
--- /dev/null
+++ b/testsuite/vm_boot_test/run_full.sh
@@ -0,0 +1,3 @@
+#!/bin/bash
+
+avocado run vm_boot_test.py -t full -p build_dir="$BUILDDIR" -p time_to_wait=300
diff --git a/testsuite/vm_boot_test/variant.yaml b/testsuite/vm_boot_test/variant.yaml
deleted file mode 100644
index 9ddc634..0000000
--- a/testsuite/vm_boot_test/variant.yaml
+++ /dev/null
@@ -1,22 +0,0 @@
-variants: !mux
- stretch-amd64:
- distro: "stretch"
- arch: "amd64"
- stretch-i386:
- distro: "stretch"
- arch: "i386"
- stretch-arm:
- distro: "stretch"
- arch: "arm"
- stretch-arm64:
- distro: "stretch"
- arch: "arm64"
- buster-amd64:
- distro: "buster"
- arch: "amd64"
- buster-i386:
- distro: "buster"
- arch: "i386"
- buster-arm:
- distro: "buster"
- arch: "arm"
diff --git a/testsuite/vm_boot_test/vm_boot_test.py b/testsuite/vm_boot_test/vm_boot_test.py
index c937a16..73fee3e 100644
--- a/testsuite/vm_boot_test/vm_boot_test.py
+++ b/testsuite/vm_boot_test/vm_boot_test.py
@@ -13,13 +13,10 @@ import start_vm
from avocado import Test
-class VmBootTest(Test):
+class VmBase(Test):
- def test(self):
- # TODO: add default values
+ def vm_start(self, arch='amd64', distro='buster'):
build_dir = self.params.get('build_dir', default='.')
- arch = self.params.get('arch', default='arm')
- distro = self.params.get('distro', default='stretch')
time_to_wait = self.params.get('time_to_wait', default=60)
self.log.info('===================================================')
@@ -51,3 +48,41 @@ class VmBootTest(Test):
return
self.fail('Test failed')
+
+class VmBootTestFast(VmBase):
+
+ """
+ Test QEMU image start (fast)
+
+ :avocado: tags=fast,full
+ """
+ def test_arm_stretch(self):
+ self.vm_start('arm','stretch')
+
+ def test_arm_buster(self):
+ self.vm_start('arm','buster')
+
+ def test_arm64_stretch(self):
+ self.vm_start('arm64','stretch')
+
+ def test_amd64_stretch(self):
+ self.vm_start('amd64','stretch')
+
+class VmBootTestFull(VmBase):
+
+ """
+ Test QEMU image start (full)
+
+ :avocado: tags=full
+ """
+ def test_i386_stretch(self):
+ self.vm_start('i386','stretch')
+
+ def test_i386_buster(self):
+ self.vm_start('i386','buster')
+
+ def test_amd64_buster(self):
+ self.vm_start('amd64','buster')
+
+ def test_amd64_focal(self):
+ self.vm_start('amd64','focal')
--
2.25.1
^ permalink raw reply [flat|nested] 15+ messages in thread
* [PATCH v3 06/11] vm_boot_test: Improve QEMU images checking
2021-03-17 14:52 [PATCH v3 00/11] Update Avocado testsuite Anton Mikanovich
` (4 preceding siblings ...)
2021-03-17 14:52 ` [PATCH v3 05/11] vm_boot_test: Remove external varianter Anton Mikanovich
@ 2021-03-17 14:52 ` Anton Mikanovich
2021-03-17 14:52 ` [PATCH v3 07/11] build_test: Refactoring build tests cases Anton Mikanovich
` (4 subsequent siblings)
10 siblings, 0 replies; 15+ messages in thread
From: Anton Mikanovich @ 2021-03-17 14:52 UTC (permalink / raw)
To: isar-users; +Cc: Anton Mikanovich
Makes QEMU start test to analyze boot log in real-time. It helps test
cases to finish as soon as booting succeeds and do not wasting time on
waiting.
Get rid of python-subprocess32 backport package.
Signed-off-by: Anton Mikanovich <amikan@ilbers.de>
---
testsuite/vm_boot_test/vm_boot_test.py | 59 ++++++++++++++++++++------
1 file changed, 47 insertions(+), 12 deletions(-)
diff --git a/testsuite/vm_boot_test/vm_boot_test.py b/testsuite/vm_boot_test/vm_boot_test.py
index 73fee3e..4c1b6fe 100644
--- a/testsuite/vm_boot_test/vm_boot_test.py
+++ b/testsuite/vm_boot_test/vm_boot_test.py
@@ -1,7 +1,8 @@
#!/usr/bin/env python3
import os
-import subprocess32
+import select
+import subprocess
import sys
import time
import tempfile
@@ -13,6 +14,9 @@ import start_vm
from avocado import Test
+class CanBeFinished(Exception):
+ pass
+
class VmBase(Test):
def vm_start(self, arch='amd64', distro='buster'):
@@ -31,23 +35,54 @@ class VmBase(Test):
cmdline = start_vm.format_qemu_cmdline(arch, build_dir, distro,
None, None)
cmdline.insert(1, '-nographic')
+ cmdline.append('-chardev')
+ cmdline.append('stdio,id=ch0,logfile=' + output_file)
cmdline.append('-serial')
- cmdline.append('file:' + output_file)
+ cmdline.append('chardev:ch0')
+ cmdline.append('-monitor')
+ cmdline.append('none')
self.log.info('QEMU boot line: ' + str(cmdline))
- devnull = open(os.devnull, 'w')
-
- p1 = subprocess32.Popen(cmdline, stdout=devnull, stderr=devnull)
- time.sleep(int(time_to_wait))
- p1.kill()
- p1.wait()
+ login_prompt = b'isar login:'
+ service_prompt = b'Just an example'
+
+ timeout = time.time() + int(time_to_wait)
+
+ p1 = subprocess.Popen(cmdline, stdout=subprocess.PIPE,
+ stderr=subprocess.PIPE)
+ try:
+ poller = select.poll()
+ poller.register(p1.stdout, select.POLLIN)
+ poller.register(p1.stderr, select.POLLIN)
+ while time.time() < timeout and p1.poll() is None:
+ events = poller.poll(1000 * (timeout - time.time()))
+ for fd, event in events:
+ if fd == p1.stdout.fileno():
+ # Wait for the complete string if it is read in chunks
+ # like "i", "sar", " login:"
+ time.sleep(0.01)
+ data = os.read(fd, 1024)
+ if login_prompt in data:
+ raise CanBeFinished
+ if fd == p1.stderr.fileno():
+ self.log.error(p1.stderr.readline())
+ except CanBeFinished:
+ self.log.debug('Got login prompt')
+ finally:
+ if p1.poll() is None:
+ p1.kill()
+ p1.wait()
if os.path.exists(output_file):
- if 'isar login:' in open(output_file).read():
- return
-
- self.fail('Test failed')
+ with open(output_file, "rb") as f1:
+ data = f1.read()
+ if service_prompt in data and login_prompt in data:
+ return
+ else:
+ self.log.error(data)
+
+ self.fail('Log ' + output_file)
class VmBootTestFast(VmBase):
--
2.25.1
^ permalink raw reply [flat|nested] 15+ messages in thread
* [PATCH v3 07/11] build_test: Refactoring build tests cases
2021-03-17 14:52 [PATCH v3 00/11] Update Avocado testsuite Anton Mikanovich
` (5 preceding siblings ...)
2021-03-17 14:52 ` [PATCH v3 06/11] vm_boot_test: Improve QEMU images checking Anton Mikanovich
@ 2021-03-17 14:52 ` Anton Mikanovich
2021-03-17 14:52 ` [PATCH v3 08/11] testsuite: Add Python generations for testsuite in gitignore Anton Mikanovich
` (3 subsequent siblings)
10 siblings, 0 replies; 15+ messages in thread
From: Anton Mikanovich @ 2021-03-17 14:52 UTC (permalink / raw)
To: isar-users; +Cc: Anton Mikanovich
Split build test into classes and separate cases. Implement test cases
tagging for external configuring. Also remove the usage of external
varianter plugin.
In this step, all ci_build test cases were copied as-is without
functional changes.
Signed-off-by: Anton Mikanovich <amikan@ilbers.de>
---
testsuite/build_test/build_test.py | 137 ++++++++++++++++++++++++-----
testsuite/build_test/cibase.py | 121 +++++++++++++++++++++++++
testsuite/build_test/cibuilder.py | 79 +++++++++++++++++
testsuite/build_test/run.sh | 3 -
testsuite/build_test/run_fast.sh | 3 +
testsuite/build_test/run_full.sh | 3 +
testsuite/build_test/variant.yaml | 22 -----
7 files changed, 323 insertions(+), 45 deletions(-)
create mode 100644 testsuite/build_test/cibase.py
create mode 100644 testsuite/build_test/cibuilder.py
delete mode 100755 testsuite/build_test/run.sh
create mode 100755 testsuite/build_test/run_fast.sh
create mode 100755 testsuite/build_test/run_full.sh
delete mode 100644 testsuite/build_test/variant.yaml
diff --git a/testsuite/build_test/build_test.py b/testsuite/build_test/build_test.py
index 7a55c2f..bc33fce 100644
--- a/testsuite/build_test/build_test.py
+++ b/testsuite/build_test/build_test.py
@@ -1,29 +1,126 @@
#!/usr/bin/env python3
import os
-import subprocess32
-import sys
-from os.path import dirname
-from avocado import Test
+from cibase import CIBaseTest
-class BuildTest(Test):
+class ReproTest(CIBaseTest):
- def test(self):
- # TODO: add default values
- build_dir = self.params.get('build_dir', default='.')
- arch = self.params.get('arch', default='arm')
- distro = self.params.get('distro', default='stretch')
+ """
+ Test cached base repository
- self.log.info('===================================================')
- self.log.info('Running Isar build test for (' + distro + '-' + arch + ')')
- self.log.info('Isar build folder is: ' + build_dir)
- self.log.info('===================================================')
+ :avocado: tags=repro,fast,full
+ """
+ def test_repro(self):
+ targets_signed = ['mc:de0-nano-soc-buster:isar-image-base',
+ 'mc:qemuarm64-stretch:isar-image-base']
- #isar_root = dirname(__file__) + '/..'
- os.chdir(build_dir)
- cmdline = ['bitbake', 'mc:qemu' + arch + '-' + distro + ':isar-image-base']
- p1 = subprocess32.run(cmdline)
+ targets_unsigned = ['mc:qemuamd64-stretch:isar-image-base',
+ 'mc:qemuarm-stretch:isar-image-base']
+
+ is_cross_build = self.params.get('cross', default=0)
+
+ self.perform_repro_test(targets_signed, is_cross_build, 1)
+ self.perform_repro_test(targets_unsigned, is_cross_build, 0)
+
+class CrossTest(CIBaseTest):
+
+ """
+ Start cross build for the defined set of configurations
+
+ :avocado: tags=cross,fast,full
+ """
+ def test_cross(self):
+ targets = ['mc:qemuarm-stretch:isar-image-base',
+ 'mc:qemuarm-buster:isar-image-base',
+ 'mc:qemuarm64-stretch:isar-image-base',
+ 'mc:qemuamd64-stretch:isar-image-base',
+ 'mc:de0-nano-soc-buster:isar-image-base',
+ 'mc:stm32mp15x-buster:isar-image-base',
+ 'mc:rpi-stretch:isar-image-base',
+ 'mc:qemuarm64-focal:isar-image-base',
+ 'mc:qemuarm-bullseye:isar-image-base']
+
+ self.perform_build_test(targets, 1, None)
+
+class SdkTest(CIBaseTest):
+
+ """
+ In addition test SDK creation
+
+ :avocado: tags=sdk,fast,full
+ """
+ def test_sdk(self):
+ self.perform_build_test('mc:qemuarm-stretch:isar-image-base',
+ 1, 'do_populate_sdk')
+
+class NoCrossTest(CIBaseTest):
+
+ """
+ Start non-cross build for the defined set of configurations
+
+ :avocado: tags=nocross,full
+ """
+ def test_nocross(self):
+ targets = ['mc:qemuarm-stretch:isar-image-base',
+ 'mc:qemuarm-buster:isar-image-base',
+ 'mc:qemuarm64-stretch:isar-image-base',
+ 'mc:qemui386-stretch:isar-image-base',
+ 'mc:qemui386-buster:isar-image-base',
+ 'mc:qemuamd64-stretch:isar-image-base',
+ 'mc:qemuamd64-buster:isar-image-base',
+ 'mc:qemuamd64-buster-tgz:isar-image-base',
+ 'mc:qemuamd64-buster:isar-initramfs',
+ 'mc:qemumipsel-stretch:isar-image-base',
+ 'mc:qemumipsel-buster:isar-image-base',
+ 'mc:nand-ubi-demo-buster:isar-image-ubi',
+ 'mc:rpi-stretch:isar-image-base',
+ 'mc:qemuamd64-focal:isar-image-base',
+ 'mc:qemuamd64-bullseye:isar-image-base',
+ 'mc:qemuarm-bullseye:isar-image-base',
+ 'mc:qemui386-bullseye:isar-image-base',
+ 'mc:qemumipsel-bullseye:isar-image-base']
+
+ self.perform_build_test(targets, 0, None)
+
+class RebuildTest(CIBaseTest):
+
+ """
+ Test image rebuild
+
+ :avocado: tags=rebuild,fast,full
+ """
+ def test_rebuild(self):
+ is_cross_build = self.params.get('cross', default=0)
+
+ layerdir_core = self.getlayerdir('core')
+
+ dpkgbase_file = layerdir_core + '/classes/dpkg-base.bbclass'
+
+ self.backupfile(dpkgbase_file)
+ with open(dpkgbase_file, 'a') as file:
+ file.write('do_fetch_append() {\n\n}')
+
+ try:
+ self.perform_build_test('mc:qemuamd64-stretch:isar-image-base',
+ is_cross_build, None)
+ finally:
+ self.restorefile(dpkgbase_file)
+
+class WicTest(CIBaseTest):
+
+ """
+ Test wic --exclude-path
+
+ :avocado: tags=wic,fast,full
+ """
+ def test_wic_exclude(self):
+ is_cross_build = self.params.get('cross', default=0)
+
+ # TODO: remove hardcoded filenames
+ wks_path = '/scripts/lib/wic/canned-wks/sdimage-efi.wks'
+ wic_path = '/tmp/deploy/images/qemuamd64/isar-image-base-debian-stretch-qemuamd64.wic.img'
+
+ self.perform_wic_test('mc:qemuamd64-stretch:isar-image-base',
+ is_cross_build, wks_path, wic_path)
- if p1.returncode:
- self.fail('Test failed')
diff --git a/testsuite/build_test/cibase.py b/testsuite/build_test/cibase.py
new file mode 100644
index 0000000..68debca
--- /dev/null
+++ b/testsuite/build_test/cibase.py
@@ -0,0 +1,121 @@
+#!/usr/bin/env python3
+
+import os
+import re
+import tempfile
+
+from cibuilder import CIBuilder
+from avocado.utils import process
+
+isar_root = os.path.dirname(__file__) + '/../..'
+
+class CIBaseTest(CIBuilder):
+
+ def perform_build_test(self, targets, cross, bitbake_cmd):
+ build_dir = self.params.get('build_dir', default=isar_root + '/build')
+ quiet = self.params.get('quiet', default=None)
+ bitbake_args = '-v'
+
+ if quiet:
+ bitbake_args = ''
+
+ self.log.info('===================================================')
+ self.log.info('Running Isar build test for:')
+ self.log.info(targets)
+ self.log.info('Isar build folder is: ' + build_dir)
+ self.log.info('===================================================')
+
+ self.init(build_dir)
+ self.confprepare(build_dir, 1, cross, 1)
+
+ self.log.info('Starting build...')
+
+ self.bitbake(build_dir, targets, bitbake_cmd, bitbake_args)
+
+ def perform_repro_test(self, targets, cross, signed):
+ build_dir = self.params.get('build_dir', default=isar_root + '/build')
+ quiet = self.params.get('quiet', default=None)
+ bitbake_args = '-v'
+
+ if quiet:
+ bitbake_args = ''
+
+ self.log.info('===================================================')
+ self.log.info('Running repro Isar build test for:')
+ self.log.info(targets)
+ self.log.info('Isar build folder is: ' + build_dir)
+ self.log.info('===================================================')
+
+ self.init(build_dir)
+ self.confprepare(build_dir, 1, cross, 1)
+
+ gpg_pub_key = os.path.dirname(__file__) + '/../base-apt/test_pub.key'
+ gpg_priv_key = os.path.dirname(__file__) + '/../base-apt/test_priv.key'
+
+ if signed:
+ with open(build_dir + '/conf/ci_build.conf', 'a') as file:
+ # Enable use of signed cached base repository
+ file.write('BASE_REPO_KEY="file://' + gpg_pub_key + '"\n')
+
+ os.chdir(build_dir)
+
+ os.environ['GNUPGHOME'] = tempfile.mkdtemp()
+ result = process.run('gpg --import %s %s' % (gpg_pub_key, gpg_priv_key))
+
+ if result.exit_status:
+ self.fail('GPG import failed')
+
+ self.bitbake(build_dir, targets, None, bitbake_args)
+
+ self.deletetmp(build_dir)
+ with open(build_dir + '/conf/ci_build.conf', 'a') as file:
+ file.write('ISAR_USE_CACHED_BASE_REPO = "1"\n')
+ file.write('BB_NO_NETWORK = "1"\n')
+
+ self.bitbake(build_dir, targets, None, bitbake_args)
+
+ # Cleanup and disable use of signed cached base repository
+ self.deletetmp(build_dir)
+ self.confcleanup(build_dir)
+
+ def perform_wic_test(self, targets, cross, wks_path, wic_path):
+ build_dir = self.params.get('build_dir', default=isar_root + '/build')
+ quiet = self.params.get('quiet', default=None)
+ bitbake_args = '-v'
+
+ if quiet:
+ bitbake_args = ''
+
+ self.log.info('===================================================')
+ self.log.info('Running WIC exclude build test for:')
+ self.log.info(targets)
+ self.log.info('Isar build folder is: ' + build_dir)
+ self.log.info('===================================================')
+
+ self.init(build_dir)
+ self.confprepare(build_dir, 1, cross, 1)
+
+ layerdir_isar = self.getlayerdir('isar')
+
+ wks_file = layerdir_isar + wks_path
+ wic_img = build_dir + wic_path
+
+ if not os.path.isfile(wic_img):
+ self.fail('Build was not performed before: ' + wic_img + ' not exist')
+
+ self.backupfile(wks_file)
+ self.backupmove(wic_img)
+
+ with open(wks_file, 'r') as file:
+ lines = file.readlines()
+ with open(wks_file, 'w') as file:
+ for line in lines:
+ file.write(re.sub(r'part \/ ', 'part \/ --exclude-path usr ', line))
+
+ try:
+ self.bitbake(build_dir, targets, None, bitbake_args)
+ finally:
+ self.restorefile(wks_file)
+
+ self.restorefile(wic_img)
+
diff --git a/testsuite/build_test/cibuilder.py b/testsuite/build_test/cibuilder.py
new file mode 100644
index 0000000..85a5678
--- /dev/null
+++ b/testsuite/build_test/cibuilder.py
@@ -0,0 +1,79 @@
+#!/usr/bin/env python3
+
+import os
+import shutil
+
+from avocado import Test
+from avocado.utils import path
+from avocado.utils import process
+
+isar_root = os.path.dirname(__file__) + '/../..'
+
+class CIBuilder(Test):
+
+ def init(self, build_dir):
+ os.chdir(isar_root)
+ output = process.getoutput('/bin/bash -c "source isar-init-build-env \
+ %s 2>&1 >/dev/null; env"' % build_dir)
+ env = dict((line.split("=", 1) for line in output.splitlines()))
+ os.environ.update(env)
+
+ def confprepare(self, build_dir, compat_arch, cross, debsrc_cache):
+ with open(build_dir + '/conf/ci_build.conf', 'w') as file:
+ if compat_arch:
+ file.write('ISAR_ENABLE_COMPAT_ARCH_amd64 = "1"\n')
+ file.write('ISAR_ENABLE_COMPAT_ARCH_arm64 = "1"\n')
+ file.write('ISAR_ENABLE_COMPAT_ARCH_debian-stretch_amd64 = "0"\n')
+ if cross:
+ file.write('ISAR_CROSS_COMPILE = "1"\n')
+ if debsrc_cache:
+ file.write('BASE_REPO_FEATURES = "cache-deb-src"\n')
+
+ with open(build_dir + '/conf/local.conf', 'r+') as file:
+ for line in file:
+ if 'include ci_build.conf' in line:
+ break
+ else:
+ file.write('\ninclude ci_build.conf')
+
+ def confcleanup(self, build_dir):
+ open(build_dir + '/conf/ci_build.conf', 'w').close()
+
+ def deletetmp(self, build_dir):
+ process.run('rm -rf ' + build_dir + '/tmp', sudo=True)
+
+ def bitbake(self, build_dir, target, cmd, args):
+ os.chdir(build_dir)
+ cmdline = ['bitbake']
+ if args:
+ cmdline.append(args)
+ if cmd:
+ cmdline.append('-c')
+ cmdline.append(cmd)
+ if isinstance(target, list):
+ cmdline.extend(target)
+ else:
+ cmdline.append(target)
+
+ process.run(" ".join(cmdline))
+
+ def backupfile(self, path):
+ shutil.copy2(path, path + '.ci-backup')
+
+ def backupmove(self, path):
+ shutil.move(path, path + '.ci-backup')
+
+ def restorefile(self, path):
+ shutil.move(path + '.ci-backup', path)
+
+ def getlayerdir(self, layer):
+ try:
+ path.find_command('bitbake')
+ except path.CmdNotFoundError:
+ build_dir = self.params.get('build_dir', default=isar_root + '/build')
+ self.init(build_dir)
+ output = process.getoutput('bitbake -e | grep "^LAYERDIR_.*="')
+ bitbake_env = dict((line.split("=", 1) for line in output.splitlines()))
+
+ return bitbake_env['LAYERDIR_' + layer].strip('"')
+
diff --git a/testsuite/build_test/run.sh b/testsuite/build_test/run.sh
deleted file mode 100755
index a8ea9cc..0000000
--- a/testsuite/build_test/run.sh
+++ /dev/null
@@ -1,3 +0,0 @@
-#!/bin/bash
-
-avocado run build_test.py --mux-yaml test:variant.yaml --mux-inject build_dir:$BUILDDIR
diff --git a/testsuite/build_test/run_fast.sh b/testsuite/build_test/run_fast.sh
new file mode 100755
index 0000000..4d1bf44
--- /dev/null
+++ b/testsuite/build_test/run_fast.sh
@@ -0,0 +1,3 @@
+#!/bin/bash
+
+avocado run build_test.py -t fast -p quiet=1 -p cross=1
diff --git a/testsuite/build_test/run_full.sh b/testsuite/build_test/run_full.sh
new file mode 100755
index 0000000..af5ec59
--- /dev/null
+++ b/testsuite/build_test/run_full.sh
@@ -0,0 +1,3 @@
+#!/bin/bash
+
+avocado run build_test.py -t full -p quiet=1
diff --git a/testsuite/build_test/variant.yaml b/testsuite/build_test/variant.yaml
deleted file mode 100644
index 9ddc634..0000000
--- a/testsuite/build_test/variant.yaml
+++ /dev/null
@@ -1,22 +0,0 @@
-variants: !mux
- stretch-amd64:
- distro: "stretch"
- arch: "amd64"
- stretch-i386:
- distro: "stretch"
- arch: "i386"
- stretch-arm:
- distro: "stretch"
- arch: "arm"
- stretch-arm64:
- distro: "stretch"
- arch: "arm64"
- buster-amd64:
- distro: "buster"
- arch: "amd64"
- buster-i386:
- distro: "buster"
- arch: "i386"
- buster-arm:
- distro: "buster"
- arch: "arm"
--
2.25.1
^ permalink raw reply [flat|nested] 15+ messages in thread
* [PATCH v3 08/11] testsuite: Add Python generations for testsuite in gitignore
2021-03-17 14:52 [PATCH v3 00/11] Update Avocado testsuite Anton Mikanovich
` (6 preceding siblings ...)
2021-03-17 14:52 ` [PATCH v3 07/11] build_test: Refactoring build tests cases Anton Mikanovich
@ 2021-03-17 14:52 ` Anton Mikanovich
2021-03-17 14:52 ` [PATCH v3 09/11] testsuite: Fix test suite prepare guide Anton Mikanovich
` (2 subsequent siblings)
10 siblings, 0 replies; 15+ messages in thread
From: Anton Mikanovich @ 2021-03-17 14:52 UTC (permalink / raw)
To: isar-users; +Cc: Anton Mikanovich
Ignore Python byte code auto generated files inside testsuite.
Signed-off-by: Anton Mikanovich <amikan@ilbers.de>
---
testsuite/.gitignore | 1 +
1 file changed, 1 insertion(+)
create mode 100644 testsuite/.gitignore
diff --git a/testsuite/.gitignore b/testsuite/.gitignore
new file mode 100644
index 0000000..0d20b64
--- /dev/null
+++ b/testsuite/.gitignore
@@ -0,0 +1 @@
+*.pyc
--
2.25.1
^ permalink raw reply [flat|nested] 15+ messages in thread
* [PATCH v3 09/11] testsuite: Fix test suite prepare guide
2021-03-17 14:52 [PATCH v3 00/11] Update Avocado testsuite Anton Mikanovich
` (7 preceding siblings ...)
2021-03-17 14:52 ` [PATCH v3 08/11] testsuite: Add Python generations for testsuite in gitignore Anton Mikanovich
@ 2021-03-17 14:52 ` Anton Mikanovich
2021-03-17 14:52 ` [PATCH v3 10/11] ci_build: Migrate to Avocado Anton Mikanovich
2021-03-17 14:52 ` [PATCH v3 11/11] vm_smoke_test: " Anton Mikanovich
10 siblings, 0 replies; 15+ messages in thread
From: Anton Mikanovich @ 2021-03-17 14:52 UTC (permalink / raw)
To: isar-users; +Cc: Anton Mikanovich
Remove deprecated yaml-to-mux plugin and yml variants from the doc.
Also remove subprocess32 backport installation which is not used.
Signed-off-by: Anton Mikanovich <amikan@ilbers.de>
---
testsuite/README.md | 21 +++------------------
1 file changed, 3 insertions(+), 18 deletions(-)
diff --git a/testsuite/README.md b/testsuite/README.md
index 5e64223..f91ea29 100644
--- a/testsuite/README.md
+++ b/testsuite/README.md
@@ -4,29 +4,14 @@ The framework could be installed by using standard HOWTO:
https://github.com/avocado-framework/avocado#installing-with-standard-python-tools
-Then you need to install varianter yaml-to-mux plugin by following these instructions:
-
- https://github.com/avocado-framework/avocado/tree/master/optional_plugins
-
-## For Debian 9.x
-
- $ sudo apt-get install python-pip
- $ pip install --user subprocess32
- $ pip install --user avocado-framework
- $ pip install --user avocado-framework-plugin-varianter-yaml-to-mux
-
-# Pre
-
- $ export PATH=$PATH:~/.local/bin
- $ cd isar
- $ source isar-init-build-env
+## For Debian (tested on Debian 10.x)
+ $ sudo dpkg -i avocado_85.0_all.deb
# Run test
Each testsuite directory contains:
- - run.sh - script to start tests
- - variants.yaml - set of input data
+ - run_*.sh - script to start tests
- *.py - test case
# Other
--
2.25.1
^ permalink raw reply [flat|nested] 15+ messages in thread
* [PATCH v3 10/11] ci_build: Migrate to Avocado
2021-03-17 14:52 [PATCH v3 00/11] Update Avocado testsuite Anton Mikanovich
` (8 preceding siblings ...)
2021-03-17 14:52 ` [PATCH v3 09/11] testsuite: Fix test suite prepare guide Anton Mikanovich
@ 2021-03-17 14:52 ` Anton Mikanovich
2021-03-17 14:56 ` Jan Kiszka
2021-03-17 14:52 ` [PATCH v3 11/11] vm_smoke_test: " Anton Mikanovich
10 siblings, 1 reply; 15+ messages in thread
From: Anton Mikanovich @ 2021-03-17 14:52 UTC (permalink / raw)
To: isar-users; +Cc: Anton Mikanovich
Call Avocado test cases instead of shell based.
Signed-off-by: Anton Mikanovich <amikan@ilbers.de>
---
scripts/ci_build.sh | 170 ++++----------------------
scripts/ci_build_legacy.sh | 239 +++++++++++++++++++++++++++++++++++++
2 files changed, 261 insertions(+), 148 deletions(-)
create mode 100755 scripts/ci_build_legacy.sh
diff --git a/scripts/ci_build.sh b/scripts/ci_build.sh
index 3868fb6..9abebb8 100755
--- a/scripts/ci_build.sh
+++ b/scripts/ci_build.sh
@@ -14,59 +14,12 @@ export PATH=$PATH:/sbin
# Go to Isar root
cd "$(dirname "$0")/.."
+# Get Avocado build tests path
+BUILD_TEST_DIR="$(pwd)/testsuite/build_test"
+
# Start build in Isar tree by default
BUILD_DIR=./build
-BB_ARGS="-v"
-
-TARGETS_SET="\
- mc:qemuarm-stretch:isar-image-base \
- mc:qemuarm-buster:isar-image-base \
- mc:qemuarm64-stretch:isar-image-base \
- mc:qemui386-stretch:isar-image-base \
- mc:qemui386-buster:isar-image-base \
- mc:qemuamd64-stretch:isar-image-base \
- mc:qemuamd64-buster:isar-image-base \
- mc:qemuamd64-buster-tgz:isar-image-base \
- mc:qemuamd64-buster:isar-initramfs \
- mc:qemumipsel-stretch:isar-image-base \
- mc:qemumipsel-buster:isar-image-base \
- mc:nand-ubi-demo-buster:isar-image-ubi \
- mc:rpi-stretch:isar-image-base \
- mc:qemuamd64-focal:isar-image-base"
- # qemu-user-static of <= buster too old to build that
- # mc:qemuarm64-buster:isar-image-base
- # mc:qemuarm64-bullseye:isar-image-base
-
-TARGETS_SET_BULLSEYE="\
- mc:qemuamd64-bullseye:isar-image-base \
- mc:qemuarm-bullseye:isar-image-base \
- mc:qemui386-bullseye:isar-image-base \
- mc:qemumipsel-bullseye:isar-image-base \
-"
-
-CROSS_TARGETS_SET="\
- mc:qemuarm-stretch:isar-image-base \
- mc:qemuarm-buster:isar-image-base \
- mc:qemuarm64-stretch:isar-image-base \
- mc:qemuamd64-stretch:isar-image-base \
- mc:de0-nano-soc-buster:isar-image-base \
- mc:stm32mp15x-buster:isar-image-base \
- mc:rpi-stretch:isar-image-base \
- mc:qemuarm64-focal:isar-image-base"
-
-CROSS_TARGETS_SET_BULLSEYE="\
- mc:qemuarm-bullseye:isar-image-base \
-"
-
-REPRO_TARGETS_SET_SIGNED="\
- mc:de0-nano-soc-buster:isar-image-base \
- mc:qemuarm64-stretch:isar-image-base"
-
-REPRO_TARGETS_SET="\
- mc:qemuamd64-stretch:isar-image-base \
- mc:qemuarm-buster:isar-image-base"
-
show_help() {
echo "This script builds the default Isar images."
echo
@@ -88,6 +41,10 @@ show_help() {
echo " 3 if invalid parameters are passed."
}
+TAGS="full"
+CROSS_BUILD="0"
+QUIET="0"
+
# Parse command line to get user configuration
while [ $# -gt 0 ]
do
@@ -106,16 +63,18 @@ do
CROSS_BUILD="1"
;;
-d|--debug)
- BB_ARGS="$BB_ARGS -D"
+ QUIET="0"
+ VERBOSE="--show-job-log"
;;
-f|--fast)
# Start build for the reduced set of configurations
# Enforce cross-compilation to speed up the build
- FAST_BUILD="1"
+ TAGS="fast"
CROSS_BUILD="1"
;;
-q|--quiet)
- BB_ARGS=""
+ QUIET="1"
+ VERBOSE=""
;;
-r|--repro)
REPRO_BUILD="1"
@@ -134,106 +93,21 @@ do
shift
done
+if [ -z "$REPRO_BUILD" ]; then
+ TAGS = "$TAGS,-repro"
+fi
+
+# Provide working path
+export VIRTUAL_ENV="./"
+
# the real stuff starts here, trace commands from now on
set -x
# Setup build folder for the current build
if [ ! -d "$BUILD_DIR" ]; then
- mkdir -p "$BUILD_DIR"
+ mkdir -p "$BUILD_DIR"
fi
source isar-init-build-env "$BUILD_DIR"
-cat >>conf/local.conf <<EOF
-ISAR_ENABLE_COMPAT_ARCH_amd64 = "1"
-ISAR_ENABLE_COMPAT_ARCH_arm64 = "1"
-ISAR_ENABLE_COMPAT_ARCH_debian-stretch_amd64 = "0"
-EOF
-
-if [ -n "$CROSS_BUILD" ]; then
- sed -i -e 's/ISAR_CROSS_COMPILE ?= "0"/ISAR_CROSS_COMPILE ?= "1"/g' conf/local.conf
-fi
-
-if [ -n "$REPRO_BUILD" ]; then
- ISAR_TESTSUITE_GPG_PUB_KEY_FILE="$TESTSUITEDIR/base-apt/test_pub.key"
- ISAR_TESTSUITE_GPG_PRIV_KEY_FILE="$TESTSUITEDIR/base-apt/test_priv.key"
- export GNUPGHOME=$(mktemp -d)
- gpg --import $ISAR_TESTSUITE_GPG_PUB_KEY_FILE $ISAR_TESTSUITE_GPG_PRIV_KEY_FILE
-
- # Enable use of signed cached base repository
- echo BASE_REPO_KEY=\"file://$ISAR_TESTSUITE_GPG_PUB_KEY_FILE\" >> conf/local.conf
- bitbake $BB_ARGS $REPRO_TARGETS_SET_SIGNED
- while [ -e bitbake.sock ]; do sleep 1; done
- sudo rm -rf tmp
- sed -i -e 's/#ISAR_USE_CACHED_BASE_REPO ?= "1"/ISAR_USE_CACHED_BASE_REPO ?= "1"/g' conf/local.conf
- sed -i -e 's/^#BB_NO_NETWORK/BB_NO_NETWORK/g' conf/local.conf
- bitbake $BB_ARGS $REPRO_TARGETS_SET_SIGNED
- while [ -e bitbake.sock ]; do sleep 1; done
- # Cleanup and disable use of signed cached base repository
- sudo rm -rf tmp
- sed -i -e 's/ISAR_USE_CACHED_BASE_REPO ?= "1"/#ISAR_USE_CACHED_BASE_REPO ?= "1"/g' conf/local.conf
- sed -i -e 's/^BB_NO_NETWORK/#BB_NO_NETWORK/g' conf/local.conf
- sed -i -e 's/^BASE_REPO_KEY/#BASE_REPO_KEY/g' conf/local.conf
-
- # Enable use of unsigned cached base repository
- bitbake $BB_ARGS $REPRO_TARGETS_SET
- while [ -e bitbake.sock ]; do sleep 1; done
- sudo rm -rf tmp
- sed -i -e 's/#ISAR_USE_CACHED_BASE_REPO ?= "1"/ISAR_USE_CACHED_BASE_REPO ?= "1"/g' conf/local.conf
- sed -i -e 's/^#BB_NO_NETWORK/BB_NO_NETWORK/g' conf/local.conf
- bitbake $BB_ARGS $REPRO_TARGETS_SET
- while [ -e bitbake.sock ]; do sleep 1; done
- # Cleanup and disable use of unsigned cached base repository
- sudo rm -rf tmp
- sed -i -e 's/ISAR_USE_CACHED_BASE_REPO ?= "1"/#ISAR_USE_CACHED_BASE_REPO ?= "1"/g' conf/local.conf
- sed -i -e 's/^BB_NO_NETWORK/#BB_NO_NETWORK/g' conf/local.conf
-fi
-
-sed -i -e 's/^#BASE_REPO_FEATURES ?= "cache-deb-src"/BASE_REPO_FEATURES ?= "cache-deb-src"/g' conf/local.conf
-# Start cross build for the defined set of configurations
-sed -i -e 's/ISAR_CROSS_COMPILE ?= "0"/ISAR_CROSS_COMPILE ?= "1"/g' conf/local.conf
-bitbake $BB_ARGS $CROSS_TARGETS_SET
-while [ -e bitbake.sock ]; do sleep 1; done
-if bitbake $BB_ARGS $CROSS_TARGETS_SET_BULLSEYE; then
- echo "bullseye cross: PASSED"
-else
- echo "bullseye cross: KFAIL"
-fi
-# In addition test SDK creation
-bitbake $BB_ARGS -c do_populate_sdk mc:qemuarm-stretch:isar-image-base
-while [ -e bitbake.sock ]; do sleep 1; done
-
-if [ -z "$FAST_BUILD" ]; then
- # Cleanup and disable cross build
- sudo rm -rf tmp
- sed -i -e 's/ISAR_CROSS_COMPILE ?= "1"/ISAR_CROSS_COMPILE ?= "0"/g' conf/local.conf
- bitbake $BB_ARGS $TARGETS_SET
- while [ -e bitbake.sock ]; do sleep 1; done
-
- if bitbake $BB_ARGS $TARGETS_SET_BULLSEYE; then
- echo "bullseye: PASSED"
- else
- echo "bullseye: KFAIL"
- fi
- while [ -e bitbake.sock ]; do sleep 1; done
-fi
-
-eval $(bitbake -e | grep "^LAYERDIR_core=")
-eval $(bitbake -e | grep "^LAYERDIR_isar=")
-cp -a "${LAYERDIR_core}/classes/dpkg-base.bbclass" "${LAYERDIR_core}/classes/dpkg-base.bbclass.ci-backup"
-echo -e "do_fetch_append() {\n\n}" >> "${LAYERDIR_core}/classes/dpkg-base.bbclass"
-
-bitbake $BB_ARGS mc:qemuamd64-stretch:isar-image-base
-
-mv "${LAYERDIR_core}/classes/dpkg-base.bbclass.ci-backup" "${LAYERDIR_core}/classes/dpkg-base.bbclass"
-
-# Test wic --exclude-path
-cp -a "${LAYERDIR_isar}/scripts/lib/wic/canned-wks/sdimage-efi.wks" "${LAYERDIR_isar}/scripts/lib/wic/canned-wks/sdimage-efi.wks.ci-backup"
-mv ${BUILDDIR}/tmp/deploy/images/qemuamd64/isar-image-base-debian-stretch-qemuamd64.wic.img \
- ${BUILDDIR}/tmp/deploy/images/qemuamd64/isar-image-base-debian-stretch-qemuamd64.wic.img.ci-backup
-sed -i -e 's/part \/ /part \/ --exclude-path usr /g' "${LAYERDIR_isar}/scripts/lib/wic/canned-wks/sdimage-efi.wks"
-
-bitbake $BB_ARGS mc:qemuamd64-stretch:isar-image-base
-
-mv "${LAYERDIR_isar}/scripts/lib/wic/canned-wks/sdimage-efi.wks.ci-backup" "${LAYERDIR_isar}/scripts/lib/wic/canned-wks/sdimage-efi.wks"
-mv ${BUILDDIR}/tmp/deploy/images/qemuamd64/isar-image-base-debian-stretch-qemuamd64.wic.img.ci-backup \
- ${BUILDDIR}/tmp/deploy/images/qemuamd64/isar-image-base-debian-stretch-qemuamd64.wic.img
+avocado run "$BUILD_TEST_DIR/build_test.py" -t $TAGS -p build_dir="$BUILD_DIR" \
+ -p quiet=$QUIET -p cross=$CROSS_BUILD $VERBOSE
diff --git a/scripts/ci_build_legacy.sh b/scripts/ci_build_legacy.sh
new file mode 100755
index 0000000..3868fb6
--- /dev/null
+++ b/scripts/ci_build_legacy.sh
@@ -0,0 +1,239 @@
+#!/usr/bin/env bash
+# Script for CI system build
+#
+# Alexander Smirnov <asmirnov@ilbers.de>
+# Copyright (c) 2016-2018 ilbers GmbH
+
+set -e
+
+ES_BUG=3
+
+# Export $PATH to use 'parted' tool
+export PATH=$PATH:/sbin
+
+# Go to Isar root
+cd "$(dirname "$0")/.."
+
+# Start build in Isar tree by default
+BUILD_DIR=./build
+
+BB_ARGS="-v"
+
+TARGETS_SET="\
+ mc:qemuarm-stretch:isar-image-base \
+ mc:qemuarm-buster:isar-image-base \
+ mc:qemuarm64-stretch:isar-image-base \
+ mc:qemui386-stretch:isar-image-base \
+ mc:qemui386-buster:isar-image-base \
+ mc:qemuamd64-stretch:isar-image-base \
+ mc:qemuamd64-buster:isar-image-base \
+ mc:qemuamd64-buster-tgz:isar-image-base \
+ mc:qemuamd64-buster:isar-initramfs \
+ mc:qemumipsel-stretch:isar-image-base \
+ mc:qemumipsel-buster:isar-image-base \
+ mc:nand-ubi-demo-buster:isar-image-ubi \
+ mc:rpi-stretch:isar-image-base \
+ mc:qemuamd64-focal:isar-image-base"
+ # qemu-user-static of <= buster too old to build that
+ # mc:qemuarm64-buster:isar-image-base
+ # mc:qemuarm64-bullseye:isar-image-base
+
+TARGETS_SET_BULLSEYE="\
+ mc:qemuamd64-bullseye:isar-image-base \
+ mc:qemuarm-bullseye:isar-image-base \
+ mc:qemui386-bullseye:isar-image-base \
+ mc:qemumipsel-bullseye:isar-image-base \
+"
+
+CROSS_TARGETS_SET="\
+ mc:qemuarm-stretch:isar-image-base \
+ mc:qemuarm-buster:isar-image-base \
+ mc:qemuarm64-stretch:isar-image-base \
+ mc:qemuamd64-stretch:isar-image-base \
+ mc:de0-nano-soc-buster:isar-image-base \
+ mc:stm32mp15x-buster:isar-image-base \
+ mc:rpi-stretch:isar-image-base \
+ mc:qemuarm64-focal:isar-image-base"
+
+CROSS_TARGETS_SET_BULLSEYE="\
+ mc:qemuarm-bullseye:isar-image-base \
+"
+
+REPRO_TARGETS_SET_SIGNED="\
+ mc:de0-nano-soc-buster:isar-image-base \
+ mc:qemuarm64-stretch:isar-image-base"
+
+REPRO_TARGETS_SET="\
+ mc:qemuamd64-stretch:isar-image-base \
+ mc:qemuarm-buster:isar-image-base"
+
+show_help() {
+ echo "This script builds the default Isar images."
+ echo
+ echo "Usage:"
+ echo " $0 [params]"
+ echo
+ echo "Parameters:"
+ echo " -b, --build BUILD_DIR set path to build directory. If not set,"
+ echo " the build will be started in current path."
+ echo " -c, --cross enable cross-compilation."
+ echo " -d, --debug enable debug bitbake output."
+ echo " -f, --fast cross build reduced set of configurations."
+ echo " -q, --quiet suppress verbose bitbake output."
+ echo " -r, --repro enable use of cached base repository."
+ echo " --help display this message and exit."
+ echo
+ echo "Exit status:"
+ echo " 0 if OK,"
+ echo " 3 if invalid parameters are passed."
+}
+
+# Parse command line to get user configuration
+while [ $# -gt 0 ]
+do
+ key="$1"
+
+ case $key in
+ -h|--help)
+ show_help
+ exit 0
+ ;;
+ -b|--build)
+ BUILD_DIR="$2"
+ shift
+ ;;
+ -c|--cross)
+ CROSS_BUILD="1"
+ ;;
+ -d|--debug)
+ BB_ARGS="$BB_ARGS -D"
+ ;;
+ -f|--fast)
+ # Start build for the reduced set of configurations
+ # Enforce cross-compilation to speed up the build
+ FAST_BUILD="1"
+ CROSS_BUILD="1"
+ ;;
+ -q|--quiet)
+ BB_ARGS=""
+ ;;
+ -r|--repro)
+ REPRO_BUILD="1"
+ # This switch is deprecated, just here to not cause failing CI on
+ # legacy configs
+ case "$2" in
+ -s|--sign) shift ;;
+ esac
+ ;;
+ *)
+ echo "error: invalid parameter '$key', please try '--help' to get list of supported parameters"
+ exit $ES_BUG
+ ;;
+ esac
+
+ shift
+done
+
+# the real stuff starts here, trace commands from now on
+set -x
+
+# Setup build folder for the current build
+if [ ! -d "$BUILD_DIR" ]; then
+ mkdir -p "$BUILD_DIR"
+fi
+source isar-init-build-env "$BUILD_DIR"
+
+cat >>conf/local.conf <<EOF
+ISAR_ENABLE_COMPAT_ARCH_amd64 = "1"
+ISAR_ENABLE_COMPAT_ARCH_arm64 = "1"
+ISAR_ENABLE_COMPAT_ARCH_debian-stretch_amd64 = "0"
+EOF
+
+if [ -n "$CROSS_BUILD" ]; then
+ sed -i -e 's/ISAR_CROSS_COMPILE ?= "0"/ISAR_CROSS_COMPILE ?= "1"/g' conf/local.conf
+fi
+
+if [ -n "$REPRO_BUILD" ]; then
+ ISAR_TESTSUITE_GPG_PUB_KEY_FILE="$TESTSUITEDIR/base-apt/test_pub.key"
+ ISAR_TESTSUITE_GPG_PRIV_KEY_FILE="$TESTSUITEDIR/base-apt/test_priv.key"
+ export GNUPGHOME=$(mktemp -d)
+ gpg --import $ISAR_TESTSUITE_GPG_PUB_KEY_FILE $ISAR_TESTSUITE_GPG_PRIV_KEY_FILE
+
+ # Enable use of signed cached base repository
+ echo BASE_REPO_KEY=\"file://$ISAR_TESTSUITE_GPG_PUB_KEY_FILE\" >> conf/local.conf
+ bitbake $BB_ARGS $REPRO_TARGETS_SET_SIGNED
+ while [ -e bitbake.sock ]; do sleep 1; done
+ sudo rm -rf tmp
+ sed -i -e 's/#ISAR_USE_CACHED_BASE_REPO ?= "1"/ISAR_USE_CACHED_BASE_REPO ?= "1"/g' conf/local.conf
+ sed -i -e 's/^#BB_NO_NETWORK/BB_NO_NETWORK/g' conf/local.conf
+ bitbake $BB_ARGS $REPRO_TARGETS_SET_SIGNED
+ while [ -e bitbake.sock ]; do sleep 1; done
+ # Cleanup and disable use of signed cached base repository
+ sudo rm -rf tmp
+ sed -i -e 's/ISAR_USE_CACHED_BASE_REPO ?= "1"/#ISAR_USE_CACHED_BASE_REPO ?= "1"/g' conf/local.conf
+ sed -i -e 's/^BB_NO_NETWORK/#BB_NO_NETWORK/g' conf/local.conf
+ sed -i -e 's/^BASE_REPO_KEY/#BASE_REPO_KEY/g' conf/local.conf
+
+ # Enable use of unsigned cached base repository
+ bitbake $BB_ARGS $REPRO_TARGETS_SET
+ while [ -e bitbake.sock ]; do sleep 1; done
+ sudo rm -rf tmp
+ sed -i -e 's/#ISAR_USE_CACHED_BASE_REPO ?= "1"/ISAR_USE_CACHED_BASE_REPO ?= "1"/g' conf/local.conf
+ sed -i -e 's/^#BB_NO_NETWORK/BB_NO_NETWORK/g' conf/local.conf
+ bitbake $BB_ARGS $REPRO_TARGETS_SET
+ while [ -e bitbake.sock ]; do sleep 1; done
+ # Cleanup and disable use of unsigned cached base repository
+ sudo rm -rf tmp
+ sed -i -e 's/ISAR_USE_CACHED_BASE_REPO ?= "1"/#ISAR_USE_CACHED_BASE_REPO ?= "1"/g' conf/local.conf
+ sed -i -e 's/^BB_NO_NETWORK/#BB_NO_NETWORK/g' conf/local.conf
+fi
+
+sed -i -e 's/^#BASE_REPO_FEATURES ?= "cache-deb-src"/BASE_REPO_FEATURES ?= "cache-deb-src"/g' conf/local.conf
+# Start cross build for the defined set of configurations
+sed -i -e 's/ISAR_CROSS_COMPILE ?= "0"/ISAR_CROSS_COMPILE ?= "1"/g' conf/local.conf
+bitbake $BB_ARGS $CROSS_TARGETS_SET
+while [ -e bitbake.sock ]; do sleep 1; done
+if bitbake $BB_ARGS $CROSS_TARGETS_SET_BULLSEYE; then
+ echo "bullseye cross: PASSED"
+else
+ echo "bullseye cross: KFAIL"
+fi
+# In addition test SDK creation
+bitbake $BB_ARGS -c do_populate_sdk mc:qemuarm-stretch:isar-image-base
+while [ -e bitbake.sock ]; do sleep 1; done
+
+if [ -z "$FAST_BUILD" ]; then
+ # Cleanup and disable cross build
+ sudo rm -rf tmp
+ sed -i -e 's/ISAR_CROSS_COMPILE ?= "1"/ISAR_CROSS_COMPILE ?= "0"/g' conf/local.conf
+ bitbake $BB_ARGS $TARGETS_SET
+ while [ -e bitbake.sock ]; do sleep 1; done
+
+ if bitbake $BB_ARGS $TARGETS_SET_BULLSEYE; then
+ echo "bullseye: PASSED"
+ else
+ echo "bullseye: KFAIL"
+ fi
+ while [ -e bitbake.sock ]; do sleep 1; done
+fi
+
+eval $(bitbake -e | grep "^LAYERDIR_core=")
+eval $(bitbake -e | grep "^LAYERDIR_isar=")
+cp -a "${LAYERDIR_core}/classes/dpkg-base.bbclass" "${LAYERDIR_core}/classes/dpkg-base.bbclass.ci-backup"
+echo -e "do_fetch_append() {\n\n}" >> "${LAYERDIR_core}/classes/dpkg-base.bbclass"
+
+bitbake $BB_ARGS mc:qemuamd64-stretch:isar-image-base
+
+mv "${LAYERDIR_core}/classes/dpkg-base.bbclass.ci-backup" "${LAYERDIR_core}/classes/dpkg-base.bbclass"
+
+# Test wic --exclude-path
+cp -a "${LAYERDIR_isar}/scripts/lib/wic/canned-wks/sdimage-efi.wks" "${LAYERDIR_isar}/scripts/lib/wic/canned-wks/sdimage-efi.wks.ci-backup"
+mv ${BUILDDIR}/tmp/deploy/images/qemuamd64/isar-image-base-debian-stretch-qemuamd64.wic.img \
+ ${BUILDDIR}/tmp/deploy/images/qemuamd64/isar-image-base-debian-stretch-qemuamd64.wic.img.ci-backup
+sed -i -e 's/part \/ /part \/ --exclude-path usr /g' "${LAYERDIR_isar}/scripts/lib/wic/canned-wks/sdimage-efi.wks"
+
+bitbake $BB_ARGS mc:qemuamd64-stretch:isar-image-base
+
+mv "${LAYERDIR_isar}/scripts/lib/wic/canned-wks/sdimage-efi.wks.ci-backup" "${LAYERDIR_isar}/scripts/lib/wic/canned-wks/sdimage-efi.wks"
+mv ${BUILDDIR}/tmp/deploy/images/qemuamd64/isar-image-base-debian-stretch-qemuamd64.wic.img.ci-backup \
+ ${BUILDDIR}/tmp/deploy/images/qemuamd64/isar-image-base-debian-stretch-qemuamd64.wic.img
--
2.25.1
^ permalink raw reply [flat|nested] 15+ messages in thread
* Re: [PATCH v3 10/11] ci_build: Migrate to Avocado
2021-03-17 14:52 ` [PATCH v3 10/11] ci_build: Migrate to Avocado Anton Mikanovich
@ 2021-03-17 14:56 ` Jan Kiszka
2021-03-17 17:26 ` Anton Mikanovich
0 siblings, 1 reply; 15+ messages in thread
From: Jan Kiszka @ 2021-03-17 14:56 UTC (permalink / raw)
To: Anton Mikanovich, isar-users
On 17.03.21 15:52, Anton Mikanovich wrote:
> Call Avocado test cases instead of shell based.
>
> Signed-off-by: Anton Mikanovich <amikan@ilbers.de>
> ---
> scripts/ci_build.sh | 170 ++++----------------------
> scripts/ci_build_legacy.sh | 239 +++++++++++++++++++++++++++++++++++++
> 2 files changed, 261 insertions(+), 148 deletions(-)
> create mode 100755 scripts/ci_build_legacy.sh
>
> diff --git a/scripts/ci_build.sh b/scripts/ci_build.sh
> index 3868fb6..9abebb8 100755
> --- a/scripts/ci_build.sh
> +++ b/scripts/ci_build.sh
> @@ -14,59 +14,12 @@ export PATH=$PATH:/sbin
> # Go to Isar root
> cd "$(dirname "$0")/.."
>
> +# Get Avocado build tests path
> +BUILD_TEST_DIR="$(pwd)/testsuite/build_test"
> +
> # Start build in Isar tree by default
> BUILD_DIR=./build
>
> -BB_ARGS="-v"
> -
> -TARGETS_SET="\
> - mc:qemuarm-stretch:isar-image-base \
> - mc:qemuarm-buster:isar-image-base \
> - mc:qemuarm64-stretch:isar-image-base \
> - mc:qemui386-stretch:isar-image-base \
> - mc:qemui386-buster:isar-image-base \
> - mc:qemuamd64-stretch:isar-image-base \
> - mc:qemuamd64-buster:isar-image-base \
> - mc:qemuamd64-buster-tgz:isar-image-base \
> - mc:qemuamd64-buster:isar-initramfs \
> - mc:qemumipsel-stretch:isar-image-base \
> - mc:qemumipsel-buster:isar-image-base \
> - mc:nand-ubi-demo-buster:isar-image-ubi \
> - mc:rpi-stretch:isar-image-base \
> - mc:qemuamd64-focal:isar-image-base"
> - # qemu-user-static of <= buster too old to build that
> - # mc:qemuarm64-buster:isar-image-base
> - # mc:qemuarm64-bullseye:isar-image-base
> -
> -TARGETS_SET_BULLSEYE="\
> - mc:qemuamd64-bullseye:isar-image-base \
> - mc:qemuarm-bullseye:isar-image-base \
> - mc:qemui386-bullseye:isar-image-base \
> - mc:qemumipsel-bullseye:isar-image-base \
> -"
> -
> -CROSS_TARGETS_SET="\
> - mc:qemuarm-stretch:isar-image-base \
> - mc:qemuarm-buster:isar-image-base \
> - mc:qemuarm64-stretch:isar-image-base \
> - mc:qemuamd64-stretch:isar-image-base \
> - mc:de0-nano-soc-buster:isar-image-base \
> - mc:stm32mp15x-buster:isar-image-base \
> - mc:rpi-stretch:isar-image-base \
> - mc:qemuarm64-focal:isar-image-base"
> -
> -CROSS_TARGETS_SET_BULLSEYE="\
> - mc:qemuarm-bullseye:isar-image-base \
> -"
> -
> -REPRO_TARGETS_SET_SIGNED="\
> - mc:de0-nano-soc-buster:isar-image-base \
> - mc:qemuarm64-stretch:isar-image-base"
> -
> -REPRO_TARGETS_SET="\
> - mc:qemuamd64-stretch:isar-image-base \
> - mc:qemuarm-buster:isar-image-base"
> -
> show_help() {
> echo "This script builds the default Isar images."
> echo
> @@ -88,6 +41,10 @@ show_help() {
> echo " 3 if invalid parameters are passed."
> }
>
> +TAGS="full"
> +CROSS_BUILD="0"
> +QUIET="0"
> +
> # Parse command line to get user configuration
> while [ $# -gt 0 ]
> do
> @@ -106,16 +63,18 @@ do
> CROSS_BUILD="1"
> ;;
> -d|--debug)
> - BB_ARGS="$BB_ARGS -D"
> + QUIET="0"
> + VERBOSE="--show-job-log"
> ;;
> -f|--fast)
> # Start build for the reduced set of configurations
> # Enforce cross-compilation to speed up the build
> - FAST_BUILD="1"
> + TAGS="fast"
> CROSS_BUILD="1"
> ;;
> -q|--quiet)
> - BB_ARGS=""
> + QUIET="1"
> + VERBOSE=""
> ;;
> -r|--repro)
> REPRO_BUILD="1"
> @@ -134,106 +93,21 @@ do
> shift
> done
>
> +if [ -z "$REPRO_BUILD" ]; then
> + TAGS = "$TAGS,-repro"
> +fi
> +
> +# Provide working path
> +export VIRTUAL_ENV="./"
> +
> # the real stuff starts here, trace commands from now on
> set -x
>
> # Setup build folder for the current build
> if [ ! -d "$BUILD_DIR" ]; then
> - mkdir -p "$BUILD_DIR"
> + mkdir -p "$BUILD_DIR"
> fi
> source isar-init-build-env "$BUILD_DIR"
>
> -cat >>conf/local.conf <<EOF
> -ISAR_ENABLE_COMPAT_ARCH_amd64 = "1"
> -ISAR_ENABLE_COMPAT_ARCH_arm64 = "1"
> -ISAR_ENABLE_COMPAT_ARCH_debian-stretch_amd64 = "0"
> -EOF
> -
> -if [ -n "$CROSS_BUILD" ]; then
> - sed -i -e 's/ISAR_CROSS_COMPILE ?= "0"/ISAR_CROSS_COMPILE ?= "1"/g' conf/local.conf
> -fi
> -
> -if [ -n "$REPRO_BUILD" ]; then
> - ISAR_TESTSUITE_GPG_PUB_KEY_FILE="$TESTSUITEDIR/base-apt/test_pub.key"
> - ISAR_TESTSUITE_GPG_PRIV_KEY_FILE="$TESTSUITEDIR/base-apt/test_priv.key"
> - export GNUPGHOME=$(mktemp -d)
> - gpg --import $ISAR_TESTSUITE_GPG_PUB_KEY_FILE $ISAR_TESTSUITE_GPG_PRIV_KEY_FILE
> -
> - # Enable use of signed cached base repository
> - echo BASE_REPO_KEY=\"file://$ISAR_TESTSUITE_GPG_PUB_KEY_FILE\" >> conf/local.conf
> - bitbake $BB_ARGS $REPRO_TARGETS_SET_SIGNED
> - while [ -e bitbake.sock ]; do sleep 1; done
> - sudo rm -rf tmp
> - sed -i -e 's/#ISAR_USE_CACHED_BASE_REPO ?= "1"/ISAR_USE_CACHED_BASE_REPO ?= "1"/g' conf/local.conf
> - sed -i -e 's/^#BB_NO_NETWORK/BB_NO_NETWORK/g' conf/local.conf
> - bitbake $BB_ARGS $REPRO_TARGETS_SET_SIGNED
> - while [ -e bitbake.sock ]; do sleep 1; done
> - # Cleanup and disable use of signed cached base repository
> - sudo rm -rf tmp
> - sed -i -e 's/ISAR_USE_CACHED_BASE_REPO ?= "1"/#ISAR_USE_CACHED_BASE_REPO ?= "1"/g' conf/local.conf
> - sed -i -e 's/^BB_NO_NETWORK/#BB_NO_NETWORK/g' conf/local.conf
> - sed -i -e 's/^BASE_REPO_KEY/#BASE_REPO_KEY/g' conf/local.conf
> -
> - # Enable use of unsigned cached base repository
> - bitbake $BB_ARGS $REPRO_TARGETS_SET
> - while [ -e bitbake.sock ]; do sleep 1; done
> - sudo rm -rf tmp
> - sed -i -e 's/#ISAR_USE_CACHED_BASE_REPO ?= "1"/ISAR_USE_CACHED_BASE_REPO ?= "1"/g' conf/local.conf
> - sed -i -e 's/^#BB_NO_NETWORK/BB_NO_NETWORK/g' conf/local.conf
> - bitbake $BB_ARGS $REPRO_TARGETS_SET
> - while [ -e bitbake.sock ]; do sleep 1; done
> - # Cleanup and disable use of unsigned cached base repository
> - sudo rm -rf tmp
> - sed -i -e 's/ISAR_USE_CACHED_BASE_REPO ?= "1"/#ISAR_USE_CACHED_BASE_REPO ?= "1"/g' conf/local.conf
> - sed -i -e 's/^BB_NO_NETWORK/#BB_NO_NETWORK/g' conf/local.conf
> -fi
> -
> -sed -i -e 's/^#BASE_REPO_FEATURES ?= "cache-deb-src"/BASE_REPO_FEATURES ?= "cache-deb-src"/g' conf/local.conf
> -# Start cross build for the defined set of configurations
> -sed -i -e 's/ISAR_CROSS_COMPILE ?= "0"/ISAR_CROSS_COMPILE ?= "1"/g' conf/local.conf
> -bitbake $BB_ARGS $CROSS_TARGETS_SET
> -while [ -e bitbake.sock ]; do sleep 1; done
> -if bitbake $BB_ARGS $CROSS_TARGETS_SET_BULLSEYE; then
> - echo "bullseye cross: PASSED"
> -else
> - echo "bullseye cross: KFAIL"
> -fi
> -# In addition test SDK creation
> -bitbake $BB_ARGS -c do_populate_sdk mc:qemuarm-stretch:isar-image-base
> -while [ -e bitbake.sock ]; do sleep 1; done
> -
> -if [ -z "$FAST_BUILD" ]; then
> - # Cleanup and disable cross build
> - sudo rm -rf tmp
> - sed -i -e 's/ISAR_CROSS_COMPILE ?= "1"/ISAR_CROSS_COMPILE ?= "0"/g' conf/local.conf
> - bitbake $BB_ARGS $TARGETS_SET
> - while [ -e bitbake.sock ]; do sleep 1; done
> -
> - if bitbake $BB_ARGS $TARGETS_SET_BULLSEYE; then
> - echo "bullseye: PASSED"
> - else
> - echo "bullseye: KFAIL"
> - fi
> - while [ -e bitbake.sock ]; do sleep 1; done
> -fi
> -
> -eval $(bitbake -e | grep "^LAYERDIR_core=")
> -eval $(bitbake -e | grep "^LAYERDIR_isar=")
> -cp -a "${LAYERDIR_core}/classes/dpkg-base.bbclass" "${LAYERDIR_core}/classes/dpkg-base.bbclass.ci-backup"
> -echo -e "do_fetch_append() {\n\n}" >> "${LAYERDIR_core}/classes/dpkg-base.bbclass"
> -
> -bitbake $BB_ARGS mc:qemuamd64-stretch:isar-image-base
> -
> -mv "${LAYERDIR_core}/classes/dpkg-base.bbclass.ci-backup" "${LAYERDIR_core}/classes/dpkg-base.bbclass"
> -
> -# Test wic --exclude-path
> -cp -a "${LAYERDIR_isar}/scripts/lib/wic/canned-wks/sdimage-efi.wks" "${LAYERDIR_isar}/scripts/lib/wic/canned-wks/sdimage-efi.wks.ci-backup"
> -mv ${BUILDDIR}/tmp/deploy/images/qemuamd64/isar-image-base-debian-stretch-qemuamd64.wic.img \
> - ${BUILDDIR}/tmp/deploy/images/qemuamd64/isar-image-base-debian-stretch-qemuamd64.wic.img.ci-backup
> -sed -i -e 's/part \/ /part \/ --exclude-path usr /g' "${LAYERDIR_isar}/scripts/lib/wic/canned-wks/sdimage-efi.wks"
> -
> -bitbake $BB_ARGS mc:qemuamd64-stretch:isar-image-base
> -
> -mv "${LAYERDIR_isar}/scripts/lib/wic/canned-wks/sdimage-efi.wks.ci-backup" "${LAYERDIR_isar}/scripts/lib/wic/canned-wks/sdimage-efi.wks"
> -mv ${BUILDDIR}/tmp/deploy/images/qemuamd64/isar-image-base-debian-stretch-qemuamd64.wic.img.ci-backup \
> - ${BUILDDIR}/tmp/deploy/images/qemuamd64/isar-image-base-debian-stretch-qemuamd64.wic.img
> +avocado run "$BUILD_TEST_DIR/build_test.py" -t $TAGS -p build_dir="$BUILD_DIR" \
> + -p quiet=$QUIET -p cross=$CROSS_BUILD $VERBOSE
> diff --git a/scripts/ci_build_legacy.sh b/scripts/ci_build_legacy.sh
> new file mode 100755
> index 0000000..3868fb6
> --- /dev/null
> +++ b/scripts/ci_build_legacy.sh
> @@ -0,0 +1,239 @@
> +#!/usr/bin/env bash
> +# Script for CI system build
> +#
> +# Alexander Smirnov <asmirnov@ilbers.de>
> +# Copyright (c) 2016-2018 ilbers GmbH
> +
> +set -e
> +
> +ES_BUG=3
> +
> +# Export $PATH to use 'parted' tool
> +export PATH=$PATH:/sbin
> +
> +# Go to Isar root
> +cd "$(dirname "$0")/.."
> +
> +# Start build in Isar tree by default
> +BUILD_DIR=./build
> +
> +BB_ARGS="-v"
> +
> +TARGETS_SET="\
> + mc:qemuarm-stretch:isar-image-base \
> + mc:qemuarm-buster:isar-image-base \
> + mc:qemuarm64-stretch:isar-image-base \
> + mc:qemui386-stretch:isar-image-base \
> + mc:qemui386-buster:isar-image-base \
> + mc:qemuamd64-stretch:isar-image-base \
> + mc:qemuamd64-buster:isar-image-base \
> + mc:qemuamd64-buster-tgz:isar-image-base \
> + mc:qemuamd64-buster:isar-initramfs \
> + mc:qemumipsel-stretch:isar-image-base \
> + mc:qemumipsel-buster:isar-image-base \
> + mc:nand-ubi-demo-buster:isar-image-ubi \
> + mc:rpi-stretch:isar-image-base \
> + mc:qemuamd64-focal:isar-image-base"
> + # qemu-user-static of <= buster too old to build that
> + # mc:qemuarm64-buster:isar-image-base
> + # mc:qemuarm64-bullseye:isar-image-base
> +
> +TARGETS_SET_BULLSEYE="\
> + mc:qemuamd64-bullseye:isar-image-base \
> + mc:qemuarm-bullseye:isar-image-base \
> + mc:qemui386-bullseye:isar-image-base \
> + mc:qemumipsel-bullseye:isar-image-base \
> +"
> +
> +CROSS_TARGETS_SET="\
> + mc:qemuarm-stretch:isar-image-base \
> + mc:qemuarm-buster:isar-image-base \
> + mc:qemuarm64-stretch:isar-image-base \
> + mc:qemuamd64-stretch:isar-image-base \
> + mc:de0-nano-soc-buster:isar-image-base \
> + mc:stm32mp15x-buster:isar-image-base \
> + mc:rpi-stretch:isar-image-base \
> + mc:qemuarm64-focal:isar-image-base"
> +
> +CROSS_TARGETS_SET_BULLSEYE="\
> + mc:qemuarm-bullseye:isar-image-base \
> +"
> +
> +REPRO_TARGETS_SET_SIGNED="\
> + mc:de0-nano-soc-buster:isar-image-base \
> + mc:qemuarm64-stretch:isar-image-base"
> +
> +REPRO_TARGETS_SET="\
> + mc:qemuamd64-stretch:isar-image-base \
> + mc:qemuarm-buster:isar-image-base"
> +
> +show_help() {
> + echo "This script builds the default Isar images."
> + echo
> + echo "Usage:"
> + echo " $0 [params]"
> + echo
> + echo "Parameters:"
> + echo " -b, --build BUILD_DIR set path to build directory. If not set,"
> + echo " the build will be started in current path."
> + echo " -c, --cross enable cross-compilation."
> + echo " -d, --debug enable debug bitbake output."
> + echo " -f, --fast cross build reduced set of configurations."
> + echo " -q, --quiet suppress verbose bitbake output."
> + echo " -r, --repro enable use of cached base repository."
> + echo " --help display this message and exit."
> + echo
> + echo "Exit status:"
> + echo " 0 if OK,"
> + echo " 3 if invalid parameters are passed."
> +}
> +
> +# Parse command line to get user configuration
> +while [ $# -gt 0 ]
> +do
> + key="$1"
> +
> + case $key in
> + -h|--help)
> + show_help
> + exit 0
> + ;;
> + -b|--build)
> + BUILD_DIR="$2"
> + shift
> + ;;
> + -c|--cross)
> + CROSS_BUILD="1"
> + ;;
> + -d|--debug)
> + BB_ARGS="$BB_ARGS -D"
> + ;;
> + -f|--fast)
> + # Start build for the reduced set of configurations
> + # Enforce cross-compilation to speed up the build
> + FAST_BUILD="1"
> + CROSS_BUILD="1"
> + ;;
> + -q|--quiet)
> + BB_ARGS=""
> + ;;
> + -r|--repro)
> + REPRO_BUILD="1"
> + # This switch is deprecated, just here to not cause failing CI on
> + # legacy configs
> + case "$2" in
> + -s|--sign) shift ;;
> + esac
> + ;;
> + *)
> + echo "error: invalid parameter '$key', please try '--help' to get list of supported parameters"
> + exit $ES_BUG
> + ;;
> + esac
> +
> + shift
> +done
> +
> +# the real stuff starts here, trace commands from now on
> +set -x
> +
> +# Setup build folder for the current build
> +if [ ! -d "$BUILD_DIR" ]; then
> + mkdir -p "$BUILD_DIR"
> +fi
> +source isar-init-build-env "$BUILD_DIR"
> +
> +cat >>conf/local.conf <<EOF
> +ISAR_ENABLE_COMPAT_ARCH_amd64 = "1"
> +ISAR_ENABLE_COMPAT_ARCH_arm64 = "1"
> +ISAR_ENABLE_COMPAT_ARCH_debian-stretch_amd64 = "0"
> +EOF
> +
> +if [ -n "$CROSS_BUILD" ]; then
> + sed -i -e 's/ISAR_CROSS_COMPILE ?= "0"/ISAR_CROSS_COMPILE ?= "1"/g' conf/local.conf
> +fi
> +
> +if [ -n "$REPRO_BUILD" ]; then
> + ISAR_TESTSUITE_GPG_PUB_KEY_FILE="$TESTSUITEDIR/base-apt/test_pub.key"
> + ISAR_TESTSUITE_GPG_PRIV_KEY_FILE="$TESTSUITEDIR/base-apt/test_priv.key"
> + export GNUPGHOME=$(mktemp -d)
> + gpg --import $ISAR_TESTSUITE_GPG_PUB_KEY_FILE $ISAR_TESTSUITE_GPG_PRIV_KEY_FILE
> +
> + # Enable use of signed cached base repository
> + echo BASE_REPO_KEY=\"file://$ISAR_TESTSUITE_GPG_PUB_KEY_FILE\" >> conf/local.conf
> + bitbake $BB_ARGS $REPRO_TARGETS_SET_SIGNED
> + while [ -e bitbake.sock ]; do sleep 1; done
> + sudo rm -rf tmp
> + sed -i -e 's/#ISAR_USE_CACHED_BASE_REPO ?= "1"/ISAR_USE_CACHED_BASE_REPO ?= "1"/g' conf/local.conf
> + sed -i -e 's/^#BB_NO_NETWORK/BB_NO_NETWORK/g' conf/local.conf
> + bitbake $BB_ARGS $REPRO_TARGETS_SET_SIGNED
> + while [ -e bitbake.sock ]; do sleep 1; done
> + # Cleanup and disable use of signed cached base repository
> + sudo rm -rf tmp
> + sed -i -e 's/ISAR_USE_CACHED_BASE_REPO ?= "1"/#ISAR_USE_CACHED_BASE_REPO ?= "1"/g' conf/local.conf
> + sed -i -e 's/^BB_NO_NETWORK/#BB_NO_NETWORK/g' conf/local.conf
> + sed -i -e 's/^BASE_REPO_KEY/#BASE_REPO_KEY/g' conf/local.conf
> +
> + # Enable use of unsigned cached base repository
> + bitbake $BB_ARGS $REPRO_TARGETS_SET
> + while [ -e bitbake.sock ]; do sleep 1; done
> + sudo rm -rf tmp
> + sed -i -e 's/#ISAR_USE_CACHED_BASE_REPO ?= "1"/ISAR_USE_CACHED_BASE_REPO ?= "1"/g' conf/local.conf
> + sed -i -e 's/^#BB_NO_NETWORK/BB_NO_NETWORK/g' conf/local.conf
> + bitbake $BB_ARGS $REPRO_TARGETS_SET
> + while [ -e bitbake.sock ]; do sleep 1; done
> + # Cleanup and disable use of unsigned cached base repository
> + sudo rm -rf tmp
> + sed -i -e 's/ISAR_USE_CACHED_BASE_REPO ?= "1"/#ISAR_USE_CACHED_BASE_REPO ?= "1"/g' conf/local.conf
> + sed -i -e 's/^BB_NO_NETWORK/#BB_NO_NETWORK/g' conf/local.conf
> +fi
> +
> +sed -i -e 's/^#BASE_REPO_FEATURES ?= "cache-deb-src"/BASE_REPO_FEATURES ?= "cache-deb-src"/g' conf/local.conf
> +# Start cross build for the defined set of configurations
> +sed -i -e 's/ISAR_CROSS_COMPILE ?= "0"/ISAR_CROSS_COMPILE ?= "1"/g' conf/local.conf
> +bitbake $BB_ARGS $CROSS_TARGETS_SET
> +while [ -e bitbake.sock ]; do sleep 1; done
> +if bitbake $BB_ARGS $CROSS_TARGETS_SET_BULLSEYE; then
> + echo "bullseye cross: PASSED"
> +else
> + echo "bullseye cross: KFAIL"
> +fi
> +# In addition test SDK creation
> +bitbake $BB_ARGS -c do_populate_sdk mc:qemuarm-stretch:isar-image-base
> +while [ -e bitbake.sock ]; do sleep 1; done
> +
> +if [ -z "$FAST_BUILD" ]; then
> + # Cleanup and disable cross build
> + sudo rm -rf tmp
> + sed -i -e 's/ISAR_CROSS_COMPILE ?= "1"/ISAR_CROSS_COMPILE ?= "0"/g' conf/local.conf
> + bitbake $BB_ARGS $TARGETS_SET
> + while [ -e bitbake.sock ]; do sleep 1; done
> +
> + if bitbake $BB_ARGS $TARGETS_SET_BULLSEYE; then
> + echo "bullseye: PASSED"
> + else
> + echo "bullseye: KFAIL"
> + fi
> + while [ -e bitbake.sock ]; do sleep 1; done
> +fi
> +
> +eval $(bitbake -e | grep "^LAYERDIR_core=")
> +eval $(bitbake -e | grep "^LAYERDIR_isar=")
> +cp -a "${LAYERDIR_core}/classes/dpkg-base.bbclass" "${LAYERDIR_core}/classes/dpkg-base.bbclass.ci-backup"
> +echo -e "do_fetch_append() {\n\n}" >> "${LAYERDIR_core}/classes/dpkg-base.bbclass"
> +
> +bitbake $BB_ARGS mc:qemuamd64-stretch:isar-image-base
> +
> +mv "${LAYERDIR_core}/classes/dpkg-base.bbclass.ci-backup" "${LAYERDIR_core}/classes/dpkg-base.bbclass"
> +
> +# Test wic --exclude-path
> +cp -a "${LAYERDIR_isar}/scripts/lib/wic/canned-wks/sdimage-efi.wks" "${LAYERDIR_isar}/scripts/lib/wic/canned-wks/sdimage-efi.wks.ci-backup"
> +mv ${BUILDDIR}/tmp/deploy/images/qemuamd64/isar-image-base-debian-stretch-qemuamd64.wic.img \
> + ${BUILDDIR}/tmp/deploy/images/qemuamd64/isar-image-base-debian-stretch-qemuamd64.wic.img.ci-backup
> +sed -i -e 's/part \/ /part \/ --exclude-path usr /g' "${LAYERDIR_isar}/scripts/lib/wic/canned-wks/sdimage-efi.wks"
> +
> +bitbake $BB_ARGS mc:qemuamd64-stretch:isar-image-base
> +
> +mv "${LAYERDIR_isar}/scripts/lib/wic/canned-wks/sdimage-efi.wks.ci-backup" "${LAYERDIR_isar}/scripts/lib/wic/canned-wks/sdimage-efi.wks"
> +mv ${BUILDDIR}/tmp/deploy/images/qemuamd64/isar-image-base-debian-stretch-qemuamd64.wic.img.ci-backup \
> + ${BUILDDIR}/tmp/deploy/images/qemuamd64/isar-image-base-debian-stretch-qemuamd64.wic.img
>
Will that break .gitlab-ci.yml? Or is everything missing installed
on-demand by the script?
Jan
--
Siemens AG, T RDA IOT
Corporate Competence Center Embedded Linux
^ permalink raw reply [flat|nested] 15+ messages in thread
* Re: [PATCH v3 10/11] ci_build: Migrate to Avocado
2021-03-17 14:56 ` Jan Kiszka
@ 2021-03-17 17:26 ` Anton Mikanovich
2021-03-17 17:36 ` Jan Kiszka
0 siblings, 1 reply; 15+ messages in thread
From: Anton Mikanovich @ 2021-03-17 17:26 UTC (permalink / raw)
To: Jan Kiszka, isar-users
17.03.2021 17:56, Jan Kiszka wrote:
>
> Will that break .gitlab-ci.yml? Or is everything missing installed
> on-demand by the script?
>
> Jan
>
Currently yes, because there is no Avocado package in kas-isar container.
We will test this on Gitlab internally to proof the only update step is
installing Avocado itself and make you know.
--
Anton Mikanovich
Promwad Ltd.
External service provider of ilbers GmbH
Maria-Merian-Str. 8
85521 Ottobrunn, Germany
+49 (89) 122 67 24-0
Commercial register Munich, HRB 214197
General Manager: Baurzhan Ismagulov
^ permalink raw reply [flat|nested] 15+ messages in thread
* Re: [PATCH v3 10/11] ci_build: Migrate to Avocado
2021-03-17 17:26 ` Anton Mikanovich
@ 2021-03-17 17:36 ` Jan Kiszka
0 siblings, 0 replies; 15+ messages in thread
From: Jan Kiszka @ 2021-03-17 17:36 UTC (permalink / raw)
To: Anton Mikanovich, isar-users
On 17.03.21 18:26, Anton Mikanovich wrote:
> 17.03.2021 17:56, Jan Kiszka wrote:
>>
>> Will that break .gitlab-ci.yml? Or is everything missing installed
>> on-demand by the script?
>>
>> Jan
>>
> Currently yes, because there is no Avocado package in kas-isar container.
> We will test this on Gitlab internally to proof the only update step is
> installing Avocado itself and make you know.
You can install any missing dependencies as part of the CI setup
("before_script"). There is reason to install Avocado into kas-isar as
it is not needed for building images, only for testing them in Isar.
Jan
--
Siemens AG, T RDA IOT
Corporate Competence Center Embedded Linux
^ permalink raw reply [flat|nested] 15+ messages in thread
* [PATCH v3 11/11] vm_smoke_test: Migrate to Avocado
2021-03-17 14:52 [PATCH v3 00/11] Update Avocado testsuite Anton Mikanovich
` (9 preceding siblings ...)
2021-03-17 14:52 ` [PATCH v3 10/11] ci_build: Migrate to Avocado Anton Mikanovich
@ 2021-03-17 14:52 ` Anton Mikanovich
10 siblings, 0 replies; 15+ messages in thread
From: Anton Mikanovich @ 2021-03-17 14:52 UTC (permalink / raw)
To: isar-users; +Cc: Anton Mikanovich
Call Avocado test cases instead of shell based.
Signed-off-by: Anton Mikanovich <amikan@ilbers.de>
---
scripts/vm_smoke_test | 110 ++++-------------------
scripts/vm_smoke_test_legacy | 168 +++++++++++++++++++++++++++++++++++
2 files changed, 185 insertions(+), 93 deletions(-)
create mode 100755 scripts/vm_smoke_test_legacy
diff --git a/scripts/vm_smoke_test b/scripts/vm_smoke_test
index ce08213..0ef3caf 100755
--- a/scripts/vm_smoke_test
+++ b/scripts/vm_smoke_test
@@ -3,9 +3,7 @@
# This software is a part of ISAR.
# Copyright (C) 2015-2018 ilbers GmbH
-CONSOLE_OUTPUT=/tmp/isar_console
-PID_FILE=/tmp/qemu.pid
-VERBOSE=1
+VERBOSE="--show-job-log"
TIMEOUT=300
# Error codes:
@@ -13,75 +11,12 @@ ES_OK=0
ES_FAIL=1
ES_BUG=3
-RET=$ES_OK
+RET=$ES_FAIL
-dump_boot_log() {
- echo "Boot log:\n8<--"
- cat $CONSOLE_OUTPUT
- echo "\n8<--"
-}
-
-check_login_prompt() {
- echo -n "Check login prompt: "
-
- str=$(grep "isar login: " $CONSOLE_OUTPUT)
-
- if [ -n "$str" ]; then
- echo "PASSED"
- else
- echo "FAIL"
- RET=$ES_FAIL
- FAIL=1
- fi
-}
-
-check_example_module() {
- echo -n "Check example module: "
-
- str=$(grep "Just an example" $CONSOLE_OUTPUT)
-
- if [ -n "$str" ]; then
- echo "PASSED"
- else
- echo "FAIL"
- RET=$ES_FAIL
- FAIL=1
- fi
-}
-
-run_test () {
- ARCH=$1
- DISTRO=$2
-
- echo "-------------------------------------------------"
- echo "Testing Isar [$DISTRO] image for [$ARCH] machine:"
+# Get Avocado QEMU tests path
+VM_TEST_DIR="$(dirname "$0")/../testsuite/vm_boot_test"
- start_vm -a $ARCH -d $DISTRO -o $CONSOLE_OUTPUT -p $PID_FILE > /dev/null 2>&1 &
- sleep 5
-
- if [ -z `ps -p $! -o pid=` ]; then
- echo "QEMU start: FAILED"
- RET=$ES_FAIL
- echo "Command output:\n8<--"
- start_vm -a $ARCH -d $DISTRO -o $CONSOLE_OUTPUT -p $PID_FILE
- echo "\n8<--"
- else
- sleep $TIMEOUT
- kill `cat $PID_FILE`
-
- FAIL=0
-
- check_login_prompt
-
- check_example_module
-
- [ $VERBOSE -eq 1 -o $FAIL -eq 1 ] && dump_boot_log
-
- rm $CONSOLE_OUTPUT
- fi
-
- rm $PID_FILE
-}
+BUILD_DIR=$PWD
show_help() {
echo "This script tests the Isar images for default targets in QEMU."
@@ -91,10 +26,6 @@ show_help() {
echo
echo "Parameters:"
echo " -f,--fast test reduced set of supported targets."
- echo " -o,--output FILE specify file to store console output."
- echo " The default is: /tmp/isar_console"
- echo " -p,--pid-file FILE specify file to store QEMU process PID."
- echo " The default is: /tmp/qemu.pid"
echo " -q, --quiet do not display boot logs for all the targets."
echo " If test failed for the specific configuration,"
echo " the respective boot log will be printed anyway."
@@ -119,18 +50,18 @@ do
exit 0
;;
-o|--output)
- CONSOLE_OUTPUT=$2
+ # Deprecated option
shift
;;
-p|--pid-file)
- PID_FILE=$2
+ # Deprecated option
shift
;;
-f|--fast)
FAST_BUILD="1"
;;
-q|--quiet)
- VERBOSE=0
+ VERBOSE=""
;;
-t|--timeout)
TIMEOUT=$2
@@ -145,24 +76,17 @@ do
shift
done
-# ARM machine
-run_test arm stretch
-run_test arm buster
-
-# AMD64 machine
-if [ -z "$FAST_BUILD" ]; then
- run_test amd64 buster
- run_test amd64 focal
+TAGS="full"
+if [ -n "$FAST_BUILD" ]; then
+ TAGS="fast"
fi
-run_test amd64 stretch
-# i386 machine
-if [ -z "$FAST_BUILD" ]; then
- run_test i386 stretch
- run_test i386 buster
-fi
+# Provide working path
+export VIRTUAL_ENV="./"
-# ARM64 machine
-run_test arm64 stretch
+if avocado run "$VM_TEST_DIR/vm_boot_test.py" -t $TAGS \
+ -p build_dir="$BUILD_DIR" -p time_to_wait=$TIMEOUT $VERBOSE; then
+ RET=$ES_OK
+fi
exit $RET
diff --git a/scripts/vm_smoke_test_legacy b/scripts/vm_smoke_test_legacy
new file mode 100755
index 0000000..ce08213
--- /dev/null
+++ b/scripts/vm_smoke_test_legacy
@@ -0,0 +1,168 @@
+#!/bin/sh
+#
+# This software is a part of ISAR.
+# Copyright (C) 2015-2018 ilbers GmbH
+
+CONSOLE_OUTPUT=/tmp/isar_console
+PID_FILE=/tmp/qemu.pid
+VERBOSE=1
+TIMEOUT=300
+
+# Error codes:
+ES_OK=0
+ES_FAIL=1
+ES_BUG=3
+
+RET=$ES_OK
+
+dump_boot_log() {
+ echo "Boot log:\n8<--"
+ cat $CONSOLE_OUTPUT
+ echo "\n8<--"
+}
+
+check_login_prompt() {
+ echo -n "Check login prompt: "
+
+ str=$(grep "isar login: " $CONSOLE_OUTPUT)
+
+ if [ -n "$str" ]; then
+ echo "PASSED"
+ else
+ echo "FAIL"
+ RET=$ES_FAIL
+ FAIL=1
+ fi
+}
+
+check_example_module() {
+ echo -n "Check example module: "
+
+ str=$(grep "Just an example" $CONSOLE_OUTPUT)
+
+ if [ -n "$str" ]; then
+ echo "PASSED"
+ else
+ echo "FAIL"
+ RET=$ES_FAIL
+ FAIL=1
+ fi
+}
+
+run_test () {
+ ARCH=$1
+ DISTRO=$2
+
+ echo "-------------------------------------------------"
+ echo "Testing Isar [$DISTRO] image for [$ARCH] machine:"
+
+ start_vm -a $ARCH -d $DISTRO -o $CONSOLE_OUTPUT -p $PID_FILE > /dev/null 2>&1 &
+ sleep 5
+
+ if [ -z `ps -p $! -o pid=` ]; then
+ echo "QEMU start: FAILED"
+ RET=$ES_FAIL
+ echo "Command output:\n8<--"
+ start_vm -a $ARCH -d $DISTRO -o $CONSOLE_OUTPUT -p $PID_FILE
+ echo "\n8<--"
+ else
+ sleep $TIMEOUT
+ kill `cat $PID_FILE`
+
+ FAIL=0
+
+ check_login_prompt
+
+ check_example_module
+
+ [ $VERBOSE -eq 1 -o $FAIL -eq 1 ] && dump_boot_log
+
+ rm $CONSOLE_OUTPUT
+ fi
+
+ rm $PID_FILE
+}
+
+show_help() {
+ echo "This script tests the Isar images for default targets in QEMU."
+ echo
+ echo "Usage:"
+ echo " $0 [params]"
+ echo
+ echo "Parameters:"
+ echo " -f,--fast test reduced set of supported targets."
+ echo " -o,--output FILE specify file to store console output."
+ echo " The default is: /tmp/isar_console"
+ echo " -p,--pid-file FILE specify file to store QEMU process PID."
+ echo " The default is: /tmp/qemu.pid"
+ echo " -q, --quiet do not display boot logs for all the targets."
+ echo " If test failed for the specific configuration,"
+ echo " the respective boot log will be printed anyway."
+ echo " -t,--timeout SEC specify time in seconds to wait before stop QEMU."
+ echo " The default is: 300"
+ echo " -h, --help display this message and exit."
+ echo
+ echo "Exit status:"
+ echo " 0 if OK,"
+ echo " 1 if test failed,"
+ echo " 3 if invalid parameters are passed."
+}
+
+# Parse command line to get user configuration
+while [ $# -gt 0 ]
+do
+ key="$1"
+
+ case $key in
+ -h|--help)
+ show_help
+ exit 0
+ ;;
+ -o|--output)
+ CONSOLE_OUTPUT=$2
+ shift
+ ;;
+ -p|--pid-file)
+ PID_FILE=$2
+ shift
+ ;;
+ -f|--fast)
+ FAST_BUILD="1"
+ ;;
+ -q|--quiet)
+ VERBOSE=0
+ ;;
+ -t|--timeout)
+ TIMEOUT=$2
+ shift
+ ;;
+ *)
+ echo "error: invalid parameter '$key', please try '--help' to get list of supported parameters"
+ exit $ES_BUG
+ ;;
+ esac
+
+ shift
+done
+
+# ARM machine
+run_test arm stretch
+run_test arm buster
+
+# AMD64 machine
+if [ -z "$FAST_BUILD" ]; then
+ run_test amd64 buster
+ run_test amd64 focal
+fi
+run_test amd64 stretch
+
+# i386 machine
+if [ -z "$FAST_BUILD" ]; then
+ run_test i386 stretch
+ run_test i386 buster
+fi
+
+# ARM64 machine
+run_test arm64 stretch
+
+exit $RET
--
2.25.1
^ permalink raw reply [flat|nested] 15+ messages in thread