[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH 15/19] tests/boot_linux_console: Extract the gunzip() helper
From: |
Philippe Mathieu-Daudé |
Subject: |
[PATCH 15/19] tests/boot_linux_console: Extract the gunzip() helper |
Date: |
Thu, 26 Sep 2019 19:34:23 +0200 |
We are going to use the same pattern. Instead of keeping
copy/pasting this code, extract as a local function.
Signed-off-by: Philippe Mathieu-Daudé <address@hidden>
---
tests/acceptance/boot_linux_console.py | 10 ++++++----
1 file changed, 6 insertions(+), 4 deletions(-)
diff --git a/tests/acceptance/boot_linux_console.py
b/tests/acceptance/boot_linux_console.py
index 8a9a314ab4..079590f0c8 100644
--- a/tests/acceptance/boot_linux_console.py
+++ b/tests/acceptance/boot_linux_console.py
@@ -19,6 +19,11 @@ from avocado.utils import process
from avocado.utils import archive
+def gunzip(in_pathname_gz, out_pathname):
+ with gzip.open(in_pathname_gz, 'rb') as f_in:
+ with open(out_pathname, 'wb') as f_out:
+ shutil.copyfileobj(f_in, f_out)
+
class BootLinuxConsole(Test):
"""
Boots a Linux kernel and checks that the console is operational and the
@@ -166,10 +171,7 @@ class BootLinuxConsole(Test):
initrd_hash = 'bf806e17009360a866bf537f6de66590de349a99'
initrd_path_gz = self.fetch_asset(initrd_url, asset_hash=initrd_hash)
initrd_path = self.workdir + "rootfs.cpio"
-
- with gzip.open(initrd_path_gz, 'rb') as f_in:
- with open(initrd_path, 'wb') as f_out:
- shutil.copyfileobj(f_in, f_out)
+ gunzip(initrd_path_gz, initrd_path)
self.vm.set_machine('malta')
self.vm.set_console()
--
2.20.1
- [PATCH 05/19] hw/arm/bcm2835: Add various unimplemented peripherals, (continued)
- [PATCH 05/19] hw/arm/bcm2835: Add various unimplemented peripherals, Philippe Mathieu-Daudé, 2019/09/26
- [PATCH 06/19] hw/char/bcm2835_aux: Add trace events, Philippe Mathieu-Daudé, 2019/09/26
- [PATCH 09/19] hw/arm/bcm2835_peripherals: Use the thermal sensor block, Philippe Mathieu-Daudé, 2019/09/26
- [PATCH 07/19] hw/misc/bcm2835_mbox: Add trace events, Philippe Mathieu-Daudé, 2019/09/26
- [PATCH 08/19] hw/misc/bcm2835_thermal: Add a dummy BCM2835 thermal sensor, Philippe Mathieu-Daudé, 2019/09/26
- [PATCH 10/19] hw/timer/bcm2835: Add the BCM2835 SYS_timer, Philippe Mathieu-Daudé, 2019/09/26
- [PATCH 11/19] hw/arm/bcm2835_peripherals: Use the SYS_timer, Philippe Mathieu-Daudé, 2019/09/26
- [PATCH 14/19] python/qemu/machine: Allow to use other serial consoles than default, Philippe Mathieu-Daudé, 2019/09/26
- [PATCH 13/19] hw/arm/raspi: Define various blocks base addresses, Philippe Mathieu-Daudé, 2019/09/26
- [PATCH 12/19] hw/arm/bcm2835_peripherals: Add Clock/Power/Reset Manager blocks, Philippe Mathieu-Daudé, 2019/09/26
- [PATCH 15/19] tests/boot_linux_console: Extract the gunzip() helper,
Philippe Mathieu-Daudé <=
- [PATCH 16/19] tests/boot_linux_console: Add a test for the Raspberry Pi 2, Philippe Mathieu-Daudé, 2019/09/26
- [PATCH 17/19] tests/boot_linux_console: Test the raspi2 UART1 (16550 based), Philippe Mathieu-Daudé, 2019/09/26
- [PATCH 18/19] tests/boot_linux_console: Boot Linux and run few commands on raspi3, Philippe Mathieu-Daudé, 2019/09/26
- [PATCH 19/19] tests/boot_linux_console: Test SDHCI and termal sensor on raspi3, Philippe Mathieu-Daudé, 2019/09/26
- Re: [PATCH 00/19] hw/arm/raspi: Improve Raspberry Pi 2/3 reliability, BALATON Zoltan, 2019/09/26