trimmed Linux distros and reworked verification

This commit is contained in:
clemensv 2019-12-05 16:30:55 +01:00
Родитель da0838c8e1
Коммит df3bb1fc32
47 изменённых файлов: 242 добавлений и 441 удалений

Просмотреть файл

@ -6,7 +6,7 @@
<CoreFrameworks Condition="'$(WindowsOnly)'!='true'">netcoreapp3.0</CoreFrameworks>
<TargetFrameworks>$(WindowsFrameworks)$(CoreFrameworks)</TargetFrameworks>
<WindowsRuntimeIdentifiers Condition="'$(OS)'=='Windows_NT'">win7-x64;win7-x86;win10-x64;win10-x86;</WindowsRuntimeIdentifiers>
<UnixRuntimeIdentifiers Condition="'$(WindowsOnly)'=='false'">osx-x64;debian.8-x64;ubuntu.16.10-x64;ubuntu.18.04-x64;ubuntu.16.10-x64;ubuntu.18.10-x64;opensuse-x64;ol-x64;rhel-x64;fedora-x64;centos-x64</UnixRuntimeIdentifiers>
<UnixRuntimeIdentifiers Condition="'$(WindowsOnly)'=='false'">osx-x64;debian.10-x64;ubuntu.18.04-x64;opensuse.15.0-x64;fedora.30-x64</UnixRuntimeIdentifiers>
<RuntimeIdentifiers>$(WindowsRuntimeIdentifiers)$(UnixRuntimeIdentifiers)</RuntimeIdentifiers>
</PropertyGroup>

Просмотреть файл

@ -39,7 +39,7 @@
</Content>
<Content Include="azbridge.sh" CopyToPublishDirectory="PreserveNewest" Condition="! $(RuntimeIdentifier.StartsWith('win'))" RemoveOnUninstall="true">
<LinuxPath>/etc/profile.d/azbridge.sh</LinuxPath>
<LinuxFileMode Condition="!($(RuntimeIdentifier.StartsWith('rhel')) OR $(RuntimeIdentifier.StartsWith('fedora')) OR $(RuntimeIdentifier.StartsWith('ol')) OR $(RuntimeIdentifier.StartsWith('centos')))" >0555</LinuxFileMode>
<LinuxFileMode Condition="!($(RuntimeIdentifier.StartsWith('rhel')) OR $(RuntimeIdentifier.StartsWith('fedora')) OR $(RuntimeIdentifier.StartsWith('opensuse')) OR $(RuntimeIdentifier.StartsWith('centos')))" >0555</LinuxFileMode>
</Content>
<Content Include="../tools/Powershell/add-hostname.ps1" CopyToPublishDirectory="PreserveNewest" Condition="$(RuntimeIdentifier.StartsWith('win'))" />
<Content Include="../tools/Powershell/remove-hostname.ps1" CopyToPublishDirectory="PreserveNewest" Condition="$(RuntimeIdentifier.StartsWith('win'))" />
@ -137,20 +137,16 @@
<ItemGroup Condition="$(RuntimeIdentifier.StartsWith('debian')) OR $(RuntimeIdentifier.StartsWith('ubuntu')) OR $(RuntimeIdentifier.StartsWith('linuxmint'))">
<!-- <DebDependency Include="lttng-ust" Version=""/> -->
<DebDependency Include="libcurl3" Version="" Condition="$(RuntimeIdentifier.StartsWith('debian.8')) OR $(RuntimeIdentifier.StartsWith('ubuntu.14')) OR $(RuntimeIdentifier.StartsWith('ubuntu.15')) OR $(RuntimeIdentifier.StartsWith('ubuntu.16'))"/>
<DebDependency Include="libcurl4" Version="" Condition= "$(RuntimeIdentifier.StartsWith('debian.9')) OR $(RuntimeIdentifier.StartsWith('debian.10')) OR $(RuntimeIdentifier.StartsWith('ubuntu.18'))"/>
<DebDependency Include="libssl1.0.0" Version="" />
<DebDependency Include="libcurl3 | libcurl4" Version=""/>
<DebDependency Include="libssl1.0.0 | libssl1.0.2 | libssl1.1" Version="" />
<DebDependency Include="libkrb5-3" Version="" />
<DebDependency Include="zlib1g" Version="" />
<DebDependency Include="libicu52" Version="" Condition= "$(RuntimeIdentifier.StartsWith('debian.8')) OR $(RuntimeIdentifier.StartsWith('ubuntu.14'))" />
<DebDependency Include="libicu55" Version="" Condition= "$(RuntimeIdentifier.StartsWith('ubuntu.16'))" />
<DebDependency Include="libicu57" Version="" Condition= "$(RuntimeIdentifier.StartsWith('debian.9')) OR $(RuntimeIdentifier.StartsWith('ubuntu.17')) OR $(RuntimeIdentifier.StartsWith('linuxmint.17'))" />
<DebDependency Include="libicu60" Version="" Condition= "$(RuntimeIdentifier.StartsWith('debian.10')) OR $(RuntimeIdentifier.StartsWith('ubuntu.18')) OR $(RuntimeIdentifier.StartsWith('linuxmint.18'))" />
<DebDependency Include="libicu52 | libicu55 | libicu57 | libicu60 | libicu62 | libicu63" Version="" />
</ItemGroup>
<ItemGroup Condition="$(RuntimeIdentifier.StartsWith('opensuse'))">
<RpmDotNetDependency Include="libopenssl1_0_0" Version="" />
<RpmDotNetDependency Include="libicu52_1" Version="" />
<RpmDotNetDependency Include="libicu" Version="" />
<RpmDotNetDependency Include="krb5" Version="" />
</ItemGroup>
@ -184,7 +180,7 @@
</ItemGroup>
</Target>
<Target Name="PackageZip" DependsOnTargets="CreateZip" Condition="$(RuntimeIdentifier.EndsWith($(PlatformTarget)))">
<Target Name="PackageZip" DependsOnTargets="CreateZip" Condition="$(RuntimeIdentifier.EndsWith($(PlatformTarget))) AND $(RuntimeIdentifier.StartsWith('win'))">
<Copy SourceFiles="$(ZipPath)" DestinationFolder="$(BuildDir)/$(TargetFramework)" />
</Target>
<Target Name="PackageTarball" DependsOnTargets="CreateTarball" Condition="('$(TargetFramework)' == 'netcoreapp3.0') AND $(UnixRuntimeIdentifiers.Contains($(RuntimeIdentifier)))">

