@@ -25,14 +25,15 @@ public class LinuxInstallerTests : IDisposable
2525 private readonly string _tmpDir ;
2626 private readonly string _contextDir ;
2727 private readonly ITestOutputHelper _outputHelper ;
28+ private readonly string _excludeLinuxArch ;
2829
2930 private bool _rpmContextInitialized = false ;
3031 private bool _debContextInitialized = false ;
3132 private bool _sharedContextInitialized = false ;
3233
3334 private const string NetStandard21RpmPackage = @"https://dotnetcli.blob.core.windows.net/dotnet/Runtime/3.1.0/netstandard-targeting-pack-2.1.0-x64.rpm" ;
3435 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" ;
3637 private const string RuntimeDepsVersion = "10.0-preview" ;
3738
3839 public static bool IncludeRpmTests => Config . TestRpmPackages ;
@@ -53,13 +54,17 @@ public LinuxInstallerTests(ITestOutputHelper outputHelper)
5354 Directory . CreateDirectory ( _tmpDir ) ;
5455 _contextDir = Path . Combine ( _tmpDir , Path . GetRandomFileName ( ) ) ;
5556 Directory . CreateDirectory ( _contextDir ) ;
57+
58+ _excludeLinuxArch = Config . Architecture == Architecture . X64 ?
59+ Architecture . Arm64 . ToString ( ) . ToLower ( ) :
60+ Architecture . X64 . ToString ( ) . ToLower ( ) ;
5661 }
5762
5863 public void Dispose ( )
5964 {
6065 try
6166 {
62- // Directory.Delete(_tmpDir, recursive: true);
67+ Directory . Delete ( _tmpDir , recursive : true ) ;
6368 }
6469 catch
6570 {
@@ -92,31 +97,46 @@ public void DebTest(string repo, string tag)
9297
9398 private void InitializeContext ( PackageType packageType )
9499 {
100+ string packageArchitecture =
101+ Config . Architecture == Architecture . X64 ?
102+ "x64" :
103+ packageType == PackageType . Rpm ?
104+ "aarch64" :
105+ "arm64" ;
106+
95107 if ( packageType == PackageType . Rpm && ! _rpmContextInitialized )
96108 {
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" ) )
100115 . ToList ( ) ;
101116
102117 foreach ( string rpmPackage in rpmPackages )
103118 {
104119 File . Copy ( rpmPackage , Path . Combine ( _contextDir , Path . GetFileName ( rpmPackage ) ) ) ;
105120 }
106121
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+ }
108126 _rpmContextInitialized = true ;
109127 }
110128 else if ( ! _debContextInitialized )
111129 {
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 ) )
114132 {
115133 File . Copy ( debPackage , Path . Combine ( _contextDir , Path . GetFileName ( debPackage ) ) ) ;
116134 }
117135
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+ }
120140 _debContextInitialized = true ;
121141 }
122142
@@ -127,7 +147,10 @@ private void InitializeContext(PackageType packageType)
127147 Directory . CreateDirectory ( nugetPackagesDir ) ;
128148 foreach ( string package in Directory . GetFiles ( Config . PackagesDirectory , "*.nupkg" , SearchOption . AllDirectories ) )
129149 {
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+ }
131154 }
132155
133156 // Copy and update NuGet.config from scenario-tests repo
@@ -147,6 +170,24 @@ private void InitializeContext(PackageType packageType)
147170 }
148171 }
149172
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+
150191 private void InsertLocalPackagesPathToNuGetConfig ( string nuGetConfig , string localPackagesPath )
151192 {
152193 XDocument doc = XDocument . Load ( nuGetConfig ) ;
@@ -247,7 +288,7 @@ private List<string> GetPackageList(string baseImage, PackageType packageType)
247288 AddPackage ( packageList , "aspnetcore-runtime-" , packageType ) ;
248289 AddPackage ( packageList , "aspnetcore-targeting-pack-" , packageType ) ;
249290 AddPackage ( packageList , "dotnet-apphost-pack-" , packageType ) ;
250- if ( Config . Architecture == "x64" )
291+ if ( Config . Architecture == Architecture . X64 )
251292 {
252293 // netstandard package exists for x64 only
253294 AddPackage ( packageList , "netstandard-targeting-pack-" , packageType ) ;
0 commit comments