All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH for 7.0 0/5] bsd-user-smoke: A simple smoke test for bsd-user
@ 2021-11-27 20:18 Warner Losh
  2021-11-27 20:18 ` [PATCH for 7.0 1/5] h.armv7: Simple hello-world test for armv7 Warner Losh
                   ` (5 more replies)
  0 siblings, 6 replies; 11+ messages in thread
From: Warner Losh @ 2021-11-27 20:18 UTC (permalink / raw)
  To: qemu-devel; +Cc: arrowd, kevans, richard.henderson, f4bug, def, Warner Losh

This series adds a number of simple binaries that FreeBSD's clang can build on
any system. I've kept it simple so that there's no extra binaries that need to
be installed. Given the current state of bsd-user in the project's repo, this
likely is as extensive a set of tests that should be done right now. We can load
static binaries only (so these are static binaries) and hello world is the
canonical test. I have binaries for all the supported FreeBSD targets, but have
included only the ones that are in upstream (or in review) at this time.

In the future, I'll integreate with the tcg tests when there's more in upstream
they can test.  Since that requires putting together FreeBSD sysroots for all
the supported architectures for multiple versions, I'm going to delay that for a
while. I'll also integrate FreeBSD's 5k system tests when we're much further
along with the upstreaming.

The purpose of this is to give others doing changes in this area a standardized
way to ensure their changes don't fundamentally break bsd-user. This approach
will work for all setups that do a 'make check' to do their testing.

Based-on: 20211108035136.43687-1-imp@bsdimp.com

Warner Losh (5):
  h.armv7: Simple hello-world test for armv7
  h.i386: Simple hello-world test for i386
  h.amd64: Simple hello-world test for x86_64
  smoke-bsd-user: A test script to run all the FreeBSD binaries
  bsd-user-smoke: Add to build

 tests/bsd-user-smoke/h.amd64.S      | 28 +++++++++++++++++++++
 tests/bsd-user-smoke/h.armv7.S      | 37 +++++++++++++++++++++++++++
 tests/bsd-user-smoke/h.i386.S       | 39 +++++++++++++++++++++++++++++
 tests/bsd-user-smoke/meson.build    | 31 +++++++++++++++++++++++
 tests/bsd-user-smoke/smoke-bsd-user | 22 ++++++++++++++++
 tests/meson.build                   |  1 +
 6 files changed, 158 insertions(+)
 create mode 100644 tests/bsd-user-smoke/h.amd64.S
 create mode 100644 tests/bsd-user-smoke/h.armv7.S
 create mode 100644 tests/bsd-user-smoke/h.i386.S
 create mode 100644 tests/bsd-user-smoke/meson.build
 create mode 100644 tests/bsd-user-smoke/smoke-bsd-user

-- 
2.33.0



^ permalink raw reply	[flat|nested] 11+ messages in thread

* [PATCH for 7.0 1/5] h.armv7: Simple hello-world test for armv7
  2021-11-27 20:18 [PATCH for 7.0 0/5] bsd-user-smoke: A simple smoke test for bsd-user Warner Losh
@ 2021-11-27 20:18 ` Warner Losh
  2021-11-27 20:18 ` [PATCH for 7.0 2/5] h.i386: Simple hello-world test for i386 Warner Losh
                   ` (4 subsequent siblings)
  5 siblings, 0 replies; 11+ messages in thread
From: Warner Losh @ 2021-11-27 20:18 UTC (permalink / raw)
  To: qemu-devel; +Cc: arrowd, kevans, richard.henderson, f4bug, def, Warner Losh

A simple, tiny, statically linked armv7 'hello world' test. It uses two
system calls (write and exit) and provides a basic sanity check to make
sure that the arm bsd-user binary can interpret FreeBSD armv7 binaries.

Signed-off-by: Warner Losh <imp@bsdimp.com>
---
 tests/bsd-user-smoke/h.armv7.S | 37 ++++++++++++++++++++++++++++++++++
 1 file changed, 37 insertions(+)
 create mode 100644 tests/bsd-user-smoke/h.armv7.S

diff --git a/tests/bsd-user-smoke/h.armv7.S b/tests/bsd-user-smoke/h.armv7.S
new file mode 100644
index 00000000000..fe986f15ef6
--- /dev/null
+++ b/tests/bsd-user-smoke/h.armv7.S
@@ -0,0 +1,37 @@
+# Copyright (c) 2021 Warner Losh
+# SPDX-License-Identifier: BSD-2-Clause
+
+#include <sys/syscall.h>
+#define STDOUT_FILENO	1
+
+	.text
+	.file	"hello.s"
+	.syntax unified
+	.globl	qemu_start                            @ -- Begin function qemu_start
+	.p2align	2
+	.type	qemu_start,%function
+	.code	32                              @ @qemu_start
+qemu_start:
+@ %bb.0:                                @ %entry
+
+	# write(1, .L.str, sizeof(.L.str) - 1)
+	movw	r1, :lower16:.L.str	@ Load hello world
+	movt	r1, :upper16:.L.str
+	ldr	r0, =STDOUT_FILENO
+	ldr	r2, =(.L.strEnd - .L.str - 1)
+	ldr	r7, =SYS_write
+	swi	0
+
+	# _exit(0)
+	ldr	r0, =0			@ success
+	ldr	r7, =SYS_exit
+	swi	0
+.Lfunc_end0:
+	.size	qemu_start, .Lfunc_end0-qemu_start
+                                        @ -- End function
+	.type	.L.str,%object                  @ @.str
+	.section	.rodata.str1.1,"aMS",%progbits,1
+.L.str:
+	.asciz	"Hello World\n"
+.L.strEnd:
+	.size .L.str, .L.strEnd - .L.str
-- 
2.33.0



^ permalink raw reply related	[flat|nested] 11+ messages in thread

* [PATCH for 7.0 2/5] h.i386: Simple hello-world test for i386
  2021-11-27 20:18 [PATCH for 7.0 0/5] bsd-user-smoke: A simple smoke test for bsd-user Warner Losh
  2021-11-27 20:18 ` [PATCH for 7.0 1/5] h.armv7: Simple hello-world test for armv7 Warner Losh
