tests/functional: replace 'run_cmd' with subprocess helpers

The 'run_cmd' helper is re-implementing a convenient helper that
already exists in the form of the 'run' and 'check_call' methods
provided by 'subprocess'.

Reviewed-by: Thomas Huth <thuth@redhat.com>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
Message-ID: <20241217155953.3950506-29-berrange@redhat.com>
Signed-off-by: Thomas Huth <thuth@redhat.com>
This commit is contained in:
Daniel P. Berrangé 2024-12-17 15:59:49 +00:00 committed by Thomas Huth
parent 3bb4c8b613
commit 37e9b19c34
6 changed files with 41 additions and 30 deletions

View file

@ -11,11 +11,12 @@
import os
import stat
from subprocess import check_call, DEVNULL
from qemu_test import QemuSystemTest
from qemu_test import exec_command_and_wait_for_pattern
from qemu_test import wait_for_console_pattern
from qemu_test import which, run_cmd, get_qemu_img
from qemu_test import which, get_qemu_img
class TuxRunBaselineTest(QemuSystemTest):
@ -76,8 +77,9 @@ class TuxRunBaselineTest(QemuSystemTest):
disk_image = self.scratch_file("rootfs.ext4")
run_cmd(['zstd', "-f", "-d", disk_image_zst,
"-o", disk_image])
check_call(['zstd', "-f", "-d", disk_image_zst,
"-o", disk_image],
stdout=DEVNULL, stderr=DEVNULL)
# zstd copies source archive permissions for the output
# file, so must make this writable for QEMU
os.chmod(disk_image, stat.S_IRUSR | stat.S_IWUSR)