ROOT := $(abspath $(CURDIR))
export ROOT
+# $(xtfdir) defaults to $(ROOT) so development and testing can be done
+# straight out of the working tree.
+xtfdir ?= $(ROOT)
DESTDIR ?= $(ROOT)/dist
-PREFIX ?= $(ROOT)
-export DESTDIR PREFIX
+
+ifeq ($(filter /%,$(xtfdir)),)
+$(error $$(xtfdir) must be absolute, not '$(xtfdir)')
+endif
+
+ifneq ($(DESTDIR),)
+ifeq ($(filter /%,$(DESTDIR)),)
+$(error $$(DESTDIR) must be absolute, not '$(DESTDIR)')
+endif
+endif
+
+xtftestdir := $(xtfdir)/tests
+
+export DESTDIR xtfdir xtftestdir
# Programs used
CC ?= $(CROSS_COMPILE)gcc
.PHONY: install
install:
- @$(INSTALL_DIR) $(DESTDIR)
- $(INSTALL_PROGRAM) xtf-runner $(DESTDIR)
+ @$(INSTALL_DIR) $(DESTDIR)$(xtfdir)
+ $(INSTALL_PROGRAM) xtf-runner $(DESTDIR)$(xtfdir)
@set -e; for D in $(wildcard tests/*); do \
[ ! -e $$D/Makefile ] && continue; \
$(MAKE) -C $$D install; \
.PHONY: install install-each-env
install: install-each-env test-info.json
- @$(INSTALL_DIR) $(DESTDIR)/tests/$(NAME)
- $(INSTALL_DATA) test-info.json $(DESTDIR)/tests/$(NAME)
+ @$(INSTALL_DIR) $(DESTDIR)$(xtftestdir)/$(NAME)
+ $(INSTALL_DATA) test-info.json $(DESTDIR)$(xtftestdir)/$(NAME)
define PERENV_build
@{ cat $$< $(TEST-EXTRA-CFG) ;} | \
sed -e "s/@@NAME@@/$$(NAME)/g" \
-e "s/@@ENV@@/$(1)/g" \
- -e "s!@@PREFIX@@!$$(PREFIX)!g" \
+ -e "s!@@XTFDIR@@!$$(xtfdir)!g" \
> $$@.tmp
@if ! cmp -s $$@ $$@.tmp; then mv -f $$@.tmp $$@; else rm -f $$@.tmp; fi
.PHONY: install-$(1) install-$(1).cfg
install-$(1): test-$(1)-$(NAME)
- @$(INSTALL_DIR) $(DESTDIR)/tests/$(NAME)
- $(INSTALL_PROGRAM) $$< $(DESTDIR)/tests/$(NAME)
+ @$(INSTALL_DIR) $(DESTDIR)$(xtftestdir)/$(NAME)
+ $(INSTALL_PROGRAM) $$< $(DESTDIR)$(xtftestdir)/$(NAME)
install-$(1).cfg: test-$(1)-$(NAME).cfg
- @$(INSTALL_DIR) $(DESTDIR)/tests/$(NAME)
- $(INSTALL_DATA) $$< $(DESTDIR)/tests/$(NAME)
+ @$(INSTALL_DIR) $(DESTDIR)$(xtftestdir)/$(NAME)
+ $(INSTALL_DATA) $$< $(DESTDIR)$(xtftestdir)/$(NAME)
install-each-env: install-$(1) install-$(1).cfg
name="test-@@ENV@@-@@NAME@@"
builder="hvm"
memory=128
-firmware_override="@@PREFIX@@/tests/@@NAME@@/test-@@ENV@@-@@NAME@@"
+firmware_override="@@XTFDIR@@/tests/@@NAME@@/test-@@ENV@@-@@NAME@@"
# The framework doesn't reboot. A reboot signal is almost certainly a triple
# fault instead. Prevent it turning into a runaway domain.
name="test-@@ENV@@-@@NAME@@"
loader="generic"
memory=128
-kernel="@@PREFIX@@/tests/@@NAME@@/test-@@ENV@@-@@NAME@@"
+kernel="@@XTFDIR@@/tests/@@NAME@@/test-@@ENV@@-@@NAME@@"
If XTF is built elsewhere, it should be installed:
- $ make install PREFIX=/path DESTDIR=/path
+ $ make install xtfdir=/path DESTDIR=/path
with paths appropriate for the system under test.
- For the paths of binaries, `xl` accepts either an absolute path, or certain
relative paths (`/etc/xen/` or `$CWD` for `kernel=`, `$libdir/xen/boot` for
- `firmware_override=`). The default `PREFIX=` is configured correctly for
+ `firmware_override=`). The default `xtfdir=` is configured correctly for
running the tests out of the build working tree. If the tests are running
- elsewhere, use `make install DESTDIR=$X PREFIX=$Y` to configure absolute
+ elsewhere, use `make install DESTDIR=$X xtfdir=$Y` to configure absolute
paths appropriately for the test system.