diff --git a/eng/helix/content/runtests.cmd b/eng/helix/content/runtests.cmd index 88ed152e90..80f5a66bb3 100644 --- a/eng/helix/content/runtests.cmd +++ b/eng/helix/content/runtests.cmd @@ -2,28 +2,28 @@ REM Disable "!Foo!" expansions because they break the filter syntax setlocal disableextensions -set target=%1 -set targetFrameworkIdentifier=%2 -set sdkVersion=%3 -set runtimeVersion=%4 -set helixQueue=%5 -set arch=%6 -set quarantined=%7 +REM Use '$' as a variable name prefix to avoid MSBuild variable collisions with these variables +set $target=%1 +set $sdkVersion=%2 +set $runtimeVersion=%3 +set $helixQueue=%4 +set $arch=%5 +set $quarantined=%6 set DOTNET_HOME=%HELIX_CORRELATION_PAYLOAD%\sdk -set DOTNET_ROOT=%DOTNET_HOME%\%arch% +set DOTNET_ROOT=%DOTNET_HOME%\%$arch% set DOTNET_SKIP_FIRST_TIME_EXPERIENCE=1 set DOTNET_MULTILEVEL_LOOKUP=0 set DOTNET_CLI_HOME=%HELIX_CORRELATION_PAYLOAD%\home set PATH=%DOTNET_ROOT%;%PATH%;%HELIX_CORRELATION_PAYLOAD%\node\bin -powershell.exe -NoProfile -ExecutionPolicy unrestricted -Command "[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12; &([scriptblock]::Create((Invoke-WebRequest -useb 'https://dot.net/v1/dotnet-install.ps1'))) -Architecture %arch% -Version %sdkVersion% -InstallDir %DOTNET_ROOT%" -powershell.exe -NoProfile -ExecutionPolicy unrestricted -Command "[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12; &([scriptblock]::Create((Invoke-WebRequest -useb 'https://dot.net/v1/dotnet-install.ps1'))) -Architecture %arch% -Runtime dotnet -Version %runtimeVersion% -InstallDir %DOTNET_ROOT%" +powershell.exe -NoProfile -ExecutionPolicy unrestricted -Command "[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12; &([scriptblock]::Create((Invoke-WebRequest -useb 'https://dot.net/v1/dotnet-install.ps1'))) -Architecture %$arch% -Version %$sdkVersion% -InstallDir %DOTNET_ROOT%" +powershell.exe -NoProfile -ExecutionPolicy unrestricted -Command "[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12; &([scriptblock]::Create((Invoke-WebRequest -useb 'https://dot.net/v1/dotnet-install.ps1'))) -Architecture %$arch% -Runtime dotnet -Version %$runtimeVersion% -InstallDir %DOTNET_ROOT%" -set HELIX=%helixQueue% +set HELIX=%$helixQueue% -%DOTNET_ROOT%\dotnet vstest %target% -lt >discovered.txt +%DOTNET_ROOT%\dotnet vstest %$target% -lt >discovered.txt find /c "Exception thrown" discovered.txt REM "ERRORLEVEL is not %ERRORLEVEL%" https://blogs.msdn.microsoft.com/oldnewthing/20080926-00/?p=20743/ if not errorlevel 1 ( @@ -34,11 +34,15 @@ if not errorlevel 1 ( set exit_code=0 +if %$quarantined%==True ( + set %$quarantined=true +) + set NONQUARANTINE_FILTER="Flaky:All!=true&Flaky:Helix:All!=true&Flaky:Helix:Queue:All!=true&Flaky:Helix:Queue:%HELIX%!=true" set QUARANTINE_FILTER="Flaky:All=true|Flaky:Helix:All=true|Flaky:Helix:Queue:All=true|Flaky:Helix:Queue:%HELIX%=true" -if %quarantined%==true ( +if %$quarantined%==true ( echo Running quarantined tests. - %DOTNET_ROOT%\dotnet vstest %target% --logger:xunit --TestCaseFilter:%QUARANTINE_FILTER% + %DOTNET_ROOT%\dotnet vstest %$target% --logger:xunit --TestCaseFilter:%QUARANTINE_FILTER% if errorlevel 1 ( echo Failure in flaky test 1>&2 REM DO NOT EXIT and DO NOT SET EXIT_CODE to 1 @@ -48,7 +52,7 @@ if %quarantined%==true ( REM only puts the explicit filter traits the user provided in REM Filter syntax: https://github.com/Microsoft/vstest-docs/blob/master/docs/filter.md echo Running non-quarantined tests. - %DOTNET_ROOT%\dotnet vstest %target% --logger:xunit --TestCaseFilter:%NONQUARANTINE_FILTER% + %DOTNET_ROOT%\dotnet vstest %$target% --logger:xunit --TestCaseFilter:%NONQUARANTINE_FILTER% if errorlevel 1 ( echo Failure in non-flaky test 1>&2 set exit_code=1 diff --git a/eng/targets/Helix.targets b/eng/targets/Helix.targets index eecd36f02a..722158b18f 100644 --- a/eng/targets/Helix.targets +++ b/eng/targets/Helix.targets @@ -106,7 +106,7 @@ Usage: dotnet msbuild /t:Helix src/MyTestProject.csproj $(TargetFileName) @(HelixPreCommand) @(HelixPostCommand) - call runtests.cmd $(TargetFileName) $(TargetFrameworkIdentifier) $(NETCoreSdkVersion) $(MicrosoftNETCoreAppRuntimeVersion) $(_HelixFriendlyNameTargetQueue) $(TargetArchitecture) $(RunQuarantinedTests) + call runtests.cmd $(TargetFileName) $(NETCoreSdkVersion) $(MicrosoftNETCoreAppRuntimeVersion) $(_HelixFriendlyNameTargetQueue) $(TargetArchitecture) $(RunQuarantinedTests) ./runtests.sh $(TargetFileName) $(NETCoreSdkVersion) $(MicrosoftNETCoreAppRuntimeVersion) $(_HelixFriendlyNameTargetQueue) $(TargetArchitecture) $(RunQuarantinedTests) $(HelixCommand) $(HelixTimeout) diff --git a/src/Tools/dotnet-watch/test/AwaitableProcess.cs b/src/Tools/dotnet-watch/test/AwaitableProcess.cs index b7e6afde53..553b7a4d11 100644 --- a/src/Tools/dotnet-watch/test/AwaitableProcess.cs +++ b/src/Tools/dotnet-watch/test/AwaitableProcess.cs @@ -72,11 +72,12 @@ namespace Microsoft.DotNet.Watcher.Tools.FunctionalTests _process.ErrorDataReceived += OnData; _process.Exited += OnExit; + _logger.WriteLine($"{DateTime.Now}: starting process: '{_process.StartInfo.FileName} {_process.StartInfo.Arguments}'"); _process.Start(); _started = true; _process.BeginErrorReadLine(); _process.BeginOutputReadLine(); - _logger.WriteLine($"{DateTime.Now}: process start: '{_process.StartInfo.FileName} {_process.StartInfo.Arguments}'"); + _logger.WriteLine($"{DateTime.Now}: process started: '{_process.StartInfo.FileName} {_process.StartInfo.Arguments}'"); } public async Task GetOutputLineAsync(string message, TimeSpan timeout) diff --git a/src/Tools/dotnet-watch/test/Scenario/ProjectToolScenario.cs b/src/Tools/dotnet-watch/test/Scenario/ProjectToolScenario.cs index 44d49a203a..461939f3d6 100644 --- a/src/Tools/dotnet-watch/test/Scenario/ProjectToolScenario.cs +++ b/src/Tools/dotnet-watch/test/Scenario/ProjectToolScenario.cs @@ -149,15 +149,6 @@ namespace Microsoft.DotNet.Watcher.Tools.FunctionalTests File.WriteAllText(Path.Combine(WorkFolder, "Directory.Build.targets"), ""); } - private string GetMetadata(string key) - { - return typeof(ProjectToolScenario) - .Assembly - .GetCustomAttributes() - .First(a => string.Equals(a.Key, key, StringComparison.Ordinal)) - .Value; - } - public void Dispose() { try diff --git a/src/Tools/dotnet-watch/test/Scenario/WatchableApp.cs b/src/Tools/dotnet-watch/test/Scenario/WatchableApp.cs index 699942e224..eeae109bf9 100644 --- a/src/Tools/dotnet-watch/test/Scenario/WatchableApp.cs +++ b/src/Tools/dotnet-watch/test/Scenario/WatchableApp.cs @@ -104,12 +104,15 @@ namespace Microsoft.DotNet.Watcher.Tools.FunctionalTests WorkingDirectory = SourceDirectory, EnvironmentVariables = { - ["DOTNET_CLI_CONTEXT_VERBOSE"] = bool.TrueString, ["DOTNET_USE_POLLING_FILE_WATCHER"] = UsePollingWatcher.ToString(), - ["DOTNET_ROOT"] = Directory.GetParent(dotnetPath).FullName, }, }; + if (string.IsNullOrEmpty(Environment.GetEnvironmentVariable("helix"))) + { + spec.EnvironmentVariables["DOTNET_ROOT"] = Directory.GetParent(dotnetPath).FullName; + } + Process = new AwaitableProcess(spec, _logger); Process.Start(); }