@ 2021-11-27 20:18 ` Warner Losh
  2021-11-27 20:18 ` [PATCH for 7.0 3/5] h.amd64: Simple hello-world test for x86_64 Warner Losh
                   ` (3 subsequent siblings)
  5 siblings, 0 replies; 11+ messages in thread
From: Warner Losh @ 2021-11-27 20:18 UTC (permalink / raw)
  To: qemu-devel; +Cc: arrowd, kevans, richard.henderson, f4bug, def, Warner Losh

A simple, tiny, statically linked i386 'hello world' test. It uses two
system calls (write and exit) and provides a basic sanity check to make
sure that the arm bsd-user binary can interpret FreeBSD 32-bit i386
binaries.

Signed-off-by: Warner Losh <imp@bsdimp.com>
---
 tests/bsd-user-smoke/h.i386.S | 39 +++++++++++++++++++++++++++++++++++
 1 file changed, 39 insertions(+)
 create mode 100644 tests/bsd-user-smoke/h.i386.S

diff --git a/tests/bsd-user-smoke/h.i386.S b/tests/bsd-user-smoke/h.i386.S
new file mode 100644
index 00000000000..0af5a709f15
--- /dev/null
+++ b/tests/bsd-user-smoke/h.i386.S
@@ -0,0 +1,39 @@
+# Copyright (c) 2021 Warner Losh
+# SPDX-License-Identifier: BSD-2-Clause
+
+#include <sys/syscall.h>
+#define STDOUT_FILENO	1
+
+	.text
+	.file	"hello.s"
+	.globl	qemu_start                            # -- Begin function qemu_start
+	.p2align	4, 0x90
+	.type	qemu_start,@function
+qemu_start:                                   # @qemu_start
+# %bb.0:                                # %entry
+	pushl	%ebp
+	movl	%esp, %ebp
+
+	# write(1, .L.str, sizeof(.L.str) - 1)
+	pushl	$(.L.strEnd - .L.str - 1)
+	pushl	$.L.str
+	pushl	$STDOUT_FILENO
+	pushl	%eax			# dummy return address
+	movl	$SYS_write, %eax
+	int	$0x80
+	addl	$16, %esp		# 3 args + 1 dummy
+
+	# _exit(0)
+	pushl	$0
+	pushl	%eax			# dummy return address
+	movl	$SYS_exit, %eax
+	int	$0x80
+.Lfunc_end0:
+	.size	qemu_start, .Lfunc_end0-qemu_start
+                                        # -- End function
+	.type	.L.str,@object                  # @.str
+	.section	.rodata.str1.1,"aMS",@progbits,1
+.L.str:
+	.asciz	"Hello World\n"
+.L.strEnd:
+	.size .L.str, .L.strEnd - .L.str
-- 
2.33.0



^ permalink raw reply related	[flat|nested] 11+ messages in thread

* [PATCH for 7.0 3/5] h.amd64: Simple hello-world test for x86_64
  2021-11-27 20:18 [PATCH for 7.0 0/5] bsd-user-smoke: A simple smoke test for bsd-user Warner Losh
  2021-11-27 20:18 ` [PATCH for 7.0 1/5] h.armv7: Simple hello-world test for armv7 Warner Losh
  2021-11-27 20:18 ` [PATCH for 7.0 2/5] h.i386: Simple hello-world test for i386 Warner Losh
@ 2021-11-27 20:18 ` Warner Losh
  2021-11-27 20:18 ` [PATCH for 7.0 4/5] smoke-bsd-user: A test script to run all the FreeBSD binaries Warner Losh
                   ` (2 subsequent siblings)
  5 siblings, 0 replies; 11+ messages in thread
