diff mbox series

[v1,03/11] tests/tcg: move some multiarch files and make conditional

Message ID 20210917162332.3511179-4-alex.bennee@linaro.org
State Superseded
Headers show
Series testing and plugin pre-PR (configure, gitlab, plugins) | expand

Commit Message

Alex Bennée Sept. 17, 2021, 4:23 p.m. UTC
We had some messy code to filter out stuff we can't build. Lets junk
that and simplify the logic by pushing some stuff into subdirs. In
particular we move:

  float_helpers into libs - not a standalone test
  linux-test into linux - so we only build on Linux hosts

This allows for at least some of the tests to be nominally usable
by *BSD user builds.

Signed-off-by: Alex Bennée <alex.bennee@linaro.org>

Cc: Warner Losh <imp@bsdimp.com>
---
 tests/tcg/multiarch/{ => libs}/float_helpers.c |  2 +-
 tests/tcg/multiarch/{ => linux}/linux-test.c   |  0
 tests/tcg/multiarch/Makefile.target            | 15 ++++++++++-----
 tests/tcg/x86_64/Makefile.target               |  4 ++++
 4 files changed, 15 insertions(+), 6 deletions(-)
 rename tests/tcg/multiarch/{ => libs}/float_helpers.c (99%)
 rename tests/tcg/multiarch/{ => linux}/linux-test.c (100%)

-- 
2.30.2

Comments

Warner Losh Sept. 17, 2021, 5:05 p.m. UTC | #1
On Fri, Sep 17, 2021 at 10:23 AM Alex Bennée <alex.bennee@linaro.org> wrote:

> We had some messy code to filter out stuff we can't build. Lets junk

> that and simplify the logic by pushing some stuff into subdirs. In

> particular we move:

>

>   float_helpers into libs - not a standalone test

>   linux-test into linux - so we only build on Linux hosts

>

> This allows for at least some of the tests to be nominally usable

> by *BSD user builds.

>

> Signed-off-by: Alex Bennée <alex.bennee@linaro.org>

> Cc: Warner Losh <imp@bsdimp.com>

> ---

>  tests/tcg/multiarch/{ => libs}/float_helpers.c |  2 +-

>  tests/tcg/multiarch/{ => linux}/linux-test.c   |  0

>  tests/tcg/multiarch/Makefile.target            | 15 ++++++++++-----

>  tests/tcg/x86_64/Makefile.target               |  4 ++++

>  4 files changed, 15 insertions(+), 6 deletions(-)

>  rename tests/tcg/multiarch/{ => libs}/float_helpers.c (99%)

>  rename tests/tcg/multiarch/{ => linux}/linux-test.c (100%)

>


Reviewed-by: Warner Losh <imp@bsdimp.com>


I've also tested it as well.


> diff --git a/tests/tcg/multiarch/float_helpers.c

> b/tests/tcg/multiarch/libs/float_helpers.c

> similarity index 99%

> rename from tests/tcg/multiarch/float_helpers.c

> rename to tests/tcg/multiarch/libs/float_helpers.c

> index bc530e5732..4e68d2b659 100644

> --- a/tests/tcg/multiarch/float_helpers.c

> +++ b/tests/tcg/multiarch/libs/float_helpers.c

> @@ -22,7 +22,7 @@

>  #include <float.h>

>  #include <fenv.h>

>

> -#include "float_helpers.h"

> +#include "../float_helpers.h"

>

>  #define ARRAY_SIZE(x) (sizeof(x) / sizeof((x)[0]))

>

> diff --git a/tests/tcg/multiarch/linux-test.c

> b/tests/tcg/multiarch/linux/linux-test.c

> similarity index 100%

> rename from tests/tcg/multiarch/linux-test.c

> rename to tests/tcg/multiarch/linux/linux-test.c

> diff --git a/tests/tcg/multiarch/Makefile.target

> b/tests/tcg/multiarch/Makefile.target

> index 85a6fb7a2e..3763df2019 100644

> --- a/tests/tcg/multiarch/Makefile.target

> +++ b/tests/tcg/multiarch/Makefile.target

> @@ -8,18 +8,23 @@

>  MULTIARCH_SRC=$(SRC_PATH)/tests/tcg/multiarch

>

>  # Set search path for all sources

> -VPATH          += $(MULTIARCH_SRC)

