This is an automated email from the git hooks/post-receive script.

guillem pushed a commit to branch main
in repository dpkg.

View the commit online:
https://git.dpkg.org/cgit/dpkg/dpkg.git/commit/?id=9c5108b5d71bbc78166641fde03fa2e72acefecd

commit 9c5108b5d71bbc78166641fde03fa2e72acefecd
Author: Guillem Jover <[email protected]>
AuthorDate: Tue Oct 17 10:14:25 2023 +0200

    test: Add installtest target and make test use the build tree programs
    
    The usual convention is for a test or check target to use the programs
    from the build tree, and an installtest or installcheck target to test
    the as installed programs from the system.
    
    Set the DPKG_BUILDTREE variable automatically for test and add a new
    installtest target to make the usage more standard and easier to use.
---
 .gitlab-ci.yml | 4 +---
 tests/Makefile | 4 ++++
 tests/README   | 3 ++-
 3 files changed, 7 insertions(+), 4 deletions(-)

diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
index 7c1a4f27f..e0e6c1883 100644
--- a/.gitlab-ci.yml
+++ b/.gitlab-ci.yml
@@ -46,6 +46,4 @@ func-tests:
   script:
     - ./configure
     - make
-    - cd tests
-    - echo "DPKG_BUILDTREE = $(realpath ..)" >>.pkg-tests.conf
-    - eatmydata make test
+    - eatmydata make -C tests installtest
diff --git a/tests/Makefile b/tests/Makefile
index 75a3cfc11..bdd9dd318 100644
--- a/tests/Makefile
+++ b/tests/Makefile
@@ -118,6 +118,7 @@ endif
 # By default do nothing
 all help::
        @echo "Run 'make test' to run all the tests"
+       @echo "Run 'make installtest' to run all the tests as installed"
        @echo "Run 'make <test-id>-test' to run a specifict test"
        @echo "Run 'make clean' to remove all intermediary files"
        @echo ""
@@ -134,10 +135,13 @@ $(build_targets)::
 
 test_targets = $(addsuffix -test,$(TESTS))
 
+test:: export DPKG_BUILDTREE=$(realpath ..)
 test:: $(test_targets)
 $(test_targets)::
        $(MAKE) -C $(subst -test,,$@) test
 
+installtest: $(test_targets)
+
 .PHONY: test $(test_targets)
 
 
diff --git a/tests/README b/tests/README
index f35635d03..3da99ab00 100644
--- a/tests/README
+++ b/tests/README
@@ -9,7 +9,8 @@ There's a brief usage information when invoking “make” on the 
topdir.
 You probably want to use something like eatmydata to run the tests, it
 affects the performance significantly.
 
-To use the tools from the dpkg build-tree, set DPKG_BUILDTREE accordingly.
+To test the tools from the dpkg build-tree, use the «test» target. If you
+want instead to test the installed programs use the «installtest» target
 
 The DPKG_TESTSUITE_OPTIONS environment/make variable can be used to change
 the behavior of the test runs, the following options are currently

-- 
Dpkg.Org's dpkg

Reply via email to