CC: list was missed..

---------- Forwarded message ---------
From: Selva Nair <selva.n...@gmail.com>
Date: Thu, Feb 9, 2023 at 2:54 PM
Subject: Re: [Openvpn-devel] [PATCH v2 5/5] Add building unit tests with
mingw to github actions
To: Arne Schwabe <a...@rfc2549.org>


Hi,

Thanks, this is much better with tests grouped together.

Some nitpicks below that could be fixed while merging.

On Thu, Feb 9, 2023 at 11:38 AM Arne Schwabe <a...@rfc2549.org> wrote:

> This runs each test in its own action since order of stderr and stdout
> is seemingly random in github action Windows output and this way at least
> tests outputs are groups gy test
>

"test outputs are grouped by"


>
> Patch v2: use -static-libgcc to avoid comping gcc runtime libraries.
>
> Signed-off-by: Arne Schwabe <a...@rfc2549.org>
> ---
>  .github/workflows/build.yaml | 111 ++++++++++++++++++++++++++++++++++-
>  1 file changed, 109 insertions(+), 2 deletions(-)
>
> diff --git a/.github/workflows/build.yaml b/.github/workflows/build.yaml
> index 5888e91e5..a1026fddb 100644
> --- a/.github/workflows/build.yaml
> +++ b/.github/workflows/build.yaml
> @@ -55,9 +55,10 @@ jobs:
>        PKCS11_HELPER_VERSION: "1.29.0"
>        OPENSSL_VERSION: "${{ matrix.osslver }}"
>        TAP_WINDOWS_VERSION: "9.23.3"
> +      CMOCKA_VERSION: "1.1.5"
>      steps:
>        - name: Install dependencies
> -        run: sudo apt update && sudo apt install -y mingw-w64 libtool
> automake autoconf man2html unzip
> +        run: sudo apt update && sudo apt install -y mingw-w64 libtool
> automake autoconf man2html unzip cmake ninja-build build-essential wget
>        - name: Checkout OpenVPN
>          uses: actions/checkout@v3
>          with:
> @@ -72,7 +73,7 @@ jobs:
>          uses: actions/cache@v3
>          with:
>            path: '~/mingw/'
> -          key: ${{ matrix.target }}-mingw-${{ matrix.osslver }}-${{
> env.LZO_VERSION }}-${{ env.PKCS11_HELPER_VERSION }}-${{
> env.TAP_WINDOWS_VERSION }}
> +          key: ${{ matrix.target }}-mingw-${{ matrix.osslver }}-${{
> env.LZO_VERSION }}-${{ env.PKCS11_HELPER_VERSION }}-${{
> env.TAP_WINDOWS_VERSION }}--${{ env.CMOCKA_VERSION }}
>
>        # Repeating  if: steps.cache.outputs.cache-hit != 'true'
>        # on every step for building dependencies is ugly but
> @@ -84,12 +85,33 @@ jobs:
>            wget -c -P download-cache/ "
> https://build.openvpn.net/downloads/releases/tap-windows-${TAP_WINDOWS_VERSION}.zip
> "
>            wget -c -P download-cache/ "
> https://www.oberhumer.com/opensource/lzo/download/lzo-${LZO_VERSION}.tar.gz
> "
>            wget -c -P download-cache/ "
> https://github.com/OpenSC/pkcs11-helper/releases/download/pkcs11-helper-${PKCS11_HELPER_VERSION}/pkcs11-helper-${PKCS11_HELPER_VERSION}.tar.bz2
> "
> +          wget -c -P download-cache/ "
> https://github.com/coreboot/cmocka/archive/refs/tags/cmocka-${CMOCKA_VERSION}.tar.gz
> "
>            tar jxf
> "download-cache/pkcs11-helper-${PKCS11_HELPER_VERSION}.tar.bz2"
>            wget -c -P download-cache/ "
> https://www.openssl.org/source/old/1.1.1/openssl-${OPENSSL_VERSION}.tar.gz";
> || wget -c -P download-cache/ "
> https://www.openssl.org/source/openssl-${OPENSSL_VERSION}.tar.gz";
>            tar zxf "download-cache/openssl-${OPENSSL_VERSION}.tar.gz"
>            tar zxf "download-cache/lzo-${LZO_VERSION}.tar.gz"
> +          tar zxf "download-cache/cmocka-${CMOCKA_VERSION}.tar.gz"
>            unzip download-cache/tap-windows-${TAP_WINDOWS_VERSION}.zip
>
> +      - name: create cmocka build directory
> +        if: steps.cache.outputs.cache-hit != 'true'
> +        run: mkdir cmocka-build
> +
> +      - name: configure cmocka
> +        if: steps.cache.outputs.cache-hit != 'true'
> +        working-directory: "./cmocka-build"
> +        run: cmake -GNinja -DCMAKE_C_COMPILER=${{ matrix.chost }}-gcc
> -DCMAKE_CXX_COMPILER=${{ matrix.chost }}-g++ -DCMAKE_SYSTEM_NAME=Windows
> -DCMAKE_SHARED_LINKER_FLAGS=-static-libgcc
> -DCMAKE_PREFIX_PATH=${HOME}/mingw/opt/lib/pkgconfig/
> -DCMAKE_INCLUDE_PATH=${HOME}/mingw/opt/lib/include
> -DCMAKE_LIBRARY_PATH=${HOME}/mingw/opt/lib
> -DCMAKE_INSTALL_PREFIX=${HOME}/mingw/opt/ ../cmocka-cmocka-${{
> env.CMOCKA_VERSION }}
> +
> +      - name: build cmocka
> +        if: steps.cache.outputs.cache-hit != 'true'
> +        working-directory: "./cmocka-build"
> +        run: ninja
> +
> +      - name: install cmocka
> +        if: steps.cache.outputs.cache-hit != 'true'
> +        working-directory: "./cmocka-build"
> +        run: ninja install
> +
>        - name: Configure OpenSSL
>          if: steps.cache.outputs.cache-hit != 'true'
>          run: ./Configure --cross-compile-prefix=${{ matrix.chost }}-
> shared ${{ matrix.target }} no-capieng --prefix="${HOME}/mingw/opt"
> --openssldir="${HOME}/mingw/opt" -static-libgcc
> @@ -154,6 +176,90 @@ jobs:
>        - name: build OpenVPN
>          run: make -j3
>          working-directory: openvpn
> +      - name: build OpenVPN unittests
> +        run: make -j3 check
> +        working-directory: openvpn
> +
> +      # We use multiple upload-artifact here, so it becomes a flat folder
> +      # structure since we need the dlls on the same level as the binaries
> +      - name: Archive cmocka/openssl/lzo dlls
> +        uses: actions/upload-artifact@v3
> +        with:
> +          retention-days: 1
> +          name: mingw-unittest-${{matrix.target}}-ossl${{ matrix.osslver
> }}-dlls
> +          path: '~/mingw/opt/bin/*.dll'
> +
> +      # libtool puts some wrapper binaries in
> openvpn/tests/unit_tests/openvpn/
> +      # and the real binaries in openvpn/tests/unit_tests/openvpn/.libs/
> +      - name: Archive unittest artifacts
> +        uses: actions/upload-artifact@v3
> +        with:
> +          retention-days: 1
> +          name: mingw-unittest-${{matrix.target}}-ossl${{ matrix.osslver
> }}-tests
> +          path: openvpn/tests/unit_tests/openvpn/.libs/*.exe
> +
> +      # Currently not used by the unit test but might in the future and
> also
> +      # helpful if manually downloading and running openvpn.exe from a
> mingw
> +      # build
> +      - name: Archive openvpn binary
> +        uses: actions/upload-artifact@v3
> +        with:
> +          retention-days: 1
> +          name: mingw-unittest-${{matrix.target}}-ossl${{ matrix.osslver
> }}-tests
> +          path: openvpn/src/openvpn/.libs/*.exe
> +
> +  mingw-unittest:
> +    needs: [ mingw ]
> +    strategy:
> +      fail-fast: false
> +      matrix:
> +        osslver: [ 1.1.1q, 3.0.5 ]
> +        target: [ mingw64, mingw ]
> +
> +    runs-on: windows-latest
> +    name: "mingw unittests - ${{matrix.target}} - OSSL ${{ matrix.osslver
> }}"
> +    steps:
> +      - name: Retrieve mingw unittest dlls
> +        uses: actions/download-artifact@v3
> +        with:
> +          name: mingw-unittest-${{matrix.target}}-ossl${{ matrix.osslver
> }}-dlls
> +          path: unittests
> +
> +      - name: Retrieve mingw unittest
> +        uses: actions/download-artifact@v3
> +        with:
> +          name: mingw-unittest-${{matrix.target}}-ossl${{ matrix.osslver
> }}-tests
> +          path: unittests
> +
> +      - name: List unittests directory
> +        run: "dir unittests"
> +
> +      - name: Run argvunit test
>

"argvunit test" --> "argv unit test" etc. here and below ? This gets
printed as the action name in output.

+        run: ./unittests/argv_testdriver.exe
> +
> +      - name: Run auth_tokenunit test

+        run: ./unittests/auth_token_testdriver.exe
> +
> +      - name: Run bufferunit test
> +        run: ./unittests/buffer_testdriver.exe
> +
> +      - name: Run cryptounit test
> +        run: ./unittests/crypto_testdriver.exe
> +
> +      - name: Run miscunit test
> +        run: ./unittests/misc_testdriver.exe
> +
> +      - name: Run ncpunit test
> +        run: ./unittests/ncp_testdriver.exe
> +
> +      - name: Run packet idunit test
> +        run: ./unittests/packet_id_testdriver.exe
> +
> +      - name: Run pktunit test
> +        run: ./unittests/pkt_testdriver.exe
> +
> +      - name: Run providerunit test
> +        run: ./unittests/provider_testdriver.exe
>
>    ubuntu:
>      strategy:
> @@ -450,3 +556,4 @@ jobs:
>          run: make -j3
>        - name: make check
>          run: make check
> +


Acked-by: Selva Nair <selva.n...@gmail.com>
_______________________________________________
Openvpn-devel mailing list
Openvpn-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/openvpn-devel

Reply via email to