diff mbox series

[for,7.0,5/5] bsd-user-smoke: Add to build

Message ID 20211127201846.64187-6-imp@bsdimp.com
State New
Headers show
Series bsd-user-smoke: A simple smoke test for bsd-user | expand

Commit Message

Warner Losh Nov. 27, 2021, 8:18 p.m. UTC
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

Comments

Philippe Mathieu-Daudé Jan. 4, 2022, 11:25 p.m. UTC | #1
+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',
Warner Losh Jan. 4, 2022, 11:28 p.m. UTC | #2
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',
>
diff mbox series

Patch

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',