]> xenbits.xensource.com Git - people/liuw/xtf.git/commitdiff
Correct the usage of $(DESTDIR) and $(PREFIX)
authorAndrew Cooper <andrew.cooper3@citrix.com>
Wed, 20 Jul 2016 17:43:13 +0000 (18:43 +0100)
committerAndrew Cooper <andrew.cooper3@citrix.com>
Tue, 26 Jul 2016 10:18:24 +0000 (11:18 +0100)
The GNU coding standards expect $(DESTDIR) to be the root of everything
installed, and for $(PREFIX) to then be added to the path.  This is not how
XTF previously behaved.

XTF is not a typical package, and doesn't meet the usual semantics; it expects
to arrange all files under a single directory.  Drop the use of $(PREFIX)
entirely (to avoid the expectation that it behaves as $(prefix) usually
behaves) and introduce $(xtfdir) instead.

$(DESTDIR) now works as intended for staged installes, and $(xtfdir) is the
single selected directy containing all installed content.

The intended way to install XTF now:

  $ make install DESTDIR=/path/to/staging/area xtfdir=/local/scratch/xtf

Reported-by: Wei Liu <wei.liu2@citrix.com>
Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
Reviewed-by: Wei Liu <wei.liu2@citrix.com>
Makefile
build/gen.mk
config/default-hvm.cfg.in
config/default-pv.cfg.in
docs/introduction.dox
docs/mainpage.dox

index 45f384698cfcbdc1e4d11a80f8efb082571f77d1..8c36da0305f3fbedf07b22690559e66bc7715d85 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -2,9 +2,24 @@ MAKEFLAGS += -r
 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
@@ -28,8 +43,8 @@ all:
 
 .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; \
index 0a172b36ea1e9a5f51b129412b015e8dd4cb0c74..aeac2a6b2e78ae376e782191879cc5b115c2e899 100644 (file)
@@ -31,8 +31,8 @@ test-info.json: $(ROOT)/build/mkinfo.py FORCE
 
 .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
 
@@ -54,7 +54,7 @@ test-$(1)-$(NAME).cfg: $$(cfg-$(1)) FORCE
        @{ 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
 
@@ -63,12 +63,12 @@ test-$(1)-$(NAME).cfg: $$(cfg-$(1)) FORCE
 
 .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
 
index 2a395a5535fd3e5506c6c2dfd3bd048248849600..7d29e0c0eaced207ed44b32f0d42b554008ef0d0 100644 (file)
@@ -1,7 +1,7 @@
 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.
index 044e50ecad8269738dc30aab8351c79d24a10cf8..166e4647282da67788cb973d18e327827194bf4c 100644 (file)
@@ -1,4 +1,4 @@
 name="test-@@ENV@@-@@NAME@@"
 loader="generic"
 memory=128
-kernel="@@PREFIX@@/tests/@@NAME@@/test-@@ENV@@-@@NAME@@"
+kernel="@@XTFDIR@@/tests/@@NAME@@/test-@@ENV@@-@@NAME@@"
index e9a0777306f8178f44f0712b89647a652e4d1abf..3151fbf555c524db2aa28850dce68cce8ea6ab73 100644 (file)
@@ -131,7 +131,7 @@ If XTF in being built in dom0, all paths should be set up to run correctly.
 
 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.
 
index 26394233c7faee91ff8c069eb58e4a6b3127e972..942929ea537a42b198876ff3cd0c5100fa0ba4a2 100644 (file)
@@ -62,9 +62,9 @@ To run tests on a Xen host: (see @ref errata first)
 
 - 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.