return EXIT_FAILURE;
}
- const long timeout_ms = strtol(argv[1], nullptr, 10);
- int exit_code = run_timed_process(timeout_ms, argc-2, &argv[2]);
+ // Due to how Helix test environment variables are set, we have to receive
+ // the raw timeout value in minutes. Then we convert it to milliseconds when
+ // calling run_timed_process().
+ const long timeout_mins = strtol(argv[1], nullptr, 10);
+ int exit_code = run_timed_process(timeout_mins * 60000L, argc-2, &argv[2]);
printf("App Exit Code: %d\n", exit_code);
return exit_code;
</PropertyGroup>
<PropertyGroup>
<CLRTestRunFile Condition="'$(CLRTestIsHosted)'=='true'">"$CORE_ROOT/corerun" $(CoreRunArgs) ${__DotEnvArg}</CLRTestRunFile>
- <WatcherRunFile>"$CORE_ROOT/watchdog" $_WatcherTimeoutMilliseconds</WatcherRunFile>
+ <WatcherRunFile>"$CORE_ROOT/watchdog" $_WatcherTimeoutMins</WatcherRunFile>
<!-- Note that this overwrites CLRTestBashPreCommands rather than adding to it. -->
<CLRTestBashPreCommands Condition="'$(CLRTestKind)' == 'BuildAndRun' and '$(TargetArchitecture)' == 'wasm'"><![CDATA[
cd "$%28dirname "${BASH_SOURCE[0]}")"
LockFile="lock"
_RunWithWatcher=0
-_WatcherTimeoutMilliseconds=600000
+_WatcherTimeoutMins=10
-if [[ ! -z "$__TestTimeout" ]]%3B then
- _WatcherTimeoutMilliseconds=$__TestTimeout
+if [[ ! -z "$__TestCollectionTimeoutMins" ]]%3B then
+ _WatcherTimeoutMins=$__TestCollectionTimeoutMins
fi
+# The watcher needs a bit of time to start up, capture dumps, clean up, and so on.
+# Because of this, we pass a smaller timeout than the test collection one.
+# For simplicity purposes, we will assume there are no work items with just
+# a one-minute max timeout.
+if (( $_WatcherTimeoutMins > 1 ))%3B then
+ _WatcherTimeoutMins="%24((_WatcherTimeoutMins-1))"
+fi
# The __TestEnv variable may be used to specify a script to source before the test.
if [ -n "$__TestEnv" ]%3B then
</PropertyGroup>
<PropertyGroup>
<CLRTestRunFile Condition="'$(CLRTestIsHosted)'=='true'">"%CORE_ROOT%\corerun.exe" $(CoreRunArgs) %__DotEnvArg%</CLRTestRunFile>
- <WatcherRunFile>"%CORE_ROOT%\watchdog.exe" %_WatcherTimeoutMilliseconds%</WatcherRunFile>
+ <WatcherRunFile>"%CORE_ROOT%\watchdog.exe" %_WatcherTimeoutMins%</WatcherRunFile>
<BatchCopyCoreShimLocalCmds Condition="'$(CLRTestScriptLocalCoreShim)' == 'true'"><![CDATA[
REM Local CoreShim requested - see MSBuild property 'CLRTestScriptLocalCoreShim'
pushd %~dp0
set "scriptPath=%~dp0"
set /A _RunWithWatcher=0
-set _WatcherTimeoutMilliseconds=600000
+set /A _WatcherTimeoutMins=10
-IF NOT "%__TestTimeout%"=="" (
- set _WatcherTimeoutMilliseconds=%__TestTimeout%
+IF NOT "%__TestCollectionTimeoutMins%"=="" (
+ set /A _WatcherTimeoutMins=%__TestCollectionTimeoutMins%
+)
+
+REM The watcher needs a bit of time to start up, capture dumps, clean up, and so on.
+REM Because of this, we pass a smaller timeout than the test collection one.
+REM For simplicity purposes, we will assume there are no work items with just
+REM a one-minute max timeout.
+IF %_WatcherTimeoutMins% GTR 1 (
+ set /A _WatcherTimeoutMins-=1
)
$(BatchCLRTestArgPrep)
<HelixPreCommand Include="set CLRCustomTestLauncher=%HELIX_CORRELATION_PAYLOAD%\nativeaottest.cmd" Condition=" '$(NativeAotTest)' == 'true' " />
<HelixPreCommand Include="set __TestEnv=%HELIX_WORKITEM_PAYLOAD%\$(TestEnvFileName)" />
<HelixPreCommand Include="set __TestTimeout=$(TimeoutPerTestInMilliseconds)" Condition=" '$(TimeoutPerTestInMilliseconds)' != '' " />
+ <HelixPreCommand Include="set __TestCollectionTimeoutMins=$(TimeoutPerTestCollectionInMinutes)" Condition=" '$(TimeoutPerTestCollectionInMinutes)' != '' " />
<HelixPreCommand Include="set __CollectDumps=1" />
<HelixPreCommand Include="set __CrashDumpFolder=%HELIX_DUMP_FOLDER%" />
<HelixPreCommand Include="set __TestArchitecture=$(TargetArchitecture)" />
<HelixPreCommand Include="export CLRCustomTestLauncher=$HELIX_CORRELATION_PAYLOAD/nativeaottest.sh" Condition=" '$(NativeAotTest)' == 'true' " />
<HelixPreCommand Include="export __TestEnv=$HELIX_WORKITEM_PAYLOAD/$(TestEnvFileName)" />
<HelixPreCommand Include="export __TestTimeout=$(TimeoutPerTestInMilliseconds)" Condition=" '$(TimeoutPerTestInMilliseconds)' != '' " />
+ <HelixPreCommand Include="export __TestCollectionTimeoutMins=$(TimeoutPerTestCollectionInMinutes)" Condition=" '$(TimeoutPerTestCollectionInMinutes)' != '' " />
<HelixPreCommand Include="export __CollectDumps=1" />
<HelixPreCommand Include="export __CrashDumpFolder=$HELIX_DUMP_FOLDER" />
<HelixPreCommand Include="set __TestArchitecture=$(TargetArchitecture)" />