Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions src/Foundation/NSObject.mac.cs
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,7 @@ public partial class NSObject {
static IntPtr sw = Dlfcn.dlopen (Constants.SharedWithYouLibrary, 1);
static IntPtr swc = Dlfcn.dlopen (Constants.SharedWithYouCoreLibrary, 1);
static IntPtr th = Dlfcn.dlopen (Constants.ThreadNetworkLibrary, 1);
static IntPtr ni = Dlfcn.dlopen (Constants.NearbyInteractionLibrary, 1);

#if !NET
[Obsolete ("Use PlatformAssembly for easier code sharing across platforms.")]
Expand Down
2 changes: 1 addition & 1 deletion src/homekit.cs
Original file line number Diff line number Diff line change
Expand Up @@ -175,7 +175,7 @@ partial interface HMAccessory {
string FirmwareVersion { get; }

[NullAllowed]
[Mac (13,0), iOS (16,1), MacCatalyst (16,1), Watch (9,1), TV (16,1)]
[Mac (13, 0), iOS (16, 1), MacCatalyst (16, 1), Watch (9, 1), TV (16, 1)]
[Export ("matterNodeID", ArgumentSemantic.Copy)]
NSNumber MatterNodeId { get; }

Expand Down
39 changes: 36 additions & 3 deletions tests/common/TestRuntime.cs
Original file line number Diff line number Diff line change
Expand Up @@ -113,11 +113,21 @@ public static Version GetSDKVersion ()
return new Version (major, minor, build);
}

static bool? is_in_ci;
public static bool IsInCI {
get {
if (!is_in_ci.HasValue) {
var in_ci = !string.IsNullOrEmpty (Environment.GetEnvironmentVariable ("BUILD_REVISION"));
in_ci |= !string.IsNullOrEmpty (Environment.GetEnvironmentVariable ("BUILD_SOURCEVERSION")); // set by Azure DevOps
is_in_ci = in_ci;
}
return is_in_ci.Value;
}
}

public static void IgnoreInCI (string message)
{
var in_ci = !string.IsNullOrEmpty (Environment.GetEnvironmentVariable ("BUILD_REVISION"));
in_ci |= !string.IsNullOrEmpty (Environment.GetEnvironmentVariable ("BUILD_SOURCEVERSION")); // set by Azure DevOps
if (!in_ci) {
if (!IsInCI) {
Console.WriteLine ($"Not ignoring test ('{message}'), because not running in CI. BUILD_REVISION={Environment.GetEnvironmentVariable ("BUILD_REVISION")} BUILD_SOURCEVERSION={Environment.GetEnvironmentVariable ("BUILD_SOURCEVERSION")}");
return;
}
Expand Down Expand Up @@ -169,6 +179,29 @@ public static void AssertNotDevice (string message = "This test does not run on
#endif
}

public static void AssertDesktop (string message = "This test only runs on Desktops (macOS or MacCatalyst).")
{
#if __MACOS__ || __MACCATALYST__
return;
#endif
NUnit.Framework.Assert.Ignore (message);
}

public static void AssertNotDesktop (string message = "This test does not run on Desktops (macOS or MacCatalyst).")
{
#if __MACOS__ || __MACCATALYST__
NUnit.Framework.Assert.Ignore (message);
#endif
}

public static void AssertNotX64Desktop (string message = "This test does not run on x64 desktops.")
{
#if __MACOS__ || __MACCATALYST__
if (!IsARM64)
NUnit.Framework.Assert.Ignore (message);
#endif
}

public static void AssertNotARM64Desktop (string message = "This test does not run on an ARM64 desktop.")
{
#if __MACOS__ || __MACCATALYST__
Expand Down
4 changes: 4 additions & 0 deletions tests/introspection/ApiCtorInitTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -134,6 +134,10 @@ protected virtual bool Skip (Type type)
return true;
case "HMMatterRequestHandler": // got removed and the current API throws an exception at run time.
return true;
#if __MACCATALYST__
case "PKIdentityButton":
return true;
#endif
}

#if !NET
Expand Down
24 changes: 22 additions & 2 deletions tests/introspection/ApiSelectorTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -380,9 +380,9 @@ protected virtual bool Skip (Type type, string selectorName)
return true;
}
break;
#if __WATCHOS__
#if (__WATCHOS__ || __MACOS__ || __MACCATALYST__)
case "AVPlayerItem":
switch (selectorName) {
switch (selectorName) { // comes from AVPlayerItem+MPAdditions.h
case "nowPlayingInfo":
case "setNowPlayingInfo:":
return TestRuntime.IsSimulatorOrDesktop;
Expand Down Expand Up @@ -939,6 +939,26 @@ protected virtual bool Skip (Type type, string selectorName)
return true;
break;
}
#endif
break;
case "SKAdImpression":
#if __MACCATALYST__
switch (selectorName) {
case "initWithSourceAppStoreItemIdentifier:advertisedAppStoreItemIdentifier:adNetworkIdentifier:adCampaignIdentifier:adImpressionIdentifier:timestamp:signature:version:":
if (TestRuntime.CheckXcodeVersion (14, 0))
return true;
break;
}
#endif
break;
case "EKParticipant":
#if __MACCATALYST__
switch (selectorName) {
case "ABRecordWithAddressBook:": // Deprecated in 13.1
if (TestRuntime.CheckXcodeVersion (14, 0))
return true;
break;
}
#endif
break;
case "SWRemoveParticipantAlertController":
Expand Down
6 changes: 5 additions & 1 deletion tests/introspection/ApiTypoTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -1072,8 +1072,12 @@ public void ConstantsCheck ()
Assert.True (CheckLibrary (s), fi.Name);
break;
#endif
case "ChipLibrary": // Chip is removed entirely beginning Xcode 14
if (!TestRuntime.CheckXcodeVersion (14, 0))
if (TestRuntime.IsDevice)
Assert.True (CheckLibrary (s), fi.Name);
break;
#if !__MACOS__
case "ChipLibrary":
case "ThreadNetworkLibrary":
case "MediaSetupLibrary":
case "MLComputeLibrary":
Expand Down
1 change: 1 addition & 0 deletions tests/introspection/Mac/MacApiCtorInitTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,7 @@ protected override bool Skip (Type type)
case "Foundation.NSUnitPressure": // -init should never be called on NSUnit!
case "Foundation.NSUnitSpeed": // -init should never be called on NSUnit!
case "MonoMac.EventKit.EKParticipant":
case "EventKit.EKCalendarItem":
case "EventKit.EKParticipant":
case "XamCore.CoreImage.CISampler":
case "CoreImage.CISampler":
Expand Down
27 changes: 26 additions & 1 deletion tests/introspection/iOS/iOSApiProtocolTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -205,7 +205,6 @@ protected override bool Skip (Type type, string protocolName)
#if __MACCATALYST__
case "BCChatButton":
case "PKAddPassButton":
case "PKPaymentButton":
case "UIButton":
case "UIControl":
case "UISegmentedControl":
Expand All @@ -222,6 +221,32 @@ protected override bool Skip (Type type, string protocolName)
if (protocolName == "UIContextMenuInteractionDelegate")
return !TestRuntime.CheckXcodeVersion (12, 0);
break;

// We have to special case the following PKPayment* in MacCatalyst
// since it gets all of these via inheritance from UIView
case "PKPaymentButton":
case "PKPaymentAuthorizationViewController":
switch (protocolName) {
case "UIUserActivityRestoring":
case "UIAppearanceContainer":
case "UIFocusItem":
case "UICoordinateSpace":
case "UIPopoverPresentationControllerSourceItem":
case "UIContextMenuInteractionDelegate":
case "UIFocusItemContainer":
case "UITraitEnvironment":
case "UIActivityItemsConfigurationProviding":
case "UIResponderStandardEditActions":
case "UILargeContentViewerItem":
case "UIDynamicItem":
case "UIAppearance":
case "UIAccessibilityContentSizeCategoryImageAdjusting":
case "UIContentContainer":
if (TestRuntime.CheckXcodeVersion (14, 0))
return true;
break;
}
break;
#endif
}

Expand Down
14 changes: 11 additions & 3 deletions tests/monotouch-test/AppKit/NSTextInputClient.cs
Original file line number Diff line number Diff line change
Expand Up @@ -82,8 +82,13 @@ public void NSTextInputClient_ShouldGetFirstRect ()
NSRange range;
var rect = textView.GetFirstRect (new NSRange (12, 18), out range);

Assert.AreEqual (rect, new CGRect (0, 0, 12, 14), "NSTextInputClient_ShouldGetFirstRect - Returned wrong rect");
Assert.AreEqual (range, new NSRange (10, 4), "NSTextInputClient_ShouldGetFirstRect - Returned wrong Range");
if (TestRuntime.CheckXcodeVersion (14, 0)) {
Assert.AreEqual (rect, new CGRect (0, 0, 0, 14), "NSTextInputClient_ShouldGetFirstRect - Returned wrong rect");
Assert.AreEqual (range, new NSRange (12, 0), "NSTextInputClient_ShouldGetFirstRect - Returned wrong Range");
} else {
Assert.AreEqual (rect, new CGRect (0, 0, 12, 14), "NSTextInputClient_ShouldGetFirstRect - Returned wrong rect");
Assert.AreEqual (range, new NSRange (10, 4), "NSTextInputClient_ShouldGetFirstRect - Returned wrong Range");
}
}

[Test]
Expand All @@ -101,7 +106,10 @@ public void NSTextInputClient_ShouldGetFractionofDistanceThroughGlyph ()
[Test]
public void NSTextInputClient_ShouldGetBaselineDelta ()
{
Assert.IsTrue (textView.GetBaselineDelta (4) == 11, "NSTextInputClient_ShouldGetBaselineDelta - Returned wrong baseline delta value");
if (TestRuntime.CheckXcodeVersion (14, 0))
Assert.IsTrue (textView.GetBaselineDelta (4) == 0, "NSTextInputClient_ShouldGetBaselineDelta - Returned wrong baseline delta value");
else
Assert.IsTrue (textView.GetBaselineDelta (4) == 11, "NSTextInputClient_ShouldGetBaselineDelta - Returned wrong baseline delta value");
}

[Test]
Expand Down
2 changes: 2 additions & 0 deletions tests/monotouch-test/CoreBluetooth/CentralManagerTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,8 @@ public override void DisconnectedPeripheral (CBCentralManager central, CBPeriphe
[SetUp]
public void SetUp ()
{
if (TestRuntime.IsInCI && TestRuntime.CheckXcodeVersion (14, 0))
TestRuntime.AssertNotDesktop (); // Looks like this particular test doesn't like Desktop + M1 bot machines
// iOS 13 and friends require bluetooth permission
if (TestRuntime.CheckXcodeVersion (11, 0))
TestRuntime.CheckBluetoothPermission (true);
Expand Down
12 changes: 10 additions & 2 deletions tests/monotouch-test/EventKit/CalendarTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,11 @@ public void FromEventStore ()
Assert.Null (c.Source, "Source");
Assert.False (c.Subscribed, "Subscribed");
#if MONOMAC || __MACCATALYST__
Assert.That (c.SupportedEventAvailabilities, Is.EqualTo (EKCalendarEventAvailability.Busy | EKCalendarEventAvailability.Free), "SupportedEventAvailabilities");
if (TestRuntime.CheckXcodeVersion (14, 0))
Assert.That (c.SupportedEventAvailabilities, Is.EqualTo (EKCalendarEventAvailability.None), "SupportedEventAvailabilities");
else
Assert.That (c.SupportedEventAvailabilities, Is.EqualTo (EKCalendarEventAvailability.Busy | EKCalendarEventAvailability.Free), "SupportedEventAvailabilities");

Assert.That (c.Title, Is.EqualTo (string.Empty), "Title");
#else
Assert.That (c.SupportedEventAvailabilities, Is.EqualTo (EKCalendarEventAvailability.None), "SupportedEventAvailabilities");
Expand Down Expand Up @@ -120,7 +124,11 @@ public void FromEventStoreWithReminder ()
Assert.Null (c.Source, "Source");
Assert.False (c.Subscribed, "Subscribed");
#if MONOMAC || __MACCATALYST__
Assert.That (c.SupportedEventAvailabilities, Is.EqualTo (EKCalendarEventAvailability.Busy | EKCalendarEventAvailability.Free), "SupportedEventAvailabilities");
if (TestRuntime.CheckXcodeVersion (14, 0))
Assert.That (c.SupportedEventAvailabilities, Is.EqualTo (EKCalendarEventAvailability.None), "SupportedEventAvailabilities");
else
Assert.That (c.SupportedEventAvailabilities, Is.EqualTo (EKCalendarEventAvailability.Busy | EKCalendarEventAvailability.Free), "SupportedEventAvailabilities");

Assert.That (c.Title, Is.EqualTo (string.Empty), "Title");
#else
Assert.That (c.SupportedEventAvailabilities, Is.EqualTo (EKCalendarEventAvailability.None), "SupportedEventAvailabilities");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,8 @@ public class HKAppleWalkingSteadinessTest {
[SetUp]
public void SetUp ()
{
#if MONOMAC
TestRuntime.AssertXcodeVersion (14, 0);
#else
TestRuntime.AssertNotDesktop (); // Only runs on iOS Devices or Simulators, which makes sense `Apple Walking Steadiness`.
TestRuntime.AssertXcodeVersion (13, 0);
#endif
}

[Test]
Expand Down
1 change: 1 addition & 0 deletions tests/monotouch-test/MetalPerformanceShaders/MnistTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ public void IsSupported ()
TestRuntime.AssertNotSimulator ("Fails with 'Objective-C exception thrown. Name: NSInvalidArgumentException Reason: -[MTLSimHeap protectionOptions]: unrecognized selector sent to instance 0x600002a09090' - note that we don't call this selector.");
#endif
TestRuntime.IgnoreInCI ("This test seems to make bots keel over and die.");
TestRuntime.AssertNotX64Desktop (); // Intel Mac is not fast enough.

var device = MTLDevice.SystemDefault;
// some older hardware won't have a default
Expand Down
1 change: 1 addition & 0 deletions tests/monotouch-test/Network/NWPathMonitorTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -126,6 +126,7 @@ public void ProhibitInterfaceTypeTest ()
});
}
#if MONOMAC
[Ignore ("Unusable nil instance returned, verified with ObjC project. Filled rdar://FB11984039.")]
[Test]
public void CreateForEthernetChannelTest ()
{
Expand Down
3 changes: 3 additions & 0 deletions tests/monotouch-test/ObjCRuntime/DelegateAndDataSourceTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -136,6 +136,9 @@ bool Skip (Type t)
// The default constructor doesn't work (it's also obsolete)
return true;
#endif
case "SWCollaborationView":
// Crashes when calling setDelegate: with null.
return true;
}

switch (t.Namespace) {
Expand Down
2 changes: 2 additions & 0 deletions tests/monotouch-test/System.Net.Http/MessageHandlers.cs
Original file line number Diff line number Diff line change
Expand Up @@ -612,6 +612,8 @@ public void RejectSslCertificatesWithCustomValidationCallbackNSUrlSessionHandler
callbackWasExecuted = true;
try {
Assert.IsNotNull (certificate);
if (errors == SslPolicyErrors.RemoteCertificateChainErrors && TestRuntime.IsInCI)
return false;
Assert.AreEqual (SslPolicyErrors.None, errors);
} catch (Exception e) {
ex2 = e;
Expand Down
14 changes: 14 additions & 0 deletions tools/devops/automation/build-pipeline.yml
Original file line number Diff line number Diff line change
Expand Up @@ -124,6 +124,20 @@ parameters:
"Agent.HasDevices -equals False",
"Agent.IsPaired -equals False"
]
},
{
stageName: 'mac_13_0_m1',
displayName: 'M1 - Mac Ventura (13.0)',
macPool: 'VSEng-VSMac-Xamarin-Shared',
useImage: false,
statusContext: 'M1 - Mac Ventura (13.0)',
demands: [
"Agent.OS -equals Darwin",
"macOS.Name -equals Ventura",
"macOS.Architecture -equals arm64",
"Agent.HasDevices -equals False",
"Agent.IsPaired -equals False"
]
}]

resources:
Expand Down
14 changes: 14 additions & 0 deletions tools/devops/automation/build-pull-request.yml
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,20 @@ parameters:
"Agent.HasDevices -equals False",
"Agent.IsPaired -equals False"
]
},
{
stageName: 'mac_13_0_m1',
displayName: 'M1 - Mac Ventura (13.0)',
macPool: 'VSEng-VSMac-Xamarin-Shared',
useImage: false,
statusContext: 'M1 - Mac Ventura (13.0)',
demands: [
"Agent.OS -equals Darwin",
"macOS.Name -equals Ventura",
"macOS.Architecture -equals arm64",
"Agent.HasDevices -equals False",
"Agent.IsPaired -equals False"
]
}]

resources:
Expand Down