hw: usb: hcd-ohci: check for processed TD before retire
[qemu/ar7.git] / tests / vm / Makefile.include
blob61f893ffdc0971e04d30e6ed4d31e25b9c397008
1 # Makefile for VM tests
3 .PHONY: vm-build-all vm-clean-all
5 EFI_AARCH64 = $(wildcard $(BUILD_DIR)/pc-bios/edk2-aarch64-code.fd)
7 IMAGES := freebsd netbsd openbsd centos fedora
8 ifneq ($(GENISOIMAGE),)
9 IMAGES += ubuntu.i386 centos
10 ifneq ($(EFI_AARCH64),)
11 IMAGES += ubuntu.aarch64 centos.aarch64
12 endif
13 endif
15 IMAGES_DIR := $(HOME)/.cache/qemu-vm/images
16 IMAGE_FILES := $(patsubst %, $(IMAGES_DIR)/%.img, $(IMAGES))
18 .PRECIOUS: $(IMAGE_FILES)
20 ifneq ($(PYTHON),)
21 HAVE_PYTHON_YAML = $(shell $(PYTHON) -c "import yaml" 2> /dev/null && echo yes)
22 endif
24 # 'vm-help' target was historically named 'vm-test'
25 vm-help vm-test:
26         @echo "vm-help: Test QEMU in preconfigured virtual machines"
27         @echo
28         @echo "  vm-build-freebsd                - Build QEMU in FreeBSD VM"
29         @echo "  vm-build-netbsd                 - Build QEMU in NetBSD VM"
30         @echo "  vm-build-openbsd                - Build QEMU in OpenBSD VM"
31         @echo "  vm-build-fedora                 - Build QEMU in Fedora VM"
32 ifneq ($(GENISOIMAGE),)
33         @echo "  vm-build-centos                 - Build QEMU in CentOS VM, with Docker"
34         @echo "  vm-build-ubuntu.i386            - Build QEMU in ubuntu i386 VM"
35 ifneq ($(EFI_AARCH64),)
36         @echo "  vm-build-ubuntu.aarch64         - Build QEMU in ubuntu aarch64 VM"
37         @echo "  vm-build-centos.aarch64         - Build QEMU in CentOS aarch64 VM"
38 else
39         @echo "  (to build centos/ubuntu aarch64 images use configure --efi-aarch64)"
40 endif
41 else
42         @echo "  (install genisoimage to build centos/ubuntu images)"
43 endif
44         @echo ""
45         @echo "  vm-build-all                    - Build QEMU in all VMs"
46         @echo "  vm-clean-all                    - Clean up VM images"
47         @echo
48         @echo "For trouble-shooting:"
49         @echo "  vm-boot-serial-<guest>          - Boot guest, serial console on stdio"
50         @echo "  vm-boot-ssh-<guest>             - Boot guest and login via ssh"
51         @echo
52         @echo "Special variables:"
53         @echo "    BUILD_TARGET=foo              - Override the build target"
54         @echo "    TARGET_LIST=a,b,c             - Override target list in builds"
55         @echo '    EXTRA_CONFIGURE_OPTS="..."'
56         @echo "    J=[0..9]*                     - Override the -jN parameter for make commands"
57         @echo "    DEBUG=1                       - Enable verbose output on host and interactive debugging"
58         @echo "    LOG_CONSOLE=1                 - Log console to file in: ~/.cache/qemu-vm "
59         @echo "    V=1                           - Enable verbose ouput on host and guest commands"
60         @echo "    QEMU_LOCAL=1                 - Use QEMU binary local to this build."
61         @echo "    QEMU=/path/to/qemu            - Change path to QEMU binary"
62         @echo "    QEMU_IMG=/path/to/qemu-img    - Change path to qemu-img tool"
63 ifeq ($(HAVE_PYTHON_YAML),yes)
64         @echo "    QEMU_CONFIG=/path/conf.yml   - Change path to VM configuration .yml file."
65 else
66         @echo "    (install python3-yaml to enable support for yaml file to configure a VM.)"
67 endif
68         @echo "                                   See conf_example_*.yml for file format details."
70 vm-build-all: $(addprefix vm-build-, $(IMAGES))
72 vm-clean-all:
73         rm -f $(IMAGE_FILES)
75 $(IMAGES_DIR)/%.img:    $(SRC_PATH)/tests/vm/% \
76                         $(SRC_PATH)/tests/vm/basevm.py \
77                         $(SRC_PATH)/tests/vm/Makefile.include
78         @mkdir -p $(IMAGES_DIR)
79         $(call quiet-command, \
80                 $(PYTHON) $< \
81                 $(if $(V)$(DEBUG), --debug) \
82                 $(if $(GENISOIMAGE),--genisoimage $(GENISOIMAGE)) \
83                 $(if $(QEMU_LOCAL),--build-path $(BUILD_DIR)) \
84                 $(if $(EFI_AARCH64),--efi-aarch64 $(EFI_AARCH64)) \
85                 $(if $(LOG_CONSOLE),--log-console) \
86                 --image "$@" \
87                 --force \
88                 --build-image $@, \
89                 "  VM-IMAGE $*")
92 # Build in VM $(IMAGE)
93 vm-build-%: $(IMAGES_DIR)/%.img
94         $(call quiet-command, \
95                 $(PYTHON) $(SRC_PATH)/tests/vm/$* \
96                 $(if $(V)$(DEBUG), --debug) \
97                 $(if $(DEBUG), --interactive) \
98                 $(if $(J),--jobs $(J)) \
99                 $(if $(V),--verbose) \
100                 $(if $(QEMU_LOCAL),--build-path $(BUILD_DIR)) \
101                 $(if $(EFI_AARCH64),--efi-aarch64 $(EFI_AARCH64)) \
102                 $(if $(LOG_CONSOLE),--log-console) \
103                 --image "$<" \
104                 $(if $(BUILD_TARGET),--build-target $(BUILD_TARGET)) \
105                 --snapshot \
106                 --build-qemu $(SRC_PATH) -- \
107                 $(if $(TARGET_LIST),--target-list=$(TARGET_LIST)) \
108                 $(if $(EXTRA_CONFIGURE_OPTS),$(EXTRA_CONFIGURE_OPTS)), \
109                 "  VM-BUILD $*")
111 vm-boot-serial-%: $(IMAGES_DIR)/%.img
112         qemu-system-x86_64 -enable-kvm -m 4G -smp 2 -nographic \
113                 -drive if=none,id=vblk,cache=writeback,file="$<" \
114                 -netdev user,id=vnet \
115                 -device virtio-blk-pci,drive=vblk \
116                 -device virtio-net-pci,netdev=vnet \
117         || true
119 vm-boot-ssh-%: $(IMAGES_DIR)/%.img
120         $(call quiet-command, \
121                 $(PYTHON) $(SRC_PATH)/tests/vm/$* \
122                 $(if $(J),--jobs $(J)) \
123                 $(if $(V)$(DEBUG), --debug) \
124                 $(if $(QEMU_LOCAL),--build-path $(BUILD_DIR)) \
125                 $(if $(EFI_AARCH64),--efi-aarch64 $(EFI_AARCH64)) \
126                 $(if $(LOG_CONSOLE),--log-console) \
127                 --image "$<" \
128                 --interactive \
129                 false, \
130                 "  VM-BOOT-SSH $*") || true