From patchwork Thu Feb 9 16:37:05 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Arne Schwabe X-Patchwork-Id: 3068 Return-Path: Delivered-To: patchwork@openvpn.net Received: by 2002:a05:7300:c95:b0:82:e4b3:40a0 with SMTP id p21csp587353dyk; Thu, 9 Feb 2023 08:37:42 -0800 (PST) X-Google-Smtp-Source: AK7set8PYaoB5E0Jy5zC4z/ZzAftR6osVgTELnsguOi/DnH0O4PnbuGk2EaXbrHHHgKnnzAX/ARr X-Received: by 2002:a17:903:2344:b0:196:5d8d:2d6f with SMTP id c4-20020a170903234400b001965d8d2d6fmr13227155plh.13.1675960662669; Thu, 09 Feb 2023 08:37:42 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1675960662; cv=none; d=google.com; s=arc-20160816; b=oN0xUioWRi976CFyBLqyLwuIuhkHA3QtYfCv7zOqBiD15vYFDAGygQuM8v9fm8FvEl V5VT7KiS0wRb/R2BRJjo2oP2SDtqhGQV7RqvmwVXAnTTLR54+6FW35QZdtwT2J/yhoNq 2qgUIcKG0u+AXT4JlnWR2X6eDq8z6W0EIjI1In+eppeKncwIzXwzeVDnstFYjJ0LRSO4 HLguoiecnj38rDfpK8AfNd4joeLFqw6jwAioVjiwK60n3iHlEx8t6sGONKqiB32vsXXg FYswseW3Jpz2kzanKwnWX25Y0cq3WD15ueJxXMoaSyEq7V0t9rRzVv9M0YwQKY7ZUXJ+ zoWA== 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=GIQuC0rvdxphLrqXoAVB7DsfNPYbAG1V8dlBDmxJTdLBzLe155sycc/+1z5Ode1a/M 0YlNLzh56PsFXlO+ht10T1tsHtdBb5vWgbm+atvLDE6msYlXEsNJZU7fYhiBKOAEcBwC 3IST/7XZOWgA7pNbdEcrm2CJKO39CYFWZXsIkOL64qrtcniFgeKZ59cIW0t2VV8BJ8Qn bze2LFxIUTEY/rjTolUyAgC7wzvpfv1Zs25RLdYihCMhWlpXgMwtI1SOZBOhNf++9teI Ipsxx6IXOSYWpecXzsoVBToQKAuBd3hNA15URhaJSp+/TlralgyaAiu8nM5fSbVPnW/Y cxEQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@sourceforge.net header.s=x header.b=Za9UybSM; dkim=neutral (body hash did not verify) header.i=@sf.net header.s=x header.b=e3W+y2ko; 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 w4-20020a1709027b8400b001993a708a7csi1911837pll.227.2023.02.09.08.37.42 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Thu, 09 Feb 2023 08:37:42 -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=Za9UybSM; dkim=neutral (body hash did not verify) header.i=@sf.net header.s=x header.b=e3W+y2ko; 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-4.v29.lw.sourceforge.com) by sfs-ml-4.v29.lw.sourceforge.com with esmtp (Exim 4.95) (envelope-from ) id 1pQ9vC-0001Ar-H6; Thu, 09 Feb 2023 16:37:18 +0000 Received: from [172.30.20.202] (helo=mx.sourceforge.net) by sfs-ml-4.v29.lw.sourceforge.com with esmtps (TLS1.2) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.95) (envelope-from ) id 1pQ9v9-0001Ak-Tz for openvpn-devel@lists.sourceforge.net; Thu, 09 Feb 2023 16:37:16 +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=Za9UybSM6lS5kMFg7yMM4vTHmw XbWOyZwrYjOdv9Acg1sn/pHA59ozugeWC/2hzCnZ+jt8t4jGV9CxB/ethAt3KokEtHWqfPmtsbHCt mHsGHop4i7y3GUGedq86jE2JxcfRQ57tNnTfCjsfXLjF4M/6BEcMqsP+YpJqY6GHuNdg=; 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=e3W+y2kodaZIC3CBuxx4NUoxC8 W9PcTAasetR+655rzCG6YWgCHO2fGy1MyHZ0rtAg3pnZBV9SfOGmEBVBfGn1jCK6986CbhKy8MjXp BCtUrkrmyhhogYXp6k38vDkDG3OwZ/S8g8ClZA3j3QBKwAsUB+ZgYmF3NgDZq3Hl39/I=; Received: from mail.blinkt.de ([192.26.174.232]) by sfi-mx-2.v28.lw.sourceforge.com with esmtps (TLS1.2:ECDHE-RSA-AES256-GCM-SHA384:256) (Exim 4.95) id 1pQ9v5-0007Fy-FC for openvpn-devel@lists.sourceforge.net; Thu, 09 Feb 2023 16:37:14 +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 1pQ9uz-000OsN-OG for openvpn-devel@lists.sourceforge.net; Thu, 09 Feb 2023 17:37:05 +0100 Received: (nullmailer pid 466219 invoked by uid 10006); Thu, 09 Feb 2023 16:37:05 -0000 From: Arne Schwabe To: openvpn-devel@lists.sourceforge.net Date: Thu, 9 Feb 2023 17:37:05 +0100 Message-Id: <20230209163705.466173-1-arne@rfc2549.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230208001819.244694-1-arne@rfc2549.org> References: <20230208001819.244694-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-2.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.0 URIBL_BLOCKED ADMINISTRATOR NOTICE: The query to URIBL was blocked. See http://wiki.apache.org/spamassassin/DnsBlocklists#dnsbl-block for more information. [URIs: matrix.target] 0.0 SPF_NONE SPF: sender does not publish an SPF Record 0.0 SPF_HELO_NONE SPF: HELO does not publish an SPF Record 0.2 HEADER_FROM_DIFFERENT_DOMAINS From and EnvelopeFrom 2nd level mail domains are different X-Headers-End: 1pQ9v5-0007Fy-FC 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?1757372127706110997?= X-GMAIL-MSGID: =?utf-8?q?1757372127706110997?= 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 Acked-by: Selva Nair --- .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 +