Skip to content

Commit

Permalink
Enable diagnostic logging when running tests to catch random test fai…
Browse files Browse the repository at this point in the history
…lures on CI agents (#387)
  • Loading branch information
kichalla authored Oct 14, 2019
1 parent 573fc3c commit 34dc510
Show file tree
Hide file tree
Showing 3 changed files with 60 additions and 2 deletions.
23 changes: 22 additions & 1 deletion build/testBuildImages.sh
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,11 @@

set -e

echo
echo "Current list of running processes:"
ps aux | less
echo

declare -r REPO_DIR=$( cd $( dirname "$0" ) && cd .. && pwd )
declare -r buildBuildImagesScript="$REPO_DIR/build/buildBuildImages.sh"
declare -r testProjectName="Oryx.BuildImage.Tests"
Expand All @@ -26,4 +31,20 @@ fi
echo
echo "Building and running tests..."
cd "$TESTS_SRC_DIR/$testProjectName"
dotnet test --test-adapter-path:. --logger:"xunit;LogFilePath=$ARTIFACTS_DIR\testResults\\$testProjectName.xml" -c $BUILD_CONFIGURATION

artifactsDir="$REPO_DIR/artifacts"
mkdir -p "$artifactsDir"
diagnosticFileLocation="$artifactsDir/$testProjectName-log.txt"

# Create a directory to capture any debug logs that MSBuild generates
msbuildDebugLogsDir="$artifactsDir/msbuildDebugLogs"
mkdir -p "$msbuildDebugLogsDir"
export MSBUILDDEBUGPATH="$msbuildDebugLogsDir"
export MSBUILDDISABLENODEREUSE=1

dotnet test \
--diag "$diagnosticFileLocation" \
--verbosity diag \
--test-adapter-path:. \
--logger:"xunit;LogFilePath=$ARTIFACTS_DIR\testResults\\$testProjectName.xml" \
-c $BUILD_CONFIGURATION
16 changes: 16 additions & 0 deletions build/testIntegration.sh
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,11 @@

set -e

echo
echo "Current list of running processes:"
ps aux | less
echo

declare -r REPO_DIR=$( cd $( dirname "$0" ) && cd .. && pwd )
source $REPO_DIR/build/__variables.sh

Expand Down Expand Up @@ -53,9 +58,20 @@ echo

testProjectName="Oryx.Integration"
cd "$TESTS_SRC_DIR/$testProjectName.Tests"
artifactsDir="$REPO_DIR/artifacts"
mkdir -p "$artifactsDir"
diagnosticFileLocation="$artifactsDir/$testProjectName.Tests$integrationTestPlatform-log.txt"

# Create a directory to capture any debug logs that MSBuild generates
msbuildDebugLogsDir="$artifactsDir/msbuildDebugLogs"
mkdir -p "$msbuildDebugLogsDir"
export MSBUILDDEBUGPATH="$msbuildDebugLogsDir"
export MSBUILDDISABLENODEREUSE=1

dotnet test \
$testCaseFilter \
--diag "$diagnosticFileLocation" \
--verbosity diag \
--test-adapter-path:. \
--logger:"xunit;LogFilePath=$ARTIFACTS_DIR/testResults/$testProjectName$integrationTestPlatform.Tests.xml" \
-c $BUILD_CONFIGURATION
23 changes: 22 additions & 1 deletion build/testRunTimeImages.sh
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,11 @@

set -e

echo
echo "Current list of running processes:"
ps aux | less
echo

declare -r REPO_DIR=$( cd $( dirname "$0" ) && cd .. && pwd )
declare -r buildRuntimeImagesScript="$REPO_DIR/build/buildRunTimeImages.sh"
declare -r testProjectName="Oryx.RuntimeImage.Tests"
Expand All @@ -26,4 +31,20 @@ fi
echo
echo "Building and running tests..."
cd "$TESTS_SRC_DIR/$testProjectName"
dotnet test --test-adapter-path:. --logger:"xunit;LogFilePath=$ARTIFACTS_DIR\testResults\\$testProjectName.xml" -c $BUILD_CONFIGURATION

artifactsDir="$REPO_DIR/artifacts"
mkdir -p "$artifactsDir"
diagnosticFileLocation="$artifactsDir/$testProjectName-log.txt"

# Create a directory to capture any debug logs that MSBuild generates
msbuildDebugLogsDir="$artifactsDir/msbuildDebugLogs"
mkdir -p "$msbuildDebugLogsDir"
export MSBUILDDEBUGPATH="$msbuildDebugLogsDir"
export MSBUILDDISABLENODEREUSE=1

dotnet test \
--diag "$diagnosticFileLocation" \
--verbosity diag \
--test-adapter-path:. \
--logger:"xunit;LogFilePath=$ARTIFACTS_DIR\testResults\\$testProjectName.xml" \
-c $BUILD_CONFIGURATION

0 comments on commit 34dc510

Please sign in to comment.