Skip to content

Commit 540c1d3

Browse files
authored
Merge pull request #1963 from omajid/3.1-smoke-test-speedup
[release/3.1] Fix smoke test timeout detection to work again
2 parents ea9e737 + eb25bb1 commit 540c1d3

File tree

1 file changed

+12
-3
lines changed

1 file changed

+12
-3
lines changed

smoke-test.sh

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -212,17 +212,26 @@ function doCommand() {
212212
"${dotnetCmd}" $newArgs --no-restore >> "$logFile" 2>&1
213213
fi
214214
elif [[ "$1" == "run" && "$proj" =~ ^(web|mvc|webapi|razor)$ ]]; then
215+
# A separate log file that we will over-write all the time.
216+
exitLogFile="$testingDir/exitLogFile"
217+
echo > $exitLogFile
218+
# Run an application in the background and redirect its
219+
# stdout+stderr to a separate process (tee). The tee process
220+
# writes its input to 2 files:
221+
# - Either the normal log or stdout
222+
# - A log that's only used to find out when it's safe to kill
223+
# the application.
215224
if [ "$projectOutput" == "true" ]; then
216-
"${dotnetCmd}" $1 &
225+
"${dotnetCmd}" $1 2>&1 > >(tee -a "$exitLogFile") &
217226
else
218-
"${dotnetCmd}" $1 >> "$logFile" 2>&1 &
227+
"${dotnetCmd}" $1 2>&1 > >(tee -a "$logFile" "$exitLogFile" >/dev/null) &
219228
fi
220229
webPid=$!
221230
killCommand="pkill -SIGTERM -P $webPid"
222231
echo " waiting up to 30 seconds for web project with pid $webPid..."
223232
echo " to clean up manually after an interactive cancellation, run: $killCommand"
224233
for seconds in $(seq 30); do
225-
if [ "$(tail -n 1 "$logFile")" = 'Application started. Press Ctrl+C to shut down.' ]; then
234+
if grep 'Application started. Press Ctrl+C to shut down.' "$exitLogFile"; then
226235
echo " app ready for shutdown after $seconds seconds"
227236
break
228237
fi

0 commit comments

Comments
 (0)