From: Warner Losh @ 2021-11-27 20:18 UTC (permalink / raw)
  To: qemu-devel; +Cc: arrowd, kevans, richard.henderson, f4bug, def, Warner Losh

A simple, tiny, statically linked 64-bit x86 'hello world' test. It uses
two system calls (write and exit) and provides a basic sanity check to
make sure that the arm bsd-user binary can interpret FreeBSD 64-bit
amd64 binaries. Please note: it's named amd64 because that's the target
name for FreeBSD's clang and it simplifies building a little.

Signed-off-by: Warner Losh <imp@bsdimp.com>
---
 tests/bsd-user-smoke/h.amd64.S | 28 ++++++++++++++++++++++++++++
 1 file changed, 28 insertions(+)
 create mode 100644 tests/bsd-user-smoke/h.amd64.S

diff --git a/tests/bsd-user-smoke/h.amd64.S b/tests/bsd-user-smoke/h.amd64.S
new file mode 100644
index 00000000000..a769e59beb8
--- /dev/null
+++ b/tests/bsd-user-smoke/h.amd64.S
@@ -0,0 +1,28 @@
+# Copyright (c) 2021 Warner Losh
+# SPDX-License-Identifier: BSD-2-Clause
+
+#include <sys/syscall.h>
+#define STDOUT_FILENO	1
+
+	.text
+	.globl	qemu_start
+	.p2align	4, 0x90
+qemu_start:
+
+	# write(1, .L.str, sizeof(.L.str) - 1)
+	movq	$.L.str, %rsi
+	movl	$STDOUT_FILENO, %edi
+	movl	$len, %edx
+	movl	$SYS_write, %eax
+	syscall
+
+	# _exit(0)
+	xorl	%edi, %edi
+	movl	$SYS_exit, %eax
+	syscall
+
+	.section	.rodata.str1.1,"aMS",@progbits,1
+.L.str:
+	.asciz	"Hello World\n"
+.L.strEnd:
+len=.L.strEnd - .L.str - 1
-- 
2.33.0



^ permalink raw reply related	[flat|nested] 11+ messages in thread

* [PATCH for 7.0 4/5] smoke-bsd-user: A test script to run all the FreeBSD binaries
  2021-11-27 20:18 [PATCH for 7.0 0/5] bsd-user-smoke: A simple smoke test for bsd-user Warner Losh
                   ` (2 preceding siblings ...)
  2021-11-27 20:18 ` [PATCH for 7.0 3/5] h.amd64: Simple hello-world test for x86_64 Warner Losh
@ 2021-11-27 20:18 ` Warner Losh
  2021-11-27 20:18 ` [PATCH for 7.0 5/5] bsd-user-smoke: Add to build Warner Losh
  2021-12-03 23:46 ` [PATCH for 7.0 0/5] bsd-user-smoke: A simple smoke test for bsd-user Warner Losh
  5 siblings, 0 replies; 11+ messages in thread
From: Warner Losh @ 2021-11-27 20:18 UTC (permalink / raw)
  To: qemu-devel; +Cc: arrowd, kevans, richard.henderson, f4bug, def, Warner Losh

Simple shell script to iterate through all the FreeBSD binaries running
qemu-$binary to ensure that we have minimal functionality for each
platform. When more of the bsd-user fork has been upstreamed, this
will be replaced by more extensive regresion tests.

Signed-off-by: Warner Losh <imp@bsdimp.com>
---
 tests/bsd-user-smoke/smoke-bsd-user | 22 ++++++++++++++++++++++
 1 file changed, 22 insertions(+)
 create mode 100644 tests/bsd-user-smoke/smoke-bsd-user

diff --git a/tests/bsd-user-smoke/smoke-bsd-user b/tests/bsd-user-smoke/smoke-bsd-user
new file mode 100644
index 00000000000..20818fdf918
--- /dev/null
+++ b/tests/bsd-user-smoke/smoke-bsd-user
@@ -0,0 +1,22 @@
+#!/bin/sh
+
+build=$1
+testing=$2
+
+smoke_one() {
+	local a=$1 q=$2
+
+	echo Hello World > foo1
+	$build/qemu-$q $testing/h.$a > foo2 || die "cmd failed: $build/qemu-$q $testing/h.$a"
+	cmp foo1 foo2 || die "Hello World expected"
+	rm foo1 foo2
+}
+
+die() {
+	echo $1
+	exit 1
+}
+
+smoke_one amd64 x86_64
+smoke_one armv7 arm
+smoke_one i386 i386
-- 
2.33.0



^ permalink raw reply related	[flat|nested] 11+ messages in thread

* [PATCH for 7.0 5/5] bsd-user-smoke: Add to build
  2021-11-27 20:18 [PATCH for 7.0 0/5] bsd-user-smoke: A simple smoke test for bsd-user Warner Losh
                   ` (3 preceding siblings ...)
  2021-11-27 20:18 ` [PATCH for 7.0 4/5] smoke-bsd-user: A test script to run all the FreeBSD binaries Warner Losh
@ 2021-11-27 20:18 ` Warner Losh
  2022-01-04 23:25   ` Philippe Mathieu-Daudé
  2021-12-03 23:46 ` [PATCH for 7.0 0/5] bsd-user-smoke: A simple smoke test for bsd-user Warner Losh
  5 siblings, 1 reply; 11+ messages in thread
