From patchwork Wed Feb 8 00:18:19 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Arne Schwabe X-Patchwork-Id: 3062 Return-Path: Delivered-To: patchwork@openvpn.net Received: by 2002:a05:7300:c95:b0:82:e4b3:40a0 with SMTP id p21csp4396746dyk; Tue, 7 Feb 2023 16:19:23 -0800 (PST) X-Google-Smtp-Source: AK7set/4Lbv6FhyWY/CGLwl5EZ+HB+B9f8XpMNuhG7P5Q9kIMWYtbNkfU7xte6TTMLWw6lGZb8rQ X-Received: by 2002:a17:90a:4f:b0:22c:5703:3d9f with SMTP id 15-20020a17090a004f00b0022c57033d9fmr6029762pjb.38.1675815562801; Tue, 07 Feb 2023 16:19:22 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1675815562; cv=none; d=google.com; s=arc-20160816; b=mY7/4M8awEpoyhEmD53lzfA2NUrokP40OsZJmlswqC5PTTmNEM5eDkidvTh3rZ4xlT D1B6cYyEYDPlmzyc5ZIn9rq+5b2tsV6kogFuQh9C7YbVfdxB5SVW2knfM5VjZBgeBn7T w/lqsjn5UIKNuzVI54l3T75mVwCKwT1vvQIQr2ijYsjPCUzACxRcwvxcIWFGW0zHxHRF HcaMFcokUhfNy4MdW1O21hwhqwtYD3BNoX+DuGHuRKW4H9lzDawcUbh6tEiXU1CQfEIa efboaKS3isd1Yy/mGM6diFIQ9/D2es5PjtvAOSfdiBoyW1mfH2fZcumWQjpQXdv2xepd +FNQ== 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=fYbht9A+QoRV5wuqNhLamXBda3t5wrQSALw+6iHpi9c=; b=MrrcElM4l15mmzv/EZiaOEmtZLgz3VqdAc+OIzyAR+X89iRQG/DkAGAxNCngzpH6kd hFKrVsDSmdEctvLVdx4mx0YjjnS1kWf/JnHN8N3CgzS5keuknzEkrvAjIFB3a67H/oSq PPvx1Da1FX8xE5IPrfU+awtqelvr1sDRtKxrrP7xE92lcLK/Uqcbw3IwkNRvHPtW5xiW T/GOkVj5er4XGU/9OLypN+a5qZAwHyyct11YdUz9EYD++Ez2JCSqfGcmqEMwQ0TYR2MH ++bNs1e1tSSGuSqFPrnA+GvNhzSZdugeAodJUs1EfslWG4y/6gBAbx68cMrWNEnxcDQr iDTg== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@sourceforge.net header.s=x header.b=LqMKN3Dq; dkim=neutral (body hash did not verify) header.i=@sf.net header.s=x header.b=imNdGxtU; 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 nv15-20020a17090b1b4f00b00226c700afe3si521306pjb.37.2023.02.07.16.19.22 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Tue, 07 Feb 2023 16:19:22 -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=LqMKN3Dq; dkim=neutral (body hash did not verify) header.i=@sf.net header.s=x header.b=imNdGxtU; 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 1pPYAY-0006YS-Ul; Wed, 08 Feb 2023 00:18:38 +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 1pPYAX-0006YK-5C for openvpn-devel@lists.sourceforge.net; Wed, 08 Feb 2023 00:18:36 +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=7bMF5FvB3/zUgXrxT73jgUqxifByJPLh1SS5ZCSmLY0=; b=LqMKN3DqM6PG0DwzNj7kzo1jLP AD/BjLf3XnqTOiI/vQR6Exf6JDKlXbrL+2FytKVLSImV5FMmYPnSuXnO2XpAPZQs3U6oK9I3wCBJf TTl/gv5RXbqRVn/N8rvYpJul6+EEaqYEW7WM4o4f5MVhsdo8KnFGojTAdMNP80mXGMFA=; 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=7bMF5FvB3/zUgXrxT73jgUqxifByJPLh1SS5ZCSmLY0=; b=imNdGxtUG1NSCPgDMVc8bX+J2r rVQTvdZEhNmHhGj1969Bfrnk5qJ/Gcv87GeutShTH23XxEwAo7IbH9BEkcD4APe2QMXOW33Nnegbf B95UvBxZYPGC6VxgeiOR5maFd8rWMJvdnEl7fublCTPv/dbP0A1Ac9mbXOuFQE42AFEU=; 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 1pPYAU-0001F6-Fr for openvpn-devel@lists.sourceforge.net; Wed, 08 Feb 2023 00:18:36 +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 1pPYAG-000FIm-15 for openvpn-devel@lists.sourceforge.net; Wed, 08 Feb 2023 01:18:20 +0100 Received: (nullmailer pid 244754 invoked by uid 10006); Wed, 08 Feb 2023 00:18:19 -0000 From: Arne Schwabe To: openvpn-devel@lists.sourceforge.net Date: Wed, 8 Feb 2023 01:18:19 +0100 Message-Id: <20230208001819.244694-6-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-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: Signed-off-by: Arne Schwabe --- .github/workflows/build.yaml | 110 ++++++++++++++++++++++++++++++++++- 1 file changed, 108 insertions(+), 2 deletions(-) diff --git a/.github/workflows/build.yaml b/.github/workflows/build.yaml index 132624547..c71bd2c4d 100644 --- a/.github/workflows/build.yaml +++ b/.github/workflows/build.yaml @@ -55,9 +55,10 @@ jobs [...] 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: 1pPYAU-0001F6-Fr Subject: [Openvpn-devel] [PATCH 5/5] Add building and running mingw unittests 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?1757219979738235827?= X-GMAIL-MSGID: =?utf-8?q?1757219979738235827?= Signed-off-by: Arne Schwabe --- .github/workflows/build.yaml | 110 ++++++++++++++++++++++++++++++++++- 1 file changed, 108 insertions(+), 2 deletions(-) diff --git a/.github/workflows/build.yaml b/.github/workflows/build.yaml index 132624547..c71bd2c4d 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_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,89 @@ 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 ddls on the same level as the binaries + - name: Archive cmocka/openssl/lzo ddls + uses: actions/upload-artifact@v3 + with: + retention-days: 1 + name: mingw-unittest-${{matrix.target}}-ossl${{ matrix.osslver }}-dlls + path: '~/mingw/opt/bin/*.dll' + + - name: Archive gcc dlls + uses: actions/upload-artifact@v3 + with: + retention-days: 1 + name: mingw-unittest-${{matrix.target}}-ossl${{ matrix.osslver }}-dlls + path: /usr/lib/gcc/${{ matrix.chost }}/10-win32/*.dll + + - name: Archive mingw dlls + uses: actions/upload-artifact@v3 + with: + retention-days: 1 + name: mingw-unittest-${{matrix.target}}-ossl${{ matrix.osslver }}-dlls + path: /usr/${{ matrix.chost }}/lib/*.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 unit tests + run: | + ./unittests/argv_testdriver.exe + ./unittests/auth_token_testdriver.exe + ./unittests/buffer_testdriver.exe + ./unittests/crypto_testdriver.exe + ./unittests/misc_testdriver.exe + ./unittests/ncp_testdriver.exe + ./unittests/packet_id_testdriver.exe + ./unittests/pkt_testdriver.exe + ./unittests/provider_testdriver.exe ubuntu: strategy: @@ -442,3 +547,4 @@ jobs: run: make -j3 - name: make check run: make check +