[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH] tests: Improve 'make test': Run all build-time runnable tests


  • To: Bernhard Kaindl <bernhard.kaindl@xxxxxxxxxx>
  • From: Jan Beulich <jbeulich@xxxxxxxx>
  • Date: Thu, 25 Jun 2026 14:48:03 +0200
  • Authentication-results: eu.smtp.expurgate.cloud; dkim=pass header.s=google header.d=suse.com header.i="@suse.com" header.h="Content-Transfer-Encoding:In-Reply-To:Autocrypt:From:Content-Language:References:Cc:To:Subject:User-Agent:MIME-Version:Date:Message-ID"
  • Autocrypt: addr=jbeulich@xxxxxxxx; keydata= xsDiBFk3nEQRBADAEaSw6zC/EJkiwGPXbWtPxl2xCdSoeepS07jW8UgcHNurfHvUzogEq5xk hu507c3BarVjyWCJOylMNR98Yd8VqD9UfmX0Hb8/BrA+Hl6/DB/eqGptrf4BSRwcZQM32aZK 7Pj2XbGWIUrZrd70x1eAP9QE3P79Y2oLrsCgbZJfEwCgvz9JjGmQqQkRiTVzlZVCJYcyGGsD /0tbFCzD2h20ahe8rC1gbb3K3qk+LpBtvjBu1RY9drYk0NymiGbJWZgab6t1jM7sk2vuf0Py O9Hf9XBmK0uE9IgMaiCpc32XV9oASz6UJebwkX+zF2jG5I1BfnO9g7KlotcA/v5ClMjgo6Gl MDY4HxoSRu3i1cqqSDtVlt+AOVBJBACrZcnHAUSuCXBPy0jOlBhxPqRWv6ND4c9PH1xjQ3NP nxJuMBS8rnNg22uyfAgmBKNLpLgAGVRMZGaGoJObGf72s6TeIqKJo/LtggAS9qAUiuKVnygo 3wjfkS9A3DRO+SpU7JqWdsveeIQyeyEJ/8PTowmSQLakF+3fote9ybzd880fSmFuIEJldWxp Y2ggPGpiZXVsaWNoQHN1c2UuY29tPsJgBBMRAgAgBQJZN5xEAhsDBgsJCAcDAgQVAggDBBYC AwECHgECF4AACgkQoDSui/t3IH4J+wCfQ5jHdEjCRHj23O/5ttg9r9OIruwAn3103WUITZee e7Sbg12UgcQ5lv7SzsFNBFk3nEQQCACCuTjCjFOUdi5Nm244F+78kLghRcin/awv+IrTcIWF hUpSs1Y91iQQ7KItirz5uwCPlwejSJDQJLIS+QtJHaXDXeV6NI0Uef1hP20+y8qydDiVkv6l IreXjTb7DvksRgJNvCkWtYnlS3mYvQ9NzS9PhyALWbXnH6sIJd2O9lKS1Mrfq+y0IXCP10eS FFGg+Av3IQeFatkJAyju0PPthyTqxSI4lZYuJVPknzgaeuJv/2NccrPvmeDg6Coe7ZIeQ8Yj t0ARxu2xytAkkLCel1Lz1WLmwLstV30g80nkgZf/wr+/BXJW/oIvRlonUkxv+IbBM3dX2OV8 AmRv1ySWPTP7AAMFB/9PQK/VtlNUJvg8GXj9ootzrteGfVZVVT4XBJkfwBcpC/XcPzldjv+3 HYudvpdNK3lLujXeA5fLOH+Z/G9WBc5pFVSMocI71I8bT8lIAzreg0WvkWg5V2WZsUMlnDL9 mpwIGFhlbM3gfDMs7MPMu8YQRFVdUvtSpaAs8OFfGQ0ia3LGZcjA6Ik2+xcqscEJzNH+qh8V m5jjp28yZgaqTaRbg3M/+MTbMpicpZuqF4rnB0AQD12/3BNWDR6bmh+EkYSMcEIpQmBM51qM EKYTQGybRCjpnKHGOxG0rfFY1085mBDZCH5Kx0cl0HVJuQKC+dV2ZY5AqjcKwAxpE75MLFkr wkkEGBECAAkFAlk3nEQCGwwACgkQoDSui/t3IH7nnwCfcJWUDUFKdCsBH/E5d+0ZnMQi+G0A nAuWpQkjM1ASeQwSHEeAWPgskBQL
  • Cc: Andrew Cooper <andrew.cooper3@xxxxxxxxxx>, Anthony PERARD <anthony.perard@xxxxxxxxxx>, Michal Orzel <michal.orzel@xxxxxxx>, Julien Grall <julien@xxxxxxx>, Roger Pau Monné <roger.pau@xxxxxxxxxx>, Stefano Stabellini <sstabellini@xxxxxxxxxx>, Teddy Astie <teddy.astie@xxxxxxxxxx>, Stewart Hildebrand <stewart.hildebrand@xxxxxxx>, xen-devel@xxxxxxxxxxxxxxxxxxxx
  • Delivery-date: Thu, 25 Jun 2026 12:48:17 +0000
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>