Просмотреть файл

@ -1,18 +1,54 @@
<Project>
<Import Project="Directory.Build.props" />
<PropertyGroup>
<OutputType>None</OutputType>
</PropertyGroup>
<ItemGroup>
<ProjectsToBuild Include="**\*proj" Exclude="$(MSBuildProjectFile)"/>
</ItemGroup>
<Target Name="Build">
<MSBuild Projects ="@(ProjectsToBuild)" ContinueOnError ="false" Targets="Build" />
<PropertyGroup>
<ImageSuffix Condition="$(RuntimeIdentifier.StartsWith('debian')) OR $(RuntimeIdentifier.StartsWith('ubuntu')) OR $(RuntimeIdentifier.StartsWith('linuxmint'))">deb</ImageSuffix>
<ImageSuffix Condition="$(RuntimeIdentifier.StartsWith('rhel')) OR $(RuntimeIdentifier.StartsWith('fedora')) OR $(RuntimeIdentifier.StartsWith('opensuse'))">rpm</ImageSuffix>
<ImageSuffix Condition="'$(ImageSuffix)' == ''">tar.gz</ImageSuffix>
</PropertyGroup>
<Target Name="BuildImage" Condition=" '$(RuntimeIdentifier)' != '' AND !$(RuntimeIdentifier.StartsWith('osx'))">
<Exec Command="test.cmd build &quot;$(RuntimeIdentifier)&quot; &quot;$(ImageSuffix)&quot; &quot;$(VersionPrefix)&quot; &quot;$(VersionSuffix)&quot; &quot;$(TargetFramework)&quot;" Condition="'$(OS)'=='Windows_NT'"/>
<Exec Command="bash ./test.sh build &quot;$(RuntimeIdentifier)&quot; &quot;$(ImageSuffix)&quot; &quot;$(VersionPrefix)&quot; &quot;$(VersionSuffix)&quot; &quot;$(TargetFramework)&quot;" Condition="'$(OS)'=='Unix'"/>
</Target>
<Target Name="VSTest">
<MSBuild Projects ="@(ProjectsToBuild)" ContinueOnError ="false" Targets="VSTest"/>
<Target Name="VSTestImage" Condition=" '$(RuntimeIdentifier)' != '' AND !$(RuntimeIdentifier.StartsWith('osx'))">
<Exec Command="test.cmd test &quot;$(RuntimeIdentifier)&quot; &quot;$(ImageSuffix)&quot; &quot;$(VersionPrefix)&quot; &quot;$(VersionSuffix)&quot; &quot;$(TargetFramework)&quot;" Condition="'$(OS)'=='Windows_NT'"/>
<Exec Command="bash ./test.sh test &quot;$(RuntimeIdentifier)&quot; &quot;$(ImageSuffix)&quot; &quot;$(VersionPrefix)&quot; &quot;$(VersionSuffix)&quot; &quot;$(TargetFramework)&quot;" Condition="'$(OS)'=='Unix'"/>
</Target>
<Target Name="Clean">
<MSBuild Projects ="@(ProjectsToBuild)" ContinueOnError ="false" Targets="Clean"/>
<Target Name="CleanImage" Condition=" '$(RuntimeIdentifier)' != '' AND !$(RuntimeIdentifier.StartsWith('osx'))">
<Exec Command="test.cmd clean &quot;$(RuntimeIdentifier)&quot; &quot;$(ImageSuffix)&quot; &quot;$(VersionPrefix)&quot; &quot;$(VersionSuffix)&quot; &quot;$(TargetFramework)&quot;" Condition="'$(OS)'=='Windows_NT'"/>
<Exec Command="bash ./test.sh clean &quot;$(RuntimeIdentifier)&quot; &quot;$(ImageSuffix)&quot; &quot;$(VersionPrefix)&quot; &quot;$(VersionSuffix)&quot; &quot;$(TargetFramework)&quot;" Condition="'$(OS)'=='Unix'"/>
</Target>
<Target Name="BuildProjectIfRIDSet" DependsOnTargets="BuildImage" Condition=" '$(RuntimeIdentifier)' != ''">
<Message Text="Target: $(PlatformTarget) $(RuntimeIdentifier) $(TargetFramework)" Importance="high" />
</Target>
<Target Name="BuildProjectForAllUnixRIDs" Condition=" '$(RuntimeIdentifier)' == ''">
<ItemGroup>
<_BuildRuntimeIdentifier Include="$(UnixRuntimeIdentifiers)" />
</ItemGroup>
<MSBuild Projects="$(MSBuildProjectFile)" Targets="Build" Properties="RuntimeIdentifier=%(_BuildRuntimeIdentifier.Identity)" />
</Target>
<Target Name="Build" DependsOnTargets="BuildProjectIfRIDSet;BuildProjectForAllUnixRIDs" />
<Target Name="VSTestProjectIfRIDSet" DependsOnTargets="VSTestImage" Condition=" '$(RuntimeIdentifier)' != ''" />
<Target Name="VSTestProjectForAllUnixRIDs" Condition=" '$(RuntimeIdentifier)' == ''">
<ItemGroup>
<_VSTestRuntimeIdentifier Include="$(UnixRuntimeIdentifiers)" />
</ItemGroup>
<MSBuild Projects="$(MSBuildProjectFile)" Targets="VSTest" Properties="RuntimeIdentifier=%(_VSTestRuntimeIdentifier.Identity)" />
</Target>
<Target Name="VSTest" DependsOnTargets="VSTestProjectIfRIDSet;VSTestProjectForAllUnixRIDs" />
<Target Name="CleanProjectIfRIDSet" DependsOnTargets="CleanImage" Condition=" '$(RuntimeIdentifier)' != ''" />
<Target Name="CleanProjectForAllUnixRIDs" Condition=" '$(RuntimeIdentifier)' == ''">
<ItemGroup>
<_CleanRuntimeIdentifier Include="$(UnixRuntimeIdentifiers)" />
</ItemGroup>
<MSBuild Projects="$(MSBuildProjectFile)" Targets="Clean" Properties="RuntimeIdentifier=%(_CleanRuntimeIdentifier.Identity)" />
</Target>
<Target Name="Clean" DependsOnTargets="CleanProjectIfRIDSet;CleanProjectForAllUnixRIDs" />
</Project>

