diff --git a/mk/mono.mk b/mk/mono.mk
index 5275034d1751..de8ea30c2470 100644
--- a/mk/mono.mk
+++ b/mk/mono.mk
@@ -1,4 +1,4 @@
-NEEDED_MONO_VERSION := 7af64d1ebe9e9ee305cdae8ec5995c9521cbcf19
+NEEDED_MONO_VERSION := 5608fe0abb3e501c461b2979a913c0bed3fe2a6d
NEEDED_MONO_BRANCH := 2019-06
MONO_DIRECTORY := mono
diff --git a/tests/common/Configuration.cs b/tests/common/Configuration.cs
index 140cb8a475ad..eb533d1f26ec 100644
--- a/tests/common/Configuration.cs
+++ b/tests/common/Configuration.cs
@@ -315,7 +315,7 @@ public static string SourceRoot {
// might need tweaking.
if (mt_src_root == null)
#if MONOMAC
- mt_src_root = Path.GetFullPath (Path.Combine (TestAssemblyDirectory, "../../.."));
+ mt_src_root = RootPath;
#else
mt_src_root = Path.GetFullPath (Path.Combine (TestAssemblyDirectory, "../../../.."));
#endif
diff --git a/tests/common/ProductTests.cs b/tests/common/ProductTests.cs
index 6dfc3bd3d235..a4a95c701704 100644
--- a/tests/common/ProductTests.cs
+++ b/tests/common/ProductTests.cs
@@ -70,7 +70,7 @@ public void MinOSVersion (Profile profile, MachO.LoadCommands load_command, Mach
foreach (var machoFile in machoFiles) {
var fatfile = MachO.Read (machoFile);
foreach (var slice in fatfile) {
- if (slice.IsDynamicLibrary && slice.Architecture == MachO.Architectures.x86_64 && slice.Parent.size < 10240 /* this is the dummy x86_64 slice to appease Apple's notarization tooling */)
+ if (slice.IsDynamicLibrary && slice.Architecture == MachO.Architectures.x86_64 && slice.Parent != null && slice.Parent.size < 10240 /* this is the dummy x86_64 slice to appease Apple's notarization tooling */)
continue;
var any_load_command = false;
foreach (var lc in slice.load_commands) {
diff --git a/tests/mmptest/mmptest.csproj b/tests/mmptest/mmptest.csproj
index 64cc505a8b6f..8da9a3ffcde7 100644
--- a/tests/mmptest/mmptest.csproj
+++ b/tests/mmptest/mmptest.csproj
@@ -113,6 +113,9 @@
SdkVersions.cs
+
+ MachO.cs
+
diff --git a/tests/mmptest/src/CodeStrippingTests.cs b/tests/mmptest/src/CodeStrippingTests.cs
index aa6f2d57d804..fef5b3fc500a 100644
--- a/tests/mmptest/src/CodeStrippingTests.cs
+++ b/tests/mmptest/src/CodeStrippingTests.cs
@@ -4,6 +4,7 @@
using NUnit.Framework;
using Xamarin.Utils;
+using Xamarin.Tests;
namespace Xamarin.MMP.Tests
{
@@ -59,6 +60,10 @@ void StripTestCore (TI.UnifiedTestConfig test, bool debugStrips, bool releaseStr
[TestCase (false, false, false)]
public void ShouldStripMonoPosixHelper (bool? strip, bool debugStrips, bool releaseStrips)
{
+ var posixHelper = Path.Combine (Configuration.SdkRootXM, "lib", "libMonoPosixHelper.dylib");
+ if (Xamarin.MachO.GetArchitectures (posixHelper).Count < 2)
+ Assert.Ignore ($"libMonoPosixHelper.dylib is not a fat library.");
+
MMPTests.RunMMPTest (tmpDir =>
{
TI.UnifiedTestConfig test = CreateStripTestConfig (strip, tmpDir);
@@ -90,16 +95,21 @@ public void ExplictStripOption_ThirdPartyLibrary_AndWarnsIfSo (bool? strip, bool
{
MMPTests.RunMMPTest (tmpDir =>
{
- string originalLocation = Path.Combine (TI.FindRootDirectory (), MonoPosixOffset);
+ string originalLocation = Path.Combine (Configuration.SourceRoot, "tests", "test-libraries", "libtest-fat.macos.dylib");
string newLibraryLocation = Path.Combine (tmpDir, "libTest.dylib");
File.Copy (originalLocation, newLibraryLocation);
TI.UnifiedTestConfig test = CreateStripTestConfig (strip, tmpDir, $" --native-reference=\"{newLibraryLocation}\"");
test.Release = true;
- string buildOutput = TI.TestUnifiedExecutable (test).BuildOutput;
+ var testOutput = TI.TestUnifiedExecutable (test);
+ string buildOutput = testOutput.BuildOutput;
Assert.AreEqual (shouldStrip, DidAnyLipoStrip (buildOutput), "lipo usage did not match expectations");
- Assert.AreEqual (shouldStrip, buildOutput.Contains ("MM2108"), "Warning did not match expectations");
+ if (shouldStrip) {
+ testOutput.Messages.AssertWarning (2108, "libTest.dylib was stripped of architectures except x86_64 to comply with App Store restrictions. This could break existing codesigning signatures. Consider stripping the library with lipo or disabling with --optimize=-trim-architectures");
+ } else {
+ testOutput.Messages.AssertWarningCount (0);
+ }
});
}
diff --git a/tests/test-libraries/libtest-fat.macos.dylib b/tests/test-libraries/libtest-fat.macos.dylib
new file mode 100755
index 000000000000..a4d24be5c1e6
Binary files /dev/null and b/tests/test-libraries/libtest-fat.macos.dylib differ
diff --git a/tools/common/MachO.cs b/tools/common/MachO.cs
index eb95c74fcba8..5061efd8d4e1 100644
--- a/tools/common/MachO.cs
+++ b/tools/common/MachO.cs
@@ -232,10 +232,19 @@ public static IEnumerable Read (string filename)
}
} else {
var mf = file as MachOFile;
- if (mf != null)
+ if (mf != null) {
yield return mf;
- else
- throw ErrorHelper.CreateError (1604, "File of type {0} is not a MachO file ({1}).", file.GetType ().Name, filename);
+ yield break;
+ }
+
+ var sl = file as StaticLibrary;
+ if (sl != null) {
+ foreach (var obj in sl.ObjectFiles)
+ yield return obj;
+ yield break;
+ }
+
+ throw ErrorHelper.CreateError (1604, "File of type {0} is not a MachO file ({1}).", file.GetType ().Name, filename);
}
}