xamarin-macios/tests/introspection
Rolf Bjarne Kvinge 696e7a5679
[ObjCRuntime] Add a non-deprecated internal system-version checking API and use it everywhere. (#13231)
* [ObjCRuntime] Add a non-deprecated internal system-version checking API and use it everywhere.

The PlatformHelper class is deprecated, so implement a new version that isn't
deprecated, and which shares a similar API between all platforms - the Check*
methods includes the name of the platform, because that makes it clearer which
version we're talking about from the call site. There's a quirk though:
there's no separate ChecktvOS or CheckMacCatalyst, because the system version
is the same as for iOS, so we can just use 'iOS'.

For macOS we can now use NSProcessInfo.ProcessInfo.OperatingSystemVersion to
determine the OS version, because it's supported in all versions of macOS we
support for .NET.

Fixes issues such as this when building with XAMCORE_4_0:

> CoreMedia/CMSync.cs(590,11): error CS0103: The name 'PlatformHelper' does not exist in the current context

* Bring back PlatformHelper.CheckSystemVersion, but only for !NET.

* [tests] Remove 32-bit macOS logic, it's long dead.

* [introspection] Implement OS version check using 'NSProcessInfo.ProcessInfo.IsOperatingSystemAtLeastVersion' for macOS.

* [monotouch-test] Use TestRuntime.[Check|Assert]XcodeVersion instead of PlatformHelper.CheckSystemVersion.
2021-11-04 11:13:23 +01:00
..
Mac [ObjCRuntime] Add a non-deprecated internal system-version checking API and use it everywhere. (#13231) 2021-11-04 11:13:23 +01:00
dotnet Submodule MonoTouch.Dialog. (#13058) 2021-10-26 08:18:34 +02:00
iOS [QuickLook] Add missing selectors for Xcode 13.1 (#13200) 2021-11-02 10:42:20 -04:00
ApiAvailabilityTest.cs [Dotnet] Enable the Test to check for Dotnet Attributes (#12745) 2021-09-20 15:13:53 -04:00
ApiBaseTest.cs [tests][intro] Fix Phase tests on macOS 12 and iOS devices (#12376) 2021-08-06 16:28:04 -04:00
ApiCMAttachmentTest.cs [SecIdentity] Subclass NativeObject + numerous other code updates (#13149) 2021-11-02 07:48:55 +01:00
ApiClassPtrTest.cs Fix some whitespace issues in various files. (#12399) 2021-08-11 10:06:46 +02:00
ApiCoreImageFiltersTest.cs Fix CIRawFilter intro issues 2021-09-10 14:31:02 -04:00
ApiCtorInitTest.cs [runtime] Add support for toggle refs to CoreCLR. (#11757) 2021-06-02 00:13:49 +02:00
ApiFieldTest.cs [xcode13] Bump PR to Xcode 13 Beta 2 (#12017) 2021-06-28 17:54:52 -04:00
ApiFrameworkTest.cs [CoreWLan] Add XCode13 beta 1 support. (#12103) 2021-07-19 09:02:47 -04:00
ApiPInvokeTest.cs [introspection] Skip verifying the objc_msgSend[Super]_stret on all platforms. (#12939) 2021-10-07 20:15:54 +02:00
ApiProtocolTest.cs [AVFoundation] Add support for xcode 13 beta 5. (#12550) 2021-09-15 11:37:21 -04:00
ApiSelectorTest.cs [Intents] Update bindings for Xcode 13.0 betas 1 through 5 (#12771) 2021-09-21 20:30:56 -04:00
ApiSignatureTest.cs [.NET] Move the nfloat type to the ObjCRuntime namespace for .NET. (#13092) 2021-10-28 11:06:31 +02:00
ApiStructTest.cs Fix some whitespace issues in various files. (#12399) 2021-08-11 10:06:46 +02:00
ApiTypeTest.cs Fix some whitespace issues in various files. (#12399) 2021-08-11 10:06:46 +02:00
ApiTypoTest.cs [ObjCRuntime] Add a non-deprecated internal system-version checking API and use it everywhere. (#13231) 2021-11-04 11:13:23 +01:00
ApiWeakPropertyTest.cs Fix some whitespace issues in various files. (#12399) 2021-08-11 10:06:46 +02:00
CoreSelectorTest.cs [xcode12] Introspection-based fixes for Big Sur (#9632) 2020-09-15 08:56:24 -04:00
EnvironmentVariable.cs Move parts of dontlink tests into new introspection tests (#32) 2016-05-04 20:14:32 -04:00
README.md [tests] Move linker tests from maccore (#69) 2016-05-20 14:07:34 -04:00
xamarin1.png Move parts of dontlink tests into new introspection tests (#32) 2016-05-04 20:14:32 -04:00

README.md

Introspection Tests

Introspection tests are executed on target (both simulator and device for iOS) or a specific version of OSX. The application proceed to analyze itself using:

  • System.Reflection for managed code; and
  • the ObjectiveC runtime library for native code

and compare the results. E.g. if using .NET reflection it can see a binding for a NSBundle type then it should be able to find a native NSBundle type using the ObjC runtime functions. Otherwise an error is raised...

Since the application analyze itself it must contains everything we wish to test. That's why the introspection tests needs to be built with the managed linker disable, i.e. "Don't link".

Pros

  • The tests always tell the truth, which can differ from documentation or header files;

Cons

  • Incomplete - Not everything is encoded in the metadata / executable;
  • Too complete - Not every truth is good to be known (or published), which requires creating special cases in the tests