Also add tests. Fixes https://github.com/xamarin/xamarin-macios/issues/12219.
This commit is contained in:
Родитель
c5e60a1462
Коммит
9dcc4d07b4
|
@ -729,6 +729,12 @@ mono_jit_exec (MonoDomain * domain, MonoAssembly * assembly, int argc, const cha
|
|||
|
||||
char *assemblyPath = xamarin_bridge_get_assembly_location (assembly->gchandle);
|
||||
|
||||
if (argc > 0) {
|
||||
// The first argument is to the native executable, which we don't want to pass on to native code.
|
||||
argc--;
|
||||
argv = &argv [1];
|
||||
}
|
||||
|
||||
LOG_CORECLR (stderr, "mono_jit_exec (%p, %p, %i, %p) => EXECUTING %s\n", domain, assembly, argc, argv, assemblyPath);
|
||||
for (int i = 0; i < argc; i++) {
|
||||
LOG_CORECLR (stderr, " Argument #%i: %s\n", i + 1, argv [i]);
|
||||
|
|
|
@ -13,7 +13,7 @@ namespace MySimpleApp
|
|||
|
||||
Console.WriteLine (Environment.GetEnvironmentVariable ("MAGIC_WORD"));
|
||||
|
||||
return 0;
|
||||
return args.Length;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -2,5 +2,8 @@
|
|||
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
||||
<plist version="1.0">
|
||||
<dict>
|
||||
<!-- We need this because we'd otherwise default to the latest macOS version we support (currently 12.0), and we'll want to execute on earlier versions -->
|
||||
<key>LSMinimumSystemVersion</key>
|
||||
<string>11.0</string>
|
||||
</dict>
|
||||
</plist>
|
||||
|
|
|
@ -2,6 +2,7 @@ using System;
|
|||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Runtime.InteropServices;
|
||||
using System.Text;
|
||||
|
||||
using Mono.Cecil;
|
||||
|
@ -567,7 +568,7 @@ namespace Xamarin.Tests {
|
|||
[Test]
|
||||
[TestCase (ApplePlatform.MacOSX, "osx-x64")]
|
||||
[TestCase (ApplePlatform.MacOSX, "osx-arm64")]
|
||||
[TestCase (ApplePlatform.MacOSX, "osx-arm64;osx-x64")]
|
||||
// [TestCase (ApplePlatform.MacOSX, "osx-arm64;osx-x64")] // https://github.com/xamarin/xamarin-macios/issues/12265
|
||||
public void BuildCoreCLR (ApplePlatform platform, string runtimeIdentifiers)
|
||||
{
|
||||
var project = "MySimpleApp";
|
||||
|
@ -581,8 +582,22 @@ namespace Xamarin.Tests {
|
|||
properties ["UseMonoRuntime"] = "false";
|
||||
var rv = DotNet.AssertBuild (project_path, properties);
|
||||
|
||||
AssertThatLinkerExecuted (rv);
|
||||
var appPathRuntimeIdentifier = runtimeIdentifiers.IndexOf (';') >= 0 ? "" : runtimeIdentifiers;
|
||||
var appPath = Path.Combine (Path.GetDirectoryName (project_path), "bin", "Debug", "net6.0-macos", appPathRuntimeIdentifier, project + ".app");
|
||||
var appPath = Path.Combine (Path.GetDirectoryName (project_path), "bin", "Debug", platform.ToFramework (), appPathRuntimeIdentifier, project + ".app");
|
||||
var infoPlistPath = GetInfoPListPath (platform, appPath);
|
||||
Assert.That (infoPlistPath, Does.Exist, "Info.plist");
|
||||
var infoPlist = PDictionary.FromFile (infoPlistPath);
|
||||
Assert.AreEqual ("com.xamarin.mysimpleapp", infoPlist.GetString ("CFBundleIdentifier").Value, "CFBundleIdentifier");
|
||||
Assert.AreEqual ("MySimpleApp", infoPlist.GetString ("CFBundleDisplayName").Value, "CFBundleDisplayName");
|
||||
Assert.AreEqual ("3.14", infoPlist.GetString ("CFBundleVersion").Value, "CFBundleVersion");
|
||||
Assert.AreEqual ("3.14", infoPlist.GetString ("CFBundleShortVersionString").Value, "CFBundleShortVersionString");
|
||||
|
||||
var appExecutable = Path.Combine (appPath, "Contents", "MacOS", Path.GetFileNameWithoutExtension (project_path));
|
||||
Assert.That (appExecutable, Does.Exist, "There is an executable");
|
||||
if (!(runtimeIdentifiers == "osx-arm64" && RuntimeInformation.ProcessArchitecture == Architecture.X64))
|
||||
ExecuteWithMagicWordAndAssert (appExecutable);
|
||||
|
||||
var createdump = Path.Combine (appPath, "Contents", "MonoBundle", "createdump");
|
||||
Assert.That (createdump, Does.Exist, "createdump existence");
|
||||
}
|
||||
|
|
Загрузка…
Ссылка в новой задаче