xamarin-macios/tests
Rolf Bjarne Kvinge dd363191cc
[dotnet-linker] Add ProcessExportedFields to the list of steps we execute. Fixes #20061. (#20066)
Fixes https://github.com/xamarin/xamarin-macios/issues/20061.
2024-02-20 16:46:47 +01:00
..
.nuget/packages Make our local .NET the default .NET for the build. (#15086) 2022-06-07 10:11:02 +02:00
BundledResources [tests] Remove 32-bit architectures and logic from project files. 2023-02-02 16:30:29 +01:00
EmbeddedResources [tests] Fix all the remaining warnings in monotouch-test, EmbeddedResources and bindings-test. (#19722) 2024-01-08 07:41:48 +01:00
api-shared [tests] Use Enum.HasFlag according to reviews. 2023-05-15 16:13:40 +02:00
bcl-test [tests] Bump min OS versions in all tests. 2023-02-02 16:30:28 +01:00
bgen Get Mono.Cecil from NuGet everywhere. (#19535) 2023-12-04 20:15:03 +01:00
bindings-framework-test [net8.0] Merge main into net8.0. 2023-05-17 08:28:14 +02:00
bindings-test [dotnet-linker] Add ProcessExportedFields to the list of steps we execute. Fixes #20061. (#20066) 2024-02-20 16:46:47 +01:00
bindings-test2 [net8.0] Merge main into net8.0. 2023-05-17 08:28:14 +02:00
bindings-xcframework-test [net8.0] Merge main into net8.0. 2023-05-17 08:28:14 +02:00
cecil-tests [ModelIO] Make P/Invokes have blittable signatures. (#20153) 2024-02-20 16:46:34 +01:00
common [tests] Add test to keep track of trimmer warnings. (#20125) 2024-02-16 16:53:12 +01:00
dotnet [tests] Unignore the BuildNet7_0App test. Fixes #18655. (#19768) 2024-02-19 17:54:20 +01:00
framework-test Add the .NET TFM as a constant to the generated SdkVersions.cs from our Makefile variables. (#19401) 2023-11-08 13:36:50 +01:00
fsharp [tests] Remove 32-bit architectures and logic from project files. 2023-02-02 16:30:29 +01:00
fsharplibrary [net8.0] Merge main into net8.0. 2023-04-13 08:27:25 +02:00
generator [src] Remove the Protocolize attribute. (#19684) 2024-01-11 16:23:15 +01:00
interdependent-binding-projects Add the .NET TFM as a constant to the generated SdkVersions.cs from our Makefile variables. (#19401) 2023-11-08 13:36:50 +01:00
introspection [Xcode 15.2] Bump to Xcode 15.2 (#19785) 2024-01-12 04:56:22 -05:00
linker Update test 2023-11-24 14:51:40 +01:00
mac-binding-project [tests] Bump min OS versions in all tests. 2023-02-02 16:30:28 +01:00
misc
mmp-regression [net8.0] Merge main into net8.0. 2023-08-08 16:06:04 +02:00
mmptest Get Mono.Cecil from NuGet everywhere. (#19535) 2023-12-04 20:15:03 +01:00
mono-native Add the .NET TFM as a constant to the generated SdkVersions.cs from our Makefile variables. (#19401) 2023-11-08 13:36:50 +01:00
monotouch-test [UIKit] Remove presnippet for UITextView.TypingAttributes. Fixes #12709. (#20089) 2024-02-13 08:28:11 +01:00
msbuild [msbuild] Use MetadataLoadContext in the UnpackLibraryResources task. (#20017) 2024-02-13 16:40:58 +01:00
mtouch [dotnet] Fix typo causing universal builds to not keep any symbols when stripped. Fixes #19860. (#19900) 2024-01-29 20:19:11 +01:00
perftest Change all null checking expressions to use 'is' and 'is not'. (#18176) 2023-05-05 17:52:19 +02:00
qa-regression [net8.0] Merge main into net8.0. 2023-05-11 11:54:37 +02:00
sampletester Add the .NET TFM as a constant to the generated SdkVersions.cs from our Makefile variables. (#19401) 2023-11-08 13:36:50 +01:00
scripted [autoformat] Add all of tests/. (#16857) 2022-12-05 08:23:34 +01:00
scriptingbridge Change all null checking expressions to use 'is' and 'is not'. (#18176) 2023-05-05 17:52:19 +02:00
templates [net8.0] Merge main into net8.0. 2023-05-11 11:54:37 +02:00
test-libraries [dotnet-linker] Add ProcessExportedFields to the list of steps we execute. Fixes #20061. (#20066) 2024-02-20 16:46:47 +01:00
xammac_tests [Vision] Update Xcode 15 support (#19412) 2024-01-02 15:17:57 -05:00
xcframework-test Add the .NET TFM as a constant to the generated SdkVersions.cs from our Makefile variables. (#19401) 2023-11-08 13:36:50 +01:00
xharness [devops] Split monotouch-test by platform as well. (#19988) 2024-02-14 09:26:34 +01:00
xtro-sharpie [Foundation] Bind a few missing notifications. Fixes #19837. (#19846) 2024-01-18 08:10:27 -05:00
.gitignore Make our local .NET the default .NET for the build. (#15086) 2022-06-07 10:11:02 +02:00
ComputeRegistrarConstant.targets [tests] Fix computing when the dynamic registrar is used. 2023-06-22 08:44:47 +02:00
Directory.Build.targets
HtmlTransform.xslt
Makefile [tests] Fix calling 'dotnet build' by actually passing 'build'. (#20038) 2024-02-06 14:43:47 +01:00
README.md
nunit.framework.targets
nunit.framework.xml
package-dotnet-tests.sh Make our local .NET the default .NET for the build. (#15086) 2022-06-07 10:11:02 +02:00
package-mac-tests.sh [tests] Fix condition to not build packaged macOS tests in parallel in CI. (#19838) 2024-01-19 14:35:29 -05:00
packaged-macos-tests.mk [tests] Misc changes to make tests work/pass when .NET isn't enabled. (#18828) 2023-08-28 16:15:28 +02:00
run-with-timeout.csharp Simplify argument logic in the C# scripts. (#19805) 2024-01-15 16:51:36 +01:00
run-with-timeout.sh [tests] Improve handling timed out macOS tests. (#15747) 2022-08-29 12:06:25 +02:00
test-dependencies.sh [system-dependencies] Check for and install shellcheck and yamllint. (#16285) 2022-10-10 08:05:51 +02:00
tests-mac.sln
tests.sln [tests] Remove 32-bit architectures and logic from project files. 2023-02-02 16:30:29 +01:00

README.md

Various tests to be executed prior to releases

Test permissions

There are a number of tests that acccess the file system and the bluetooh. For these tests to correctly execute you have to ensure that the terminal application that you are using to execute the tests has access to the full filesystem and the bluetooth. If you do not do this step the macOS tests will crash.

Test solutions

Many of the test solutions and test projects are generated, and will only be available after running make once.

  • tests.sln: This is the base test solution for Xamarin.iOS, which targets iOS using the Unified API. Not generated.
  • tests-tvos.sln: All the TVOS test projects. Generated.
  • tests-watchos.sln: All the WatchOS test projects. Generated.
  • tests-mac.sln: This is the base test solution for Xamarin.Mac. Not generated.

Test solution/project generation

The tool that generates the test solutions / projects is called xharness, and lives in the xharness subdirectory.

Types of Tests

Unit Tests

Most of the projects are using NUnit[Lite] and looks like unit tests. They are meant to be executed on the target: simulator, devices, OSX.

In reality most of them are regression tests - but that does not change the need to execute and continually expand them to cover new code.

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 are part of the dontlink.app application (for iOS) and the dontlink-mac project (for OSX).

Pros

  • They always tell the truth, which can differ from documentation

Cons

  • Incomplete - Not everything is encoded in the metadata / executable;
  • Too complete - Not every truth is good to be known (or published)

Extrospection Tests

Extrospection tests takes data from some outside sources and see if our implementation match the information, e.g.

  • Header files from the SDK;
  • Rules, like Gendarme or FxCop;

Since this is done externally there's no need to run them on the devices, simulator or even a specific version of OSX.

Pro

  • There is more data available, e.g. information lost when compiling

Con

  • The data might not represent the truth (errors, false positives...)

Xamarin.Mac

Many tests when run for macOS use a integration hack which helps handle a number of issues:

  • Allowing command line arguments to tests while excluding "psn" arguments passed in while debugging with Visual Studio for Mac
  • Invoking _exit to work around a number of post-test hangs. See the bug for details.
  • Add a number of "default" excludes for mono BCL tests

One very useful "hack" this support adds is the ability to run a single test from the command line via the XM_TEST_NAME environmental variable. For example

XM_TEST_NAME=MonoTouchFixtures.Security.KeyTest.CreateRandomKeyWithParametersTests make run-mac-unified-xammac_tests

Test Suites

*-tests : where * is the assembly name, e.g. monotouch

Use the project defaults for linking, i.e.

  • "Don't link" for simulator

  • "Link SDK assemblies only" for devices

  • regression testing without using the linker

  • both simulator and devices are set to "Don't link"

linkall

  • regression testing using the linker on the all assemblies

  • "Link all assemblies" for both simulator/devices

linksdk

  • regression testing using the linker on the SDK assemblies

  • "Link SDK assemblies only" for both simulator/devices

bcl-test

These are the Mono BCL test suite tweaked to run on the mobile profile. It reuse the files directly from mono's repository (linking, not copying).

As other unit tests the configuration is set to mimick normal apps, e.g.

  • "Don't link" for simulator

  • "Link SDK assemblies only" for devices

Common make targets

Run every test in both the simulator and on device, using both the compat and the new profile (for the simulator both in 32 and 64bit mode).

$ make run

Run every test in the simulator, using both the compat and the new profile (both 32 and 64bit simulators).

$ make run-all-sim

Run every test on device, using both the compat and the new profile

$ make run-all-dev

Detailed make targets

  • Main target

    • run-what-where-project: Builds, installs (if applicable) and runs the specified test project on the specified platform. This is the most common target to use.
    • build-what-where-project: Will build the specified test project for the specified platform and target.
    • install-what-where-project: Will install the specified test project on a connected device. There's currently no way to select the device, so ensure you've only one connected (if many devices are connected, it's random which will used).
    • exec-what-where-project: Will run the specified test project in the simulator or on a device.
  • What

    • -ios-: iOS.
    • -tvos-: TVOS.
    • -watchos-: WatchOS

    If "What" is skipped, all variations are executed sequentially.

  • Where

    • -simclassic-: Simulator using the Classic API. Only applicable when platform is iOS.
    • -simunified-: Simulator using Unified API. The build will contain both an i386 and an x86_64 binary. Only applicable to the build-* target, while the -sim32- and -sim64- are only applicable to the exec-* targets. Only applicable when the platform is iOS.
    • -sim32-: 32bits iOS simulator using the Unified API. Not applicable to other platforms.
    • -sim64-: 64bits iOS simulator using the Unified API. Not applicable to other platforms.
    • -sim-:
      • iOS: Both the -simclassic- and -simunified- versions.
      • WatchOS/TVOS: The WatchOS/TVOS simulator.
    • -devclassic-: Device using the Classic API. Only applicable when the platform is iOS.
    • -devunified-: Device using the Unified API. The build will contain both an armv7 and an arm64 binary. It's not possible to select a 32/64bit version, you'll run what your device supports. Only applicable when the platform is iOS.
    • -dev-:
      • iOS: Both the -devclassic- and -devunified- versions.
      • WatchOS/TVOS: A Watch or TV device.
  • Examples

    $ make run-ios-sim32-monotouchtest: This will run monotouch-test using the Unified API in a 32-bit simulator. $ make run-tvos-dev-dont\ link: This will run dont link on an Apple TV device.

Utility run-* targets

These targets will build, install (if applicable) and run the specified project(s).

  • Simulator

    • run-sim-project: Builds and runs the specified test project in the simulator in compat, 32 and 64bit mode.
    • run-sim: Builds and runs all the non-bcl test projects in the simulator in compat, 32 and 64bit mode.
  • Device

    • run-dev-project: Builds and runs the specified non-bcl test project on a device in compat and native mode (if it's 32 and 64bit depends on the device; 64bit devices will run in 64bit mode and the same for 32bit devices).
    • run-devcompat: Run all the non-bcl test projects on device, in compat mode.
    • run-devdual: Run all the non-bcl test projects on device, in native mode (if it's 32 and 64bit depends on the device; 64bit devices will run in 64bit mode and the same for 32bit devices).
    • run-dev: Run all the non-bcl test projects on device, in both compat and native mode.