Fix testing 32-bit XM apps. Fixes maccore issue 884. (#4555)

* [jenkins] Only XM apps with variations are Classic/32-bit apps, so adjust ignore logic accordingly. Fixes maccore issue 884.

Fixes https://github.com/xamarin/maccore/issues/884.

* [mmp] Fix passing -stdlib=libc++ to clang.

* [tests] Fix 32-bit XM issues.

* [xharness] Add support for building 32-bit XM apps by using Xcode 9.4.

* [xharness] Since xharness can now build 32-bit mac apps, enable them by default.

* Remove debug code.

* Remove unused variable.
This commit is contained in:
Rolf Bjarne Kvinge 2018-08-03 23:06:23 +02:00 коммит произвёл Sebastien Pouliot
Родитель 5400e01178
Коммит 9d65e42f58
7 изменённых файлов: 49 добавлений и 21 удалений

Просмотреть файл

@ -75,6 +75,7 @@ namespace Xamarin.Mac.Tests
case "CoreMLLibrary":
case "ExternalAccessoryLibrary":
case "CoreSpotlightLibrary":
case "BusinessChatLibrary":
return LoadStatus.Acceptable;
}
}

Просмотреть файл

@ -728,6 +728,7 @@ partial class TestRuntime
}
#endif
#if __UNIFIED__
#if __MACOS__
public static global::CoreGraphics.CGColor GetCGColor (NSColor color)
#else
@ -745,4 +746,5 @@ partial class TestRuntime
return color.CGColor;
#endif
}
#endif // __UNIFIED__
}

Просмотреть файл

@ -214,7 +214,7 @@ namespace Introspection {
case "NSAppearanceCustomization":
switch (type.Name) {
case "NSPopover":
if (!Mac.CheckSystemVersion (10, 13)) // Was added in 10.13
if (!Mac.CheckSystemVersion (10, 13) || IntPtr.Size == 4) // Was added in 10.13
return true;
break;
case "NSApplication":

Просмотреть файл

@ -87,6 +87,7 @@ namespace xharness
// Run
public AppRunnerTarget Target { get; set; }
public string SdkRoot { get; set; }
public string SdkRoot94 { get; set; }
public string Configuration { get; set; } = "Debug";
public string LogFile { get; set; }
public string LogDirectory { get; set; } = Environment.CurrentDirectory;
@ -107,17 +108,28 @@ namespace xharness
LaunchTimeout = InWrench ? 3 : 120;
}
static string FindXcode (string path)
{
var p = path;
do {
if (p == "/") {
throw new Exception (string.Format ("Could not find Xcode.app in {0}", path));
} else if (File.Exists (Path.Combine (p, "Contents", "MacOS", "Xcode"))) {
return p;
}
p = Path.GetDirectoryName (p);
} while (true);
}
public string XcodeRoot {
get {
var p = SdkRoot;
do {
if (p == "/") {
throw new Exception (string.Format ("Could not find Xcode.app in {0}", SdkRoot));
} else if (File.Exists (Path.Combine (p, "Contents", "MacOS", "Xcode"))) {
return p;
}
p = Path.GetDirectoryName (p);
} while (true);
return FindXcode (SdkRoot);
}
}
public string Xcode94Root {
get {
return FindXcode (SdkRoot94);
}
}
@ -244,6 +256,8 @@ namespace xharness
IOS_DESTDIR = make_config ["IOS_DESTDIR"];
if (string.IsNullOrEmpty (SdkRoot))
SdkRoot = make_config ["XCODE_DEVELOPER_ROOT"];
if (string.IsNullOrEmpty (SdkRoot94))
SdkRoot94 = make_config ["XCODE94_DEVELOPER_ROOT"];
}
void AutoConfigureMac ()

Просмотреть файл