Просмотреть файл

@ -1,23 +0,0 @@
@echo off
SET _CXNSTRING=
FOR /F "delims=" %%i IN (%AZBRIDGE_TEST_CXNSTRING%) DO SET _CXNSTRING=%%i
if "%_CXNSTRING%" == "" (
echo AZBRIDGE_TEST_CXNSTRING environment variable must be set to valid relay connection string
exit /b
)
set _IMAGE_ID=
rem for /f %%i in ('docker images %IMAGE_NAME% -q') do set _IMAGE_ID=%%i
rem 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
if NOT "%_RESULT%"=="0" exit /b %_RESULT%
set _TESTNAME=test_nc_config_ping_pong
call ../_scripts/runtest.cmd
exit /b %_RESULT%

Просмотреть файл

@ -1,20 +0,0 @@
#!/bin/bash
_CXNSTRING=$AZBRIDGE_TEST_CXNSTRING
if [ -z $_CXNSTRING ]; then
echo AZBRIDGE_TEST_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 $1 $2 $3 $4
#fi
_MOUNTPATH=$(dirname $(pwd))
_TESTNAME=test_nc_ping_pong
source ../_scripts/runtest.sh
if [ $_RESULT -ne 0 ]; then exit $_RESULT; fi
_TESTNAME=test_nc_config_ping_pong
source ../_scripts/runtest.sh
exit $_RESULT

Просмотреть файл

@ -1,4 +0,0 @@
set _IMAGE_ID=
for /f %%i in ('docker images %IMAGE_NAME% -q') do set _IMAGE_ID=%%i
if "%_IMAGE_ID%"=="" exit /b
docker rmi -f %IMAGE_NAME%:latest

Просмотреть файл

@ -1,3 +0,0 @@
if [ ! -z `docker images "$IMAGE_NAME" -q` ]; then
docker rmi -f $IMAGE_NAME:latest
fi

Просмотреть файл

@ -0,0 +1,5 @@
FROM debian:buster AS build
ARG package_name
COPY ./tmp/$package_name .
RUN apt-get update -y
RUN apt-get install -y apt-utils ./$package_name netcat-openbsd findutils

Просмотреть файл

