On Tue, 07/03 12:56, Philippe Mathieu-Daudé wrote: > Hi Fam, > > On 07/02/2018 12:19 PM, Philippe Mathieu-Daudé wrote: > > On 07/02/2018 04:18 AM, Fam Zheng wrote: > >> On Thu, 06/28 12:35, Philippe Mathieu-Daudé wrote: > >>> Before the first use, the VM image are resized with qemu-img. > >>> > >>> Add a dependency to the qemu-img tool to fix: > >>> > >>> $ make vm-build-ubuntu.i386 > >>> Traceback (most recent call last): > >>> File "source/qemu/tests/vm/basevm.py", line 236, in main > >>> return vm.build_image(args.image) > >>> File "tests/vm/ubuntu.i386", line 67, in build_image > >>> subprocess.check_call(["qemu-img", "resize", img_tmp, "50G"]) > >>> OSError: [Errno 2] No such file or directory > >>> tests/vm/Makefile.include:23: recipe for target > >>> 'tests/vm/ubuntu.i386.img' failed > >>> make: *** [tests/vm/ubuntu.i386.img] Error 2 > >>> > >>> Signed-off-by: Philippe Mathieu-Daudé <f4...@amsat.org> > >>> --- > >>> tests/vm/Makefile.include | 3 +++ > >>> 1 file changed, 3 insertions(+) > >>> > >>> diff --git a/tests/vm/Makefile.include b/tests/vm/Makefile.include > >>> index 5daa2a3b73..e5e8146267 100644 > >>> --- a/tests/vm/Makefile.include > >>> +++ b/tests/vm/Makefile.include > >>> @@ -17,10 +17,13 @@ vm-test: > >>> > >>> vm-build-all: $(addprefix vm-build-, $(IMAGES)) > >>> > >>> +$(IMAGE_FILES): qemu-img$(EXESUF) > >> > >> No, please don't do this. Let's keep on supporting vm tests from a clean > >> source > >> tree. Similar to qemu_bin, this can be handled in basevm.py. > > > > OK. > > The ubuntu.i386 VM is the only one using the qemu-img tool in his > build_image() method implementation. Is it OK to add this check there? > The basevm.build_image() is only an abstract method.
Maybe you can add a BaseVM.qemu_img() method that looks up for available qemu-img on the system or build dir. Fam > > >>> + > >>> tests/vm/%.img: $(SRC_PATH)/tests/vm/% \ > >>> $(SRC_PATH)/tests/vm/basevm.py \ > >>> $(SRC_PATH)/tests/vm/Makefile.include > >>> $(call quiet-command, \ > >>> + PATH=$(PATH):. \ > >>> $< \ > >>> $(if $(V)$(DEBUG), --debug) \ > >>> --image "$@" \ > >>> -- > >>> 2.18.0 > >>> > >>