2018-08-29 03:01:02 +00:00
|
|
|
#! /bin/bash
|
2016-04-02 02:19:32 +00:00
|
|
|
PLATFORM=$1
|
|
|
|
TYPE=$2
|
|
|
|
WHERE="cat != ManualTest"
|
|
|
|
TEST_DIR="."
|
|
|
|
TEST_PATTERN="*Test.dll"
|
|
|
|
ASSEMBLIES=""
|
2017-10-30 01:40:10 +00:00
|
|
|
TEST_LOG_FILE="TestLog.txt"
|
2016-04-02 02:19:32 +00:00
|
|
|
|
|
|
|
if [ -d "$TEST_DIR/_tests" ]; then
|
|
|
|
TEST_DIR="$TEST_DIR/_tests"
|
|
|
|
fi
|
|
|
|
|
2017-10-30 01:40:10 +00:00
|
|
|
rm -f "$TEST_LOG_FILE"
|
|
|
|
|
|
|
|
# Uncomment to log test output to a file instead of the console
|
2017-12-31 18:53:16 +00:00
|
|
|
export LIDARR_TESTS_LOG_OUTPUT="File"
|
2017-10-30 01:40:10 +00:00
|
|
|
|
2017-12-31 18:53:16 +00:00
|
|
|
if [[ -z "${APPVEYOR}" ]]; then
|
|
|
|
NUNIT="$TEST_DIR/NUnit.ConsoleRunner.3.7.0/tools/nunit3-console.exe"
|
|
|
|
NUNIT_COMMAND="$NUNIT"
|
|
|
|
NUNIT_PARAMS="--workers=1"
|
2019-03-12 00:38:14 +00:00
|
|
|
elif [ "$PLATFORM" = "Windows" ]; then
|
2017-12-31 18:53:16 +00:00
|
|
|
NUNIT="nunit3-console"
|
|
|
|
NUNIT_COMMAND="$NUNIT"
|
|
|
|
NUNIT_PARAMS="--result=myresults.xml;format=AppVeyor --workers=1"
|
|
|
|
unset TMP
|
|
|
|
unset TEMP
|
2019-03-12 00:38:14 +00:00
|
|
|
else
|
|
|
|
NUNIT="$TEST_DIR/NUnit.ConsoleRunner.3.7.0/tools/nunit3-console.exe"
|
|
|
|
NUNIT_COMMAND="$NUNIT"
|
|
|
|
NUNIT_PARAMS="--result=myresults.xml --workers=1"
|
|
|
|
unset TMP
|
|
|
|
unset TEMP
|
2017-12-31 18:53:16 +00:00
|
|
|
fi
|
2016-04-02 02:19:32 +00:00
|
|
|
|
|
|
|
if [ "$PLATFORM" = "Windows" ]; then
|
2019-03-15 21:50:33 +00:00
|
|
|
mkdir -p "$ProgramData/Lidarr"
|
2016-04-02 02:19:32 +00:00
|
|
|
WHERE="$WHERE && cat != LINUX"
|
2019-03-12 00:38:14 +00:00
|
|
|
elif [ "$PLATFORM" = "Linux" ] || [ "$PLATFORM" = "Mac" ] ; then
|
2019-03-27 19:51:56 +00:00
|
|
|
mkdir -p ~/.config/Lidarr
|
2016-04-02 02:19:32 +00:00
|
|
|
WHERE="$WHERE && cat != WINDOWS"
|
|
|
|
NUNIT_COMMAND="mono --debug --runtime=v4.0 $NUNIT"
|
|
|
|
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"
|
|
|
|
elif [ "$TYPE" = "Integration" ] || [ "$TYPE" = "int" ] ; then
|
|
|
|
WHERE="$WHERE && cat == IntegrationTest"
|
|
|
|
elif [ "$TYPE" = "Automation" ] ; then
|
|
|
|
WHERE="$WHERE && cat == AutomationTest"
|
|
|
|
else
|
|
|
|
echo "Type must be provided as second argument: Unit, Integration or Automation"
|
|
|
|
exit 2
|
|
|
|
fi
|
|
|
|
|
|
|
|
for i in `find $TEST_DIR -name "$TEST_PATTERN"`;
|
|
|
|
do ASSEMBLIES="$ASSEMBLIES $i"
|
|
|
|
done
|
|
|
|
|
|
|
|
$NUNIT_COMMAND --where "$WHERE" $NUNIT_PARAMS $ASSEMBLIES;
|
2016-10-25 21:00:27 +00:00
|
|
|
EXIT_CODE=$?
|
|
|
|
|
|
|
|
if [ "$EXIT_CODE" -ge 0 ]; then
|
2017-12-31 18:53:16 +00:00
|
|
|
if [[ -z "${APPVEYOR}" ]]; then
|
|
|
|
echo "Failed tests: $EXIT_CODE"
|
|
|
|
else
|
|
|
|
echo "Failed tests: $EXIT_CODE"
|
|
|
|
appveyor AddMessage "Failed tests: $EXIT_CODE"
|
|
|
|
fi
|
2016-10-25 21:00:27 +00:00
|
|
|
exit 0
|
|
|
|
else
|
|
|
|
exit $EXIT_CODE
|
|
|
|
fi
|