From a0893e8847456195d0d92855cc820a40c7563414 Mon Sep 17 00:00:00 2001 From: Alex Perovich Date: Mon, 6 Jul 2020 11:48:20 -0700 Subject: [PATCH 1/5] Change default dotnet cli to the current one --- .../Sdk/tools/Microsoft.DotNet.Helix.Sdk.props | 1 + .../Sdk/tools/dotnet-cli/DotNetCli.props | 6 +++--- tests/UnitTests.proj | 1 - 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/Microsoft.DotNet.Helix/Sdk/tools/Microsoft.DotNet.Helix.Sdk.props b/src/Microsoft.DotNet.Helix/Sdk/tools/Microsoft.DotNet.Helix.Sdk.props index 13ab7424e5c..46a5001a2ad 100644 --- a/src/Microsoft.DotNet.Helix/Sdk/tools/Microsoft.DotNet.Helix.Sdk.props +++ b/src/Microsoft.DotNet.Helix/Sdk/tools/Microsoft.DotNet.Helix.Sdk.props @@ -1,6 +1,7 @@ + $(MSBuildThisFileDirectory)netcoreapp2.1/Microsoft.DotNet.Helix.Sdk.dll diff --git a/src/Microsoft.DotNet.Helix/Sdk/tools/dotnet-cli/DotNetCli.props b/src/Microsoft.DotNet.Helix/Sdk/tools/dotnet-cli/DotNetCli.props index 9c5ac4a6e46..62a83362d39 100644 --- a/src/Microsoft.DotNet.Helix/Sdk/tools/dotnet-cli/DotNetCli.props +++ b/src/Microsoft.DotNet.Helix/Sdk/tools/dotnet-cli/DotNetCli.props @@ -1,9 +1,9 @@ false - runtime - 2.1.5 - 2.1.403 + sdk + $(NETCoreSdkVersion) + 3.1.301 Current <_HelixMonoQueueTargets>$(_HelixMonoQueueTargets);$(MSBuildThisFileDirectory)DotNetCli.targets diff --git a/tests/UnitTests.proj b/tests/UnitTests.proj index c7f091ba86f..6f9d49031c2 100644 --- a/tests/UnitTests.proj +++ b/tests/UnitTests.proj @@ -11,7 +11,6 @@ test/product/ true - sdk $(AGENT_JOBNAME) From d7e391c996c39134fc8c372bba1da3a0a26dff41 Mon Sep 17 00:00:00 2001 From: Alex Perovich Date: Mon, 6 Jul 2020 12:32:50 -0700 Subject: [PATCH 2/5] Let xunit execution roll-forward --- src/Microsoft.DotNet.Helix/Sdk/CreateXUnitWorkItems.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Microsoft.DotNet.Helix/Sdk/CreateXUnitWorkItems.cs b/src/Microsoft.DotNet.Helix/Sdk/CreateXUnitWorkItems.cs index 060499363cb..4754e2361dc 100644 --- a/src/Microsoft.DotNet.Helix/Sdk/CreateXUnitWorkItems.cs +++ b/src/Microsoft.DotNet.Helix/Sdk/CreateXUnitWorkItems.cs @@ -117,7 +117,7 @@ private async Task PrepareWorkItem(ITaskItem xunitProject) Log.LogMessage($"Adding runtimeconfig and depsfile parameters for assembly {assemblyBaseName}."); driver += - $"--runtimeconfig {assemblyBaseName}.runtimeconfig.json --depsfile {assemblyBaseName}.deps.json "; + $"--roll-forward Major --runtimeconfig {assemblyBaseName}.runtimeconfig.json --depsfile {assemblyBaseName}.deps.json "; } string command = $"{driver}{xUnitRunner} {assemblyName}{(XUnitArguments != null ? " " + XUnitArguments : "")} -xml testResults.xml {arguments}"; From df914a88f8636f994384e14677c17cbcbc0b8478 Mon Sep 17 00:00:00 2001 From: Alex Perovich Date: Mon, 6 Jul 2020 14:18:20 -0700 Subject: [PATCH 3/5] Use the runtime too --- .../Sdk/tools/dotnet-cli/DotNetCli.props | 8 +++++--- tests/.gitignore | 2 ++ tests/UnitTests.proj | 1 + 3 files changed, 8 insertions(+), 3 deletions(-) create mode 100644 tests/.gitignore diff --git a/src/Microsoft.DotNet.Helix/Sdk/tools/dotnet-cli/DotNetCli.props b/src/Microsoft.DotNet.Helix/Sdk/tools/dotnet-cli/DotNetCli.props index 62a83362d39..f7b85f6c365 100644 --- a/src/Microsoft.DotNet.Helix/Sdk/tools/dotnet-cli/DotNetCli.props +++ b/src/Microsoft.DotNet.Helix/Sdk/tools/dotnet-cli/DotNetCli.props @@ -1,9 +1,11 @@ false - sdk - $(NETCoreSdkVersion) - 3.1.301 + runtime + $(BundledNETCoreAppPackageVersion) + $(NETCoreSdkVersion) + 3.1.5 + 3.1.301 Current <_HelixMonoQueueTargets>$(_HelixMonoQueueTargets);$(MSBuildThisFileDirectory)DotNetCli.targets diff --git a/tests/.gitignore b/tests/.gitignore new file mode 100644 index 00000000000..1fb32941bf2 --- /dev/null +++ b/tests/.gitignore @@ -0,0 +1,2 @@ +*.zip +*.payload diff --git a/tests/UnitTests.proj b/tests/UnitTests.proj index 6f9d49031c2..c7f091ba86f 100644 --- a/tests/UnitTests.proj +++ b/tests/UnitTests.proj @@ -11,6 +11,7 @@ test/product/ true + sdk $(AGENT_JOBNAME) From b28759d560d9a545741c65ecbfa98e86a45e13f8 Mon Sep 17 00:00:00 2001 From: Alex Perovich Date: Tue, 7 Jul 2020 11:11:59 -0700 Subject: [PATCH 4/5] Fix adhoc payload tests to not depend on ArgumentException formatting --- .../JobSender.Tests/Payloads/AdHocPayloadTests.cs | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/Microsoft.DotNet.Helix/JobSender.Tests/Payloads/AdHocPayloadTests.cs b/src/Microsoft.DotNet.Helix/JobSender.Tests/Payloads/AdHocPayloadTests.cs index c45fa8b1bc1..2b6dd76479e 100644 --- a/src/Microsoft.DotNet.Helix/JobSender.Tests/Payloads/AdHocPayloadTests.cs +++ b/src/Microsoft.DotNet.Helix/JobSender.Tests/Payloads/AdHocPayloadTests.cs @@ -11,14 +11,16 @@ public class AdHocPayloadTests public void MultipleFilesWithSameNameAreRefused() { var exception = Assert.Throws(() => new AdhocPayload(new[] { "a/b.txt", "a/c.txt", "d/b.txt" })); - Assert.Equal($"Names of files to upload have to be distinct. The following name repeats at least once: b.txt{Environment.NewLine}Parameter name: files", exception.Message); + Assert.StartsWith("Names of files to upload have to be distinct. The following name repeats at least once: b.txt", exception.Message); + Assert.Equal("files", exception.ParamName); } [Fact] public void MultipleFilesWithNamesSameUpToCaseAreStillRefused() { var exception = Assert.Throws(() => new AdhocPayload(new[] { "a/B.txt", "a/c.txt", "d/b.txt" })); - Assert.Equal($"Names of files to upload have to be distinct. The following name repeats at least once: b.txt{Environment.NewLine}Parameter name: files", exception.Message); + Assert.StartsWith("Names of files to upload have to be distinct. The following name repeats at least once: b.txt", exception.Message); + Assert.Equal("files", exception.ParamName); } [Fact] From 2e65ae7f2e72372bd5d205fdd9e8a0caeae0e581 Mon Sep 17 00:00:00 2001 From: Alex Perovich Date: Tue, 7 Jul 2020 14:38:58 -0700 Subject: [PATCH 5/5] Let roll-forward pass through in remote executor. --- .../src/RemoteExecutor.cs | 5 +++++ .../src/RemoteInvokeOptions.cs | 5 +++++ .../tests/RemoteExecutorTests.cs | 10 +++++----- 3 files changed, 15 insertions(+), 5 deletions(-) diff --git a/src/Microsoft.DotNet.RemoteExecutor/src/RemoteExecutor.cs b/src/Microsoft.DotNet.RemoteExecutor/src/RemoteExecutor.cs index 7a6d009bb1e..231c7afe7c1 100644 --- a/src/Microsoft.DotNet.RemoteExecutor/src/RemoteExecutor.cs +++ b/src/Microsoft.DotNet.RemoteExecutor/src/RemoteExecutor.cs @@ -413,6 +413,11 @@ private static string GetConsoleAppArgs(RemoteInvokeOptions options, out IEnumer args += $" --depsfile \"{DepsJsonPath}\""; } + if (!string.IsNullOrEmpty(options.RollForward)) + { + args += $" --roll-forward {options.RollForward}"; + } + args += $" \"{Path}\""; return args; } diff --git a/src/Microsoft.DotNet.RemoteExecutor/src/RemoteInvokeOptions.cs b/src/Microsoft.DotNet.RemoteExecutor/src/RemoteInvokeOptions.cs index 8002dd2b139..c1ece6250c4 100644 --- a/src/Microsoft.DotNet.RemoteExecutor/src/RemoteInvokeOptions.cs +++ b/src/Microsoft.DotNet.RemoteExecutor/src/RemoteInvokeOptions.cs @@ -58,5 +58,10 @@ public bool RunAsSudo _runAsSudo = value; } } + + /// + /// Specifies the roll-forward policy for dotnet cli to use. Only applies when running .NET Core + /// + public string RollForward { get; set; } } } diff --git a/src/Microsoft.DotNet.RemoteExecutor/tests/RemoteExecutorTests.cs b/src/Microsoft.DotNet.RemoteExecutor/tests/RemoteExecutorTests.cs index 1059e584f95..7e3488edab1 100644 --- a/src/Microsoft.DotNet.RemoteExecutor/tests/RemoteExecutorTests.cs +++ b/src/Microsoft.DotNet.RemoteExecutor/tests/RemoteExecutorTests.cs @@ -21,7 +21,7 @@ public void AsyncAction_ThrowException() { Assert.True(false); await Task.Delay(1); - }).Dispose() + }, new RemoteInvokeOptions { RollForward = "Major" }).Dispose() ); } @@ -31,7 +31,7 @@ public void AsyncAction() RemoteExecutor.Invoke(async () => { await Task.Delay(1); - }).Dispose(); + }, new RemoteInvokeOptions { RollForward = "Major" }).Dispose(); } [Fact] @@ -43,7 +43,7 @@ public void AsyncFunc_ThrowException() Assert.True(false); await Task.Delay(1); return 1; - }).Dispose() + }, new RemoteInvokeOptions { RollForward = "Major" }).Dispose() ); } @@ -55,7 +55,7 @@ public void AsyncFunc_InvalidReturnCode() { await Task.Delay(1); return 1; - }).Dispose() + }, new RemoteInvokeOptions { RollForward = "Major" }).Dispose() ); } @@ -66,7 +66,7 @@ public void AsyncFunc_NoThrow_ValidReturnCode() { await Task.Delay(1); return RemoteExecutor.SuccessExitCode; - }).Dispose(); + }, new RemoteInvokeOptions { RollForward = "Major" }).Dispose(); } } }