From: Warner Losh @ 2021-11-27 20:18 UTC (permalink / raw)
  To: qemu-devel; +Cc: arrowd, kevans, richard.henderson, f4bug, def, Warner Losh

Add a simple bsd-user smoke test for ensuring bsd-user is minimally
functional. This runs only when bsd-user has been configured. It adds a
simple execution of 'hello world' type binaries for bsd-user. At the
present these are tiny, hand-crafted binaries that are statically linked
and do not depend on any host libraries being present (they also take
advantage of the fact that on FreeBSD all system call numbers are
uniform on all architectures). This was done both for building and
testing simplicity, as well as recognizing the current state of bsd-user
in qemu upstream is extremely basic.

Signed-off-by: Warner Losh <imp@bsdimp.com>
---
 tests/bsd-user-smoke/meson.build | 31 +++++++++++++++++++++++++++++++
 tests/meson.build                |  1 +
 2 files changed, 32 insertions(+)
 create mode 100644 tests/bsd-user-smoke/meson.build

diff --git a/tests/bsd-user-smoke/meson.build b/tests/bsd-user-smoke/meson.build
new file mode 100644
index 00000000000..586697ab3b6
--- /dev/null
+++ b/tests/bsd-user-smoke/meson.build
@@ -0,0 +1,31 @@
+if not have_bsd_user
+   subdir_done()
+endif
+
+smoke_bsd_user = find_program('smoke-bsd-user')
+
+bsd_user_archs = [ 'armv7', 'amd64', 'i386' ]
+targs = []
+foreach i : bsd_user_archs
+    h = 'h.' + i
+    targs += custom_target('bsd-user h.' + i,
+        output : h,
+	input : h + '.S',
+	command : ['clang',
+	    '-target',
+	    i + '-unknown-freebsd14.0',
+	    '-o',
+	    '@OUTPUT@',
+	    '@INPUT@',
+	    '-nostdlib',
+	    '-Wl,-e',
+	    '-Wl,qemu_start',
+	    '-static'],
+	install : false)
+endforeach
+
+test('bsd-user-smoke', smoke_bsd_user,
+    args: [meson.project_build_root(), meson.current_build_dir()],
+    suite: 'smoke',
+    depends: targs
+)
diff --git a/tests/meson.build b/tests/meson.build
index 3f3882748ae..3b95efe8896 100644
--- a/tests/meson.build
+++ b/tests/meson.build
@@ -1,6 +1,7 @@
 py3 = import('python').find_installation()
 
 subdir('bench')
