mirror of
https://github.com/kernelkit/infix.git
synced 2026-07-31 04:53:01 +02:00
Before this change, setting `GIT_VERSION` in `make`'s environment was intended to allow the user to specify a custom build id. As it turns out, `test/test.mk` had duplicated the logic from `board/common/post-build.sh` to unconditionally override any value set in it. Because of the way `make` handles variables, where assignments to variables inherited from the environment are exported back to it[^1], this would mean that `test.mk` would always clobber any value set by the user. Furthermore, there is also this file called `buildroot/package/git/git.mk`, which also (reasonably) has opinions about what the proper value of `GIT_VERSION` should be. In summary, this was a bit of a mess. Therefore: Make sure that there is one single place where we determine the build id and version, and make sure that those variables are scoped under the `INFIX_` prefix to avoid clashing with any other component. [^1]: https://www.gnu.org/software/make/manual/html_node/Environment.html
46 lines
1.7 KiB
Makefile
46 lines
1.7 KiB
Makefile
base-dir := $(lastword $(subst :, ,$(BR2_EXTERNAL)))
|
|
test-dir := $(BR2_EXTERNAL_INFIX_PATH)/test
|
|
ninepm := $(BR2_EXTERNAL_INFIX_PATH)/test/9pm/9pm.py
|
|
spec-dir := $(test-dir)/spec
|
|
test-specification := $(O)/images/test-specification.pdf
|
|
|
|
UNIT_TESTS ?= $(test-dir)/case/all-repo.yaml $(test-dir)/case/all-unit.yaml
|
|
TESTS ?= $(test-dir)/case/all.yaml
|
|
|
|
base := -b $(base-dir)
|
|
|
|
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))
|
|
|
|
INFIX_IMAGE_ID := $(call qstrip,$(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))
|
|
|
|
# Common transport override for minimal defconfigs
|
|
ifneq ($(BR2_PACKAGE_ROUSETTE),y)
|
|
export INFAMY_ARGS := --transport=netconf
|
|
endif
|
|
|
|
test:
|
|
$(test-dir)/env -r $(base) $(mode) $(binaries) $(ninepm) $(TESTS)
|
|
|
|
test-sh:
|
|
$(test-dir)/env $(base) $(mode) $(binaries) -i /bin/sh
|
|
|
|
test-spec:
|
|
@esc_infix_name="$(echo $(INFIX_NAME) | sed 's/\//\\\//g')"; \
|
|
sed 's/{REPLACE}/$(subst ",,$(esc_infix_name)) $(INFIX_VERSION)/' $(spec-dir)/Readme.adoc.in > $(spec-dir)/Readme.adoc
|
|
@$(spec-dir)/generate_spec.py -d $(test-dir)/case -r $(BR2_EXTERNAL_INFIX_PATH)
|
|
@asciidoctor-pdf --failure-level INFO --theme $(spec-dir)/theme.yml -a pdf-fontsdir=$(spec-dir)/fonts -o $(test-specification) $(spec-dir)/Readme.adoc
|
|
|
|
# Unit tests run with random (-r) hostname and container name to
|
|
# prevent race conditions when running in CI environments.
|
|
test-unit:
|
|
$(test-dir)/env -r $(base) $(ninepm) $(UNIT_TESTS)
|
|
|
|
.PHONY: test test-sh test-unit test-spec
|