[PATCH] gitlab-ci: include full Rust backtraces in test runs

Paolo Bonzini posted 1 patch 2 months ago
.gitlab-ci.d/buildtest-template.yml | 1 +
1 file changed, 1 insertion(+)
[PATCH] gitlab-ci: include full Rust backtraces in test runs
Posted by Paolo Bonzini 2 months ago
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
---
 .gitlab-ci.d/buildtest-template.yml | 1 +
 1 file changed, 1 insertion(+)

diff --git a/.gitlab-ci.d/buildtest-template.yml b/.gitlab-ci.d/buildtest-template.yml
index 39da7698b09..4cc19239319 100644
--- a/.gitlab-ci.d/buildtest-template.yml
+++ b/.gitlab-ci.d/buildtest-template.yml
@@ -63,6 +63,7 @@
   stage: test
   image: $CI_REGISTRY_IMAGE/qemu/$IMAGE:$QEMU_CI_CONTAINER_TAG
   script:
+    - export RUST_BACKTRACE=1
     - source scripts/ci/gitlab-ci-section
     - section_start buildenv "Setting up to run tests"
     - scripts/git-submodule.sh update roms/SLOF
-- 
2.48.1
Re: [PATCH] gitlab-ci: include full Rust backtraces in test runs
Posted by Peter Maydell 3 weeks, 4 days ago
On Wed, 29 Jan 2025 at 08:21, Paolo Bonzini <pbonzini@redhat.com> wrote:
>
> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
> ---
>  .gitlab-ci.d/buildtest-template.yml | 1 +
>  1 file changed, 1 insertion(+)
>
> diff --git a/.gitlab-ci.d/buildtest-template.yml b/.gitlab-ci.d/buildtest-template.yml
> index 39da7698b09..4cc19239319 100644
> --- a/.gitlab-ci.d/buildtest-template.yml
> +++ b/.gitlab-ci.d/buildtest-template.yml
> @@ -63,6 +63,7 @@
>    stage: test
>    image: $CI_REGISTRY_IMAGE/qemu/$IMAGE:$QEMU_CI_CONTAINER_TAG
>    script:
> +    - export RUST_BACKTRACE=1
>      - source scripts/ci/gitlab-ci-section
>      - section_start buildenv "Setting up to run tests"
>      - scripts/git-submodule.sh update roms/SLOF
> --

This will only add the rust backtraces when the tests
are run from the CI logs, not when you locally run
"make check" or similar. There's probably a better place
to put this...

-- PMM
Re: [PATCH] gitlab-ci: include full Rust backtraces in test runs
Posted by Daniel P. Berrangé 3 weeks, 4 days ago
On Mon, Mar 10, 2025 at 09:21:37AM +0000, Peter Maydell wrote:
> On Wed, 29 Jan 2025 at 08:21, Paolo Bonzini <pbonzini@redhat.com> wrote:
> >
> > Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
> > ---
> >  .gitlab-ci.d/buildtest-template.yml | 1 +
> >  1 file changed, 1 insertion(+)
> >
> > diff --git a/.gitlab-ci.d/buildtest-template.yml b/.gitlab-ci.d/buildtest-template.yml
> > index 39da7698b09..4cc19239319 100644
> > --- a/.gitlab-ci.d/buildtest-template.yml
> > +++ b/.gitlab-ci.d/buildtest-template.yml
> > @@ -63,6 +63,7 @@
> >    stage: test
> >    image: $CI_REGISTRY_IMAGE/qemu/$IMAGE:$QEMU_CI_CONTAINER_TAG
> >    script:
> > +    - export RUST_BACKTRACE=1
> >      - source scripts/ci/gitlab-ci-section
> >      - section_start buildenv "Setting up to run tests"
> >      - scripts/git-submodule.sh update roms/SLOF
> > --
> 
> This will only add the rust backtraces when the tests
> are run from the CI logs, not when you locally run
> "make check" or similar. There's probably a better place
> to put this...

Meson's  'test()' command accepts env variables, but it'll be somewhat
tedious to add the same env to all case where we use test. Might want
to define a common 'testenv' set at the top level meson.build and then
reference it from every 'test()', unless meson has built-in support
for globally applied env vars that I'm missing.


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 :|
Re: [PATCH] gitlab-ci: include full Rust backtraces in test runs
Posted by Paolo Bonzini 3 weeks, 4 days ago
On Mon, Mar 10, 2025 at 10:25 AM Daniel P. Berrangé <berrange@redhat.com> wrote:
> > This will only add the rust backtraces when the tests
> > are run from the CI logs, not when you locally run
> > "make check" or similar. There's probably a better place
> > to put this...
>
> Meson's  'test()' command accepts env variables, but it'll be somewhat
> tedious to add the same env to all case where we use test. Might want
> to define a common 'testenv' set at the top level meson.build and then
> reference it from every 'test()', unless meson has built-in support
> for globally applied env vars that I'm missing.

It can be added to add_test_setup().

