From d1527f0b33a66dcb4b2ca4e1e05d0fa13b3f4c01 Mon Sep 17 00:00:00 2001 From: Ahmed Karic Date: Thu, 24 Oct 2024 16:49:11 +0200 Subject: [PATCH] test: simplify running infix tests from external This will facilitate running infix tests from external projects: - eliminate the need for an external topology.dot.in file - eliminate the requirement to manually provide external image name Fixes #763 --- test/env | 8 ++++++-- test/test.mk | 7 +++---- 2 files changed, 9 insertions(+), 6 deletions(-) diff --git a/test/env b/test/env index f10a1ca6b..bfcb79e19 100755 --- a/test/env +++ b/test/env @@ -96,14 +96,18 @@ start_topology() done base_img=$(get_base_img "$files") - $testdir/inject-test-mode -b "$base_img" -o "${base_img%-disk.img}-disk-test.img" + test_img="${base_img%-disk.img}-disk-test.img" + + $testdir/inject-test-mode -b "$base_img" -o "$test_img" + + img_name=$(basename "$test_img") + sed -i "s/qn_image=\".*\"/qn_image=\"$img_name\"/" "$envdir/qeneth/topology.dot.in" (cd "$envdir/qeneth/" && $qeneth generate && $qeneth start) INFAMY_ARGS="$INFAMY_ARGS $envdir/qeneth/topology.dot" cat <"$envdir/bin/qeneth" #!/bin/sh -set -x cd $envdir/qeneth && exec $testdir/qeneth/qeneth "\$@" EOF chmod +x "$envdir/bin/qeneth" diff --git a/test/test.mk b/test/test.mk index 4631c46e5..9e0bb23c7 100644 --- a/test/test.mk +++ b/test/test.mk @@ -13,9 +13,7 @@ GIT_PATH = $(BR2_EXTERNAL_INFIX_PATH) endif GIT_VERSION = $(shell git -C $(GIT_PATH) describe --dirty --always --tags) -IMAGE ?= infix -TOPOLOGY-DIR ?= $(test-dir)/virt/quad - +TOPOLOGY-DIR := $(test-dir)/virt/quad base := -b $(base-dir) TEST_MODE ?= qeneth @@ -24,7 +22,8 @@ mode-host := -t $(or $(TOPOLOGY),/etc/infamy.dot) mode-run := -t $(BINARIES_DIR)/qemu.dot mode := $(mode-$(TEST_MODE)) -binaries-$(ARCH) := $(addprefix $(IMAGE)-$(ARCH),.img -disk.img .pkg) +INFIX_IMAGE_ID := $(subst ",,$(INFIX_IMAGE_ID)) +binaries-$(ARCH) := $(addprefix $(INFIX_IMAGE_ID),.img -disk.img .pkg) binaries-x86_64 += OVMF.fd binaries := $(foreach bin,$(binaries-$(ARCH)),-f $(BINARIES_DIR)/$(bin))