Skip to content

Commit 12f92db

Browse files
authored
Eliminate duplicates in Helix TestRunner (#25663)
* Eliminate duplicates in Helix `TestRunner` - do not add source that's already in NuGet.config - configuration file now part of Helix content - do not re-set an env variable that's set in `runtests.*` nit: simplify `%Path% setting in runtests.cmd - always quote the value - but, keep the `SETLOCAL` command - don't pollute environment on Helix agents * Remove `--source` options we don't need anymore from `runtests.*` - nit: add `--no-restore` to `dotnet run` command after `dotnet restore` * Add `--arch arm64` to ARM64 `restore` build steps - #25397 - was restoring for the wrong architecture nit: add `--no-restore` to Helix project build steps - already restored
1 parent b3f4a32 commit 12f92db

File tree

5 files changed

+23
-32
lines changed

5 files changed

+23
-32
lines changed

.azure/pipelines/helix-matrix.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -50,10 +50,10 @@ jobs:
5050
agentOs: Linux
5151
timeoutInMinutes: 480
5252
steps:
53-
- script: ./restore.sh -ci -nobl
53+
- script: ./restore.sh --ci --nobl --arch arm64
5454
displayName: Restore
55-
- script: ./build.sh --ci --nobl --noBuildRepoTasks --arch arm64 -test --no-build-nodejs --all --projects
56-
$(Build.SourcesDirectory)/eng/helix/helix.proj /p:IsHelixJob=true /p:IsHelixDaily=true
55+
- script: ./build.sh --ci --nobl --arch arm64 --noBuildRepoTasks --no-build-nodejs --no-restore --test --all
56+
--projects $(Build.SourcesDirectory)/eng/helix/helix.proj /p:IsHelixJob=true /p:IsHelixDaily=true
5757
/p:ASPNETCORE_TEST_LOG_DIR=artifacts/log
5858
displayName: Run build.sh helix arm64 target
5959
env:

.azure/pipelines/quarantined-tests.yml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -53,11 +53,11 @@ jobs:
5353
agentOs: Linux
5454
timeoutInMinutes: 480
5555
steps:
56-
- script: ./restore.sh -ci -nobl
56+
- script: ./restore.sh --ci --nobl --arch arm64
5757
displayName: Restore
58-
- script: ./build.sh --ci --nobl --noBuildRepoTasks --arch arm64 -test --no-build-nodejs --all --projects
59-
$(Build.SourcesDirectory)/eng/helix/helix.proj /p:IsHelixJob=true /p:IsHelixDaily=true /p:RunQuarantinedTests=true
60-
/p:ASPNETCORE_TEST_LOG_DIR=artifacts/log
58+
- script: ./build.sh --ci --nobl --arch arm64 --noBuildRepoTasks --no-build-nodejs --no-restore --test --all
59+
--projects $(Build.SourcesDirectory)/eng/helix/helix.proj /p:IsHelixJob=true /p:IsHelixDaily=true
60+
/p:RunQuarantinedTests=true /p:ASPNETCORE_TEST_LOG_DIR=artifacts/log
6161
displayName: Run build.sh helix arm64 target
6262
continueOnError: true
6363
env:

eng/helix/content/RunTests/TestRunner.cs

Lines changed: 3 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,6 @@ public bool SetupEnvironment()
3434
}
3535

3636
EnvironmentVariables.Add("PATH", Options.Path);
37-
EnvironmentVariables.Add("DOTNET_ROOT", Options.DotnetRoot);
3837
EnvironmentVariables.Add("helix", Options.HelixQueue);
3938

4039
Console.WriteLine($"Current Directory: {Options.HELIX_WORKITEM_ROOT}");
@@ -126,14 +125,6 @@ await ProcessUtil.RunAsync($"{Options.DotnetRoot}/dotnet",
126125
throwOnError: false,
127126
cancellationToken: new CancellationTokenSource(TimeSpan.FromMinutes(2)).Token);
128127

129-
await ProcessUtil.RunAsync($"{Options.DotnetRoot}/dotnet",
130-
"nuget add source https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet5/nuget/v3/index.json --configfile NuGet.config",
131-
environmentVariables: EnvironmentVariables,
132-
outputDataReceived: Console.WriteLine,
133-
errorDataReceived: Console.Error.WriteLine,
134-
throwOnError: false,
135-
cancellationToken: new CancellationTokenSource(TimeSpan.FromMinutes(2)).Token);
136-
137128
// Write nuget sources to console, useful for debugging purposes
138129
await ProcessUtil.RunAsync($"{Options.DotnetRoot}/dotnet",
139130
"nuget list source",
@@ -199,8 +190,7 @@ public async Task<bool> InstallDotnetDump()
199190
try
200191
{
201192
await ProcessUtil.RunAsync($"{Options.DotnetRoot}/dotnet",
202-
$"tool install dotnet-dump --tool-path {Options.HELIX_WORKITEM_ROOT} " +
203-
"--version 5.0.0-* --add-source https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet5/nuget/v3/index.json",
193+
$"tool install dotnet-dump --tool-path {Options.HELIX_WORKITEM_ROOT} --version 5.0.0-*",
204194
environmentVariables: EnvironmentVariables,
205195
outputDataReceived: Console.WriteLine,
206196
errorDataReceived: Console.Error.WriteLine,
@@ -247,7 +237,7 @@ public async Task<int> RunTestsAsync()
247237
{
248238
// Timeout test run 5 minutes before the Helix job would timeout
249239
var cts = new CancellationTokenSource(Options.Timeout.Subtract(TimeSpan.FromMinutes(5)));
250-
var commonTestArgs = $"test {Options.Target} --logger:xunit --logger:\"console;verbosity=normal\" --blame \"CollectHangDump;TestTimeout=5m\"";
240+
var commonTestArgs = $"test {Options.Target} --logger:xunit --logger:\"console;verbosity=normal\" --blame \"CollectHangDump;TestTimeout=5m\"";
251241
if (Options.Quarantined)
252242
{
253243
Console.WriteLine("Running quarantined tests.");
@@ -346,7 +336,7 @@ public void UploadResults()
346336
else
347337
{
348338
Console.WriteLine("No dmps found in TestResults");
349-
}
339+
}
350340
}
351341
}
352342
}

eng/helix/content/runtests.cmd

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
@echo off
2-
REM Need delayed expansion !PATH! so parens in the path don't mess up the parens for the if statements that use parens for blocks
3-
setlocal enabledelayedexpansion
2+
SETLOCAL
43

54
REM Use '$' as a variable name prefix to avoid MSBuild variable collisions with these variables
65
set $target=%1
@@ -26,8 +25,8 @@ set DOTNET_SKIP_FIRST_TIME_EXPERIENCE=1
2625
set DOTNET_MULTILEVEL_LOOKUP=0
2726
set DOTNET_CLI_HOME=%HELIX_CORRELATION_PAYLOAD%\home
2827

29-
set PATH=%DOTNET_ROOT%;!PATH!;%HELIX_CORRELATION_PAYLOAD%\node\bin
30-
echo Set path to: %PATH%
28+
set "PATH=%DOTNET_ROOT%;%PATH%;%HELIX_CORRELATION_PAYLOAD%\node\bin"
29+
echo Set path to: "%PATH%"
3130

3231
powershell.exe -noLogo -NoProfile -ExecutionPolicy unrestricted -command ". eng\common\tools.ps1; InstallDotNet %DOTNET_ROOT% %$sdkVersion% %$arch% '' $true '' '' $true"
3332
IF [%$feedCred%] == [] (
@@ -38,11 +37,11 @@ IF [%$feedCred%] == [] (
3837

3938
set exit_code=0
4039

41-
echo "Restore: dotnet restore RunTests\RunTests.csproj --source https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet5/nuget/v3/index.json --source https://api.nuget.org/v3/index.json --ignore-failed-sources..."
42-
dotnet restore RunTests\RunTests.csproj --source https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet5/nuget/v3/index.json --source https://api.nuget.org/v3/index.json --ignore-failed-sources
40+
echo "Restore: dotnet restore RunTests\RunTests.csproj --ignore-failed-sources"
41+
dotnet restore RunTests\RunTests.csproj --ignore-failed-sources
4342

44-
echo "Running tests: dotnet run --project RunTests\RunTests.csproj -- --target %$target% --runtime %$aspRuntimeVersion% --queue %$queue% --arch %$arch% --quarantined %$quarantined% --ef %$ef% --aspnetruntime %$aspnetruntime% --aspnetref %$aspnetref% --helixTimeout %$helixTimeout%..."
45-
dotnet run --project RunTests\RunTests.csproj -- --target %$target% --runtime %$aspRuntimeVersion% --queue %$queue% --arch %$arch% --quarantined %$quarantined% --ef %$ef% --aspnetruntime %$aspnetruntime% --aspnetref %$aspnetref% --helixTimeout %$helixTimeout%
43+
echo "Running tests: dotnet run --no-restore --project RunTests\RunTests.csproj -- --target %$target% --runtime %$aspRuntimeVersion% --queue %$queue% --arch %$arch% --quarantined %$quarantined% --ef %$ef% --aspnetruntime %$aspnetruntime% --aspnetref %$aspnetref% --helixTimeout %$helixTimeout%"
44+
dotnet run --no-restore --project RunTests\RunTests.csproj -- --target %$target% --runtime %$aspRuntimeVersion% --queue %$queue% --arch %$arch% --quarantined %$quarantined% --ef %$ef% --aspnetruntime %$aspnetruntime% --aspnetref %$aspnetref% --helixTimeout %$helixTimeout%
4645
if errorlevel neq 0 (
4746
set exit_code=%errorlevel%
4847
)

eng/helix/content/runtests.sh

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -61,10 +61,12 @@ fi
6161
sync
6262

6363
exit_code=0
64-
echo "Restore: $DOTNET_ROOT/dotnet restore RunTests/RunTests.csproj --source https://api.nuget.org/v3/index.json --ignore-failed-sources..."
65-
$DOTNET_ROOT/dotnet restore RunTests/RunTests.csproj --source https://api.nuget.org/v3/index.json --ignore-failed-sources
66-
echo "Running tests: $DOTNET_ROOT/dotnet run --project RunTests/RunTests.csproj -- --target $1 --runtime $4 --queue $5 --arch $6 --quarantined $7 --ef $8 --aspnetruntime $9 --aspnetref ${10} --helixTimeout ${11}"
67-
$DOTNET_ROOT/dotnet run --project RunTests/RunTests.csproj -- --target $1 --runtime $4 --queue $5 --arch $6 --quarantined $7 --ef $8 --aspnetruntime $9 --aspnetref ${10} --helixTimeout ${11}
64+
65+
echo "Restore: $DOTNET_ROOT/dotnet restore RunTests/RunTests.csproj --ignore-failed-sources"
66+
$DOTNET_ROOT/dotnet restore RunTests/RunTests.csproj --ignore-failed-sources
67+
68+
echo "Running tests: $DOTNET_ROOT/dotnet run --no-restore --project RunTests/RunTests.csproj -- --target $1 --runtime $4 --queue $5 --arch $6 --quarantined $7 --ef $8 --aspnetruntime $9 --aspnetref ${10} --helixTimeout ${11}"
69+
$DOTNET_ROOT/dotnet run --no-restore --project RunTests/RunTests.csproj -- --target $1 --runtime $4 --queue $5 --arch $6 --quarantined $7 --ef $8 --aspnetruntime $9 --aspnetref ${10} --helixTimeout ${11}
6870
exit_code=$?
6971
echo "Finished tests...exit_code=$exit_code"
7072

0 commit comments

Comments
 (0)