xamarin-macios/tests
monojenkins daf5006281 [d16-2] [msbuild] Add reference to `System.Drawing.Common.dll` to XI projects. (#6035)
* [msbuild] Add reference to `System.Drawing.Common.dll` to XI projects.

Fixes https://github.com/mono/mono/issues/13483 :

```
@akoeplinger: Since we moved types from Mono.Android.dll and
Xamarin.iOS/WatchOS/TVOS.dll to System.Drawing.Common.dll user projects
would fail to compile. We need to add some msbuild logic to add a
reference to the assembly automatically.
```

* [msbuild] Implement the same fix for XM projects as well.

* [msbuild] Update Xamarin.iOS.Tasks.TargetTests.GetReferencedAssemblies_* tests.

We're including a new assembly, which means the
Xamarin.iOS.Tasks.TargetTests.GetReferencedAssemblies_* must be updated
accordingly.

Also modify these tests so that test assert that fails lists the actual
assembly that's missing, i.e. instead of this:

    1) Test Failure : Xamarin.iOS.Tasks.TargetTests.GetReferencedAssemblies_Executable
         #1
      Expected: 6
      But was:  7

we now print:

    1) Test Failure : Xamarin.iOS.Tasks.TargetTests.GetReferencedAssemblies_Executable
         References
      Expected: equivalent to < "mscorlib.dll", "MyLibrary.dll", "System.Core.dll", "System.dll", "System.Xml.dll", "Xamarin.iOS.dll" >
      But was:  < "mscorlib.dll", "MyLibrary.dll", "System.Core.dll", "System.dll", "System.Drawing.Common.dll", "System.Xml.dll", "Xamarin.iOS.dll" >

* [tests] Adjust Xamarin.MMP.Tests.AssemblyReferencesTests.ShouldNotAllowReference_ToSystemDrawing.

The test was verifying that referencing System.Drawing.dll and trying to use
System.Drawing.RectangleF would fail to compile (because System.Drawing.dll
shouldn't be resolved in this case).

The addition of System.Drawing.Common.dll breaks this assumption, because now
we ship System.Drawing.RectangleF, so the code that was supposed to fail to
compile works just fine instead.

So modify the test to verify that there's no System.Drawing.dll in the final
bundle.

* Remove workarounds for mono/mono#13483.

* [msbuild] Create a way out if automatically referencing System.Drawing.Common.dll causes problems.

* [msbuild] Adjust variable name and boolean logic according to review.
2019-05-10 16:16:01 +02:00
..
BundledResources
EmbeddedResources
api-shared [runtime] Improve exception creation. (#5944) 2019-04-26 11:16:23 +02:00
apitest Merge branch 'xcode10.2' into master-merge-xcode10.2 2019-04-03 13:57:31 -04:00
bcl-test Download the Mono SDK archive for macOS as well. (#5953) 2019-04-26 16:44:29 +02:00
bindings-framework-test [tests] Add missing framework to the bindings-framework-test project's LinkWith attribute. 2019-04-30 14:29:24 +00:00
bindings-test [tests] Add missing file to the mac binding test project. 2019-04-30 14:29:24 +00:00
bindings-test2
common [d16-2] [msbuild] Add reference to `System.Drawing.Common.dll` to XI projects. (#6035) 2019-05-10 16:16:01 +02:00
framework-test
fsharp [tests] Improve F# test's assert message. (#4649) 2018-08-20 19:06:01 +02:00
fsharplibrary
generator [tests] Add tests for out/ref parameters. 2019-04-30 14:29:24 +00:00
interdependent-binding-projects
introspection [d16-2] [msbuild] Add reference to `System.Drawing.Common.dll` to XI projects. (#6035) 2019-05-10 16:16:01 +02:00
linker [linker] Don't remove RuntimeCompatibilityAttribute from assembly 2019-04-03 23:52:18 +02:00
mac-binding-project Merge branch 'master' into mono-2018-10 2018-11-29 13:41:32 +01:00
mini [xharness] Use existing (and pre-defined) defines for bitcode platforms. (#5650) 2019-02-21 18:08:33 +01:00
misc
mmptest [d16-2] [msbuild] Add reference to `System.Drawing.Common.dll` to XI projects. (#6035) 2019-05-10 16:16:01 +02:00
mono-native [tests][mono-native] Adjust logic which is causing tests to fail on tvOS. (#5877) 2019-04-11 19:41:25 +02:00
monotouch-test [d16-2] [msbuild] Add reference to `System.Drawing.Common.dll` to XI projects. (#6035) 2019-05-10 16:16:01 +02:00
msbuild-mac [tests] Use latest version of NUnit for test projects to get support for parallelized tests. (#5538) 2019-02-04 15:22:00 +01:00
mtouch Merge pull request #5966 from monojenkins/backport-pr-5963-to-d16-2 2019-05-06 07:27:56 +02:00
no-mmp
qa-regression Mono 2018-08 requires macOS 10.9+, so Xamarin.Mac must as well. 2018-10-25 09:54:43 +02:00
sampletester [sampletester] Bump prebuilt-apps hash. (#6017) 2019-05-09 06:29:39 +02:00
scripted
scriptingbridge Mono 2018-08 requires macOS 10.9+, so Xamarin.Mac must as well. 2018-10-25 09:54:43 +02:00
templates [tests] Don't run BitcodeNotSupported tests on watchOS. (#5744) 2019-03-08 19:27:53 +01:00
test-libraries [tests] Add tests for out/ref parameters. 2019-04-30 14:29:24 +00:00
xammac_tests [d16-2] [msbuild] Add reference to `System.Drawing.Common.dll` to XI projects. (#6035) 2019-05-10 16:16:01 +02:00
xharness Merge remote-tracking branch 'origin/d16-2' into xharness-old-simulators-d16-2 2019-05-09 21:44:26 +02:00
xtro-sharpie Remove private API (#5915) 2019-04-25 10:16:22 -04:00
.gitignore Add mono-native tests to Makefile. 2018-11-14 13:41:36 -05:00
HtmlTransform.xslt
Makefile Download the Mono SDK archive for macOS as well. (#5953) 2019-04-26 16:44:29 +02:00
README.md Update tests/README to document XM_TEST_NAME (#4880) 2018-09-26 10:24:49 -05:00
common.mk Move tests to use new tool xibuild and thus fix msbuild tests (#5128) 2018-11-16 14:24:35 -05:00
package-mac-tests.sh [tests] Use xibuild when building packaged XM tests. Fixes maccore#1169. (#5164) 2018-11-21 09:59:10 -05:00
test-dependencies.sh
tests-mac.sln
tests.sln [tests] Add sample tester. (#5870) 2019-04-25 17:18:43 +02:00

README.md

Various tests to be executed prior to releases

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 Xamairn.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
  • Optionally integrating with the macOS message loop for tests that require it (anything that uses most Cocoa primitives).
  • 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.