Paolo
Re: [PATCH] gitlab-ci: include full Rust backtraces in test runs
Posted by Peter Maydell 3 weeks, 4 days ago
On Mon, 10 Mar 2025 at 09:40, Paolo Bonzini <pbonzini@redhat.com> wrote:
>
> On Mon, Mar 10, 2025 at 10:25 AM Daniel P. Berrangé <berrange@redhat.com> wrote:
> > > This will only add the rust backtraces when the tests
> > > are run from the CI logs, not when you locally run
> > > "make check" or similar. There's probably a better place
> > > to put this...
> >
> > Meson's  'test()' command accepts env variables, but it'll be somewhat
> > tedious to add the same env to all case where we use test. Might want
> > to define a common 'testenv' set at the top level meson.build and then
> > reference it from every 'test()', unless meson has built-in support
> > for globally applied env vars that I'm missing.
>
> It can be added to add_test_setup().

Thanks -- I just sent a patch to do it that way:

https://patchew.org/QEMU/20250310102950.3752908-1-peter.maydell@linaro.org/

-- PMM
Re: [PATCH] gitlab-ci: include full Rust backtraces in test runs
Posted by Peter Maydell 3 weeks, 4 days ago
On Mon, 10 Mar 2025 at 09:25, Daniel P. Berrangé <berrange@redhat.com> wrote:
>
> On Mon, Mar 10, 2025 at 09:21:37AM +0000, Peter Maydell wrote:
> > On Wed, 29 Jan 2025 at 08:21, Paolo Bonzini <pbonzini@redhat.com> wrote:
> > >
> > > Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
> > > ---
> > >  .gitlab-ci.d/buildtest-template.yml | 1 +
> > >  1 file changed, 1 insertion(+)
> > >
> > > diff --git a/.gitlab-ci.d/buildtest-template.yml b/.gitlab-ci.d/buildtest-template.yml
> > > index 39da7698b09..4cc19239319 100644
> > > --- a/.gitlab-ci.d/buildtest-template.yml
> > > +++ b/.gitlab-ci.d/buildtest-template.yml
> > > @@ -63,6 +63,7 @@
> > >    stage: test
> > >    image: $CI_REGISTRY_IMAGE/qemu/$IMAGE:$QEMU_CI_CONTAINER_TAG
> > >    script:
> > > +    - export RUST_BACKTRACE=1
> > >      - source scripts/ci/gitlab-ci-section
> > >      - section_start buildenv "Setting up to run tests"
> > >      - scripts/git-submodule.sh update roms/SLOF
> > > --
> >
> > This will only add the rust backtraces when the tests
> > are run from the CI logs, not when you locally run
> > "make check" or similar. There's probably a better place
> > to put this...
>
> Meson's  'test()' command accepts env variables, but it'll be somewhat
> tedious to add the same env to all case where we use test. Might want
> to define a common 'testenv' set at the top level meson.build and then
> reference it from every 'test()', unless meson has built-in support
> for globally applied env vars that I'm missing.

Or we could set it in tests/Makefile.include :-)

-- PMM
Re: [PATCH] gitlab-ci: include full Rust backtraces in test runs
Posted by Philippe Mathieu-Daudé 2 months ago
On 29/1/25 09:20, Paolo Bonzini wrote:

Stefan Hajnoczi <stefanha@redhat.com>
Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>

> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
> ---
>   .gitlab-ci.d/buildtest-template.yml | 1 +
>   1 file changed, 1 insertion(+)
> 
> diff --git a/.gitlab-ci.d/buildtest-template.yml b/.gitlab-ci.d/buildtest-template.yml
> index 39da7698b09..4cc19239319 100644
> --- a/.gitlab-ci.d/buildtest-template.yml
> +++ b/.gitlab-ci.d/buildtest-template.yml
> @@ -63,6 +63,7 @@
>     stage: test
>     image: $CI_REGISTRY_IMAGE/qemu/$IMAGE:$QEMU_CI_CONTAINER_TAG
>     script:
> +    - export RUST_BACKTRACE=1
>       - source scripts/ci/gitlab-ci-section
>       - section_start buildenv "Setting up to run tests"
>       - scripts/git-submodule.sh update roms/SLOF


Re: [PATCH] gitlab-ci: include full Rust backtraces in test runs
Posted by Thomas Huth 2 months ago
On 29/01/2025 09.20, Paolo Bonzini wrote:
> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
> ---
>   .gitlab-ci.d/buildtest-template.yml | 1 +
>   1 file changed, 1 insertion(+)
> 
> diff --git a/.gitlab-ci.d/buildtest-template.yml b/.gitlab-ci.d/buildtest-template.yml
> index 39da7698b09..4cc19239319 100644
> --- a/.gitlab-ci.d/buildtest-template.yml
> +++ b/.gitlab-ci.d/buildtest-template.yml
> @@ -63,6 +63,7 @@
>     stage: test
>     image: $CI_REGISTRY_IMAGE/qemu/$IMAGE:$QEMU_CI_CONTAINER_TAG
>     script:
> +    - export RUST_BACKTRACE=1
>       - source scripts/ci/gitlab-ci-section
>       - section_start buildenv "Setting up to run tests"
>       - scripts/git-submodule.sh update roms/SLOF

Reviewed-by: Thomas Huth <thuth@redhat.com>