[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH 09/26] tests/acceptance: Add bFLT loader linux-user test
From: |
Philippe Mathieu-Daudé |
Subject: |
[PATCH 09/26] tests/acceptance: Add bFLT loader linux-user test |
Date: |
Mon, 28 Oct 2019 08:34:24 +0100 |
From: Philippe Mathieu-Daudé <address@hidden>
Add a very quick test that runs a busybox binary in bFLT format:
$ avocado --show=app run tests/acceptance/load_bflt.py
JOB ID : db94d5960ce564c50904d666a7e259148c27e88f
JOB LOG : ~/avocado/job-results/job-2019-06-25T10.52-db94d59/job.log
(1/1) tests/acceptance/load_bflt.py:LoadBFLT.test_stm32: PASS (0.15 s)
RESULTS : PASS 1 | ERROR 0 | FAIL 0 | SKIP 0 | WARN 0 | INTERRUPT 0 |
CANCEL 0
JOB TIME : 0.54 s
Signed-off-by: Philippe Mathieu-Daudé <address@hidden>
---
This test currently fails on Aarch64 host, see LP#1833668
https://bugs.launchpad.net/qemu/+bug/1833668
---
tests/acceptance/load_bflt.py | 52 +++++++++++++++++++++++++++++++++++
1 file changed, 52 insertions(+)
create mode 100644 tests/acceptance/load_bflt.py
diff --git a/tests/acceptance/load_bflt.py b/tests/acceptance/load_bflt.py
new file mode 100644
index 0000000000..fdcaf8ad88
--- /dev/null
+++ b/tests/acceptance/load_bflt.py
@@ -0,0 +1,52 @@
+# Test the bFLT format
+#
+# Copyright (C) 2019 Philippe Mathieu-Daudé <address@hidden>
+#
+# SPDX-License-Identifier: GPL-2.0-or-later
+
+import os
+import bz2
+import subprocess
+
+from avocado_qemu import LinuxUserTest
+
+
+class LoadBFLT(LinuxUserTest):
+
+ def extract_cpio(self, cpio_path):
+ """
+ Extracts a cpio archive into the test workdir
+
+ :param cpio_path: path to the cpio archive
+ """
+ cwd = os.getcwd()
+ os.chdir(self.workdir)
+ with bz2.open(cpio_path, 'rb') as archive_cpio:
+ subprocess.run(['cpio', '-i'], input=archive_cpio.read(),
+ stderr=subprocess.DEVNULL)
+ os.chdir(cwd)
+
+ def test_stm32(self):
+ """
+ :avocado: tags=arch:arm
+ :avocado: tags=linux_user
+ :avocado: tags=quick
+ """
+ # See https://elinux.org/STM32#User_Space
+ rootfs_url = ('https://elinux.org/images/5/51/'
+ 'Stm32_mini_rootfs.cpio.bz2')
+ rootfs_hash = '9f065e6ba40cce7411ba757f924f30fcc57951e6'
+ rootfs_path_bz2 = self.fetch_asset(rootfs_url, asset_hash=rootfs_hash)
+ busybox_path = self.workdir + "/bin/busybox"
+
+ self.extract_cpio(rootfs_path_bz2)
+
+ cmd = ''
+ res = self.run("%s %s" % (busybox_path, cmd))
+ ver = 'BusyBox v1.24.0.git (2015-02-03 22:17:13 CET) multi-call
binary.'
+ self.assertIn(ver, res.stdout_text)
+
+ cmd = 'uname -a'
+ res = self.run("%s %s" % (busybox_path, cmd))
+ unm = 'armv7l GNU/Linux'
+ self.assertIn(unm, res.stdout_text)
--
2.21.0
- Re: [PATCH 03/26] tests/acceptance: Fixe wait_for_console_pattern() hangs, (continued)
- [PATCH 04/26] tests/acceptance: Send <carriage return> on serial lines, Philippe Mathieu-Daudé, 2019/10/28
- [PATCH 05/26] tests/acceptance: Refactor exec_command_and_wait_for_pattern(), Philippe Mathieu-Daudé, 2019/10/28
- [PATCH 06/26] tests/acceptance: Rename avocado_qemu.Test as MachineTest, Philippe Mathieu-Daudé, 2019/10/28
- [PATCH 07/26] tests/acceptance: Make pick_default_qemu_bin() more generic, Philippe Mathieu-Daudé, 2019/10/28
- [PATCH 08/26] tests/acceptance: Introduce LinuxUserTest base class, Philippe Mathieu-Daudé, 2019/10/28
- [PATCH 09/26] tests/acceptance: Add bFLT loader linux-user test,
Philippe Mathieu-Daudé <=
- [PATCH 10/26] tests/acceptance: Add test that boots the HelenOS microkernel on Leon3, Philippe Mathieu-Daudé, 2019/10/28
- [PATCH 11/26] tests/acceptance: Add test that boots Linux up to BusyBox on Leon3, Philippe Mathieu-Daudé, 2019/10/28
- [PATCH 12/26] .travis.yml: Let the avocado job run the Leon3 test, Philippe Mathieu-Daudé, 2019/10/28
- [PATCH 13/26] tests/acceptance: Add test that runs NetBSD 4.0 installer on PRep/40p, Philippe Mathieu-Daudé, 2019/10/28
- [PATCH 14/26] tests/acceptance: Test Open Firmware on the PReP/40p, Philippe Mathieu-Daudé, 2019/10/28