[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PATCH 4/5] tests/acceptance: Add bFLT loader linux-user te
From: |
Philippe Mathieu-Daudé |
Subject: |
[Qemu-devel] [PATCH 4/5] tests/acceptance: Add bFLT loader linux-user test |
Date: |
Tue, 25 Jun 2019 12:15:23 +0200 |
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.20.1
- [Qemu-devel] [PATCH 0/5] tests/acceptance: Add bFLT loader linux-user test, Philippe Mathieu-Daudé, 2019/06/25
- [Qemu-devel] [PATCH 1/5] tests/acceptance: Rename avocado_qemu.Test as MachineTest, Philippe Mathieu-Daudé, 2019/06/25
- [Qemu-devel] [PATCH 3/5] tests/acceptance: Introduce LinuxUserTest base class, Philippe Mathieu-Daudé, 2019/06/25
- [Qemu-devel] [PATCH 5/5] .travis.yml: Let the avocado job run linux-user tests, Philippe Mathieu-Daudé, 2019/06/25
- [Qemu-devel] [PATCH 4/5] tests/acceptance: Add bFLT loader linux-user test,
Philippe Mathieu-Daudé <=
- [Qemu-devel] [PATCH 2/5] tests/acceptance: Make pick_default_qemu_bin() more generic, Philippe Mathieu-Daudé, 2019/06/25
- Re: [Qemu-devel] [PATCH 0/5] tests/acceptance: Add bFLT loader linux-user test, no-reply, 2019/06/25