Skip to content

Commit b3e1a81

Browse files
authored
Provide target framework as an envvar to tests. (#84)
1 parent 09aa2d6 commit b3e1a81

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

Turkey/Program.cs

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -85,6 +85,7 @@ public static async Task<int> Run(string testRoot,
8585
Cleaner cleaner = new Cleaner();
8686

8787
DotNet dotnet = new DotNet();
88+
Version runtimeVersion = dotnet.LatestRuntimeVersion;
8889

8990
TestOutput defaultOutput = new TestOutputFormats.NewOutput();
9091

@@ -101,19 +102,21 @@ public static async Task<int> Run(string testRoot,
101102
var sanitizer = new EnvironmentVariableSanitizer();
102103
var envVars = sanitizer.SanitizeCurrentEnvironmentVariables();
103104

104-
var traits = CreateTraits(dotnet.LatestRuntimeVersion, dotnet.LatestSdkVersion, platformIds, dotnet.IsMonoRuntime(dotnet.LatestRuntimeVersion), trait);
105+
var traits = CreateTraits(runtimeVersion, dotnet.LatestSdkVersion, platformIds, dotnet.IsMonoRuntime(runtimeVersion), trait);
105106
Console.WriteLine($"Tests matching these traits will be skipped: {string.Join(", ", traits.OrderBy(s => s))}.");
106107

108+
envVars["TestTargetFramework"] = $"net{runtimeVersion.Major}.{runtimeVersion.Minor}";
109+
107110
SystemUnderTest system = new SystemUnderTest(
108111
dotnet,
109-
runtimeVersion: dotnet.LatestRuntimeVersion,
112+
runtimeVersion: runtimeVersion,
110113
sdkVersion: dotnet.LatestSdkVersion,
111114
platformIds: platformIds,
112115
environmentVariables: envVars,
113116
traits: traits
114117
);
115118

116-
Version packageVersion = dotnet.LatestRuntimeVersion;
119+
Version packageVersion = runtimeVersion;
117120
string nuGetConfig = await GenerateNuGetConfigIfNeededAsync(additionalFeed, packageVersion,
118121
useSourceBuildNuGetConfig: false);
119122
if (verbose && nuGetConfig != null)

0 commit comments

Comments
 (0)