DPDK patches and discussions
 help / color / mirror / Atom feed
* [PATCH] ci: combine static and shared linking build tests
@ 2022-10-17 14:07 David Marchand
  2022-10-20 11:44 ` David Marchand
  2022-10-20 15:34 ` Aaron Conole
  0 siblings, 2 replies; 5+ messages in thread
From: David Marchand @ 2022-10-17 14:07 UTC (permalink / raw)
  To: dev; +Cc: Aaron Conole, Michael Santana

Save some cpu time and disk by testing linking against static and shared
library in single environments.

The .ci/linux-build.sh is modified so it reconfigures an existing build
directory: an empty DEF_LIB= means that static and shared builds are
to be tested.

ABI checks, documentation generation and unit tests are disabled for
static builds as they would be redundant with the check against
dynamically linked binaries, if any.

Note:
- --cross-file is an option that can be passed to meson only when
  creating a build environment,
- for some other reason, --buildtype and other non -D options are only
  accepted when setting up a build directory with meson. When
  reconfiguring, only their -D$option forms are accepted,

Signed-off-by: David Marchand <david.marchand@redhat.com>
---
 .ci/linux-build.sh          | 25 ++++++++++++++++++-------
 .github/workflows/build.yml | 28 ----------------------------
 2 files changed, 18 insertions(+), 35 deletions(-)

diff --git a/.ci/linux-build.sh b/.ci/linux-build.sh
index 14148fef4a..baec65a914 100755
--- a/.ci/linux-build.sh
+++ b/.ci/linux-build.sh
@@ -1,5 +1,11 @@
 #!/bin/sh -xe
 
+if [ -z "${DEF_LIB:-}" ]; then
+    DEF_LIB=static ABI_CHECKS= BUILD_DOCS= RUN_TESTS= $0
+    DEF_LIB=shared $0
+    exit
+fi
+
 # Builds are run as root in containers, no need for sudo
 [ "$(id -u)" != '0' ] || alias sudo=
 
@@ -78,10 +84,6 @@ if [ "$RISCV64" = "true" ]; then
     cross_file=config/riscv/riscv64_linux_gcc
 fi
 
-if [ -n "$cross_file" ]; then
-    OPTS="$OPTS --cross-file $cross_file"
-fi
-
 if [ "$BUILD_DOCS" = "true" ]; then
     OPTS="$OPTS -Denable_docs=true"
 fi
@@ -101,8 +103,8 @@ else
 fi
 
 OPTS="$OPTS -Dplatform=generic"
-OPTS="$OPTS --default-library=$DEF_LIB"
-OPTS="$OPTS --buildtype=debugoptimized"
+OPTS="$OPTS -Ddefault_library=$DEF_LIB"
+OPTS="$OPTS -Dbuildtype=debugoptimized"
 OPTS="$OPTS -Dcheck_includes=true"
 if [ "$MINI" = "true" ]; then
     OPTS="$OPTS -Denable_drivers=net/null"
@@ -118,7 +120,16 @@ if [ "$ASAN" = "true" ]; then
     fi
 fi
 
-meson build --werror $OPTS
+OPTS="$OPTS -Dwerror=true"
+
+if [ -d build ]; then
+    meson configure build $OPTS
+else
+    if [ -n "$cross_file" ]; then
+        OPTS="$OPTS --cross-file $cross_file"
+    fi
+    meson setup build $OPTS
+fi
 ninja -C build
 
 if [ -z "$cross_file" ]; then
diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml
index b32758ff6f..82d83f4030 100644
--- a/.github/workflows/build.yml
+++ b/.github/workflows/build.yml
@@ -35,21 +35,12 @@ jobs:
         config:
           - os: ubuntu-20.04
             compiler: gcc
-            library: static
-          - os: ubuntu-20.04
-            compiler: gcc
-            library: shared
             mini: mini
           - os: ubuntu-20.04
             compiler: gcc
-            library: shared
             checks: doc+tests
           - os: ubuntu-20.04
             compiler: clang
-            library: static
-          - os: ubuntu-20.04
-            compiler: clang
-            library: shared
             checks: asan+doc+tests
           - os: ubuntu-20.04
             compiler: gcc
@@ -61,23 +52,12 @@ jobs:
             cross: mingw
           - os: ubuntu-20.04
             compiler: gcc
-            library: static
-            cross: aarch64
-          - os: ubuntu-20.04
-            compiler: gcc
-            library: shared
             cross: aarch64
           - os: ubuntu-20.04
             compiler: gcc
-            library: static
             cross: ppc64le
           - os: ubuntu-20.04
             compiler: gcc
-            library: shared
-            cross: ppc64le
-          - os: ubuntu-20.04
-            compiler: gcc
-            library: shared
             cross: riscv64
 
     steps:
@@ -218,16 +198,8 @@ jobs:
         config:
           - image: fedora:35
             compiler: gcc
-            library: static
-          - image: fedora:35
-            compiler: gcc
-            library: shared
-          - image: fedora:35
-            compiler: clang
-            library: static
           - image: fedora:35
             compiler: clang
-            library: shared
 
     steps:
     - name: Checkout sources
-- 
2.37.3


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

* Re: [PATCH] ci: combine static and shared linking build tests
  2022-10-17 14:07 [PATCH] ci: combine static and shared linking build tests David Marchand
@ 2022-10-20 11:44 ` David Marchand
  2022-10-20 11:51   ` Bruce Richardson
  2022-10-20 15:34 ` Aaron Conole
  1 sibling, 1 reply; 5+ messages in thread
From: David Marchand @ 2022-10-20 11:44 UTC (permalink / raw)
  To: dev; +Cc: Aaron Conole, Michael Santana

On Mon, Oct 17, 2022 at 4:08 PM David Marchand
<david.marchand@redhat.com> wrote:
>
> Save some cpu time and disk by testing linking against static and shared
> library in single environments.

Some additional info.

Before, 2h27 of cpu:
https://github.com/ovsrobot/dpdk/actions/runs/3265097067/usage

After, 2h07 of cpu:
https://github.com/ovsrobot/dpdk/actions/runs/3265960025/usage

The gain in cpu time (and global duration of the tests) is smaller
than what I saw.
Quite likely, it is dependent on what is being done on the runners.


>
> The .ci/linux-build.sh is modified so it reconfigures an existing build
> directory: an empty DEF_LIB= means that static and shared builds are
> to be tested.
>
> ABI checks, documentation generation and unit tests are disabled for
> static builds as they would be redundant with the check against
> dynamically linked binaries, if any.
>
> Note:
> - --cross-file is an option that can be passed to meson only when
>   creating a build environment,
> - for some other reason, --buildtype and other non -D options are only
>   accepted when setting up a build directory with meson. When
>   reconfiguring, only their -D$option forms are accepted,
>
> Signed-off-by: David Marchand <david.marchand@redhat.com>

-- 
David Marchand


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

* Re: [PATCH] ci: combine static and shared linking build tests
  2022-10-20 11:44 ` David Marchand
@ 2022-10-20 11:51   ` Bruce Richardson
  0 siblings, 0 replies; 5+ messages in thread
From: Bruce Richardson @ 2022-10-20 11:51 UTC (permalink / raw)
  To: David Marchand; +Cc: dev, Aaron Conole, Michael Santana

On Thu, Oct 20, 2022 at 01:44:33PM +0200, David Marchand wrote:
> On Mon, Oct 17, 2022 at 4:08 PM David Marchand
> <david.marchand@redhat.com> wrote:
> >
> > Save some cpu time and disk by testing linking against static and shared
> > library in single environments.
> 
> Some additional info.
> 
> Before, 2h27 of cpu:
> https://github.com/ovsrobot/dpdk/actions/runs/3265097067/usage
> 
> After, 2h07 of cpu:
> https://github.com/ovsrobot/dpdk/actions/runs/3265960025/usage
> 
> The gain in cpu time (and global duration of the tests) is smaller
> than what I saw.
> Quite likely, it is dependent on what is being done on the runners.
> 
Still probably a change worth making.
Acked-by: Bruce Richardson <bruce.richardson@intel.com>

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

* Re: [PATCH] ci: combine static and shared linking build tests
  2022-10-17 14:07 [PATCH] ci: combine static and shared linking build tests David Marchand
  2022-10-20 11:44 ` David Marchand
@ 2022-10-20 15:34 ` Aaron Conole
  2022-10-27 11:21   ` David Marchand
  1 sibling, 1 reply; 5+ messages in thread
From: Aaron Conole @ 2022-10-20 15:34 UTC (permalink / raw)
  To: David Marchand; +Cc: dev, Michael Santana

David Marchand <david.marchand@redhat.com> writes:

> Save some cpu time and disk by testing linking against static and shared
> library in single environments.
>
> The .ci/linux-build.sh is modified so it reconfigures an existing build
> directory: an empty DEF_LIB= means that static and shared builds are
> to be tested.
>
> ABI checks, documentation generation and unit tests are disabled for
> static builds as they would be redundant with the check against
> dynamically linked binaries, if any.
>
> Note:
> - --cross-file is an option that can be passed to meson only when
>   creating a build environment,
> - for some other reason, --buildtype and other non -D options are only
>   accepted when setting up a build directory with meson. When
>   reconfiguring, only their -D$option forms are accepted,
>
> Signed-off-by: David Marchand <david.marchand@redhat.com>
> ---

Probably also saves overall time because we would need fewer runners.  I
think this is a good change.

Acked-by: Aaron Conole <aconole@redhat.com>


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

* Re: [PATCH] ci: combine static and shared linking build tests
  2022-10-20 15:34 ` Aaron Conole
@ 2022-10-27 11:21   ` David Marchand
  0 siblings, 0 replies; 5+ messages in thread
From: David Marchand @ 2022-10-27 11:21 UTC (permalink / raw)
  To: David Marchand; +Cc: dev, Bruce Richardson, Aaron Conole, Michael Santana

On Thu, Oct 20, 2022 at 5:34 PM Aaron Conole <aconole@redhat.com> wrote:
> > Save some cpu time and disk by testing linking against static and shared
> > library in single environments.
> >
> > The .ci/linux-build.sh is modified so it reconfigures an existing build
> > directory: an empty DEF_LIB= means that static and shared builds are
> > to be tested.
> >
> > ABI checks, documentation generation and unit tests are disabled for
> > static builds as they would be redundant with the check against
> > dynamically linked binaries, if any.
> >
> > Note:
> > - --cross-file is an option that can be passed to meson only when
> >   creating a build environment,
> > - for some other reason, --buildtype and other non -D options are only
> >   accepted when setting up a build directory with meson. When
> >   reconfiguring, only their -D$option forms are accepted,
> >
> > Signed-off-by: David Marchand <david.marchand@redhat.com>
> Acked-by: Bruce Richardson <bruce.richardson@intel.com>
> Acked-by: Aaron Conole <aconole@redhat.com>

Applied, thanks.


-- 
David Marchand


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

end of thread, other threads:[~2022-10-27 11:21 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-10-17 14:07 [PATCH] ci: combine static and shared linking build tests David Marchand
2022-10-20 11:44 ` David Marchand
2022-10-20 11:51   ` Bruce Richardson
2022-10-20 15:34 ` Aaron Conole
2022-10-27 11:21   ` David Marchand

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).