On 28.05.2026 17:25, Bernhard Kaindl wrote:
> --- a/Makefile
> +++ b/Makefile
> @@ -92,6 +92,7 @@ build-docs:
>  .PHONY: test
>  test:
>       $(MAKE) -C tools/python test
> +     $(MAKE) -C tools/tests test

This means they're run sequentially, when really they could run in parallel.

> --- a/tools/Rules.mk
> +++ b/tools/Rules.mk
> @@ -189,7 +189,7 @@ INSTALL_PYTHON_PROG = \
>  %.opic: %.S
>       $(CC) $(CPPFLAGS) -DPIC $(CFLAGS) -fPIC -c -o $@ $< $(APPEND_CFLAGS)
>  
> -subdirs-all subdirs-clean subdirs-install subdirs-distclean 
> subdirs-uninstall: .phony
> +subdirs-all subdirs-clean subdirs-install subdirs-distclean subdirs-run 
> subdirs-test subdirs-uninstall: .phony
>       @set -e; for subdir in $(SUBDIRS) $(SUBDIRS-y); do \
>               $(MAKE) subdir-$(patsubst subdirs-%,%,$@)-$$subdir; \
>       done
> @@ -200,6 +200,20 @@ subdir-all-% subdir-clean-% subdir-install-% 
> subdir-uninstall-%: .phony
>  subdir-distclean-%: .phony
>       $(MAKE) -C $* distclean
>  
> +subdir-run-%: .phony
> +     $(MAKE) -C $* run
> +
> +subdir-test-%: .phony
> +     $(MAKE) -C $* test
> +
> +ifeq ($(CC),$(HOSTCC))

I understand you lift this up from uses elsewhere, but I'd suggest thinking
of ways to improve things while generalizing. CC and HOSTCC can very well
be different, and the output can still be run. What wants to be sufficiently
similar is e.g. the output of -dumpmachine (whether the middle part of the
triplet needs to match is not quite clear to me; whether e.g. the last part
differing in a suffix [e.g. -linux vs -linux-gnu] may also want considering
a match I similarly can't quite say; what I can say it that pre-built
compilers on the distro I'm looking at yield x86_64-suse-linux, while my
self-built gcc-s yield x86_64-pc-linux-gnu, yet both obviously target the
same thing).

> +define RUN_TARGETS_IF_CC_IS_HOSTCC
> +set -ex; for test in $? ; do LD_LIBRARY_PATH=$(DISTDIR)/install$(libdir) 
> ./$$test ; done

If LD_LIBRARY_PATH wants fiddling with here, I think you want to prepend to
what may already be there. Since quite a few of the tests don't reference
any of our libraries, I'm not convinced though that this wants/needs doing
here (instead of perhaps per test).

> --- a/tools/tests/cpu-policy/Makefile
> +++ b/tools/tests/cpu-policy/Makefile
> @@ -15,9 +15,9 @@ endif
>  .PHONY: all
>  all: $(TARGETS)
>  
> -.PHONY: run
> -run: $(TARGETS)
> -     ./$<
> +.PHONY: run test
> +run test: $(TARGETS)
> +     $(call RUN_TARGETS_IF_CC_IS_HOSTCC)

Try (perhaps with a trivial, independent Makefile containing just

run test:
        @echo $@

) to invoke "make run test". You'll see the rule is executed twice, once for
each target. I think you want

run: test

or the other way around. Generally I'd expect "run" to be the "on build host"
target (based on how we use it right now, with ./$(TARGET) invocations). The
other mode might better run stuff from the install/ directory. However, which
one is "run" and which one is "test" is of course simply a matter of
convention / agreement.

> --- a/tools/tests/mem-claim/Makefile
> +++ b/tools/tests/mem-claim/Makefile
> @@ -11,14 +11,7 @@ all: $(TARGETS)
>  #  Can also be called with "make run-tests-mem-claim" from the toplevel.
>  .PHONY: run
>  run: $(TARGETS)
> -ifeq ($(CC),$(HOSTCC))
> -     set -e;             \
> -     for test in $? ; do \
> -             ./$$test ;  \
> -     done
> -else
> -     $(warning HOSTCC != CC, will not run test)
> -endif
> +     $(RUN_TARGETS_IF_CC_IS_HOSTCC)
>  
>  # The tests in this directory need to run in a privileged domain (Dom0)
>  # with libxenctrl and a matching the hypervisor to test running it.

Hmm, this doesn't match present staging, yet you also don't mention any
prereq-s this is to go on top of.

> --- a/tools/tests/vpci/Makefile
> +++ b/tools/tests/vpci/Makefile
> @@ -8,11 +8,13 @@ all: $(TARGET)
>  
>  .PHONY: run
>  run: $(TARGET)
> -ifeq ($(CC),$(HOSTCC))
> -     ./$(TARGET)
> -else
> -     $(warning HOSTCC != CC, will not run test)
> -endif
> +     $(call RUN_TARGETS_IF_CC_IS_HOSTCC)
> +
> +# The tests in this directory need to run in a privileged domain (Dom0)
> +# with libxenctrl and a matching the hypervisor to test running it.
> +# Therefore, they don't run with the native test target for build-time tests.
> +.PHONY: test
> +test:

I don't think this is true here.

Jan



 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.