Skip to content

Commit c3d462b

Browse files
Remove source build support for test prereqs tarballs (#45544)
1 parent 77d763f commit c3d462b

File tree

6 files changed

+14
-49
lines changed

6 files changed

+14
-49
lines changed

src/SourceBuild/content/test/Microsoft.DotNet.SourceBuild.Tests/Config.cs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,6 @@ internal static class Config
2424
public static string? LicenseScanPath => (string)AppContext.GetData(ConfigSwitchPrefix + nameof(LicenseScanPath))!;
2525
public static string? MsftSdkTarballPath => (string)AppContext.GetData(ConfigSwitchPrefix + nameof(MsftSdkTarballPath))!;
2626
public static string? PoisonReportPath => (string)AppContext.GetData(ConfigSwitchPrefix + nameof(PoisonReportPath))!;
27-
public static string? PrereqsPath => (string)AppContext.GetData(ConfigSwitchPrefix + nameof(PrereqsPath))!;
2827
public static string? SdkTarballPath => (string)AppContext.GetData(ConfigSwitchPrefix + nameof(SdkTarballPath))!;
2928
public static string? SourceBuiltArtifactsPath => (string)AppContext.GetData(ConfigSwitchPrefix + nameof(SourceBuiltArtifactsPath))!;
3029

src/SourceBuild/content/test/Microsoft.DotNet.SourceBuild.Tests/DotNetHelper.cs

Lines changed: 9 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -48,40 +48,24 @@ public DotNetHelper(ITestOutputHelper outputHelper)
4848

4949
private static void InitNugetConfig()
5050
{
51-
bool useLocalPackages = !string.IsNullOrEmpty(Config.PrereqsPath);
52-
string nugetConfigPrefix = useLocalPackages ? "local" : "online";
51+
bool useCustomPackages = !string.IsNullOrEmpty(Config.CustomPackagesPath);
52+
string nugetConfigPrefix = useCustomPackages ? "custom" : "default";
5353
string nugetConfigPath = Path.Combine(ProjectsDirectory, "NuGet.Config");
5454
File.Copy(
5555
Path.Combine(BaselineHelper.GetAssetsDirectory(), $"{nugetConfigPrefix}.NuGet.Config"),
5656
nugetConfigPath);
5757

58-
if (useLocalPackages)
58+
if (useCustomPackages)
5959
{
60-
// When using local packages this feed is always required. It contains packages that are
61-
// not produced by source-build but are required by the various project templates.
62-
if (!Directory.Exists(Config.PrereqsPath))
60+
// This package feed is optional. You can use an alternative feed of dependency packages which can be
61+
// required in sandboxed scenarios where public feeds need to be avoided.
62+
if (!Directory.Exists(Config.CustomPackagesPath))
6363
{
64-
throw new InvalidOperationException(
65-
$"Prereqs path '{Config.PrereqsPath}' specified via /p:SourceBuildTestsPrereqsPath='...' does not exist.");
64+
throw new ArgumentException($"Specified CustomPackagesPath '{Config.CustomPackagesPath}' does not exist.");
6665
}
6766

68-
string nugetConfig = File.ReadAllText(nugetConfigPath);
69-
nugetConfig = nugetConfig.Replace("SMOKE_TEST_PACKAGE_FEED", Config.PrereqsPath);
70-
71-
// This package feed is optional. You can use an additional feed of source-built packages to run the
72-
// smoke-tests as offline as possible.
73-
if (Config.CustomPackagesPath != null)
74-
{
75-
if (!Directory.Exists(Config.CustomPackagesPath))
76-
{
77-
throw new ArgumentException($"Specified --with-packages {Config.CustomPackagesPath} does not exist.");
78-
}
79-
nugetConfig = nugetConfig.Replace("CUSTOM_PACKAGE_FEED", Config.CustomPackagesPath);
80-
}
81-
else
82-
{
83-
nugetConfig = string.Join(Environment.NewLine, nugetConfig.Split(new[] { '\r', '\n' }, StringSplitOptions.RemoveEmptyEntries).Where(s => !s.Contains("CUSTOM_PACKAGE_FEED")).ToArray());
84-
}
67+
string nugetConfig = File.ReadAllText(nugetConfigPath)
68+
.Replace("CUSTOM_PACKAGE_FEED", Config.CustomPackagesPath);
8569
File.WriteAllText(nugetConfigPath, nugetConfig);
8670
}
8771
}

src/SourceBuild/content/test/Microsoft.DotNet.SourceBuild.Tests/Microsoft.DotNet.SourceBuild.Tests.csproj

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -78,9 +78,6 @@
7878
Condition="'$(EnablePoison)' == 'true'">
7979
<Value>$(PoisonUsageReportFile)</Value>
8080
</RuntimeHostConfigurationOption>
81-
<RuntimeHostConfigurationOption Include="$(MSBuildProjectName).PrereqsPath">
82-
<Value>$(SourceBuildTestsPrereqsPath)</Value>
83-
</RuntimeHostConfigurationOption>
8481
<RuntimeHostConfigurationOption Include="$(MSBuildProjectName).SdkTarballPath">
8582
<Value>$(SdkTarballPath)</Value>
8683
</RuntimeHostConfigurationOption>
Lines changed: 5 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,9 @@
11
# Source Build Smoke Tests
22

3-
Run these tests via `build.sh --test`
3+
Run these tests via `build.sh -sb --test`
44

5-
The following properties are automatically available during test execution but can be overwritten:
6-
7-
- PoisonUsageReportFile
8-
- SdkTarballPath
9-
- SourceBuiltArtifactsPath
10-
11-
Optional msbuild properties:
12-
13-
- MsftSdkTarballPath
14-
- SourceBuildTestsConsoleVerbosity
15-
- SourceBuildTestsCustomSourceBuiltPackagesPath
16-
- SourceBuildTestsExcludeOmniSharpTests
17-
- SourceBuildTestsLicenseScanPath
18-
- SourceBuildTestsPrereqsPath
19-
20-
Make sure to rebuild the test project when changing one of those values.
5+
See the [Microsoft.DotNet.SourceBuild.Tests.csproj](Microsoft.DotNet.SourceBuild.Tests.csproj) for the available
6+
RuntimeHostConfigurationOptions that can be used to configure the tests.
217

228
## Dependencies
239

@@ -31,5 +17,5 @@ The following programs are used by some tests:
3117
## Prereq Packages
3218

3319
Some prerelease scenarios, usually security updates, require non-source-built packages which are not publicly available.
34-
Specify the directory where these packages can be found via the `SourceBuildTestsPrereqsPath` msbuild property when running tests via `build.sh ---test` e.g.
35-
`/p:SourceBuildTestsPrereqsPath=prereqs/packages/smoke-test-prereqs`.
20+
You can specify a custom nuget feed for where these packages can be loaded from via the `SourceBuildTestsCustomSourceBuiltPackagesPath`
21+
msbuild property when running tests via `build.sh ---test` e.g. `/p:SourceBuildTestsCustomSourceBuiltPackagesPath=<FEED URL OR LOCAL PATH>`.
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
<configuration>
22
<packageSources>
33
<clear />
4-
<add key="smoke-test-prereqs" value="SMOKE_TEST_PACKAGE_FEED" />
54
<add key="custom-packages" value="CUSTOM_PACKAGE_FEED" />
65
</packageSources>
76
</configuration>

0 commit comments

Comments
 (0)