@ -1,14 +0,0 @@
FROM debian:jessie AS build
ARG deb_package
WORKDIR /tmp
COPY ./tmp/$deb_package .
USER root
# temporary workaround for RPM packaging issue
# RUN sed -i '/tsflags=nodocs/d' /etc/dnf/dnf.conf
RUN apt-get update -y
#RUN yum install -y nc libstdc++ libunwind libicu compat-openssl10
RUN useradd -ms /bin/bash azbridge
#RUN rpm -i $deb_package
RUN apt-get install -y netcat-openbsd findutils gdebi-core
RUN gdebi -n $deb_package
USER azbridge

Просмотреть файл

@ -1,19 +0,0 @@
<Project>
<Import Project="..\..\..\version.props" />
<PropertyGroup>
<OutputType>None</OutputType>
</PropertyGroup>
<Target Name="Build">
<Exec Command="build.cmd $(VersionPrefix) $(VersionSuffix) $(TargetFramework)" Condition="'$(OS)'=='Windows_NT'"/>
<Exec Command="bash ./build.sh $(VersionPrefix) $(VersionSuffix) $(TargetFramework)" Condition="'$(OS)'=='Unix'"/>
</Target>
<Target Name="VSTest">
<Exec Command="test.cmd $(VersionPrefix) $(VersionSuffix) $(TargetFramework)" Condition="'$(OS)'=='Windows_NT'"/>
<Exec Command="bash ./test.sh $(VersionPrefix) $(VersionSuffix) $(TargetFramework)" Condition="'$(OS)'=='Unix'"/>
</Target>
<Target Name="Clean">
<Exec Command="clean.cmd $(VersionPrefix) $(VersionSuffix) $(TargetFramework)" Condition="'$(OS)'=='Windows_NT'"/>
<Exec Command="bash ./clean.sh $(VersionPrefix) $(VersionSuffix) $(TargetFramework)" Condition="'$(OS)'=='Unix'"/>
</Target>
</Project>

Просмотреть файл

@ -1,18 +0,0 @@
@echo off
if not "%1" == "" set VersionPrefix=%1
if not "%2" == "" set VersionSuffix=%2
if not "%3" == "" set TargetFramework=%3
if "%VersionSuffix%"=="" set VersionSuffix=preview
if "%VersionPrefix%"=="" set VersionPrefix=1.0.0
if "%TargetFramework%"=="" set TargetFramework="netcoreapp3.0"
pushd "%~dp0"
if not exist "tmp" mkdir tmp
set DebFile=azbridge.%VersionPrefix%-%VersionSuffix%.debian.8-x64.deb
copy /y ..\..\..\artifacts\build\%TargetFramework%\%DebFile% tmp > NUL
docker build -f Dockerfile . --tag azbridge_debian8_test --build-arg deb_package=%DebFile%
rd /s /q tmp
popd

Просмотреть файл

@ -1,18 +0,0 @@
#!/bin/bash
if [ ! -z $1 ]; then VersionPrefix=$1; fi
if [ ! -z $2 ]; then VersionSuffix=$2; fi
if [ ! -z $3 ]; then TargetFramework=$3; 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='netcoreapp3.0'; fi
pushd "${0%/*}" > /dev/null
if [ ! -d "tmp" ]; then mkdir tmp; fi
DebFile=azbridge.$VersionPrefix-$VersionSuffix.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

Просмотреть файл

@ -1,3 +0,0 @@
@echo off
set IMAGE_NAME=azbridge_debian8_test
call ../_scripts/removeimage.cmd

Просмотреть файл

@ -1,4 +0,0 @@
#!/bin/bash
IMAGE_NAME=azbridge_debian8_test
source ../_scripts/removeimage.sh

Просмотреть файл

@ -1,7 +0,0 @@
@echo off
pushd "%~dp0"
SET IMAGE_NAME=azbridge_debian8_test
call ../_scripts/imagetests.cmd %*
popd
exit /b %ERRORLEVEL%

Просмотреть файл

@ -1,16 +0,0 @@
#!/bin/bash
if [ ! -z $1 ]; then VersionPrefix=$1; fi
if [ ! -z $2 ]; then VersionSuffix=$2; fi
if [ ! -z $3 ]; then TargetFramework=$3; 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='netcoreapp3.0'; fi
pushd "${0%/*}" > /dev/null
IMAGE_NAME=azbridge_debian8_test
source ../_scripts/imagetests.sh
popd
exit $_RESULT

Просмотреть файл

@ -0,0 +1,5 @@
FROM fedora:30 AS build
ARG package_name
COPY ./tmp/$package_name .
RUN yum install -y $package_name
RUN yum install -y nc findutils

Просмотреть файл

@ -1,7 +0,0 @@
FROM fedora AS build
ARG rpm_package
WORKDIR /tmp
COPY ./tmp/$rpm_package .
RUN yum install -y $rpm_package
RUN yum install -y nc findutils
USER azbridge

Просмотреть файл

