diff mbox series

[1/2] .gitlab-ci.d: Split build and test in cross build job templates

Message ID 20240918125449.3125571-2-peter.maydell@linaro.org
State New
Headers show
Series gitlab-ci: Make separate sections for build and test | expand

Commit Message

Peter Maydell Sept. 18, 2024, 12:54 p.m. UTC
In the native_build_job_template we have separate steps in the script
for the build and the test steps.  This is helpful because then
gitlab will give separate timestamps in the log view for each, and
you can see how long it took to compile vs how long to test.  In the
templates in crossbuild-template.yml, however, we do both the build
and test in a single 'make' invocation, and so we don't get the
separate timing information.

Split the build and test, in the same way we do in the native build
template.

This will also give us a place to separate out how parallel we want
to do the build by default from how parallel we want to do the tests
by default, which might be helpful in future.

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
---
Gitlab seems to be inconsistent about whether you get the
separate time-taken bubbles for each line of the script section
or not; but certainly if we don't split into separate 'make'
invocations we definitely can't get the timing info...
---
 .gitlab-ci.d/crossbuild-template.yml | 23 ++++++++++++++++++++---
 1 file changed, 20 insertions(+), 3 deletions(-)

Comments

Thomas Huth Sept. 19, 2024, 11:06 a.m. UTC | #1
On 18/09/2024 14.54, Peter Maydell wrote:
> In the native_build_job_template we have separate steps in the script
> for the build and the test steps.  This is helpful because then
> gitlab will give separate timestamps in the log view for each, and
> you can see how long it took to compile vs how long to test.  In the
> templates in crossbuild-template.yml, however, we do both the build
> and test in a single 'make' invocation, and so we don't get the
> separate timing information.
> 
> Split the build and test, in the same way we do in the native build
> template.
> 
> This will also give us a place to separate out how parallel we want
> to do the build by default from how parallel we want to do the tests
> by default, which might be helpful in future.
> 
> Signed-off-by: Peter Maydell <peter.maydell@linaro.org>

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

Patch

diff --git a/.gitlab-ci.d/crossbuild-template.yml b/.gitlab-ci.d/crossbuild-template.yml
index 2ce0432eb77..d1cb7a35dbf 100644
--- a/.gitlab-ci.d/crossbuild-template.yml
+++ b/.gitlab-ci.d/crossbuild-template.yml
@@ -9,6 +9,7 @@ 
     when: always
   timeout: 80m
   before_script:
+    - JOBS=$(expr $(nproc) + 1)
     - cat /packages.txt
   script:
     - export CCACHE_BASEDIR="$(pwd)"
@@ -24,7 +25,11 @@ 
           i386-softmmu microblaze-softmmu mips-softmmu mipsel-softmmu
           mips64-softmmu ppc-softmmu riscv32-softmmu sh4-softmmu
           sparc-softmmu xtensa-softmmu $CROSS_SKIP_TARGETS"
-    - make -j$(expr $(nproc) + 1) all check-build $MAKE_CHECK_ARGS
+    - make -j"$JOBS" all check-build
+    - if test -n "$MAKE_CHECK_ARGS";
+      then
+        $MAKE -j"$JOBS" $MAKE_CHECK_ARGS ;
+      fi
     - if grep -q "EXESUF=.exe" config-host.mak;
       then make installer;
       version="$(git describe --match v[0-9]* 2>/dev/null || git rev-parse --short HEAD)";
@@ -46,6 +51,8 @@ 
     paths:
       - ccache/
     key: "$CI_JOB_NAME"
+  before_script:
+    - JOBS=$(expr $(nproc) + 1)
   script:
     - export CCACHE_BASEDIR="$(pwd)"
     - export CCACHE_DIR="$CCACHE_BASEDIR/ccache"
@@ -55,7 +62,11 @@ 
     - cd build
     - ../configure --enable-werror --disable-docs $QEMU_CONFIGURE_OPTS
         --disable-tools --enable-${ACCEL:-kvm} $EXTRA_CONFIGURE_OPTS
-    - make -j$(expr $(nproc) + 1) all check-build $MAKE_CHECK_ARGS
+    - make -j"$JOBS" all check-build
+    - if test -n "$MAKE_CHECK_ARGS";
+      then
+        $MAKE -j"$JOBS" $MAKE_CHECK_ARGS ;
+      fi
 
 .cross_user_build_job:
   extends: .base_job_template
@@ -65,6 +76,8 @@ 
     paths:
       - ccache/
     key: "$CI_JOB_NAME"
+  before_script:
+    - JOBS=$(expr $(nproc) + 1)
   script:
     - export CCACHE_BASEDIR="$(pwd)"
     - export CCACHE_DIR="$CCACHE_BASEDIR/ccache"
@@ -76,7 +89,11 @@ 
           alpha-linux-user m68k-linux-user microblazeel-linux-user
           or1k-linux-user ppc-linux-user sparc-linux-user
           xtensa-linux-user $CROSS_SKIP_TARGETS"
-    - make -j$(expr $(nproc) + 1) all check-build $MAKE_CHECK_ARGS
+    - make -j"$JOBS" all check-build
+    - if test -n "$MAKE_CHECK_ARGS";
+      then
+        $MAKE -j"$JOBS" $MAKE_CHECK_ARGS ;
+      fi
 
 # We can still run some tests on some of our cross build jobs. They can add this
 # template to their extends to save the build logs and test results