+subdir('bsd-user-smoke')
 
 test_qapi_outputs = [
   'qapi-builtin-types.c',
-- 
2.33.0



^ permalink raw reply related	[flat|nested] 11+ messages in thread

* Re: [PATCH for 7.0 0/5] bsd-user-smoke: A simple smoke test for bsd-user
  2021-11-27 20:18 [PATCH for 7.0 0/5] bsd-user-smoke: A simple smoke test for bsd-user Warner Losh
                   ` (4 preceding siblings ...)
  2021-11-27 20:18 ` [PATCH for 7.0 5/5] bsd-user-smoke: Add to build Warner Losh
@ 2021-12-03 23:46 ` Warner Losh
  2022-01-04 17:20   ` Alex Bennée
  5 siblings, 1 reply; 11+ messages in thread
From: Warner Losh @ 2021-12-03 23:46 UTC (permalink / raw)
  To: QEMU Developers
  Cc: Kyle Evans, Konrad Witaszczyk, Richard Henderson,
	Philippe Mathieu-Daudé,
	Gleb Popov

[-- Attachment #1: Type: text/plain, Size: 2556 bytes --]

PING!

If anybody (especially the BSD reviewers) could look at these, that would
be great!

It's been suggested I rename bsd-user-smoke to just be bsd-user and we put
our tests there until we can switch to the more generic tcg tests, so I'll
do that and resend in a few days.

Warner

On Sat, Nov 27, 2021 at 1:19 PM Warner Losh <imp@bsdimp.com> wrote:

> This series adds a number of simple binaries that FreeBSD's clang can
> build on
> any system. I've kept it simple so that there's no extra binaries that
> need to
> be installed. Given the current state of bsd-user in the project's repo,
> this
> likely is as extensive a set of tests that should be done right now. We
> can load
> static binaries only (so these are static binaries) and hello world is the
> canonical test. I have binaries for all the supported FreeBSD targets, but
> have
> included only the ones that are in upstream (or in review) at this time.
>
> In the future, I'll integreate with the tcg tests when there's more in
> upstream
> they can test.  Since that requires putting together FreeBSD sysroots for
> all
> the supported architectures for multiple versions, I'm going to delay that
> for a
> while. I'll also integrate FreeBSD's 5k system tests when we're much
> further
> along with the upstreaming.
>
> The purpose of this is to give others doing changes in this area a
> standardized
> way to ensure their changes don't fundamentally break bsd-user. This
> approach
> will work for all setups that do a 'make check' to do their testing.
>
> Based-on: 20211108035136.43687-1-imp@bsdimp.com
>
> Warner Losh (5):
>   h.armv7: Simple hello-world test for armv7
>   h.i386: Simple hello-world test for i386
>   h.amd64: Simple hello-world test for x86_64
>   smoke-bsd-user: A test script to run all the FreeBSD binaries
>   bsd-user-smoke: Add to build
>
>  tests/bsd-user-smoke/h.amd64.S      | 28 +++++++++++++++++++++
>  tests/bsd-user-smoke/h.armv7.S      | 37 +++++++++++++++++++++++++++
>  tests/bsd-user-smoke/h.i386.S       | 39 +++++++++++++++++++++++++++++
>  tests/bsd-user-smoke/meson.build    | 31 +++++++++++++++++++++++
>  tests/bsd-user-smoke/smoke-bsd-user | 22 ++++++++++++++++
>  tests/meson.build                   |  1 +
>  6 files changed, 158 insertions(+)
>  create mode 100644 tests/bsd-user-smoke/h.amd64.S
>  create mode 100644 tests/bsd-user-smoke/h.armv7.S
>  create mode 100644 tests/bsd-user-smoke/h.i386.S
>  create mode 100644 tests/bsd-user-smoke/meson.build
>  create mode 100644 tests/bsd-user-smoke/smoke-bsd-user
>
> --
> 2.33.0
>
>

[-- Attachment #2: Type: text/html, Size: 3191 bytes --]

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [PATCH for 7.0 0/5] bsd-user-smoke: A simple smoke test for bsd-user
  2021-12-03 23:46 ` [PATCH for 7.0 0/5] bsd-user-smoke: A simple smoke test for bsd-user Warner Losh
@ 2022-01-04 17:20   ` Alex Bennée
  2022-01-04 17:39     ` Warner Losh
  0 siblings, 1 reply; 11+ messages in thread
From: Alex Bennée @ 2022-01-04 17:20 UTC (permalink / raw)
  To: Warner Losh
  Cc: Gleb Popov, Kyle Evans, Richard Henderson,
	Philippe Mathieu-Daudé,
	qemu-devel, Konrad Witaszczyk


Warner Losh <imp@bsdimp.com> writes:

> PING!
>
> If anybody (especially the BSD reviewers) could look at these, that would be great!
>
> It's been suggested I rename bsd-user-smoke to just be bsd-user and we put our tests there until we can switch to the more generic tcg
> tests, so I'll do that and resend in a few days.

That seems reasonable. I'm curious how much of check-tcg runs on BSD at
the moment?

>
> Warner
>
> On Sat, Nov 27, 2021 at 1:19 PM Warner Losh <imp@bsdimp.com> wrote:
>
>  This series adds a number of simple binaries that FreeBSD's clang can build on
>  any system. I've kept it simple so that there's no extra binaries that need to
>  be installed. Given the current state of bsd-user in the project's repo, this
>  likely is as extensive a set of tests that should be done right now. We can load
>  static binaries only (so these are static binaries) and hello world is the
>  canonical test. I have binaries for all the supported FreeBSD targets, but have
>  included only the ones that are in upstream (or in review) at this time.
>
>  In the future, I'll integreate with the tcg tests when there's more in upstream
>  they can test.  Since that requires putting together FreeBSD sysroots for all
>  the supported architectures for multiple versions, I'm going to delay that for a
>  while. I'll also integrate FreeBSD's 5k system tests when we're much further
>  along with the upstreaming.
>
>  The purpose of this is to give others doing changes in this area a standardized
>  way to ensure their changes don't fundamentally break bsd-user. This approach
>  will work for all setups that do a 'make check' to do their testing.
>
>  Based-on: 20211108035136.43687-1-imp@bsdimp.com
>
>  Warner Losh (5):
>    h.armv7: Simple hello-world test for armv7
>    h.i386: Simple hello-world test for i386
>    h.amd64: Simple hello-world test for x86_64
>    smoke-bsd-user: A test script to run all the FreeBSD binaries
>    bsd-user-smoke: Add to build
>
>   tests/bsd-user-smoke/h.amd64.S      | 28 +++++++++++++++++++++
>   tests/bsd-user-smoke/h.armv7.S      | 37 +++++++++++++++++++++++++++
>   tests/bsd-user-smoke/h.i386.S       | 39 +++++++++++++++++++++++++++++
>   tests/bsd-user-smoke/meson.build    | 31 +++++++++++++++++++++++
>   tests/bsd-user-smoke/smoke-bsd-user | 22 ++++++++++++++++
>   tests/meson.build                   |  1 +
>   6 files changed, 158 insertions(+)
>   create mode 100644 tests/bsd-user-smoke/h.amd64.S
>   create mode 100644 tests/bsd-user-smoke/h.armv7.S
>   create mode 100644 tests/bsd-user-smoke/h.i386.S
>   create mode 100644 tests/bsd-user-smoke/meson.build
>   create mode 100644 tests/bsd-user-smoke/smoke-bsd-user
>
>  -- 
>  2.33.0


-- 
Alex Bennée


^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [PATCH for 7.0 0/5] bsd-user-smoke: A simple smoke test for bsd-user
  2022-01-04 17:20   ` Alex Bennée
@ 2022-01-04 17:39     ` Warner Losh
  0 siblings, 0 replies; 11+ messages in thread
From: Warner Losh @ 2022-01-04 17:39 UTC (permalink / raw)
  To: Alex Bennée
  Cc: Gleb Popov, Kyle Evans, Richard Henderson,
	Philippe Mathieu-Daudé,
	QEMU Developers, Konrad Witaszczyk

[-- Attachment #1: Type: text/plain, Size: 3838 bytes --]

On Tue, Jan 4, 2022 at 10:21 AM Alex Bennée <alex.bennee@linaro.org> wrote:

>
> Warner Losh <imp@bsdimp.com> writes:
>
> > PING!
> >
> > If anybody (especially the BSD reviewers) could look at these, that
> would be great!
> >
> > It's been suggested I rename bsd-user-smoke to just be bsd-user and we
> put our tests there until we can switch to the more generic tcg
> > tests, so I'll do that and resend in a few days.
>
> That seems reasonable. I'm curious how much of check-tcg runs on BSD at
> the moment?
>

About 1/3-1/2 on x86 (due to lack of signal support, the x86 stuff is
pretty basic since it's
really never evolved past it's early Blue Swirl origin phase). On other
platforms, you
need a 'sysroot' to build with the cross compiler specified. FreeBSD has
the compiler
built to build for any target by default, but not the sysroot needed and we
don't
currently have a good sysroot package that would easily drop into
automation. The
smoke test is carefully crafted to not need this. To be honest, I've not
yet tested other
architectures due to this issue with check-tcg, but will do so now that I'm
back from
the holidays. There's some other issues with bsd-user I need to focus on
first (more
changes to sys/user.h breaking the build leading to much downstream angst).

Warner


> >
> > Warner
> >
> > On Sat, Nov 27, 2021 at 1:19 PM Warner Losh <imp@bsdimp.com> wrote:
> >
> >  This series adds a number of simple binaries that FreeBSD's clang can
> build on
> >  any system. I've kept it simple so that there's no extra binaries that
> need to
> >  be installed. Given the current state of bsd-user in the project's
> repo, this
> >  likely is as extensive a set of tests that should be done right now. We
> can load
> >  static binaries only (so these are static binaries) and hello world is
> the
> >  canonical test. I have binaries for all the supported FreeBSD targets,
> but have
> >  included only the ones that are in upstream (or in review) at this time.
> >
> >  In the future, I'll integreate with the tcg tests when there's more in
> upstream
> >  they can test.  Since that requires putting together FreeBSD sysroots
> for all
> >  the supported architectures for multiple versions, I'm going to delay
> that for a
> >  while. I'll also integrate FreeBSD's 5k system tests when we're much
> further
> >  along with the upstreaming.
> >
> >  The purpose of this is to give others doing changes in this area a
> standardized
> >  way to ensure their changes don't fundamentally break bsd-user. This
> approach
> >  will work for all setups that do a 'make check' to do their testing.
> >
> >  Based-on: 20211108035136.43687-1-imp@bsdimp.com
> >
> >  Warner Losh (5):
> >    h.armv7: Simple hello-world test for armv7
> >    h.i386: Simple hello-world test for i386
> >    h.amd64: Simple hello-world test for x86_64
> >    smoke-bsd-user: A test script to run all the FreeBSD binaries
> >    bsd-user-smoke: Add to build
> >
> >   tests/bsd-user-smoke/h.amd64.S      | 28 +++++++++++++++++++++
> >   tests/bsd-user-smoke/h.armv7.S      | 37 +++++++++++++++++++++++++++
> >   tests/bsd-user-smoke/h.i386.S       | 39 +++++++++++++++++++++++++++++
> >   tests/bsd-user-smoke/meson.build    | 31 +++++++++++++++++++++++
> >   tests/bsd-user-smoke/smoke-bsd-user | 22 ++++++++++++++++
> >   tests/meson.build                   |  1 +
> >   6 files changed, 158 insertions(+)
> >   create mode 100644 tests/bsd-user-smoke/h.amd64.S
> >   create mode 100644 tests/bsd-user-smoke/h.armv7.S
> >   create mode 100644 tests/bsd-user-smoke/h.i386.S
> >   create mode 100644 tests/bsd-user-smoke/meson.build
> >   create mode 100644 tests/bsd-user-smoke/smoke-bsd-user
> >
> >  --
> >  2.33.0
>
>
> --
> Alex Bennée
>

[-- Attachment #2: Type: text/html, Size: 5004 bytes --]

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [PATCH for 7.0 5/5] bsd-user-smoke: Add to build
  2021-11-27 20:18 ` [PATCH for 7.0 5/5] bsd-user-smoke: Add to build Warner Losh
@ 2022-01-04 23:25   ` Philippe Mathieu-Daudé
  2022-01-04 23:28     ` Warner Losh
  0 siblings, 1 reply; 11+ messages in thread
From: Philippe Mathieu-Daudé @ 2022-01-04 23:25 UTC (permalink / raw)
  To: Warner Losh, qemu-devel, Paolo Bonzini
  Cc: kevans, def, richard.henderson, arrowd

+Paolo for meson

On 11/27/21 21:18, Warner Losh wrote:
> Add a simple bsd-user smoke test for ensuring bsd-user is minimally
> functional. This runs only when bsd-user has been configured. It adds a
> simple execution of 'hello world' type binaries for bsd-user. At the
> present these are tiny, hand-crafted binaries that are statically linked
> and do not depend on any host libraries being present (they also take
> advantage of the fact that on FreeBSD all system call numbers are
> uniform on all architectures). This was done both for building and
> testing simplicity, as well as recognizing the current state of bsd-user
> in qemu upstream is extremely basic.
> 
> Signed-off-by: Warner Losh <imp@bsdimp.com>
> ---
>  tests/bsd-user-smoke/meson.build | 31 +++++++++++++++++++++++++++++++
>  tests/meson.build                |  1 +
>  2 files changed, 32 insertions(+)
>  create mode 100644 tests/bsd-user-smoke/meson.build
> 
> diff --git a/tests/bsd-user-smoke/meson.build b/tests/bsd-user-smoke/meson.build
> new file mode 100644
> index 00000000000..586697ab3b6
> --- /dev/null
> +++ b/tests/bsd-user-smoke/meson.build
> @@ -0,0 +1,31 @@
> +if not have_bsd_user
> +   subdir_done()
> +endif
> +
> +smoke_bsd_user = find_program('smoke-bsd-user')
> +
> +bsd_user_archs = [ 'armv7', 'amd64', 'i386' ]
> +targs = []
> +foreach i : bsd_user_archs
> +    h = 'h.' + i
> +    targs += custom_target('bsd-user h.' + i,
> +        output : h,
> +	input : h + '.S',
> +	command : ['clang',

Do we want a find_program(clang) somewhere?

> +	    '-target',
> +	    i + '-unknown-freebsd14.0',

Also, I wonder if this trailer shouldn´t be populated by meson.

> +	    '-o',
> +	    '@OUTPUT@',
> +	    '@INPUT@',
> +	    '-nostdlib',
> +	    '-Wl,-e',
> +	    '-Wl,qemu_start',
> +	    '-static'],
> +	install : false)
> +endforeach
> +
> +test('bsd-user-smoke', smoke_bsd_user,
> +    args: [meson.project_build_root(), meson.current_build_dir()],
> +    suite: 'smoke',
> +    depends: targs
> +)
> diff --git a/tests/meson.build b/tests/meson.build
> index 3f3882748ae..3b95efe8896 100644
> --- a/tests/meson.build
> +++ b/tests/meson.build
> @@ -1,6 +1,7 @@
>  py3 = import('python').find_installation()
>  
>  subdir('bench')
> +subdir('bsd-user-smoke')
>  
>  test_qapi_outputs = [
>    'qapi-builtin-types.c',


^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [PATCH for 7.0 5/5] bsd-user-smoke: Add to build
  2022-01-04 23:25   ` Philippe Mathieu-Daudé
@ 2022-01-04 23:28     ` Warner Losh
  0 siblings, 0 replies; 11+ messages in thread
From: Warner Losh @ 2022-01-04 23:28 UTC (permalink / raw)
  To: Philippe Mathieu-Daudé
  Cc: Gleb Popov, Kyle Evans, Richard Henderson, QEMU Developers,
	Paolo Bonzini, Konrad Witaszczyk

[-- Attachment #1: Type: text/plain, Size: 2885 bytes --]

On Tue, Jan 4, 2022 at 4:25 PM Philippe Mathieu-Daudé <f4bug@amsat.org>
wrote:

> +Paolo for meson
>
> On 11/27/21 21:18, Warner Losh wrote:
> > Add a simple bsd-user smoke test for ensuring bsd-user is minimally
> > functional. This runs only when bsd-user has been configured. It adds a
> > simple execution of 'hello world' type binaries for bsd-user. At the
> > present these are tiny, hand-crafted binaries that are statically linked
> > and do not depend on any host libraries being present (they also take
> > advantage of the fact that on FreeBSD all system call numbers are
> > uniform on all architectures). This was done both for building and
> > testing simplicity, as well as recognizing the current state of bsd-user
> > in qemu upstream is extremely basic.
> >
> > Signed-off-by: Warner Losh <imp@bsdimp.com>
> > ---
> >  tests/bsd-user-smoke/meson.build | 31 +++++++++++++++++++++++++++++++
> >  tests/meson.build                |  1 +
> >  2 files changed, 32 insertions(+)
> >  create mode 100644 tests/bsd-user-smoke/meson.build
> >
> > diff --git a/tests/bsd-user-smoke/meson.build
> b/tests/bsd-user-smoke/meson.build
> > new file mode 100644
> > index 00000000000..586697ab3b6
> > --- /dev/null
> > +++ b/tests/bsd-user-smoke/meson.build
> > @@ -0,0 +1,31 @@
> > +if not have_bsd_user
> > +   subdir_done()
> > +endif
> > +
> > +smoke_bsd_user = find_program('smoke-bsd-user')
> > +
> > +bsd_user_archs = [ 'armv7', 'amd64', 'i386' ]
> > +targs = []
> > +foreach i : bsd_user_archs
> > +    h = 'h.' + i
> > +    targs += custom_target('bsd-user h.' + i,
> > +        output : h,
> > +     input : h + '.S',
> > +     command : ['clang',
>
> Do we want a find_program(clang) somewhere?
>

I am new and naive in the ways of meson... :) I am willing, however, to
learn...
Is it just s/'clang'/find_program(clang)/ here or something more complex....


> > +         '-target',
> > +         i + '-unknown-freebsd14.0',
>
> Also, I wonder if this trailer shouldn´t be populated by meson.
>

I like that idea. See above :)

Warner


> > +         '-o',
> > +         '@OUTPUT@',
> > +         '@INPUT@',
> > +         '-nostdlib',
> > +         '-Wl,-e',
> > +         '-Wl,qemu_start',
> > +         '-static'],
> > +     install : false)
> > +endforeach
> > +
> > +test('bsd-user-smoke', smoke_bsd_user,
> > +    args: [meson.project_build_root(), meson.current_build_dir()],
> > +    suite: 'smoke',
> > +    depends: targs
> > +)
> > diff --git a/tests/meson.build b/tests/meson.build
> > index 3f3882748ae..3b95efe8896 100644
> > --- a/tests/meson.build
> > +++ b/tests/meson.build
> > @@ -1,6 +1,7 @@
> >  py3 = import('python').find_installation()
> >
> >  subdir('bench')
> > +subdir('bsd-user-smoke')
> >
> >  test_qapi_outputs = [
> >    'qapi-builtin-types.c',
>

[-- Attachment #2: Type: text/html, Size: 4233 bytes --]

^ permalink raw reply	[flat|nested] 11+ messages in thread

end of thread, other threads:[~2022-01-04 23:33 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-11-27 20:18 [PATCH for 7.0 0/5] bsd-user-smoke: A simple smoke test for bsd-user Warner Losh
2021-11-27 20:18 ` [PATCH for 7.0 1/5] h.armv7: Simple hello-world test for armv7 Warner Losh
2021-11-27 20:18 ` [PATCH for 7.0 2/5] h.i386: Simple hello-world test for i386 Warner Losh
2021-11-27 20:18 ` [PATCH for 7.0 3/5] h.amd64: Simple hello-world test for x86_64 Warner Losh
2021-11-27 20:18 ` [PATCH for 7.0 4/5] smoke-bsd-user: A test script to run all the FreeBSD binaries Warner Losh
2021-11-27 20:18 ` [PATCH for 7.0 5/5] bsd-user-smoke: Add to build Warner Losh
2022-01-04 23:25   ` Philippe Mathieu-Daudé
2022-01-04 23:28     ` Warner Losh
2021-12-03 23:46 ` [PATCH for 7.0 0/5] bsd-user-smoke: A simple smoke test for bsd-user Warner Losh
2022-01-04 17:20   ` Alex Bennée
2022-01-04 17:39     ` Warner Losh

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.