From eb64940d363e4e9fb06a45d78427a5587694c2b4 Mon Sep 17 00:00:00 2001 From: Ilya Shipitsin Date: Sat, 5 Jan 2019 19:18:39 +0500 Subject: [PATCH] run openvpn tests within Azure Pipelines --- .ci/run-openvpn-tests.sh | 30 ++++++++++++++++++++++++++++++ .ci/start-se-openvpn.sh | 13 +++++++++++++ azure-pipelines.yml | 3 +++ 3 files changed, 46 insertions(+) create mode 100755 .ci/run-openvpn-tests.sh create mode 100755 .ci/start-se-openvpn.sh diff --git a/.ci/run-openvpn-tests.sh b/.ci/run-openvpn-tests.sh new file mode 100755 index 00000000..3ca67eb9 --- /dev/null +++ b/.ci/run-openvpn-tests.sh @@ -0,0 +1,30 @@ +#!/bin/bash + +set -eux + +cd +git clone https://github.com/openvpn/openvpn +cd openvpn +autoreconf -iv +./configure > build.log 2>&1 || (cat build.log && exit 1) +make > build.log 2>&1 || (cat build.log && exit 1) + +echo test > /tmp/auth.txt +echo test >> /tmp/auth.txt + +CONFIG=`ls /tmp/*l3*ovpn` + +cat << EOF > tests/t_client.rc +CA_CERT=fake +TEST_RUN_LIST="1 2" + +OPENVPN_BASE="--remote 127.0.0.1 --config $CONFIG --auth-user-pass /tmp/auth.txt" + +RUN_TITLE_1="testing udp/ipv4" +OPENVPN_CONF_1="--dev null --proto udp --port 1194 \$OPENVPN_BASE" + +RUN_TITLE_2="testing tcp/ipv4" +OPENVPN_CONF_2="--dev null --proto tcp --port 1194 \$OPENVPN_BASE" +EOF + +sudo make test_scripts=t_client.sh check diff --git a/.ci/start-se-openvpn.sh b/.ci/start-se-openvpn.sh new file mode 100755 index 00000000..afd32939 --- /dev/null +++ b/.ci/start-se-openvpn.sh @@ -0,0 +1,13 @@ +#!/bin/sh + +set -eux + +build/vpnserver start + +build/vpncmd 127.0.0.1:443 /SERVER /HUB:DEFAULT /CMD:SecureNatEnable +build/vpncmd 127.0.0.1:443 /SERVER /CMD:"OpenVpnEnable yes /PORTS:1194" +build/vpncmd 127.0.0.1:443 /SERVER /HUB:DEFAULT /CMD:"UserCreate test /GROUP:none /REALNAME:none /NOTE:none" +build/vpncmd 127.0.0.1:443 /SERVER /HUB:DEFAULT /CMD:"UserPasswordSet test /PASSWORD:test" +build/vpncmd 127.0.0.1:443 /SERVER /CMD:"OpenVpnMakeConfig ~/my_openvpn_config.zip" + +unzip -d /tmp ~/my_openvpn_config.zip diff --git a/azure-pipelines.yml b/azure-pipelines.yml index 9d91f304..17f3f860 100644 --- a/azure-pipelines.yml +++ b/azure-pipelines.yml @@ -13,4 +13,7 @@ steps: ./configure make package -C tmp -j $(nproc || sysctl -n hw.ncpu || echo 4) .ci/appveyor-deb-install-test.sh + sudo apt-get -y install autoconf libtool liblzo2-dev libpam-dev fping unzip # openvpn build deps + sudo .ci/start-se-openvpn.sh + .ci/run-openvpn-tests.sh displayName: 'Ubuntu 16.04'