mirror of
https://github.com/Motorhead1991/qemu.git
synced 2025-08-04 00:03:54 -06:00
tests/vm: Allow to set qemu-img path
By default VM build test use qemu-img from system's PATH to create the image disk. Due the lack of qemu-img on the system or the desire to simply use a version built with QEMU, it would be nice to allow one to set its path. So this patch makes that possible by reading the path to qemu-img from QEMU_IMG if set, otherwise it fallback to default behavior. Signed-off-by: Wainer dos Santos Moschetta <wainersm@redhat.com> Message-Id: <20191114134246.12073-2-wainersm@redhat.com> Signed-off-by: Alex Bennée <alex.bennee@linaro.org> Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>
This commit is contained in:
parent
afc3a8f9f1
commit
1e48931c0c
9 changed files with 16 additions and 13 deletions
|
@ -152,6 +152,11 @@ class BaseVM(object):
|
|||
def build_image(self, img):
|
||||
raise NotImplementedError
|
||||
|
||||
def exec_qemu_img(self, *args):
|
||||
cmd = [os.environ.get("QEMU_IMG", "qemu-img")]
|
||||
cmd.extend(list(args))
|
||||
subprocess.check_call(cmd)
|
||||
|
||||
def add_source_dir(self, src_dir):
|
||||
name = "data-" + hashlib.sha1(src_dir.encode("utf-8")).hexdigest()[:5]
|
||||
tarfile = os.path.join(self._tmpdir, name + ".tar")
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue