From 175f7e1c587f5ff5b7dbe4a85df72426d300db17 Mon Sep 17 00:00:00 2001 From: Tobias Waldekranz Date: Mon, 12 Jun 2023 12:43:41 +0200 Subject: [PATCH] x86_64: Make the test environment more customizable - Collect all test related targets under the test- prefix. - Add target to run test suite against a `make run` instance. The intended use-case is that you are testing out a new build with `make run`, and then realize that you want to run some tests. With this change, it is now possible to run `make infix-run-check` from a separate terminal - which attaches to the running instance and runs the tests. - Provide -sh targets to spawn interactive environments, which is useful during debugging. - Allow the user to supply a custom suite or list of tests to be run by 9PM. --- .github/workflows/build.yml | 2 +- .github/workflows/regression.yml | 2 +- board/x86_64/board.mk | 34 +++++++++++++++++++++++++------- 3 files changed, 29 insertions(+), 9 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 9a8b38c8..3c3429cf 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -61,7 +61,7 @@ jobs: - name: Test if: matrix.platform == 'x86_64' && matrix.variant == 'netconf' run: | - make infix-check + make test-qeneth - name: Prepare Artifact run: | cd output diff --git a/.github/workflows/regression.yml b/.github/workflows/regression.yml index 90e06fd1..707fd787 100644 --- a/.github/workflows/regression.yml +++ b/.github/workflows/regression.yml @@ -41,4 +41,4 @@ jobs: make - name: Regression Test run: | - make infix-check + make test-qeneth diff --git a/board/x86_64/board.mk b/board/x86_64/board.mk index d17cffd9..5e356fcd 100644 --- a/board/x86_64/board.mk +++ b/board/x86_64/board.mk @@ -1,8 +1,28 @@ -test-dir = $(BR2_EXTERNAL_INFIX_PATH)/test +test-dir := $(BR2_EXTERNAL_INFIX_PATH)/test +INFIX_TESTS ?= $(test-dir)/case/all.yaml -.PHONY: infix-check -infix-check: - $(test-dir)/env \ - -q $(test-dir)/virt/dual \ - -f $(BINARIES_DIR)/infix-x86_64.img \ - $(BR2_EXTERNAL_INFIX_PATH)/9pm/9pm.py $(test-dir)/case/all.yaml +test-env = $(test-dir)/env \ + -f $(BINARIES_DIR)/infix-x86_64.img \ + $(1) $(2) + +test-env-qeneth = $(call test-env,-q $(test-dir)/virt/dual,$(1)) +test-env-run = $(call test-env,-C -t $(BINARIES_DIR)/qemu.dot,$(1)) + +.PHONY: test-% + +test-qeneth: + $(call test-env-qeneth,\ + $(BR2_EXTERNAL_INFIX_PATH)/9pm/9pm.py \ + $(INFIX_TESTS)) +test-qeneth-sh: + $(call test-env-qeneth,/bin/sh) + +test-run: | ~/.infix-test-venv + $(call test-env-run,\ + $(BR2_EXTERNAL_INFIX_PATH)/9pm/9pm.py \ + $(INFIX_TESTS)) +test-run-sh: + $(call test-env-run,/bin/sh) + +~/.infix-test-venv: + $(test-dir)/docker/init-venv.sh $(test-dir)/docker/pip-requirements.txt