qemu-devel
[Top][All Lists]
Advanced

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

Re: [RFC v4 10/11] tests/tcg/multiarch: Add nativecall.c test


From: Alex Bennée
Subject: Re: [RFC v4 10/11] tests/tcg/multiarch: Add nativecall.c test
Date: Wed, 09 Aug 2023 18:12:53 +0100
User-agent: mu4e 1.11.13; emacs 29.1.50

Yeqi Fu <fufuyqqqqqq@gmail.com> writes:

> Introduce a new test for native calls to ensure their functionality.
> The process involves cross-compiling the test cases, building them
> as dynamically linked binaries, and running these binaries which
> necessitates the addition of the appropriate interpreter prefix.
>
> Signed-off-by: Yeqi Fu <fufuyqqqqqq@gmail.com>
> ---
>  tests/tcg/multiarch/Makefile.target     | 17 +++++
>  tests/tcg/multiarch/native/nativecall.c | 98 +++++++++++++++++++++++++
>  2 files changed, 115 insertions(+)
>  create mode 100644 tests/tcg/multiarch/native/nativecall.c
>
> diff --git a/tests/tcg/multiarch/Makefile.target 
> b/tests/tcg/multiarch/Makefile.target
> index 43bddeaf21..5231df34ba 100644
> --- a/tests/tcg/multiarch/Makefile.target
> +++ b/tests/tcg/multiarch/Makefile.target
> @@ -138,5 +138,22 @@ run-plugin-semiconsole-with-%:
>  TESTS += semihosting semiconsole
>  endif
>  
> +nativecall: native/nativecall.c
> +     $(CC) $(CFLAGS) $(EXTRA_CFLAGS) $< -o $@ $(filter-out 
> -static,$(LDFLAGS))
> +
> +ifneq ($(LD_PREFIX),)
> +ifneq ($(wildcard $(LIBNATIVE)),)
> +run-nativecall: nativecall
> +     $(call run-test,$<, $(QEMU) -L $(LD_PREFIX) --native-bypass 
> $(LIBNATIVE) $<, "nativecall")
> +else
> +run-nativecall: nativecall
> +     $(call skip-test, $<, "no native library found")
> +endif
> +else
> +run-nativecall: nativecall
> +     $(call skip-test, $<, "no elf interpreter prefix found")
> +endif
> +EXTRA_RUNS += run-nativecall
> +

Or indeed just expand VPATH and use TESTS instead of EXTRA_RUNS (which
is for additional configurations of tests):

modified   tests/tcg/multiarch/Makefile.target
@@ -138,13 +138,18 @@ run-plugin-semiconsole-with-%:
 TESTS += semihosting semiconsole
 endif
 
-nativecall: native/nativecall.c
-       $(CC) $(CFLAGS) $(EXTRA_CFLAGS) $< -o $@ $(filter-out 
-static,$(LDFLAGS))
-
 ifneq ($(LD_PREFIX),)
 ifneq ($(wildcard $(LIBNATIVE)),)
+VPATH += $(MULTIARCH_SRC)/native
+
+nativecall: nativecall.c
+       $(CC) $(CFLAGS) $(EXTRA_CFLAGS) $< -o $@ $(filter-out 
-static,$(LDFLAGS))
+
 run-nativecall: nativecall
-       $(call run-test,$<, $(QEMU) -L $(LD_PREFIX) --native-bypass 
$(LIBNATIVE) $<, "nativecall")
+       $(call run-test,$<, $(QEMU) -L $(LD_PREFIX) --native-bypass
+       $(LIBNATIVE) $<, "nativecall")
+
+TESTS += nativecall
 else
 run-nativecall: nativecall
        $(call skip-test, $<, "no native library found")
@@ -153,7 +158,6 @@ else
 run-nativecall: nativecall
        $(call skip-test, $<, "no elf interpreter prefix found")
 endif
-EXTRA_RUNS += run-nativecall

-- 
Alex Bennée
Virtualisation Tech Lead @ Linaro



reply via email to

[Prev in Thread] Current Thread [Next in Thread]