test: Unify the different test modes to a smaller number of targets

Now that tests in the host's network namespce can be run inside the
container, simplify test.mk for increased reusability.
This commit is contained in:
Tobias Waldekranz
2024-05-20 16:21:06 +02:00
parent d7c41489e0
commit 03d48e9aab
+13 -23
View File
@@ -1,36 +1,26 @@
test-dir := $(BR2_EXTERNAL_INFIX_PATH)/test
ninepm := $(BR2_EXTERNAL_INFIX_PATH)/test/9pm/9pm.py
UNIT_TESTS ?= $(test-dir)/case/all-repo.yaml $(test-dir)/case/all-unit.yaml
INFIX_TESTS ?= $(test-dir)/case/all.yaml
TEST_MODE ?= qeneth
mode-qeneth := -q $(test-dir)/virt/quad
mode-host := -t $(or $(TOPOLOGY),/etc/infamy.dot)
mode-run := -t $(BINARIES_DIR)/qemu.dot
mode := $(mode-$(TEST_MODE))
binaries-$(ARCH) := $(addprefix infix-$(ARCH),.img -disk.img .pkg)
binaries-x86_64 += OVMF.fd
binaries := $(foreach bin,$(binaries-$(ARCH)),-f $(BINARIES_DIR)/$(bin))
test-env-qeneth = $(test-dir)/env $(binaries) -q $(test-dir)/virt/quad $(1)
test-env-run = $(test-dir)/env $(binaries) -C -t $(BINARIES_DIR)/qemu.dot $(1)
test:
$(test-dir)/env $(mode) $(binaries) $(ninepm) $(INFIX_TESTS)
test test-qeneth:
$(call test-env-qeneth,\
$(BR2_EXTERNAL_INFIX_PATH)/test/9pm/9pm.py \
$(INFIX_TESTS))
test-sh test-qeneth-sh:
$(call test-env-qeneth,-i /bin/sh)
test-run: | ~/.infix-test-venv
$(call test-env-run,\
$(BR2_EXTERNAL_INFIX_PATH)/test/9pm/9pm.py \
$(INFIX_TESTS))
test-run-sh: | ~/.infix-test-venv
$(call test-env-run,/bin/sh)
test-run-play: | ~/.infix-test-venv
$(call test-env-run,$(test-dir)/case/meta/play.py)
~/.infix-test-venv:
$(test-dir)/docker/init-venv.sh $(test-dir)/docker/pip-requirements.txt
test-sh:
$(test-dir)/env $(mode) $(binaries) -i /bin/sh
test-unit:
$(test-dir)/env $(test-dir)/9pm/9pm.py $(UNIT_TESTS)
$(test-dir)/env $(ninepm) $(UNIT_TESTS)
.PHONY: test test-sh test-qeneth test-qeneth-sh test-run test-run-sh test-run-play test-unit
.PHONY: test test-sh test-unit