Skip to content

Commit

Permalink
test: simplify running infix tests from external
Browse files Browse the repository at this point in the history
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
  • Loading branch information
axkar committed Oct 24, 2024
1 parent 04c843e commit d1527f0
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 6 deletions.
8 changes: 6 additions & 2 deletions test/env
Original file line number Diff line number Diff line change
Expand Up @@ -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 <<EOF >"$envdir/bin/qeneth"
#!/bin/sh
set -x
cd $envdir/qeneth && exec $testdir/qeneth/qeneth "\$@"
EOF
chmod +x "$envdir/bin/qeneth"
Expand Down
7 changes: 3 additions & 4 deletions test/test.mk
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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))

Expand Down

0 comments on commit d1527f0

Please sign in to comment.