]> git.proxmox.com Git - mirror_qemu.git/blob - tests/vm/Makefile.include
Merge remote-tracking branch 'remotes/kraxel/tags/vga-20190705-pull-request' into...
[mirror_qemu.git] / tests / vm / Makefile.include
1 # Makefile for VM tests
2
3 .PHONY: vm-build-all vm-clean-all
4
5 IMAGES := ubuntu.i386 freebsd netbsd openbsd centos fedora
6 IMAGES_DIR := $(HOME)/.cache/qemu-vm/images
7 IMAGE_FILES := $(patsubst %, $(IMAGES_DIR)/%.img, $(IMAGES))
8
9 .PRECIOUS: $(IMAGE_FILES)
10
11 # 'vm-help' target was historically named 'vm-test'
12 vm-help vm-test:
13 @echo "vm-help: Test QEMU in preconfigured virtual machines"
14 @echo
15 @echo " vm-build-ubuntu.i386 - Build QEMU in ubuntu i386 VM"
16 @echo " vm-build-freebsd - Build QEMU in FreeBSD VM"
17 @echo " vm-build-netbsd - Build QEMU in NetBSD VM"
18 @echo " vm-build-openbsd - Build QEMU in OpenBSD VM"
19 @echo " vm-build-centos - Build QEMU in CentOS VM, with Docker"
20 @echo " vm-build-fedora - Build QEMU in Fedora VM"
21 @echo ""
22 @echo " vm-build-all - Build QEMU in all VMs"
23 @echo " vm-clean-all - Clean up VM images"
24 @echo
25 @echo "For trouble-shooting:"
26 @echo " vm-boot-serial-<guest> - Boot guest, serial console on stdio"
27 @echo " vm-boot-ssh-<guest> - Boot guest and login via ssh"
28 @echo
29 @echo "Special variables:"
30 @echo " BUILD_TARGET=foo - Override the build target"
31 @echo " TARGET_LIST=a,b,c - Override target list in builds"
32 @echo ' EXTRA_CONFIGURE_OPTS="..."'
33 @echo " J=[0..9]* - Override the -jN parameter for make commands"
34 @echo " DEBUG=1 - Enable verbose output on host and interactive debugging"
35 @echo " V=1 - Enable verbose ouput on host and guest commands"
36 @echo " QEMU=/path/to/qemu - Change path to QEMU binary"
37
38 vm-build-all: $(addprefix vm-build-, $(IMAGES))
39
40 vm-clean-all:
41 rm -f $(IMAGE_FILES)
42
43 $(IMAGES_DIR)/%.img: $(SRC_PATH)/tests/vm/% \
44 $(SRC_PATH)/tests/vm/basevm.py \
45 $(SRC_PATH)/tests/vm/Makefile.include
46 @mkdir -p $(IMAGES_DIR)
47 $(call quiet-command, \
48 $(PYTHON) $< \
49 $(if $(V)$(DEBUG), --debug) \
50 --image "$@" \
51 --force \
52 --build-image $@, \
53 " VM-IMAGE $*")
54
55
56 # Build in VM $(IMAGE)
57 vm-build-%: $(IMAGES_DIR)/%.img
58 $(call quiet-command, \
59 $(PYTHON) $(SRC_PATH)/tests/vm/$* \
60 $(if $(V)$(DEBUG), --debug) \
61 $(if $(DEBUG), --interactive) \
62 $(if $(J),--jobs $(J)) \
63 $(if $(V),--verbose) \
64 --image "$<" \
65 $(if $(BUILD_TARGET),--build-target $(BUILD_TARGET)) \
66 --snapshot \
67 --build-qemu $(SRC_PATH) -- \
68 $(if $(TARGET_LIST),--target-list=$(TARGET_LIST)) \
69 $(if $(EXTRA_CONFIGURE_OPTS),$(EXTRA_CONFIGURE_OPTS)), \
70 " VM-BUILD $*")
71
72 vm-boot-serial-%: $(IMAGES_DIR)/%.img
73 qemu-system-x86_64 -enable-kvm -m 4G -smp 2 -nographic \
74 -drive if=none,id=vblk,cache=writeback,file="$<" \
75 -netdev user,id=vnet \
76 -device virtio-blk-pci,drive=vblk \
77 -device virtio-net-pci,netdev=vnet \
78 || true
79
80 vm-boot-ssh-%: $(IMAGES_DIR)/%.img
81 $(call quiet-command, \
82 $(SRC_PATH)/tests/vm/$* \
83 --image "$<" \
84 --interactive \
85 false, \
86 " VM-BOOT-SSH $*") || true