@ -1,19 +0,0 @@
<Project>
<Import Project="..\..\..\version.props" />
<PropertyGroup>
<OutputType>None</OutputType>
</PropertyGroup>
<Target Name="Build">
<Exec Command="build.cmd $(VersionPrefix) $(VersionSuffix) $(TargetFramework)" Condition="'$(OS)'=='Windows_NT'"/>
<Exec Command="bash ./build.sh $(VersionPrefix) $(VersionSuffix) $(TargetFramework)" Condition="'$(OS)'=='Unix'"/>
</Target>
<Target Name="VSTest">
<Exec Command="test.cmd $(VersionPrefix) $(VersionSuffix) $(TargetFramework)" Condition="'$(OS)'=='Windows_NT'"/>
<Exec Command="bash ./test.sh $(VersionPrefix) $(VersionSuffix) $(TargetFramework)" Condition="'$(OS)'=='Unix'"/>
</Target>
<Target Name="Clean">
<Exec Command="clean.cmd $(VersionPrefix) $(VersionSuffix) $(TargetFramework)" Condition="'$(OS)'=='Windows_NT'"/>
<Exec Command="bash ./clean.sh $(VersionPrefix) $(VersionSuffix) $(TargetFramework)" Condition="'$(OS)'=='Unix'"/>
</Target>
</Project>

Просмотреть файл

@ -1,17 +0,0 @@
@echo off
if not "%1" == "" set VersionPrefix=%1
if not "%2" == "" set VersionSuffix=%2
if not "%3" == "" set TargetFramework=%3
if "%VersionSuffix%"=="" set VersionSuffix=preview
if "%VersionPrefix%"=="" set VersionPrefix=1.0.0
if "%TargetFramework%"=="" set TargetFramework="netcoreapp3.0"
pushd "%~dp0"
if not exist "tmp" mkdir tmp
set RpmFile=azbridge.%VersionPrefix%-%VersionSuffix%.fedora-x64.rpm
copy /y ..\..\..\artifacts\build\%TargetFramework%\%RpmFile% tmp > NUL
docker build -f Dockerfile . --tag azbridge_fedora_test --build-arg rpm_package=%RpmFile%
rd /s /q tmp
popd

Просмотреть файл

@ -1,18 +0,0 @@
#!/bin/bash
if [ ! -z $1 ]; then VersionPrefix=$1; fi
if [ ! -z $2 ]; then VersionSuffix=$2; fi
if [ ! -z $3 ]; then TargetFramework=$3; 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='netcoreapp3.0'; fi
pushd "${0%/*}" > /dev/null
if [ ! -d "tmp" ]; then mkdir tmp; fi
RpmFile=azbridge.$VersionPrefix-$VersionSuffix.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

Просмотреть файл

@ -1,3 +0,0 @@
@echo off
set IMAGE_NAME=azbridge_fedora_test
call ../_scripts/removeimage.cmd

Просмотреть файл

@ -1,4 +0,0 @@
#!/bin/bash
IMAGE_NAME=azbridge_fedora_test
source ../_scripts/removeimage.sh

Просмотреть файл

@ -1,7 +0,0 @@
@echo off
pushd "%~dp0"
SET IMAGE_NAME=azbridge_fedora_test
call ../_scripts/imagetests.cmd %*
popd
exit /b %ERRORLEVEL%

Просмотреть файл

@ -1,17 +0,0 @@
#!/bin/bash
if [ ! -z $1 ]; then VersionPrefix=$1; fi
if [ ! -z $2 ]; then VersionSuffix=$2; fi
if [ ! -z $3 ]; then TargetFramework=$3; 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='netcoreapp3.0'; fi
pushd "${0%/*}" > /dev/null
IMAGE_NAME=azbridge_fedora_test
source ../_scripts/imagetests.sh
popd
exit $_RESULT

Просмотреть файл

@ -0,0 +1,5 @@
FROM opensuse/leap:15 AS build
ARG package_name
COPY ./tmp/$package_name .
RUN zypper --no-gpg-checks --non-interactive install -y ./$package_name
RUN zypper --non-interactive install -y netcat-openbsd findutils

Просмотреть файл

@ -1,21 +1,21 @@
@echo off
echo Running %_TESTNAME%
set _OUTFILE=%temp%\azbridge-tests-%_TESTNAME%.output.txt
docker run -v %_MOUNTPATH%:/tests -e AZBRIDGE_TEST_CXNSTRING="%_CXNSTRING%" --rm %IMAGE_NAME%:latest bash /tests/%_TESTNAME%.sh > %_OUTFILE%
if exist %_MOUNTPATH%\%_TESTNAME%.reference.txt (
fc /L %_MOUNTPATH%\%_TESTNAME%.reference.txt %_OUTFILE% > NUL
if ERRORLEVEL 1 (
set _RESULT=%ERRORLEVEL%
type %_OUTFILE%
echo Error %_RESULT%
)
if ERRORLEVEL 0 (
set _RESULT=0
echo OK
)
del %_OUTFILE%
) else (
copy /Y %_OUTFILE% %_MOUNTPATH%\%_TESTNAME%.reference.txt > NUL
set _RESULT=%ERRORLEVEL%
)
echo off
echo Running %_TESTNAME%
set _OUTFILE=%temp%\azbridge-tests-%_TESTNAME%.output.txt
docker run -v %_MOUNTPATH%:/tests -e AZBRIDGE_TEST_CXNSTRING=%AZBRIDGE_TEST_CXNSTRING% --rm azbridge-test-%ImageName%:latest bash /tests/%_TESTNAME%.sh > %_OUTFILE%
if exist %_MOUNTPATH%\%_TESTNAME%.reference.txt (
fc /L %_MOUNTPATH%\%_TESTNAME%.reference.txt %_OUTFILE% > NUL
if ERRORLEVEL 1 (
set _RESULT=%ERRORLEVEL%
type %_OUTFILE%
echo Error %_RESULT%
)
if ERRORLEVEL 0 (
set _RESULT=0
echo OK
)
del %_OUTFILE%
) else (
copy /Y %_OUTFILE% %_MOUNTPATH%\%_TESTNAME%.reference.txt > NUL
set _RESULT=%ERRORLEVEL%
)
exit /b %_RESULT%

Просмотреть файл

62
test/docker/test.cmd Normal file
Просмотреть файл

@ -0,0 +1,62 @@
rem @echo off
echo %~1 %~2 %~3 %~4 %~5 %~6
if not "%~1" == "" set Operation=%~1
if not "%~2" == "" set ImageName=%~2
if not "%~3" == "" set ImageSuffix=%~3
if not "%~4" == "" set VersionPrefix=%~4
if not "%~5" == "" set VersionSuffix=%~5
if not "%~6" == "" set TargetFramework=%~6
if "%Operation%"=="" set Operation=build
if "%ImageName%"=="" set ImageName=debian.9-x64
if "%ImageSuffix%"=="" set ImageSuffix=deb
if "%VersionSuffix%"=="" set VersionSuffix=preview
if "%VersionPrefix%"=="" set VersionPrefix=1.0.0
if "%TargetFramework%"=="" set TargetFramework=netcoreapp3.0
set PackageName=azbridge.%VersionPrefix%-%VersionSuffix%.%ImageName%.%ImageSuffix%
if "%Operation%"=="build" (
pushd "%~dp0"
if NOT exist ..\..\artifacts\build\%TargetFramework%\%PackageName% (
echo Cannot find ..\..\artifacts\build\%TargetFramework%\%PackageName%
exit 2
)
if not exist "tmp" mkdir tmp
copy /y ..\..\artifacts\build\%TargetFramework%\%PackageName% tmp > NUL
docker build -f %ImageName%.dockerfile . --tag azbridge-test-%ImageName% --build-arg package_name=%PackageName%
rd /s /q tmp
popd
exit /b
)
if "%Operation%"=="test" (
if %AZBRIDGE_TEST_CXNSTRING% == "" (
echo AZBRIDGE_TEST_CXNSTRING environment variable must be set to valid relay connection string
exit /b
)
set _IMAGE_ID=
FOR /F %%i IN ("%cd%") DO set _MOUNTPATH=%%~fi
set _TESTNAME=test_nc_ping_pong
call runtest.cmd
if NOT "%_RESULT%"=="0" exit /b %_RESULT%
set _TESTNAME=test_nc_config_ping_pong
call runtest.cmd
exit /b %_RESULT%
)
if "%Operation%"=="clean" (
set IMAGE_NAME=azbridge-test-%ImageName%
for /f %%i in ('docker images %IMAGE_NAME% -q') do set _IMAGE_ID=%%i
if "%_IMAGE_ID%"=="" exit /b
docker rmi -f %IMAGE_NAME%:latest
)
else (
echo "Unknown operation"
)

55
test/docker/test.sh Normal file
Просмотреть файл

@ -0,0 +1,55 @@
#!/bin/bash
if [ ! -z $1 ]; then Operation=$1; fi
if [ ! -z $2 ]; then ImageName=$2; fi
if [ ! -z $3 ]; then ImageSuffix=$3; fi
if [ ! -z $4 ]; then VersionPrefix=$4; fi
if [ ! -z $5 ]; then VersionSuffix=$5; fi
if [ ! -z $6 ]; then TargetFramework=$6; fi
if [ -z ${Operation+x} ]; then Operation='build'; fi
if [ -z ${ImageName+x} ]; then ImageName='debian.8-x64'; fi
if [ -z ${ImageSuffix+x} ]; then VersionSuffix='deb'; 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='netcoreapp3.0'; fi
if [ "${Operation}" == "build" ]; then
pushd "${0%/*}" > /dev/null
if [ ! -d "tmp" ]; then mkdir tmp; fi
PackageName=azbridge.$VersionPrefix-$VersionSuffix.$ImageName.$ImageSuffix
cp ../../artifacts/build/$TargetFramework/$PackageName tmp/ > /dev/null
docker build -f $ImageName.dockerfile . --tag azbridge-test-$ImageName --build-arg package_name=$PackageName
rm -rf tmp
popd
else
if [ "${Operation}" == "test" ]; then
pushd "${0%/*}" > /dev/null
IMAGE_NAME=azbridge-test-$ImageName
_CXNSTRING=$AZBRIDGE_TEST_CXNSTRING
if [ -z $_CXNSTRING ]; then
echo AZBRIDGE_TEST_CXNSTRING environment variable must be set to valid relay connection string
exit
fi
_MOUNTPATH=$(pwd)
_TESTNAME=test_nc_ping_pong
source runtest.sh
#if [ $_RESULT -ne 0 ]; then exit $_RESULT; fi
_TESTNAME=test_nc_config_ping_pong
source runtest.sh
popd
#exit $_RESULT
exit
else
if [ "${Operation}" == "clean" ]; then
if [ ! -z `docker images "azbridge-test-$ImageName" -q` ]; then
docker rmi -f azbridge_test_$ImageName:latest
fi
else
echo "Unknown command"
fi
fi
fi

