On Fri, Sep 17, 2021 at 8:39 AM Alex Bennée <alex.ben...@linaro.org> wrote:

>
> Warner Losh <i...@bsdimp.com> writes:
>
> > On Tue, Aug 3, 2021 at 5:02 AM Alex Bennée <alex.ben...@linaro.org>
> wrote:
> >
> >  Not all of the multiarch tests are pure POSIX so elide over those
> >  tests on a non-Linux system. This allows for at least some of the
> >  tests to be nominally usable by *BSD user builds.
> >
> >  Signed-off-by: Alex Bennée <alex.ben...@linaro.org>
> >  Cc: Warner Losh <i...@bsdimp.com>
> >  ---
> >   tests/tcg/multiarch/Makefile.target | 6 +++++-
> >   tests/tcg/x86_64/Makefile.target    | 4 ++++
> >   2 files changed, 9 insertions(+), 1 deletion(-)
> >
> > Acked-by: Warner Losh <i...@bsdimp.com>
> >
> > To do this with gcc10, however, I had to add -Wno-error=overflow
> > otherwise I got a lot of warnings about constants being truncated to
> > 0.
> >
> > It also fails the sha1 test, but when I run it by hand it works. It turns
> > out that I have a sha1 in my path, and at least in the bsd-user edition
> > of qemu-i386 tries to run that and fails.
> >
> > Also, the hello world program needed tweaking
> >
> > So with this applied and the following patch
> >
> > diff --git a/tests/tcg/Makefile.target b/tests/tcg/Makefile.target
> > index 63cf1b2573..39420631a8 100644
> > --- a/tests/tcg/Makefile.target
> > +++ b/tests/tcg/Makefile.target
> > @@ -155,7 +155,7 @@ RUN_TESTS+=$(EXTRA_RUNS)
> >
> >  ifdef CONFIG_USER_ONLY
> >  run-%: %
> > -       $(call run-test, $<, $(QEMU) $(QEMU_OPTS) $<, "$< on
> $(TARGET_NAME)")
> > +       $(call run-test, $<, $(QEMU) $(QEMU_OPTS) ./$<, "$< on
> $(TARGET_NAME)")
> >
> >  run-plugin-%:
> >         $(call run-test, $@, $(QEMU) $(QEMU_OPTS) \
> > @@ -168,7 +168,7 @@ run-%: %
> >         $(call run-test, $<, \
> >           $(QEMU) -monitor none -display none \
> >                   -chardev file$(COMMA)path=$<.out$(COMMA)id=output \
> > -                 $(QEMU_OPTS) $<, \
> > +                 $(QEMU_OPTS) ./$<, \
> >           "$< on $(TARGET_NAME)")
>
> That's weird. I'm not super keen to merge this because it's incomplete
> (we have a large number of manual run-FOO stanzas). AFAICT neither of
> the loaders attempt to enumerate and search path so I wonder if this is
> a function of the shell?
>

bsd-user does, in fact, search the path. It does so in loader_exec. It does
this,
I believe, to support execing native binaries, but I'll need to check on
that.

It's fine if we don't merge this just yet.

>  run-plugin-%:
> > diff --git a/tests/tcg/i386/Makefile.target
> b/tests/tcg/i386/Makefile.target
> > index a053ca3f15..ae258c47f0 100644
> > --- a/tests/tcg/i386/Makefile.target
> > +++ b/tests/tcg/i386/Makefile.target
> > @@ -21,6 +21,7 @@ run-plugin-test-i386-pcmpistri-%: QEMU_OPTS += -cpu max
> >  run-test-i386-bmi2: QEMU_OPTS += -cpu max
> >  run-plugin-test-i386-bmi2-%: QEMU_OPTS += -cpu max
> >
> > +CFLAGS +=  -Wno-error=overflow
>
> I'd apply this direct to the test in question rather than a global change.
>

I think we should not apply it at all. I was so happy to get things
compiling
that I'd raced ahead of myself: when this is active, the tests fail to run.


> >  #
> >  # hello-i386 is a barebones app
> >  #
> > diff --git a/tests/tcg/i386/hello-i386.c b/tests/tcg/i386/hello-i386.c
> > index 59196dd0b7..4a5a25211c 100644
> > --- a/tests/tcg/i386/hello-i386.c
> > +++ b/tests/tcg/i386/hello-i386.c
> > @@ -1,4 +1,10 @@
> > +#ifdef __FreeBSD__
> > +#include <sys/syscall.h>
> > +#define __NR_exit SYS_exit
> > +#define __NR_write SYS_write
> > +#else
> >  #include <asm/unistd.h>
> > +#endif
> >
> >  static inline void exit(int status)
> >  {
>

I can submit this as a separate thing, but it's the only patch I'm
completely sure of.

Warner


> > I get down to a failure i the mmap test.... and that's all I have time
> to plumb the depths
> > of this morning... Investigating the mmap test failure will have to wait
> for another day.
> >
> > Warner
> >
> >  diff --git a/tests/tcg/multiarch/Makefile.target
> b/tests/tcg/multiarch/Makefile.target
> >  index 85a6fb7a2e..38ee0f1dec 100644
> >  --- a/tests/tcg/multiarch/Makefile.target
> >  +++ b/tests/tcg/multiarch/Makefile.target
> >  @@ -10,7 +10,11 @@ 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=))
> >  +MULTIARCH_SKIP=float_helpers
> >  +ifeq ($(CONFIG_LINUX),)
> >  +MULTIARCH_SKIP+=linux-test
> >  +endif
> >  +MULTIARCH_TESTS  =$(filter-out $(MULTIARCH_SKIP),$(MULTIARCH_SRCS:.c=))
> >
> >   #
> >   # The following are any additional rules needed to build things
> >  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
>
>
> --
> Alex Bennée
>

Reply via email to