Commit b438b3b8 authored by Jason A. Donenfeld's avatar Jason A. Donenfeld Committed by Jakub Kicinski

wireguard: selftests: support UML

This shoud open up various possibilities like time travel execution, and
is also just another platform to help shake out bugs.

Cc: Johannes Berg <johannes@sipsolutions.net>
Signed-off-by: default avatarJason A. Donenfeld <Jason@zx2c4.com>
Signed-off-by: default avatarJakub Kicinski <kuba@kernel.org>
parent c31b14d8
...@@ -248,8 +248,13 @@ QEMU_MACHINE := -cpu host,accel=kvm -machine s390-ccw-virtio -append $(KERNEL_CM ...@@ -248,8 +248,13 @@ QEMU_MACHINE := -cpu host,accel=kvm -machine s390-ccw-virtio -append $(KERNEL_CM
else else
QEMU_MACHINE := -cpu max -machine s390-ccw-virtio -append $(KERNEL_CMDLINE) QEMU_MACHINE := -cpu max -machine s390-ccw-virtio -append $(KERNEL_CMDLINE)
endif endif
else ifeq ($(ARCH),um)
CHOST := $(HOST_ARCH)-linux-musl
KERNEL_BZIMAGE := $(KERNEL_BUILD_PATH)/vmlinux
KERNEL_ARCH := um
KERNEL_CMDLINE := $(shell sed -n 's/CONFIG_CMDLINE=\(.*\)/\1/p' arch/um.config)
else else
$(error I only build: x86_64, i686, arm, armeb, aarch64, aarch64_be, mips, mipsel, mips64, mips64el, powerpc64, powerpc64le, powerpc, m68k, riscv64, riscv32, s390x) $(error I only build: x86_64, i686, arm, armeb, aarch64, aarch64_be, mips, mipsel, mips64, mips64el, powerpc64, powerpc64le, powerpc, m68k, riscv64, riscv32, s390x, um)
endif endif
TOOLCHAIN_FILENAME := $(CHOST)-cross.tgz TOOLCHAIN_FILENAME := $(CHOST)-cross.tgz
...@@ -262,7 +267,9 @@ $(eval $(call file_download,$(TOOLCHAIN_FILENAME),$(TOOLCHAIN_DIR),,$(DISTFILES_ ...@@ -262,7 +267,9 @@ $(eval $(call file_download,$(TOOLCHAIN_FILENAME),$(TOOLCHAIN_DIR),,$(DISTFILES_
STRIP := $(CHOST)-strip STRIP := $(CHOST)-strip
CROSS_COMPILE_FLAG := --build=$(CBUILD) --host=$(CHOST) CROSS_COMPILE_FLAG := --build=$(CBUILD) --host=$(CHOST)
$(info Building for $(CHOST) using $(CBUILD)) $(info Building for $(CHOST) using $(CBUILD))
ifneq ($(ARCH),um)
export CROSS_COMPILE := $(CHOST)- export CROSS_COMPILE := $(CHOST)-
endif
export PATH := $(TOOLCHAIN_PATH)/bin:$(PATH) export PATH := $(TOOLCHAIN_PATH)/bin:$(PATH)
export CC := $(CHOST)-gcc export CC := $(CHOST)-gcc
CCACHE_PATH := $(shell which ccache 2>/dev/null) CCACHE_PATH := $(shell which ccache 2>/dev/null)
...@@ -279,6 +286,7 @@ comma := , ...@@ -279,6 +286,7 @@ comma := ,
build: $(KERNEL_BZIMAGE) build: $(KERNEL_BZIMAGE)
qemu: $(KERNEL_BZIMAGE) qemu: $(KERNEL_BZIMAGE)
rm -f $(BUILD_PATH)/result rm -f $(BUILD_PATH)/result
ifneq ($(ARCH),um)
timeout --foreground 20m qemu-system-$(QEMU_ARCH) \ timeout --foreground 20m qemu-system-$(QEMU_ARCH) \
-nodefaults \ -nodefaults \
-nographic \ -nographic \
...@@ -291,6 +299,13 @@ qemu: $(KERNEL_BZIMAGE) ...@@ -291,6 +299,13 @@ qemu: $(KERNEL_BZIMAGE)
-no-reboot \ -no-reboot \
-monitor none \ -monitor none \
-kernel $< -kernel $<
else
timeout --foreground 20m $< \
$(KERNEL_CMDLINE) \
mem=$$(grep -q CONFIG_DEBUG_KMEMLEAK=y $(KERNEL_BUILD_PATH)/.config && echo 1G || echo 256M) \
noreboot \
con1=fd:51 51>$(BUILD_PATH)/result </dev/null 2>&1 | cat
endif
grep -Fq success $(BUILD_PATH)/result grep -Fq success $(BUILD_PATH)/result
$(BUILD_PATH)/init-cpio-spec.txt: $(TOOLCHAIN_PATH)/.installed $(BUILD_PATH)/init $(BUILD_PATH)/init-cpio-spec.txt: $(TOOLCHAIN_PATH)/.installed $(BUILD_PATH)/init
......
CONFIG_64BIT=y
CONFIG_CMDLINE="wg.success=tty1 panic_on_warn=1"
CONFIG_FRAME_WARN=1280
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment