diff --git a/.ci/setup-flags.sh b/.ci/setup-flags.sh new file mode 100755 index 00000000..9185c666 --- /dev/null +++ b/.ci/setup-flags.sh @@ -0,0 +1,56 @@ +#!/bin/bash + +# Produce flags to meson to force certain features. This ensures that the CI +# builds are actually testing all the optional features, and not failing to +# include them because the detection code is broken. + +flags=( + "--native-file=ci.ini" + "-Dwerror=true" + "-Dtools=enabled" + "-Dpcap=enabled" + "-Dpthread_setaffinity_np=enabled" + "-Dunit_test=enabled" +) + +if [ "$(uname)" = "Linux" ]; then + flags+=( + "-Dibv=enabled" + "-Dmlx5dv=enabled" + "-Dibv_hw_rate_limit=enabled" + "-Dpcap=enabled" + "-Dcap=enabled" + "-Drecvmmsg=enabled" + "-Dsendmmsg=enabled" + "-Dgso=enabled" + "-Dgro=enabled" + "-Dposix_semaphores=enabled" + "-Deventfd=enabled" + ) +fi + +case "$(arch)" in + x86_64) + flags+=( + "-Dsse2_stream=enabled" + "-Davx_stream=enabled" + "-Davx512_stream=enabled" + ) + ;; + aarch64 | arm64) + flags+=( + "-Dsve_stream=enabled" + ) + ;; +esac + +echo "Setting flags ${flags[*]}" 1>&2 + +if [ "$1" = "--python" ]; then + for arg in "${flags[@]}"; do + echo -n "--config-settings=setup-args=$arg " + done + echo +else + echo "${flags[*]}" +fi diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index ee0c4476..50e96681 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -39,10 +39,7 @@ jobs: - name: Install build requirements run: ./.ci/py-build-requirements.sh - name: Set up build directory - run: >- - meson setup build - --native-file=ci.ini - -Dwerror=true + run: meson setup build $(.ci/setup-flags.sh) - name: Build run: meson compile -C build - name: Run tests @@ -100,11 +97,7 @@ jobs: env: CC: ${{ matrix.cc }} # Do not pass -Werror when building dependencies - name: Install Python package - run: >- - pip install -v - --config-settings=setup-args=--native-file=ci.ini - --config-settings=setup-args=-Dwerror=true - . + run: pip install -v $(.ci/setup-flags.sh --python) . - name: Run tests run: pytest -v -ra # -ra summarises the reasons for skipping or failing tests - name: Run shutdown tests @@ -148,8 +141,7 @@ jobs: # the ephemeral build directory. So do a non-isolated editable # install instead. run: >- - pip install -v - --config-settings=setup-args=-Dwerror=true + pip install -v $(.ci/setup-flags.sh --python) --config-settings=setup-args=-Dbuildtype=debug --config-settings=setup-args=-Db_coverage=true --no-build-isolation @@ -158,10 +150,7 @@ jobs: run: pytest -v -ra && ./.ci/py-tests-shutdown.sh - name: Set up C++ build run: >- - meson setup build - -Dwerror=true - -Dcuda=disabled - -Dgdrapi=disabled + meson setup build $(.ci/setup-flags.sh) -Dbuildtype=debug -Db_coverage=true - name: Build C++