From 46366b9aabdce57f58c89d61bc07891e6d1fd38f Mon Sep 17 00:00:00 2001 From: Ivan Diaz Date: Tue, 21 Mar 2023 13:08:21 -0700 Subject: [PATCH 1/3] Adjusted watcher's timeout for test collections. --- src/native/watchdog/watchdog.cpp | 7 +++++-- src/tests/Common/CLRTest.Execute.Bash.targets | 8 ++++---- src/tests/Common/CLRTest.Execute.Batch.targets | 8 ++++---- src/tests/Common/helixpublishwitharcade.proj | 2 ++ 4 files changed, 15 insertions(+), 10 deletions(-) diff --git a/src/native/watchdog/watchdog.cpp b/src/native/watchdog/watchdog.cpp index fec9674cd2836..2ab508a5fb53c 100644 --- a/src/native/watchdog/watchdog.cpp +++ b/src/native/watchdog/watchdog.cpp @@ -35,8 +35,11 @@ int main(const int argc, const char *argv[]) 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; diff --git a/src/tests/Common/CLRTest.Execute.Bash.targets b/src/tests/Common/CLRTest.Execute.Bash.targets index 0623040dc12d8..621c60498d693 100644 --- a/src/tests/Common/CLRTest.Execute.Bash.targets +++ b/src/tests/Common/CLRTest.Execute.Bash.targets @@ -290,7 +290,7 @@ fi "$CORE_ROOT/corerun" $(CoreRunArgs) ${__DotEnvArg} - "$CORE_ROOT/watchdog" $_WatcherTimeoutMilliseconds + "$CORE_ROOT/watchdog" $_WatcherTimeoutMins "%CORE_ROOT%\corerun.exe" $(CoreRunArgs) %__DotEnvArg% - "%CORE_ROOT%\watchdog.exe" %_WatcherTimeoutMilliseconds% + "%CORE_ROOT%\watchdog.exe" %_WatcherTimeoutMins% + @@ -676,6 +677,7 @@ + From b3dff3c9255bb89b849053e792a2d13bca7f44ec Mon Sep 17 00:00:00 2001 From: Ivan Diaz Date: Tue, 21 Mar 2023 14:00:45 -0700 Subject: [PATCH 2/3] Had forgot to adjust the final timeout. --- src/tests/Common/CLRTest.Execute.Bash.targets | 7 +++++++ src/tests/Common/CLRTest.Execute.Batch.targets | 8 ++++++++ 2 files changed, 15 insertions(+) diff --git a/src/tests/Common/CLRTest.Execute.Bash.targets b/src/tests/Common/CLRTest.Execute.Bash.targets index 621c60498d693..89e893539e69d 100644 --- a/src/tests/Common/CLRTest.Execute.Bash.targets +++ b/src/tests/Common/CLRTest.Execute.Bash.targets @@ -555,6 +555,13 @@ 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 diff --git a/src/tests/Common/CLRTest.Execute.Batch.targets b/src/tests/Common/CLRTest.Execute.Batch.targets index d114fd8c9184a..e070d0eade512 100644 --- a/src/tests/Common/CLRTest.Execute.Batch.targets +++ b/src/tests/Common/CLRTest.Execute.Batch.targets @@ -445,6 +445,14 @@ IF NOT "%__TestCollectionTimeoutMins%"=="" ( set _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 ( + _WatcherTimeoutMins-=1 +) + $(BatchCLRTestArgPrep) $(BatchCLRTestExitCodePrep) From aecacf89ad4839aa6f6888f028da0f39ead0af1c Mon Sep 17 00:00:00 2001 From: Ivan Diaz Date: Wed, 22 Mar 2023 14:50:15 -0700 Subject: [PATCH 3/3] Fixed an error in Windows batch script. --- src/tests/Common/CLRTest.Execute.Batch.targets | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/tests/Common/CLRTest.Execute.Batch.targets b/src/tests/Common/CLRTest.Execute.Batch.targets index e070d0eade512..7ae089a0ae72e 100644 --- a/src/tests/Common/CLRTest.Execute.Batch.targets +++ b/src/tests/Common/CLRTest.Execute.Batch.targets @@ -439,10 +439,10 @@ set "lockFolder=%~dp0\lock" pushd %~dp0 set "scriptPath=%~dp0" set /A _RunWithWatcher=0 -set _WatcherTimeoutMins=10 +set /A _WatcherTimeoutMins=10 IF NOT "%__TestCollectionTimeoutMins%"=="" ( - set _WatcherTimeoutMins=%__TestCollectionTimeoutMins% + set /A _WatcherTimeoutMins=%__TestCollectionTimeoutMins% ) REM The watcher needs a bit of time to start up, capture dumps, clean up, and so on. @@ -450,7 +450,7 @@ 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 ( - _WatcherTimeoutMins-=1 + set /A _WatcherTimeoutMins-=1 ) $(BatchCLRTestArgPrep)