Просмотреть файл

@ -1,2 +1,2 @@
request: ping
reply: pong
the quick brown fox jumps over the lazy dog
etaoin shrdlu

Просмотреть файл

@ -1,5 +0,0 @@
RemoteForward:
- RelayName: a1
HostPort: 9999
Host: localhost
PortName: test

Просмотреть файл

@ -1,29 +1,10 @@
#! /bin/bash
#!/bin/bash
pushd "${0%/*}" > /dev/null
rm -f ~/testoutput.log
_LOCALCONFIG=$(mktemp)
cat test_nc_config_ping_pong.local.yml > $_LOCALCONFIG
echo AzureRelayConnectionString : "$AZBRIDGE_TEST_CXNSTRING" >> $_LOCALCONFIG
/usr/share/azbridge/azbridge -l log.txt -f $_LOCALCONFIG >> ~/testoutput.log 2>&1 &
LOCAL_LISTENER_PID=$!
_REMOTECONFIG=$(mktemp)
cat test_nc_config_ping_pong.remote.yml > $_REMOTECONFIG
echo AzureRelayConnectionString : "$AZBRIDGE_TEST_CXNSTRING" >> $_REMOTECONFIG
/usr/share/azbridge/azbridge -l log.txt -f $_REMOTECONFIG >> ~/testoutput.log 2>&1 &
REMOTE_LISTENER_PID=$!
sleep 5
#expected request: ping
echo "pong" | nc -l 9999 | xargs echo request: > ~/testoutputres.log 2>&1 &
sleep 1
#expected reply: pong
echo "ping" | nc 127.0.8.1 8888 | xargs echo reply: > ~/testoutputreq.log 2>&1
sleep 5
kill -INT $LOCAL_LISTENER_PID
kill -INT $REMOTE_LISTENER_PID
rm $_LOCALCONFIG
rm $_REMOTECONFIG
cat ~/testoutput.log
cat ~/testoutputres.log
cat ~/testoutputreq.log
popd > /dev/null
/usr/share/azbridge/azbridge -v -l ~/applog.log -x $AZBRIDGE_TEST_CXNSTRING -f /tests/test_nc_config_ping_pong.yml &
L1_PID=$!
sleep 15
echo "the quick brown fox jumps over the lazy dog" | nc -l 9999 &
sleep 5
echo "etaoin shrdlu" | nc -w 5 127.0.8.1 8888
sleep 5
kill -9 $L1_PID

Просмотреть файл

@ -1,6 +1,11 @@
LocalForward:
- RelayName: a1
BindAddress: 127.0.8.1
BindPort: 8888
PortName: test
LocalForward:
- RelayName: a1
BindAddress: 127.0.8.1
BindPort: 8888
PortName: test
RemoteForward:
- RelayName: a1
HostPort: 9999
Host: localhost
PortName: test

Просмотреть файл

@ -1,2 +1,2 @@
request: ping
reply: pong
the quick brown fox jumps over the lazy dog
etaoin shrdlu

Просмотреть файл

@ -1,19 +1,10 @@
#!/bin/bash
rm -f ~/testoutput.log
/usr/share/azbridge/azbridge -l log.txt -x $AZBRIDGE_TEST_CXNSTRING -L 127.0.8.1:8888/test:a1 >> ~/testoutput.log 2>&1 &
LOCAL_LISTENER_PID=$!
/usr/share/azbridge/azbridge -l log.txt -x $AZBRIDGE_TEST_CXNSTRING -R a1:test/9999 >> ~/testoutput.log 2>&1 &
REMOTE_LISTENER_PID=$!
sleep 5
#expected request: ping
echo "pong" | nc -l 9999 | xargs echo request: > ~/testoutputres.log 2>&1 &
sleep 1
#expected reply: pong
echo "ping" | nc 127.0.8.1 8888 | xargs echo reply: > ~/testoutputreq.log 2>&1
sleep 5
kill -INT $LOCAL_LISTENER_PID
kill -INT $REMOTE_LISTENER_PID
cat ~/testoutput.log
cat ~/testoutputres.log
cat ~/testoutputreq.log
/usr/share/azbridge/azbridge -v -l ~/applog.log -x $AZBRIDGE_TEST_CXNSTRING -L 127.0.8.1:8888/test:a1 -R a1:test/9999 &
L1_PID=$!
sleep 15
echo "the quick brown fox jumps over the lazy dog" | nc -l 9999 &
sleep 5
echo "etaoin shrdlu" | nc -w 5 127.0.8.1 8888
sleep 5
kill -9 $L1_PID

