From patchwork Fri Feb 10 14:27:12 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Arne Schwabe X-Patchwork-Id: 3074 Return-Path: Delivered-To: patchwork@openvpn.net Received: by 2002:a05:7300:c95:b0:82:e4b3:40a0 with SMTP id p21csp1312622dyk; Fri, 10 Feb 2023 06:27:50 -0800 (PST) X-Google-Smtp-Source: AK7set/Tyvjn2c6ACRyYdVFTX7fZ+RJl+m5nHMIH/nY90mXAwe7TLPLPtbQkdOHJ4mYKrY0/C5Zp X-Received: by 2002:a05:6a00:3497:b0:5a8:1866:7cfe with SMTP id cp23-20020a056a00349700b005a818667cfemr7843359pfb.17.1676039270275; Fri, 10 Feb 2023 06:27:50 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1676039270; cv=none; d=google.com; s=arc-20160816; b=mDV/FP7jQjf8xsaX188SEzD6h2heS3p0EwRKf+OES6aUjNLwUZMLQQwiPAKhhnUnXn /hYYQO9T4ibj0rqf1FW43SMRaNY44d/XgDCJmzcsUV2H5v3ls5csS1/6JZNHJyL1Rwoa 6X+Xv09SFYAIcjYPyRygPWkpOxKH//BK6mObn4wLEs05+nIEfYobDWSoV9WVhEFvm8QE Sa6djCDBCTFQNKovR+OmgSdpBYUHQli74brtTRS7E7JhgbvUfp4a9HSfVNmZ1UzjPIqe atibjoCSiXNZtH4KwlvZkYpEFd8tH8PnkcQV5b0v8ipOxaOOSRB3Vy1ZhMppDAPQujBX gJqA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=errors-to:content-transfer-encoding:list-subscribe:list-help :list-post:list-archive:list-unsubscribe:list-id:precedence:subject :mime-version:references:in-reply-to:message-id:date:to:from :dkim-signature:dkim-signature; bh=KWI2NFnYDf1EDmTyZWgI4fHQkk2gMO4HG492vm2eIqg=; b=CiS/CjugKnipPCivzUK4wY/rs0CQC7hmnqfHXfjeDYMUjKPxAhimBxYXDcIMK/rkyP tVeQdPkqd1L22wGFFij/Kv3e9bTIFM/t5+viVt/LPPQmiqWXzje3/9n3q9iEpjYiKPB/ QP6F8BBC+2qGwwExTv40jhUETzBuIZgquLVuN4a+18lfz03JgVF6LuMIAVhGoBXYp6M6 xVuBjNU4lUzARJcJJ8kcWvCn3GkGKaOeo9rSB2wYiDTPf4yt4emg70Mt1Qg4Crw7e/zd FlxzIyirxGoRl7ZvPQiBUuVUG0bKwHE4ZTxluTkLKvmnDNLzSYrElInCu3CH9HqFlmMQ Hs/g== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@sourceforge.net header.s=x header.b="JRFSTI/r"; dkim=neutral (body hash did not verify) header.i=@sf.net header.s=x header.b=jitEifML; spf=pass (google.com: domain of openvpn-devel-bounces@lists.sourceforge.net designates 216.105.38.7 as permitted sender) smtp.mailfrom=openvpn-devel-bounces@lists.sourceforge.net Received: from lists.sourceforge.net (lists.sourceforge.net. [216.105.38.7]) by mx.google.com with ESMTPS id b24-20020aa79518000000b005a862e1759fsi3769115pfp.329.2023.02.10.06.27.50 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Fri, 10 Feb 2023 06:27:50 -0800 (PST) Received-SPF: pass (google.com: domain of openvpn-devel-bounces@lists.sourceforge.net designates 216.105.38.7 as permitted sender) client-ip=216.105.38.7; Authentication-Results: mx.google.com; dkim=neutral (body hash did not verify) header.i=@sourceforge.net header.s=x header.b="JRFSTI/r"; dkim=neutral (body hash did not verify) header.i=@sf.net header.s=x header.b=jitEifML; spf=pass (google.com: domain of openvpn-devel-bounces@lists.sourceforge.net designates 216.105.38.7 as permitted sender) smtp.mailfrom=openvpn-devel-bounces@lists.sourceforge.net Received: from [127.0.0.1] (helo=sfs-ml-2.v29.lw.sourceforge.com) by sfs-ml-2.v29.lw.sourceforge.com with esmtp (Exim 4.95) (envelope-from ) id 1pQUNB-0002nR-2P; Fri, 10 Feb 2023 14:27:32 +0000 Received: from [172.30.20.202] (helo=mx.sourceforge.net) by sfs-ml-2.v29.lw.sourceforge.com with esmtps (TLS1.2) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.95) (envelope-from ) id 1pQUN7-0002ml-EH for openvpn-devel@lists.sourceforge.net; Fri, 10 Feb 2023 14:27:28 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=sourceforge.net; s=x; h=Content-Transfer-Encoding:MIME-Version:References: In-Reply-To:Message-Id:Date:Subject:To:From:Sender:Reply-To:Cc:Content-Type: Content-ID:Content-Description:Resent-Date:Resent-From:Resent-Sender: Resent-To:Resent-Cc:Resent-Message-ID:List-Id:List-Help:List-Unsubscribe: List-Subscribe:List-Post:List-Owner:List-Archive; bh=2Y02sQA3pTWW58uLK+QaIO508tMTdyzyRqqYiyPPljs=; b=JRFSTI/rTYYRmKVnzr84KM6VpM QNn47lVH/kAGZZ7Sdx8VFOSirsLukE08mvKuOpT3J8B/ui7AA6M1LRY9jyvanQZrfFtOkfsJuMU/I KXT4iNyrsS0X3hZbQXMA5dNj5Pdk/tILVzLQJILm1G4Ag5loInbcHM6P5+soU/s86FQA=; DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=sf.net; s=x ; h=Content-Transfer-Encoding:MIME-Version:References:In-Reply-To:Message-Id: Date:Subject:To:From:Sender:Reply-To:Cc:Content-Type:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:List-Id:List-Help:List-Unsubscribe:List-Subscribe: List-Post:List-Owner:List-Archive; bh=2Y02sQA3pTWW58uLK+QaIO508tMTdyzyRqqYiyPPljs=; b=jitEifMLhUT0XnIJa8A42q0HTu SqjhLY2lI6HbL4OJMa2JRJLftloOR91j/51IMOw3OIO1yxqqwvfz/JFnyuH4u9wDLZJXspsc76b4B 9u2Zvicitu5lL4MrpWcWjcw0pQp6FQTvT+cvTYUbzRC71KV2mDd9oE9pRZOQzuooGvZc=; Received: from mail.blinkt.de ([192.26.174.232]) by sfi-mx-1.v28.lw.sourceforge.com with esmtps (TLS1.2:ECDHE-RSA-AES256-GCM-SHA384:256) (Exim 4.95) id 1pQUN1-00HHnq-9P for openvpn-devel@lists.sourceforge.net; Fri, 10 Feb 2023 14:27:28 +0000 Received: from kamera.blinkt.de ([2001:638:502:390:20c:29ff:fec8:535c]) by mail.blinkt.de with smtp (Exim 4.95 (FreeBSD)) (envelope-from ) id 1pQUMq-00051k-9X for openvpn-devel@lists.sourceforge.net; Fri, 10 Feb 2023 15:27:12 +0100 Received: (nullmailer pid 572371 invoked by uid 10006); Fri, 10 Feb 2023 14:27:12 -0000 From: Arne Schwabe To: openvpn-devel@lists.sourceforge.net Date: Fri, 10 Feb 2023 15:27:12 +0100 Message-Id: <20230210142712.572303-9-arne@rfc2549.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230210142712.572303-1-arne@rfc2549.org> References: <20230210142712.572303-1-arne@rfc2549.org> MIME-Version: 1.0 X-Spam-Score: 0.3 (/) X-Spam-Report: Spam detection software, running on the system "util-spamd-1.v13.lw.sourceforge.com", has NOT identified this incoming email as spam. The original message has been attached to this so you can view it or label similar future email. If you have any questions, see the administrator of that system for details. Content preview: 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 Patch v2: use -static-libgcc to avoid comping gcc runtime libraries. Content analysis details: (0.3 points, 6.0 required) pts rule name description ---- ---------------------- -------------------------------------------------- 0.2 HEADER_FROM_DIFFERENT_DOMAINS From and EnvelopeFrom 2nd level mail domains are different 0.0 SPF_HELO_NONE SPF: HELO does not publish an SPF Record 0.0 SPF_NONE SPF: sender does not publish an SPF Record X-Headers-End: 1pQUN1-00HHnq-9P Subject: [Openvpn-devel] [PATCH v2 5/5] Add building unit tests with mingw to github actions X-BeenThere: openvpn-devel@lists.sourceforge.net X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: openvpn-devel-bounces@lists.sourceforge.net X-getmail-retrieved-from-mailbox: Inbox X-GMAIL-THRID: =?utf-8?q?1757454553676474591?= X-GMAIL-MSGID: =?utf-8?q?1757454553676474591?= 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 Patch v2: use -static-libgcc to avoid comping gcc runtime libraries. Signed-off-by: Arne Schwabe --- .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 + 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 +