> -MULTIARCH_SRCS   =$(notdir $(wildcard $(MULTIARCH_SRC)/*.c))

> -MULTIARCH_TESTS  =$(filter-out float_helpers, $(MULTIARCH_SRCS:.c=))

> +VPATH         += $(MULTIARCH_SRC)

> +MULTIARCH_SRCS =  $(notdir $(wildcard $(MULTIARCH_SRC)/*.c))

> +ifneq ($(CONFIG_LINUX),)

> +VPATH         += $(MULTIARCH_SRC)/linux

> +MULTIARCH_SRCS += $(notdir $(wildcard $(MULTIARCH_SRC)/linux/*.c))

> +endif

> +MULTIARCH_TESTS = $(MULTIARCH_SRCS:.c=)

>

> +$(info SRCS=${MULTIARCH_SRCS} and ${MULTIARCH_TESTS})

>  #

>  # The following are any additional rules needed to build things

>  #

>

>

>  float_%: LDFLAGS+=-lm

> -float_%: float_%.c float_helpers.c

> -       $(CC) $(CFLAGS) $(EXTRA_CFLAGS) $<

> $(MULTIARCH_SRC)/float_helpers.c -o $@ $(LDFLAGS)

> +float_%: float_%.c libs/float_helpers.c

> +       $(CC) $(CFLAGS) $(EXTRA_CFLAGS) $<

> $(MULTIARCH_SRC)/libs/float_helpers.c -o $@ $(LDFLAGS)

>

>  run-float_%: float_%

>         $(call run-test,$<, $(QEMU) $(QEMU_OPTS) $<,"$< on $(TARGET_NAME)")

> diff --git a/tests/tcg/x86_64/Makefile.target

> b/tests/tcg/x86_64/Makefile.target

> index 2151ea6302..d7a7385583 100644

> --- a/tests/tcg/x86_64/Makefile.target

> +++ b/tests/tcg/x86_64/Makefile.target

> @@ -8,8 +8,12 @@

>

>  include $(SRC_PATH)/tests/tcg/i386/Makefile.target

>

> +ifneq ($(CONFIG_LINUX),)

>  X86_64_TESTS += vsyscall

>  TESTS=$(MULTIARCH_TESTS) $(X86_64_TESTS) test-x86_64

> +else

> +TESTS=$(MULTIARCH_TESTS)

> +endif

>  QEMU_OPTS += -cpu max

>

>  test-x86_64: LDFLAGS+=-lm -lc

> --

> 2.30.2

>

>
<div dir="ltr"><div dir="ltr"><br></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Fri, Sep 17, 2021 at 10:23 AM Alex Bennée &lt;<a href="mailto:alex.bennee@linaro.org">alex.bennee@linaro.org</a>&gt; wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">We had some messy code to filter out stuff we can&#39;t build. Lets junk<br>
that and simplify the logic by pushing some stuff into subdirs. In<br>
particular we move:<br>
<br>
  float_helpers into libs - not a standalone test<br>
  linux-test into linux - so we only build on Linux hosts<br>
<br>
This allows for at least some of the tests to be nominally usable<br>
by *BSD user builds.<br>
<br>
Signed-off-by: Alex Bennée &lt;<a href="mailto:alex.bennee@linaro.org" target="_blank">alex.bennee@linaro.org</a>&gt;<br>

Cc: Warner Losh &lt;<a href="mailto:imp@bsdimp.com">imp@bsdimp.com</a>&gt;<br>
---<br>
 tests/tcg/multiarch/{ =&gt; libs}/float_helpers.c |  2 +-<br>
 tests/tcg/multiarch/{ =&gt; linux}/linux-test.c   |  0<br>
 tests/tcg/multiarch/Makefile.target            | 15 ++++++++++-----<br>
 tests/tcg/x86_64/Makefile.target               |  4 ++++<br>
 4 files changed, 15 insertions(+), 6 deletions(-)<br>
 rename tests/tcg/multiarch/{ =&gt; libs}/float_helpers.c (99%)<br>
 rename tests/tcg/multiarch/{ =&gt; linux}/linux-test.c (100%)<br></blockquote><div><br></div><div>Reviewed-by: Warner Losh &lt;<a href="mailto:imp@bsdimp.com">imp@bsdimp.com</a>&gt;</div><div><br></div><div>I&#39;ve also tested it as well.</div><div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
diff --git a/tests/tcg/multiarch/float_helpers.c b/tests/tcg/multiarch/libs/float_helpers.c<br>
similarity index 99%<br>
rename from tests/tcg/multiarch/float_helpers.c<br>
rename to tests/tcg/multiarch/libs/float_helpers.c<br>
index bc530e5732..4e68d2b659 100644<br>
--- a/tests/tcg/multiarch/float_helpers.c<br>
+++ b/tests/tcg/multiarch/libs/float_helpers.c<br>
@@ -22,7 +22,7 @@<br>
 #include &lt;float.h&gt;<br>
 #include &lt;fenv.h&gt;<br>
<br>
-#include &quot;float_helpers.h&quot;<br>
+#include &quot;../float_helpers.h&quot;<br>
<br>
 #define ARRAY_SIZE(x) (sizeof(x) / sizeof((x)[0]))<br>
<br>
diff --git a/tests/tcg/multiarch/linux-test.c b/tests/tcg/multiarch/linux/linux-test.c<br>
similarity index 100%<br>
rename from tests/tcg/multiarch/linux-test.c<br>
rename to tests/tcg/multiarch/linux/linux-test.c<br>
diff --git a/tests/tcg/multiarch/Makefile.target b/tests/tcg/multiarch/Makefile.target<br>
index 85a6fb7a2e..3763df2019 100644<br>
--- a/tests/tcg/multiarch/Makefile.target<br>
+++ b/tests/tcg/multiarch/Makefile.target<br>
@@ -8,18 +8,23 @@<br>
 MULTIARCH_SRC=$(SRC_PATH)/tests/tcg/multiarch<br>
<br>
 # Set search path for all sources<br>
-VPATH          += $(MULTIARCH_SRC)<br>
-MULTIARCH_SRCS   =$(notdir $(wildcard $(MULTIARCH_SRC)/*.c))<br>
-MULTIARCH_TESTS  =$(filter-out float_helpers, $(MULTIARCH_SRCS:.c=))<br>
+VPATH         += $(MULTIARCH_SRC)<br>
+MULTIARCH_SRCS =  $(notdir $(wildcard $(MULTIARCH_SRC)/*.c))<br>
+ifneq ($(CONFIG_LINUX),)<br>
+VPATH         += $(MULTIARCH_SRC)/linux<br>
+MULTIARCH_SRCS += $(notdir $(wildcard $(MULTIARCH_SRC)/linux/*.c))<br>
+endif<br>
+MULTIARCH_TESTS = $(MULTIARCH_SRCS:.c=)<br>
<br>
+$(info SRCS=${MULTIARCH_SRCS} and ${MULTIARCH_TESTS})<br>
 #<br>
 # The following are any additional rules needed to build things<br>
 #<br>
<br>
<br>
 float_%: LDFLAGS+=-lm<br>
-float_%: float_%.c float_helpers.c<br>
-       $(CC) $(CFLAGS) $(EXTRA_CFLAGS) $&lt; $(MULTIARCH_SRC)/float_helpers.c -o $@ $(LDFLAGS)<br>
+float_%: float_%.c libs/float_helpers.c<br>
+       $(CC) $(CFLAGS) $(EXTRA_CFLAGS) $&lt; $(MULTIARCH_SRC)/libs/float_helpers.c -o $@ $(LDFLAGS)<br>
<br>
 run-float_%: float_%<br>
        $(call run-test,$&lt;, $(QEMU) $(QEMU_OPTS) $&lt;,&quot;$&lt; on $(TARGET_NAME)&quot;)<br>
diff --git a/tests/tcg/x86_64/Makefile.target b/tests/tcg/x86_64/Makefile.target<br>
index 2151ea6302..d7a7385583 100644<br>
--- a/tests/tcg/x86_64/Makefile.target<br>
+++ b/tests/tcg/x86_64/Makefile.target<br>
@@ -8,8 +8,12 @@<br>
<br>
 include $(SRC_PATH)/tests/tcg/i386/Makefile.target<br>
<br>
+ifneq ($(CONFIG_LINUX),)<br>
 X86_64_TESTS += vsyscall<br>
 TESTS=$(MULTIARCH_TESTS) $(X86_64_TESTS) test-x86_64<br>
+else<br>
+TESTS=$(MULTIARCH_TESTS)<br>
+endif<br>
 QEMU_OPTS += -cpu max<br>
<br>
 test-x86_64: LDFLAGS+=-lm -lc<br>
-- <br>
2.30.2<br>
<br>
</blockquote></div></div>
Philippe Mathieu-Daudé Sept. 17, 2021, 8:38 p.m. UTC | #2
On 9/17/21 18:23, Alex Bennée wrote:
> We had some messy code to filter out stuff we can't build. Lets junk

> that and simplify the logic by pushing some stuff into subdirs. In

> particular we move:

> 

>   float_helpers into libs - not a standalone test

>   linux-test into linux - so we only build on Linux hosts

> 

> This allows for at least some of the tests to be nominally usable

> by *BSD user builds.

> 

> Signed-off-by: Alex Bennée <alex.bennee@linaro.org>

> Cc: Warner Losh <imp@bsdimp.com>

> ---

>  tests/tcg/multiarch/{ => libs}/float_helpers.c |  2 +-

>  tests/tcg/multiarch/{ => linux}/linux-test.c   |  0

>  tests/tcg/multiarch/Makefile.target            | 15 ++++++++++-----

>  tests/tcg/x86_64/Makefile.target               |  4 ++++

>  4 files changed, 15 insertions(+), 6 deletions(-)

>  rename tests/tcg/multiarch/{ => libs}/float_helpers.c (99%)

>  rename tests/tcg/multiarch/{ => linux}/linux-test.c (100%)


Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
diff mbox series

Patch

diff --git a/tests/tcg/multiarch/float_helpers.c b/tests/tcg/multiarch/libs/float_helpers.c
similarity index 99%
rename from tests/tcg/multiarch/float_helpers.c
rename to tests/tcg/multiarch/libs/float_helpers.c
index bc530e5732..4e68d2b659 100644
--- a/tests/tcg/multiarch/float_helpers.c
+++ b/tests/tcg/multiarch/libs/float_helpers.c
@@ -22,7 +22,7 @@ 
 #include <float.h>
 #include <fenv.h>
 
-#include "float_helpers.h"
+#include "../float_helpers.h"
 
 #define ARRAY_SIZE(x) (sizeof(x) / sizeof((x)[0]))
 
diff --git a/tests/tcg/multiarch/linux-test.c b/tests/tcg/multiarch/linux/linux-test.c
similarity index 100%
rename from tests/tcg/multiarch/linux-test.c
rename to tests/tcg/multiarch/linux/linux-test.c
diff --git a/tests/tcg/multiarch/Makefile.target b/tests/tcg/multiarch/Makefile.target
index 85a6fb7a2e..3763df2019 100644
--- a/tests/tcg/multiarch/Makefile.target
+++ b/tests/tcg/multiarch/Makefile.target
@@ -8,18 +8,23 @@ 
 MULTIARCH_SRC=$(SRC_PATH)/tests/tcg/multiarch
 
 # Set search path for all sources
-VPATH 		+= $(MULTIARCH_SRC)
-MULTIARCH_SRCS   =$(notdir $(wildcard $(MULTIARCH_SRC)/*.c))
-MULTIARCH_TESTS  =$(filter-out float_helpers, $(MULTIARCH_SRCS:.c=))
+VPATH 	       += $(MULTIARCH_SRC)
+MULTIARCH_SRCS =  $(notdir $(wildcard $(MULTIARCH_SRC)/*.c))
+ifneq ($(CONFIG_LINUX),)
+VPATH 	       += $(MULTIARCH_SRC)/linux
+MULTIARCH_SRCS += $(notdir $(wildcard $(MULTIARCH_SRC)/linux/*.c))
+endif
+MULTIARCH_TESTS = $(MULTIARCH_SRCS:.c=)
 
+$(info SRCS=${MULTIARCH_SRCS} and ${MULTIARCH_TESTS})
 #
 # The following are any additional rules needed to build things
 #
 
 
 float_%: LDFLAGS+=-lm
-float_%: float_%.c float_helpers.c
-	$(CC) $(CFLAGS) $(EXTRA_CFLAGS) $< $(MULTIARCH_SRC)/float_helpers.c -o $@ $(LDFLAGS)
+float_%: float_%.c libs/float_helpers.c
+	$(CC) $(CFLAGS) $(EXTRA_CFLAGS) $< $(MULTIARCH_SRC)/libs/float_helpers.c -o $@ $(LDFLAGS)
 
 run-float_%: float_%
 	$(call run-test,$<, $(QEMU) $(QEMU_OPTS) $<,"$< on $(TARGET_NAME)")
diff --git a/tests/tcg/x86_64/Makefile.target b/tests/tcg/x86_64/Makefile.target
index 2151ea6302..d7a7385583 100644
--- a/tests/tcg/x86_64/Makefile.target
+++ b/tests/tcg/x86_64/Makefile.target
@@ -8,8 +8,12 @@ 
 
 include $(SRC_PATH)/tests/tcg/i386/Makefile.target
 
+ifneq ($(CONFIG_LINUX),)
 X86_64_TESTS += vsyscall
 TESTS=$(MULTIARCH_TESTS) $(X86_64_TESTS) test-x86_64
+else
+TESTS=$(MULTIARCH_TESTS)
+endif
 QEMU_OPTS += -cpu max
 
 test-x86_64: LDFLAGS+=-lm -lc