Просмотреть файл

@ -0,0 +1,6 @@
FROM ubuntu:18.04 AS build
ARG package_name
COPY ./tmp/$package_name .
RUN apt-get update -y
RUN apt-get install -y ./$package_name netcat-openbsd findutils

Просмотреть файл

@ -1,14 +0,0 @@
FROM ubuntu:bionic AS build
ARG deb_package
WORKDIR /tmp
COPY ./tmp/$deb_package .
USER root
# temporary workaround for RPM packaging issue
# RUN sed -i '/tsflags=nodocs/d' /etc/dnf/dnf.conf
RUN apt-get update -y
#RUN yum install -y nc libstdc++ libunwind libicu compat-openssl10
RUN useradd -ms /bin/bash azbridge
#RUN rpm -i $deb_package
RUN apt-get install -y netcat-openbsd findutils gdebi-core
RUN gdebi -n $deb_package
USER azbridge

Просмотреть файл

@ -1,19 +0,0 @@
<Project>
<Import Project="..\..\..\version.props" />
<PropertyGroup>
<OutputType>None</OutputType>
</PropertyGroup>
<Target Name="Build">
<Exec Command="build.cmd $(VersionPrefix) $(VersionSuffix) $(TargetFramework)" Condition="'$(OS)'=='Windows_NT'"/>
<Exec Command="bash ./build.sh $(VersionPrefix) $(VersionSuffix) $(TargetFramework)" Condition="'$(OS)'=='Unix'"/>
</Target>
<Target Name="VSTest">
<Exec Command="test.cmd $(VersionPrefix) $(VersionSuffix) $(TargetFramework)" Condition="'$(OS)'=='Windows_NT'"/>
<Exec Command="bash ./test.sh $(VersionPrefix) $(VersionSuffix) $(TargetFramework)" Condition="'$(OS)'=='Unix'"/>
</Target>
<Target Name="Clean">
<Exec Command="clean.cmd $(VersionPrefix) $(VersionSuffix) $(TargetFramework)" Condition="'$(OS)'=='Windows_NT'"/>
<Exec Command="bash ./clean.sh $(VersionPrefix) $(VersionSuffix) $(TargetFramework)" Condition="'$(OS)'=='Unix'"/>
</Target>
</Project>

Просмотреть файл

@ -1,18 +0,0 @@
@echo off
if not "%1" == "" set VersionPrefix=%1
if not "%2" == "" set VersionSuffix=%2
if not "%3" == "" set TargetFramework=%3
if "%VersionSuffix%"=="" set VersionSuffix=preview
if "%VersionPrefix%"=="" set VersionPrefix=1.0.0
if "%TargetFramework%"=="" set TargetFramework="netcoreapp3.0"
pushd "%~dp0"
if not exist "tmp" mkdir tmp
set DebFile=azbridge.%VersionPrefix%-%VersionSuffix%.ubuntu.18.10-x64.deb
copy /y ..\..\..\artifacts\build\%TargetFramework%\%DebFile% tmp > NUL
docker build -f Dockerfile . --tag azbridge_ubuntu1604_test --build-arg deb_package=%DebFile%
rd /s /q tmp
popd

Просмотреть файл

@ -1,18 +0,0 @@
#!/bin/bash
if [ ! -z $1 ]; then VersionPrefix=$1; fi
if [ ! -z $2 ]; then VersionSuffix=$2; fi
if [ ! -z $3 ]; then TargetFramework=$3; 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='netcoreapp3.0'; fi
pushd "${0%/*}" > /dev/null
if [ ! -d "tmp" ]; then mkdir tmp; fi
DebFile=azbridge.$VersionPrefix-$VersionSuffix.ubuntu.18.10-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

Просмотреть файл

@ -1,3 +0,0 @@
@echo off
set IMAGE_NAME=azbridge_ubuntu1604_test
call ../_scripts/removeimage.cmd

Просмотреть файл

@ -1,4 +0,0 @@
#!/bin/bash
IMAGE_NAME=azbridge_ubuntu1604_test
source ../_scripts/removeimage.sh

Просмотреть файл

@ -1,7 +0,0 @@
@echo off
pushd "%~dp0"
SET IMAGE_NAME=azbridge_ubuntu1604_test
call ../_scripts/imagetests.cmd %*
popd
exit /b %ERRORLEVEL%

Просмотреть файл

@ -1,17 +0,0 @@
#!/bin/bash
if [ ! -z $1 ]; then VersionPrefix=$1; fi
if [ ! -z $2 ]; then VersionSuffix=$2; fi
if [ ! -z $3 ]; then TargetFramework=$3; 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='netcoreapp3.0'; fi
pushd "${0%/*}" > /dev/null
IMAGE_NAME=azbridge_ubuntu1604_test
source ../_scripts/imagetests.sh
popd
exit $_RESULT

Просмотреть файл

Просмотреть файл