diff --git a/build.sh b/build.sh index 98a4b22..0ca527b 100644 --- a/build.sh +++ b/build.sh @@ -1,4 +1,4 @@ -#!/usr/bin/env bash +#!/bin/bash set -euo pipefail DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" diff --git a/package.cmd b/package.cmd index fb4e68a..5c4e4ad 100644 --- a/package.cmd +++ b/package.cmd @@ -6,10 +6,10 @@ if not errorlevel 0 ( SET _DOCKER_BUILD=false ) if "%_DOCKER_BUILD%" == "true" ( - msbuild /t:clean,restore,package /p:WindowsOnly=true - docker run --rm -v %cd%:/build microsoft/dotnet:2.1-sdk /build/package.sh + msbuild /t:clean,restore,package /p:WindowsOnly=true;Configuration=Release %* + docker run --rm -v %cd%:/build microsoft/dotnet:2.1-sdk /build/package.sh %* ) else ( - msbuild /t:clean,restore,package /p:WindowsOnly=false + msbuild /t:clean,restore,package /p:WindowsOnly=false;Configuration=Release %* ) diff --git a/package.sh b/package.sh index 02d5ed5..0b381ba 100644 --- a/package.sh +++ b/package.sh @@ -1,3 +1,4 @@ -#! /bin/sh -cd "$(dirname "$0")" -dotnet msbuild /t:clean,restore,package +#!/bin/bash +pushd "${0%/*}" > /dev/null +dotnet msbuild /t:clean,restore,package /p:Configuration=Release $@ +popd diff --git a/run.ps1 b/run.ps1 index 97e04a8..25eb3d3 100644 --- a/run.ps1 +++ b/run.ps1 @@ -1 +1 @@ -dotnet msbuild -t:Clean,Restore,Package \ No newline at end of file +msbuild -t:Clean,Restore,Package $args \ No newline at end of file diff --git a/run.sh b/run.sh index 8a89580..8f89b5a 100644 --- a/run.sh +++ b/run.sh @@ -1,7 +1,7 @@ -#!/usr/bin/env bash +#!/bin/bash set -euo pipefail dotnet restore -dotnet test -dotnet build -c Release \ No newline at end of file +dotnet test $@ +dotnet build -c Release $@ \ No newline at end of file diff --git a/src/azbridge-installer/azbridge.wxs b/src/azbridge-installer/azbridge.wxs index 9de78c1..97e38fe 100644 --- a/src/azbridge-installer/azbridge.wxs +++ b/src/azbridge-installer/azbridge.wxs @@ -1,427 +1,430 @@  - + - + - + - + - + - + + + + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + @@ -435,6 +438,7 @@ + diff --git a/src/azbridge/azbridge.csproj b/src/azbridge/azbridge.csproj index bbe881c..9aaa439 100644 --- a/src/azbridge/azbridge.csproj +++ b/src/azbridge/azbridge.csproj @@ -150,16 +150,16 @@ - + - + - + - + @@ -168,8 +168,9 @@ + - + diff --git a/test/docker/_scripts/imagetests.cmd b/test/docker/_scripts/imagetests.cmd index ab6713b..783804e 100644 --- a/test/docker/_scripts/imagetests.cmd +++ b/test/docker/_scripts/imagetests.cmd @@ -18,4 +18,4 @@ if "%_IMAGE_ID%"=="" call build.cmd FOR /F %%i IN ("%cd%\..") DO set _MOUNTPATH=%%~fi set _TESTNAME=test_nc_ping_pong call ../_scripts/runtest.cmd -exit /b %_RESULT% \ No newline at end of file +exit %_RESULT% \ No newline at end of file diff --git a/test/docker/_scripts/imagetests.sh b/test/docker/_scripts/imagetests.sh new file mode 100644 index 0000000..822841e --- /dev/null +++ b/test/docker/_scripts/imagetests.sh @@ -0,0 +1,19 @@ +_CXNSTRING=$RELAY_CXNSTRING +if [ -z $_CXNSTRING ] && [ -n ${@+x} ]; then + _CXNSTRING="$@" +fi + +if [ -z $_CXNSTRING ]; then + echo RELAY_CXNSTRING environment variable must be set to valid relay connection string + exit +fi + +_IMAGE_ID=`docker images $IMAGE_NAME -q` +if [ -z $_IMAGE_ID ]; then + source build.sh +fi + +_MOUNTPATH=$(dirname $(pwd)) +_TESTNAME=test_nc_ping_pong +source ../_scripts/runtest.sh +exit $_RESULT \ No newline at end of file diff --git a/test/docker/_scripts/removeimage.sh b/test/docker/_scripts/removeimage.sh new file mode 100644 index 0000000..0b20406 --- /dev/null +++ b/test/docker/_scripts/removeimage.sh @@ -0,0 +1,3 @@ +if [ ! -z `docker images "$IMAGE_NAME" -q` ]; then + docker rmi -f $IMAGE_NAME:latest +fi \ No newline at end of file diff --git a/test/docker/_scripts/runtest.sh b/test/docker/_scripts/runtest.sh new file mode 100644 index 0000000..8ce6b85 --- /dev/null +++ b/test/docker/_scripts/runtest.sh @@ -0,0 +1,14 @@ +echo Running $_TESTNAME +_OUTFILE=$(mktemp) +docker run -v $_MOUNTPATH:/tests -e RELAY_CXNSTRING="$_CXNSTRING" --rm $IMAGE_NAME:latest sh /tests/$_TESTNAME.sh > $_OUTFILE +diff $_MOUNTPATH/$_TESTNAME.reference.txt $_OUTFILE > /dev/null 2>&1 +_RESULT=$? +if [ $_RESULT -eq 0 ]; then + echo OK +else + cat $_OUTFILE + echo Error $_RESULT +fi + +rm $_OUTFILE +exit $_RESULT \ No newline at end of file diff --git a/test/docker/centos/Test.proj b/test/docker/centos/Test.proj index 6bffc40..a20c2fb 100644 --- a/test/docker/centos/Test.proj +++ b/test/docker/centos/Test.proj @@ -4,12 +4,15 @@ - + + - + + - + + \ No newline at end of file diff --git a/test/docker/centos/build.sh b/test/docker/centos/build.sh new file mode 100644 index 0000000..76fbccb --- /dev/null +++ b/test/docker/centos/build.sh @@ -0,0 +1,15 @@ +#!/bin/bash + +if [ -z ${BuildNumber+x} ]; then BuildNumber='0000'; fi +if [ -z ${VersionSuffix+x} ]; then VersionSuffix='preview'; fi +if [ -z ${VersionPrefix+x} ]; then VersionPrefix='1.0.0'; fi +if [ -z ${TargetFramework+x} ]; then TargetFramework='netcoreapp2.0'; fi + +pushd "${0%/*}" > /dev/null +if [ ! -d "tmp" ]; then mkdir tmp; fi +RpmFile=azbridge.$VersionPrefix-$VersionSuffix-$BuildNumber.centos-x64.rpm + +cp ../../../artifacts/build/$TargetFramework/$RpmFile tmp/ > /dev/null +docker build -f Dockerfile . --tag azbridge_centos_test --build-arg rpm_package=$RpmFile +rm -rf tmp +popd \ No newline at end of file diff --git a/test/docker/centos/clean.sh b/test/docker/centos/clean.sh new file mode 100644 index 0000000..41c3d6a --- /dev/null +++ b/test/docker/centos/clean.sh @@ -0,0 +1,4 @@ +#!/bin/bash + +IMAGE_NAME=azbridge_centos_test +source ../_scripts/removeimage.sh \ No newline at end of file diff --git a/test/docker/centos/test.sh b/test/docker/centos/test.sh new file mode 100644 index 0000000..4728f8f --- /dev/null +++ b/test/docker/centos/test.sh @@ -0,0 +1,6 @@ +#!/bin/bash +pushd "${0%/*}" > /dev/null +IMAGE_NAME=azbridge_centos_test +source ../_scripts/imagetests.sh +popd +exit $_RESULT diff --git a/test/docker/debian/Test.proj b/test/docker/debian/Test.proj index 6bffc40..a20c2fb 100644 --- a/test/docker/debian/Test.proj +++ b/test/docker/debian/Test.proj @@ -4,12 +4,15 @@ - + + - + + - + + \ No newline at end of file diff --git a/test/docker/debian/build.sh b/test/docker/debian/build.sh new file mode 100644 index 0000000..d5c35a3 --- /dev/null +++ b/test/docker/debian/build.sh @@ -0,0 +1,15 @@ +#!/bin/bash + +if [ -z ${BuildNumber+x} ]; then BuildNumber='0000'; fi +if [ -z ${VersionSuffix+x} ]; then VersionSuffix='preview'; fi +if [ -z ${VersionPrefix+x} ]; then VersionPrefix='1.0.0'; fi +if [ -z ${TargetFramework+x} ]; then TargetFramework='netcoreapp2.0'; fi + +pushd "${0%/*}" > /dev/null +if [ ! -d "tmp" ]; then mkdir tmp; fi +DebFile=azbridge.$VersionPrefix-$VersionSuffix-$BuildNumber.debian.8-x64.deb + +cp ../../../artifacts/build/$TargetFramework/$DebFile tmp/ > /dev/null +docker build -f Dockerfile . --tag azbridge_debian8_test --build-arg deb_package=$DebFile +rm -rf tmp +popd \ No newline at end of file diff --git a/test/docker/debian/clean.sh b/test/docker/debian/clean.sh new file mode 100644 index 0000000..79d1f6d --- /dev/null +++ b/test/docker/debian/clean.sh @@ -0,0 +1,4 @@ +#!/bin/bash + +IMAGE_NAME=azbridge_debian8_test +source ../_scripts/removeimage.sh \ No newline at end of file diff --git a/test/docker/debian/test.sh b/test/docker/debian/test.sh new file mode 100644 index 0000000..eda3fe8 --- /dev/null +++ b/test/docker/debian/test.sh @@ -0,0 +1,6 @@ +#!/bin/bash +pushd "${0%/*}" > /dev/null +IMAGE_NAME=azbridge_debian8_test +source ../_scripts/imagetests.sh +popd +exit $_RESULT diff --git a/test/docker/fedora/Test.proj b/test/docker/fedora/Test.proj index 6bffc40..a20c2fb 100644 --- a/test/docker/fedora/Test.proj +++ b/test/docker/fedora/Test.proj @@ -4,12 +4,15 @@ - + + - + + - + + \ No newline at end of file diff --git a/test/docker/fedora/build.sh b/test/docker/fedora/build.sh new file mode 100644 index 0000000..da2b25c --- /dev/null +++ b/test/docker/fedora/build.sh @@ -0,0 +1,15 @@ +#!/bin/bash + +if [ -z ${BuildNumber+x} ]; then BuildNumber='0000'; fi +if [ -z ${VersionSuffix+x} ]; then VersionSuffix='preview'; fi +if [ -z ${VersionPrefix+x} ]; then VersionPrefix='1.0.0'; fi +if [ -z ${TargetFramework+x} ]; then TargetFramework='netcoreapp2.0'; fi + +pushd "${0%/*}" > /dev/null +if [ ! -d "tmp" ]; then mkdir tmp; fi +RpmFile=azbridge.$VersionPrefix-$VersionSuffix-$BuildNumber.fedora-x64.rpm + +cp ../../../artifacts/build/$TargetFramework/$RpmFile tmp/ > /dev/null +docker build -f Dockerfile . --tag azbridge_fedora_test --build-arg rpm_package=$RpmFile +rm -rf tmp +popd \ No newline at end of file diff --git a/test/docker/fedora/clean.sh b/test/docker/fedora/clean.sh new file mode 100644 index 0000000..6b1194c --- /dev/null +++ b/test/docker/fedora/clean.sh @@ -0,0 +1,4 @@ +#!/bin/bash + +IMAGE_NAME=azbridge_fedora_test +source ../_scripts/removeimage.sh \ No newline at end of file diff --git a/test/docker/fedora/test.sh b/test/docker/fedora/test.sh new file mode 100644 index 0000000..2f2800f --- /dev/null +++ b/test/docker/fedora/test.sh @@ -0,0 +1,7 @@ +#!/bin/bash +pushd "${0%/*}" > /dev/null + +IMAGE_NAME=azbridge_fedora_test +source ../_scripts/imagetests.sh +popd +exit $_RESULT diff --git a/test/docker/ubuntu/Test.proj b/test/docker/ubuntu/Test.proj index 6bffc40..a20c2fb 100644 --- a/test/docker/ubuntu/Test.proj +++ b/test/docker/ubuntu/Test.proj @@ -4,12 +4,15 @@ - + + - + + - + + \ No newline at end of file diff --git a/test/docker/ubuntu/build.sh b/test/docker/ubuntu/build.sh new file mode 100644 index 0000000..606f472 --- /dev/null +++ b/test/docker/ubuntu/build.sh @@ -0,0 +1,15 @@ +#!/bin/bash + +if [ -z ${BuildNumber+x} ]; then BuildNumber='0000'; fi +if [ -z ${VersionSuffix+x} ]; then VersionSuffix='preview'; fi +if [ -z ${VersionPrefix+x} ]; then VersionPrefix='1.0.0'; fi +if [ -z ${TargetFramework+x} ]; then TargetFramework='netcoreapp2.0'; fi + +pushd "${0%/*}" > /dev/null +if [ ! -d "tmp" ]; then mkdir tmp; fi +DebFile=azbridge.$VersionPrefix-$VersionSuffix-$BuildNumber.ubuntu.16.04-x64.deb + +cp ../../../artifacts/build/$TargetFramework/$DebFile tmp/ > /dev/null +docker build -f Dockerfile . --tag azbridge_ubuntu1604_test --build-arg deb_package=$DebFile +rm -rf tmp +popd \ No newline at end of file diff --git a/test/docker/ubuntu/clean.sh b/test/docker/ubuntu/clean.sh new file mode 100644 index 0000000..bfbaaf5 --- /dev/null +++ b/test/docker/ubuntu/clean.sh @@ -0,0 +1,4 @@ +#!/bin/bash + +IMAGE_NAME=azbridge_ubuntu1604_test +source ../_scripts/removeimage.sh \ No newline at end of file diff --git a/test/docker/ubuntu/test.sh b/test/docker/ubuntu/test.sh new file mode 100644 index 0000000..b4e8fb7 --- /dev/null +++ b/test/docker/ubuntu/test.sh @@ -0,0 +1,7 @@ +#!/bin/bash +pushd "${0%/*}" > /dev/null + +IMAGE_NAME=azbridge_ubuntu1604_test +source ../_scripts/imagetests.sh +popd +exit $_RESULT diff --git a/verify-build.cmd b/verify-build.cmd new file mode 100644 index 0000000..d9c0fc4 --- /dev/null +++ b/verify-build.cmd @@ -0,0 +1,4 @@ +pushd "%~dp0" +cd test/docker +msbuild /t:vstest +popd diff --git a/verify-build.sh b/verify-build.sh new file mode 100644 index 0000000..aeba8ab --- /dev/null +++ b/verify-build.sh @@ -0,0 +1,6 @@ +#!/bin/bash + +pushd "${0%/*}" > /dev/null +cd test/docker +dotnet test +popd