-
Notifications
You must be signed in to change notification settings - Fork 507
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Enable dedup optimization in FullAOT mode only #20687
Changes from 3 commits
3f0c6cf
936c053
f07f29b
c1750d9
40672df
c0c99b5
f5fc50d
ce4d456
0d42329
2d8cb06
8d6f002
9863d03
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -1917,5 +1917,79 @@ public void RaisesAppDomainUnhandledExceptionEvent (ApplePlatform platform) | |
var output = ExecuteWithMagicWordAndAssert (appExecutable, env); | ||
} | ||
} | ||
|
||
bool FindAssembly(string path, string dllName) | ||
{ | ||
try | ||
{ | ||
foreach (string file in Directory.GetFiles(path, "*.dll", SearchOption.AllDirectories)) | ||
{ | ||
if (Path.GetFileName(file).Equals(dllName, StringComparison.OrdinalIgnoreCase)) | ||
{ | ||
return true; | ||
} | ||
} | ||
} | ||
catch (Exception ex) | ||
{ | ||
Console.WriteLine($"An error occurred: {ex.Message}"); | ||
} | ||
|
||
return false; | ||
} | ||
|
||
[Test] | ||
[TestCase (ApplePlatform.iOS, "ios-arm64;")] | ||
[TestCase (ApplePlatform.MacOSX, "osx-arm64;osx-x64")] | ||
[TestCase (ApplePlatform.MacCatalyst, "maccatalyst-x64;")] | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Shouldn't we test There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Added. I didn't add simulators since we already test this on physical devices. |
||
[TestCase (ApplePlatform.TVOS, "tvos-arm64;")] | ||
public void PartialAOTExceptCoreLib (ApplePlatform platform, string runtimeIdentifiers) | ||
{ | ||
var project = "MySimpleApp"; | ||
Configuration.IgnoreIfIgnoredPlatform (platform); | ||
Configuration.AssertRuntimeIdentifiersAvailable (platform, runtimeIdentifiers); | ||
|
||
var project_path = GetProjectPath (project, runtimeIdentifiers: runtimeIdentifiers, platform: platform, out var appPath); | ||
Clean (project_path); | ||
var properties = GetDefaultProperties (runtimeIdentifiers); | ||
properties ["MtouchInterpreter"] = "-all,System.Private.CoreLib.dll"; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. nit: Just a thought. As far as I can see the added two test methods only differ by this setting, maybe it could have been an additional parameter to a single test method. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Good point, thanks. |
||
|
||
DotNet.AssertBuild (project_path, properties); | ||
|
||
Assert.True (!FindAssembly (appPath, "aot-instances.dll"), "Dedup optimization shouldn't been enabled for partial AOT compilation"); | ||
|
||
var appExecutable = GetNativeExecutable (platform, appPath); | ||
|
||
if (CanExecute (platform, runtimeIdentifiers)) { | ||
var output = ExecuteWithMagicWordAndAssert (appExecutable); | ||
} | ||
} | ||
|
||
[Test] | ||
[TestCase (ApplePlatform.iOS, "ios-arm64;")] | ||
[TestCase (ApplePlatform.MacOSX, "osx-arm64;osx-x64")] | ||
[TestCase (ApplePlatform.MacCatalyst, "maccatalyst-x64;")] | ||
[TestCase (ApplePlatform.TVOS, "tvos-arm64;")] | ||
public void PartialAOTOnlyCoreLib (ApplePlatform platform, string runtimeIdentifiers) | ||
{ | ||
var project = "MySimpleApp"; | ||
Configuration.IgnoreIfIgnoredPlatform (platform); | ||
Configuration.AssertRuntimeIdentifiersAvailable (platform, runtimeIdentifiers); | ||
|
||
var project_path = GetProjectPath (project, runtimeIdentifiers: runtimeIdentifiers, platform: platform, out var appPath); | ||
Clean (project_path); | ||
var properties = GetDefaultProperties (runtimeIdentifiers); | ||
properties ["MtouchInterpreter"] = "all,-System.Private.CoreLib.dll"; | ||
|
||
DotNet.AssertBuild (project_path, properties); | ||
|
||
Assert.True (!FindAssembly (appPath, "aot-instances.dll"), "Dedup optimization shouldn't been enabled for partial AOT compilation"); | ||
|
||
var appExecutable = GetNativeExecutable (platform, appPath); | ||
|
||
if (CanExecute (platform, runtimeIdentifiers)) { | ||
var output = ExecuteWithMagicWordAndAssert (appExecutable); | ||
} | ||
} | ||
} | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Any reason to ignore any exceptions? Wouldn't it be better to just let exceptions flow, which would eventually fail the test? This seems like it could end up hiding problems at some point.