[PATCH v2 2/5] tests/migration: Make initrd-stress.img built by default

Hyman Huang posted 5 patches 4 days, 4 hours ago
There is a newer version of this series
[PATCH v2 2/5] tests/migration: Make initrd-stress.img built by default
Posted by Hyman Huang 4 days, 4 hours ago
The initrd-stress.img was compiled by specifying the target,
to make it easier for developers to play the guestperf tool,
make it built when dependencies suffices.

Signed-off-by: Hyman Huang <yong.huang@smartx.com>
---
 tests/migration/meson.build | 33 ++++++++++++++++++++-------------
 1 file changed, 20 insertions(+), 13 deletions(-)

diff --git a/tests/migration/meson.build b/tests/migration/meson.build
index a91aa61c65..d9e5b0d241 100644
--- a/tests/migration/meson.build
+++ b/tests/migration/meson.build
@@ -1,18 +1,25 @@
+sysprof = not_found
+glib_static = not_found
+
 sysprof = dependency('sysprof-capture-4', method: 'pkg-config', required: false)
 glib_static = dependency('glib-2.0', version: glib_req_ver, required: false,
                          method: 'pkg-config', static: true)
 
-stress = executable(
-  'stress',
-  files('stress.c'),
-  dependencies: [glib_static, sysprof],
-  link_args: ['-static'],
-  build_by_default: false,
-)
 
-custom_target(
-  'initrd-stress.img',
-  output: 'initrd-stress.img',
-  input: stress,
-  command: [find_program('initrd-stress.sh'), '@OUTPUT@', '@INPUT@']
-)
+if host_os == 'linux' and sysprof.found() and glib_static.found()
+    stress = executable(
+      'stress',
+      files('stress.c'),
+      dependencies: [glib_static, sysprof],
+      link_args: ['-static'],
+    )
+
+    custom_target(
+      'initrd-stress.img',
+      output: 'initrd-stress.img',
+      input: stress,
+      command: [find_program('initrd-stress.sh'), '@OUTPUT@', '@INPUT@'],
+      build_by_default: true,
+      depends: [stress],
+    )
+endif
-- 
2.39.1
Re: [PATCH v2 2/5] tests/migration: Make initrd-stress.img built by default
Posted by Daniel P. Berrangé 1 day, 5 hours ago
On Sat, Oct 19, 2024 at 02:25:04AM +0800, Hyman Huang wrote:
> The initrd-stress.img was compiled by specifying the target,
> to make it easier for developers to play the guestperf tool,
> make it built when dependencies suffices.
> 
> Signed-off-by: Hyman Huang <yong.huang@smartx.com>
> ---
>  tests/migration/meson.build | 33 ++++++++++++++++++++-------------
>  1 file changed, 20 insertions(+), 13 deletions(-)
> 
> diff --git a/tests/migration/meson.build b/tests/migration/meson.build
> index a91aa61c65..d9e5b0d241 100644
> --- a/tests/migration/meson.build
> +++ b/tests/migration/meson.build
> @@ -1,18 +1,25 @@
> +sysprof = not_found
> +glib_static = not_found
> +

These two assignments should be redundant, given that the next two
line unconditionally overwrite them.

>  sysprof = dependency('sysprof-capture-4', method: 'pkg-config', required: false)
>  glib_static = dependency('glib-2.0', version: glib_req_ver, required: false,
>                           method: 'pkg-config', static: true)

'dependency()' should already return "not_found" given you have
'required: false'

>  
> -stress = executable(
> -  'stress',
> -  files('stress.c'),
> -  dependencies: [glib_static, sysprof],
> -  link_args: ['-static'],
> -  build_by_default: false,
> -)
>  
> -custom_target(
> -  'initrd-stress.img',
> -  output: 'initrd-stress.img',
> -  input: stress,
> -  command: [find_program('initrd-stress.sh'), '@OUTPUT@', '@INPUT@']
> -)
> +if host_os == 'linux' and sysprof.found() and glib_static.found()
> +    stress = executable(
> +      'stress',
> +      files('stress.c'),
> +      dependencies: [glib_static, sysprof],
> +      link_args: ['-static'],
> +    )
> +
> +    custom_target(
> +      'initrd-stress.img',
> +      output: 'initrd-stress.img',
> +      input: stress,
> +      command: [find_program('initrd-stress.sh'), '@OUTPUT@', '@INPUT@'],
> +      build_by_default: true,
> +      depends: [stress],
> +    )
> +endif

Assuming you remove the two redundant assignments at the top, then

  Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>

With regards,
Daniel
-- 
|: https://berrange.com      -o-    https://www.flickr.com/photos/dberrange :|
|: https://libvirt.org         -o-            https://fstop138.berrange.com :|
|: https://entangle-photo.org    -o-    https://www.instagram.com/dberrange :|