@ -20,7 +20,7 @@ namespace xharness
public bool IncludeClassicMac = true;
public bool IncludeBcl;
public bool IncludeMac = true;
public bool IncludeMac32;
public bool IncludeMac32 = true;
public bool IncludeiOS = true;
public bool IncludeiOSExtensions;
public bool IncludetvOS = true;
@ -678,10 +678,15 @@ namespace xharness
build.SpecifyConfiguration = build.ProjectConfiguration != "Debug";
RunTestTask exec;
IEnumerable<RunTestTask> execs;
var ignored_main = ignored;
if ((ignored32 || !IncludeClassicMac) && project.GenerateVariations) {
ignored_main = true; // Only if generating variations is the main project is an XM Classic app
build.RequiresXcode94 = true;
}
if (project.IsNUnitProject) {
var dll = Path.Combine (Path.GetDirectoryName (build.TestProject.Path), project.Xml.GetOutputAssemblyPath (build.ProjectPlatform, build.ProjectConfiguration).Replace ('\\', '/'));
exec = new NUnitExecuteTask (build) {
Ignored = ignored32 || !IncludeClassicMac,
Ignored = ignored_main,
TestLibrary = dll,
TestExecutable = Path.Combine (Harness.RootDirectory, "..", "packages", "NUnit.ConsoleRunner.3.5.0", "tools", "nunit3-console.exe"),
WorkingDirectory = Path.GetDirectoryName (dll),
@ -692,7 +697,7 @@ namespace xharness
execs = new [] { exec };
} else {
exec = new MacExecuteTask (build) {
Ignored = ignored32 || !IncludeClassicMac,
Ignored = ignored_main,
BCLTest = project.IsBclTest,
TestName = project.Name,
IsUnitTest = true,
@ -705,10 +710,10 @@ namespace xharness
foreach (var e in execs) {
if (project.GenerateVariations) {
Tasks.Add (CloneExecuteTask (e, project, TestPlatform.Mac_Unified, "-unified", ignored));
Tasks.Add (CloneExecuteTask (e, project, TestPlatform.Mac_Unified32, "-unified-32", ignored32));
Tasks.Add (CloneExecuteTask (e, project, TestPlatform.Mac_Unified32, "-unified-32", ignored32, true));
if (project.GenerateFull) {
Tasks.Add (CloneExecuteTask (e, project, TestPlatform.Mac_UnifiedXM45, "-unifiedXM45", ignored));
Tasks.Add (CloneExecuteTask (e, project, TestPlatform.Mac_UnifiedXM45_32, "-unifiedXM45-32", ignored32));
Tasks.Add (CloneExecuteTask (e, project, TestPlatform.Mac_UnifiedXM45_32, "-unifiedXM45-32", ignored32, true));
}
}
}
@ -808,7 +813,7 @@ namespace xharness
Tasks.AddRange (CreateRunDeviceTasks ());
}
RunTestTask CloneExecuteTask (RunTestTask task, TestProject original_project, TestPlatform platform, string suffix, bool ignore)
RunTestTask CloneExecuteTask (RunTestTask task, TestProject original_project, TestPlatform platform, string suffix, bool ignore, bool requiresXcode94 = false)
{
var build = new XBuildTask ()
{
@ -821,6 +826,7 @@ namespace xharness
};
var tp = new TestProject (Path.ChangeExtension (AddSuffixToPath (original_project.Path, suffix), "csproj"));
build.CloneTestProject (tp);
build.RequiresXcode94 = requiresXcode94;
var macExec = task as MacExecuteTask;
if (macExec != null) {
@ -2090,6 +2096,8 @@ function oninitialload ()
public Task InitialTask; // a task that's executed before this task's ExecuteAsync method.
public Task CompletedTask; // a task that's executed after this task's ExecuteAsync method.
public bool RequiresXcode94;
public void CloneTestProject (TestProject project)
{
// Don't build in the original project directory
@ -2312,6 +2320,8 @@ function oninitialload ()
protected void SetEnvironmentVariables (Process process)
{
var xcodeRoot = RequiresXcode94 ? Harness.Xcode94Root : Harness.XcodeRoot;
switch (Platform) {
case TestPlatform.iOS:
case TestPlatform.iOS_Unified:
@ -2320,7 +2330,7 @@ function oninitialload ()
case TestPlatform.iOS_TodayExtension64:
case TestPlatform.tvOS:
case TestPlatform.watchOS:
process.StartInfo.EnvironmentVariables ["MD_APPLE_SDK_ROOT"] = Harness.XcodeRoot;
process.StartInfo.EnvironmentVariables ["MD_APPLE_SDK_ROOT"] = xcodeRoot;
process.StartInfo.EnvironmentVariables ["MD_MTOUCH_SDK_ROOT"] = Path.Combine (Harness.IOS_DESTDIR, "Library", "Frameworks", "Xamarin.iOS.framework", "Versions", "Current");
process.StartInfo.EnvironmentVariables ["XBUILD_FRAMEWORK_FOLDERS_PATH"] = Path.Combine (Harness.IOS_DESTDIR, "Library", "Frameworks", "Mono.framework", "External", "xbuild-frameworks");
process.StartInfo.EnvironmentVariables ["MSBuildExtensionsPath"] = Path.Combine (Harness.IOS_DESTDIR, "Library", "Frameworks", "Mono.framework", "External", "xbuild");
@ -2331,7 +2341,7 @@ function oninitialload ()
case TestPlatform.Mac_Unified32:
case TestPlatform.Mac_UnifiedXM45:
case TestPlatform.Mac_UnifiedXM45_32:
process.StartInfo.EnvironmentVariables ["MD_APPLE_SDK_ROOT"] = Harness.XcodeRoot;
process.StartInfo.EnvironmentVariables ["MD_APPLE_SDK_ROOT"] = xcodeRoot;
process.StartInfo.EnvironmentVariables ["XBUILD_FRAMEWORK_FOLDERS_PATH"] = Path.Combine (Harness.MAC_DESTDIR, "Library", "Frameworks", "Mono.framework", "External", "xbuild-frameworks");
process.StartInfo.EnvironmentVariables ["MSBuildExtensionsPath"] = Path.Combine (Harness.MAC_DESTDIR, "Library", "Frameworks", "Mono.framework", "External", "xbuild");
process.StartInfo.EnvironmentVariables ["XamarinMacFrameworkRoot"] = Path.Combine (Harness.MAC_DESTDIR, "Library", "Frameworks", "Xamarin.Mac.framework", "Versions", "Current");
@ -2343,7 +2353,7 @@ function oninitialload ()
// XBUILD_FRAMEWORK_FOLDERS_PATH
// because these values used by both XM and XI and we can't set it to two different values at the same time.
// Any test that depends on these values should not be using 'TestPlatform.All'
process.StartInfo.EnvironmentVariables ["MD_APPLE_SDK_ROOT"] = Harness.XcodeRoot;
process.StartInfo.EnvironmentVariables ["MD_APPLE_SDK_ROOT"] = xcodeRoot;
process.StartInfo.EnvironmentVariables ["MD_MTOUCH_SDK_ROOT"] = Path.Combine (Harness.IOS_DESTDIR, "Library", "Frameworks", "Xamarin.iOS.framework", "Versions", "Current");
process.StartInfo.EnvironmentVariables ["XamarinMacFrameworkRoot"] = Path.Combine (Harness.MAC_DESTDIR, "Library", "Frameworks", "Xamarin.Mac.framework", "Versions", "Current");
process.StartInfo.EnvironmentVariables ["XAMMAC_FRAMEWORK_PATH"] = Path.Combine (Harness.MAC_DESTDIR, "Library", "Frameworks", "Xamarin.Mac.framework", "Versions", "Current");

Просмотреть файл

@ -43,6 +43,7 @@ namespace xharness
}
},
{ "sdkroot=", "Where Xcode is", (v) => harness.SdkRoot = v },
{ "sdkroot94=", "Where Xcode 9.4 is", (v) => harness.SdkRoot94 = v },
{ "target=", "Where to run the project ([ios|watchos|tvos]-[device|simulator|simulator-32|simulator-64]).", (v) => harness.Target = v.ParseAsAppRunnerTarget () },
{ "configuration=", "Which configuration to run (defaults to Debug).", (v) => harness.Configuration = v },
{ "logdirectory=", "Where to store logs.", (v) => harness.LogDirectory = v },

Просмотреть файл

@ -1371,9 +1371,9 @@ namespace Xamarin.Bundler {
}
args.Append ("-liconv -x objective-c++ ");
if (XcodeVersion.Major > 10) {
if (XcodeVersion.Major >= 10) {
// Xcode 10 doesn't ship with libstdc++
args.Append ("-stdlib:libc++");
args.Append ("-stdlib=libc++ ");
}
args.Append ("-I").Append (StringUtils.Quote (Path.Combine (GetXamMacPrefix (), "include"))).Append (' ');
if (registrarPath != null)