@@ -25,14 +25,15 @@ public class LinuxInstallerTests : IDisposable
25
25
private readonly string _tmpDir ;
26
26
private readonly string _contextDir ;
27
27
private readonly ITestOutputHelper _outputHelper ;
28
+ private readonly string _excludeLinuxArch ;
28
29
29
30
private bool _rpmContextInitialized = false ;
30
31
private bool _debContextInitialized = false ;
31
32
private bool _sharedContextInitialized = false ;
32
33
33
34
private const string NetStandard21RpmPackage = @"https://dotnetcli.blob.core.windows.net/dotnet/Runtime/3.1.0/netstandard-targeting-pack-2.1.0-x64.rpm" ;
34
35
private const string NetStandard21DebPackage = @"https://dotnetcli.blob.core.windows.net/dotnet/Runtime/3.1.0/netstandard-targeting-pack-2.1.0-x64.deb" ;
35
- private const string RuntimeDepsRepo = "mcr.microsoft.com/dotnet/nightly/ runtime-deps" ;
36
+ private const string RuntimeDepsRepo = "mcr.microsoft.com/dotnet/runtime-deps" ;
36
37
private const string RuntimeDepsVersion = "10.0-preview" ;
37
38
38
39
public static bool IncludeRpmTests => Config . TestRpmPackages ;
@@ -53,13 +54,17 @@ public LinuxInstallerTests(ITestOutputHelper outputHelper)
53
54
Directory . CreateDirectory ( _tmpDir ) ;
54
55
_contextDir = Path . Combine ( _tmpDir , Path . GetRandomFileName ( ) ) ;
55
56
Directory . CreateDirectory ( _contextDir ) ;
57
+
58
+ _excludeLinuxArch = Config . Architecture == Architecture . X64 ?
59
+ Architecture . Arm64 . ToString ( ) . ToLower ( ) :
60
+ Architecture . X64 . ToString ( ) . ToLower ( ) ;
56
61
}
57
62
58
63
public void Dispose ( )
59
64
{
60
65
try
61
66
{
62
- // Directory.Delete(_tmpDir, recursive: true);
67
+ Directory . Delete ( _tmpDir , recursive : true ) ;
63
68
}
64
69
catch
65
70
{
@@ -92,31 +97,46 @@ public void DebTest(string repo, string tag)
92
97
93
98
private void InitializeContext ( PackageType packageType )
94
99
{
100
+ string packageArchitecture =
101
+ Config . Architecture == Architecture . X64 ?
102
+ "x64" :
103
+ packageType == PackageType . Rpm ?
104
+ "aarch64" :
105
+ "arm64" ;
106
+
95
107
if ( packageType == PackageType . Rpm && ! _rpmContextInitialized )
96
108
{
97
- // For rpm enumerate RPM packages, excluding those that contain ".cm." in the name
98
- List < string > rpmPackages = Directory . GetFiles ( Config . AssetsDirectory , "*.rpm" , SearchOption . AllDirectories )
99
- . Where ( p => ! Path . GetFileName ( p ) . Contains ( "-cm." ) && ! Path . GetFileName ( p ) . EndsWith ( "azl.rpm" ) )
109
+ // Copy all applicable RPM packages, excluding Mariner and Azure Linux copies
110
+ List < string > rpmPackages =
111
+ Directory . GetFiles ( Config . AssetsDirectory , $ "*-{ packageArchitecture } *.rpm", SearchOption . AllDirectories )
112
+ . Where ( p => ! Path . GetFileName ( p ) . Contains ( "-cm." ) &&
113
+ ! Path . GetFileName ( p ) . Contains ( "-azl-" ) &&
114
+ ! Path . GetFileName ( p ) . EndsWith ( "azl.rpm" ) )
100
115
. ToList ( ) ;
101
116
102
117
foreach ( string rpmPackage in rpmPackages )
103
118
{
104
119
File . Copy ( rpmPackage , Path . Combine ( _contextDir , Path . GetFileName ( rpmPackage ) ) ) ;
105
120
}
106
121
107
- DownloadFileAsync ( NetStandard21RpmPackage , Path . Combine ( _contextDir , Path . GetFileName ( NetStandard21RpmPackage ) ) ) . Wait ( ) ;
122
+ if ( Config . Architecture == Architecture . X64 )
123
+ {
124
+ DownloadFileAsync ( NetStandard21RpmPackage , Path . Combine ( _contextDir , Path . GetFileName ( NetStandard21RpmPackage ) ) ) . Wait ( ) ;
125
+ }
108
126
_rpmContextInitialized = true ;
109
127
}
110
128
else if ( ! _debContextInitialized )
111
129
{
112
- // Copy all DEB packages as well
113
- foreach ( string debPackage in Directory . GetFiles ( Config . AssetsDirectory , " *.deb", SearchOption . AllDirectories ) )
130
+ // Copy all applicable DEB packages
131
+ foreach ( string debPackage in Directory . GetFiles ( Config . AssetsDirectory , $ "*- { packageArchitecture } *.deb", SearchOption . AllDirectories ) )
114
132
{
115
133
File . Copy ( debPackage , Path . Combine ( _contextDir , Path . GetFileName ( debPackage ) ) ) ;
116
134
}
117
135
118
- // Download NetStandard 2.1 packages
119
- DownloadFileAsync ( NetStandard21DebPackage , Path . Combine ( _contextDir , Path . GetFileName ( NetStandard21DebPackage ) ) ) . Wait ( ) ;
136
+ if ( Config . Architecture == Architecture . X64 )
137
+ {
138
+ DownloadFileAsync ( NetStandard21DebPackage , Path . Combine ( _contextDir , Path . GetFileName ( NetStandard21DebPackage ) ) ) . Wait ( ) ;
139
+ }
120
140
_debContextInitialized = true ;
121
141
}
122
142
@@ -127,7 +147,10 @@ private void InitializeContext(PackageType packageType)
127
147
Directory . CreateDirectory ( nugetPackagesDir ) ;
128
148
foreach ( string package in Directory . GetFiles ( Config . PackagesDirectory , "*.nupkg" , SearchOption . AllDirectories ) )
129
149
{
130
- File . Copy ( package , Path . Combine ( nugetPackagesDir , Path . GetFileName ( package ) ) ) ;
150
+ if ( ShouldCopyPackage ( package . ToLower ( ) ) )
151
+ {
152
+ File . Copy ( package , Path . Combine ( nugetPackagesDir , Path . GetFileName ( package ) ) ) ;
153
+ }
131
154
}
132
155
133
156
// Copy and update NuGet.config from scenario-tests repo
@@ -147,6 +170,24 @@ private void InitializeContext(PackageType packageType)
147
170
}
148
171
}
149
172
173
+ private bool ShouldCopyPackage ( string package )
174
+ {
175
+ if ( package . Contains ( ".osx-" ) ||
176
+ package . Contains ( ".win-" ) ||
177
+ package . Contains ( ".linux-musl-" ) ||
178
+ package . Contains ( ".linux-bionic-" ) ||
179
+ package . Contains ( ".mono." ) ||
180
+ package . Contains ( "symbols" ) ||
181
+ package . Contains ( "vs.redist" ) ||
182
+ package . Contains ( ".linux-arm." ) ||
183
+ package . Contains ( $ ".linux-{ _excludeLinuxArch } .") )
184
+ {
185
+ return false ;
186
+ }
187
+
188
+ return true ;
189
+ }
190
+
150
191
private void InsertLocalPackagesPathToNuGetConfig ( string nuGetConfig , string localPackagesPath )
151
192
{
152
193
XDocument doc = XDocument . Load ( nuGetConfig ) ;
@@ -247,7 +288,7 @@ private List<string> GetPackageList(string baseImage, PackageType packageType)
247
288
AddPackage ( packageList , "aspnetcore-runtime-" , packageType ) ;
248
289
AddPackage ( packageList , "aspnetcore-targeting-pack-" , packageType ) ;
249
290
AddPackage ( packageList , "dotnet-apphost-pack-" , packageType ) ;
250
- if ( Config . Architecture == "x64" )
291
+ if ( Config . Architecture == Architecture . X64 )
251
292
{
252
293
// netstandard package exists for x64 only
253
294
AddPackage ( packageList , "netstandard-targeting-pack-" , packageType ) ;
0 commit comments