New: Multi target net framework 4.6.2 and net core 3.0

This commit is contained in:
ta264 2019-10-28 21:30:08 +00:00 committed by Qstick
commit 8fe924fdcd
99 changed files with 898 additions and 852 deletions

35
test.sh
View file

@ -2,7 +2,7 @@
PLATFORM=$1
TYPE=$2
COVERAGE=$3
WHERE="cat != ManualTest"
WHERE="Category!=ManualTest"
TEST_PATTERN="*Test.dll"
ASSEMBLIES=""
TEST_LOG_FILE="TestLog.txt"
@ -16,16 +16,12 @@ if [ -d "$TEST_DIR/_tests" ]; then
TEST_DIR="$TEST_DIR/_tests"
fi
COVERAGE_RESULT_DIRECTORY="$TEST_DIR/CoverageResults/"
rm -f "$TEST_LOG_FILE"
# Uncomment to log test output to a file instead of the console
export LIDARR_TESTS_LOG_OUTPUT="File"
NUNIT="$TEST_DIR/NUnit.ConsoleRunner.3.10.0/tools/nunit3-console.exe"
NUNIT_COMMAND="$NUNIT"
NUNIT_PARAMS="--workers=1"
VSTEST_PARAMS="--Platform:x64 --logger:nunit;LogFilePath=TestResult.xml"
if [ "$PLATFORM" = "Mac" ]; then
@ -39,22 +35,21 @@ fi
if [ "$PLATFORM" = "Windows" ]; then
mkdir -p "$ProgramData/Lidarr"
WHERE="$WHERE && cat != LINUX"
WHERE="$WHERE&Category!=LINUX"
elif [ "$PLATFORM" = "Linux" ] || [ "$PLATFORM" = "Mac" ] ; then
mkdir -p ~/.config/Lidarr
WHERE="$WHERE && cat != WINDOWS"
NUNIT_COMMAND="mono --debug --runtime=v4.0 $NUNIT"
WHERE="$WHERE&Category!=WINDOWS"
else
echo "Platform must be provided as first arguement: Windows, Linux or Mac"
exit 1
fi
if [ "$TYPE" = "Unit" ]; then
WHERE="$WHERE && cat != IntegrationTest && cat != AutomationTest"
WHERE="$WHERE&Category!=IntegrationTest&Category!=AutomationTest"
elif [ "$TYPE" = "Integration" ] || [ "$TYPE" = "int" ] ; then
WHERE="$WHERE && cat == IntegrationTest"
WHERE="$WHERE&Category=IntegrationTest"
elif [ "$TYPE" = "Automation" ] ; then
WHERE="$WHERE && cat == AutomationTest"
WHERE="$WHERE&Category=AutomationTest"
else
echo "Type must be provided as second argument: Unit, Integration or Automation"
exit 2
@ -64,19 +59,13 @@ for i in `find $TEST_DIR -name "$TEST_PATTERN"`;
do ASSEMBLIES="$ASSEMBLIES $i"
done
DOTNET_PARAMS="$ASSEMBLIES --TestCaseFilter:$WHERE $VSTEST_PARAMS"
if [ "$COVERAGE" = "Coverage" ]; then
if [ "$PLATFORM" = "Windows" ] || [ "$PLATFORM" = "Linux" ]; then
dotnet tool install coverlet.console --tool-path="$TEST_DIR/coverlet/"
mkdir $COVERAGE_RESULT_DIRECTORY
OPEN_COVER="$TEST_DIR/coverlet/coverlet"
$OPEN_COVER "$TEST_DIR/" --verbosity "detailed" --format "cobertura" --format "opencover" --output "$COVERAGE_RESULT_DIRECTORY" --exclude "[Lidarr.*.Test]*" --exclude "[Lidarr.Test.*]*" --exclude "[Lidarr.Api.V1]*" --exclude "[Marr.Data]*" --exclude "[MonoTorrent]*" --exclude "[CurlSharp]*" --target "$NUNIT" --targetargs "$NUNIT_PARAMS --where=\"$WHERE\" $ASSEMBLIES";
EXIT_CODE=$?
else
echo "Coverage only supported on Windows and Linux"
exit 3
fi
dotnet vstest $DOTNET_PARAMS --settings:"src/coverlet.runsettings" --ResultsDirectory:./CoverageResults
EXIT_CODE=$?
elif [ "$COVERAGE" = "Test" ] ; then
$NUNIT_COMMAND --where "$WHERE" $NUNIT_PARAMS $ASSEMBLIES;
dotnet vstest $DOTNET_PARAMS
EXIT_CODE=$?
else
echo "Run Type must be provided as third argument: Coverage or Test"