xamarin-macios/tests
Rolf Bjarne Kvinge 786ae13f80 [mtouch] Fix an unnecessary re-link when the linker copies assemblies without processing them. (#1534)
Event sequence:

* mtouch is executed with the linker disabled.
* The linker pipeline copies all input assemblies (since the linker is
  disabled the assemblies don't change) into the PreBuild directory. This will
  keep the original timestamps of the input assemblies.
* mtouch is executed again, when none of the input assemblies changed.
* The linker pipeline will re-execute, because it will see that at least one
  of the input assemblies (at least the .exe) is newer than at least one of
  the assemblies in the PreBuild directory (usually a framework assembly,
  because those have the original timestamp from their install location).

Fix:

Touch all the assemblies in the PreBuild directory after the linker pipeline
executes the first time. This way the second time mtouch is executed, it will
find that all assemblies in the PreBuild directory have timestamps later than
all the input assemblies, so it will load the cached linked assemblies,
instead of re-executing the linker pipeline.
2017-01-20 10:45:08 +01:00
..
BundledResources [tests] Add support for building device tests for 32-bit or 64-bit. 2016-10-11 19:52:36 +02:00
EmbeddedResources [tests] Add a few more resources to test. (#1412) 2017-01-02 09:00:47 +01:00
api-shared [registrar] Use metadata tokens instead of strings to find types and methods. (#1085) 2016-11-01 14:34:56 -04:00
apitest Add NSToolbarItemGroup binding (#1386) 2016-12-29 10:37:15 -06:00
bcl-test Bump mono to get fix for System.Core tests. (#1392) 2016-12-22 11:05:31 +01:00
bindings-framework-test [xharness] Major rewrite (add server mode, add device support, add today extension support). 2017-01-05 13:08:48 +01:00
bindings-test [tests] Generate some trampoline and registrar tests. 2016-10-13 15:10:43 +02:00
common [xharness] Add support for using the system's Xamarin.iOS/Xamarin.Mac instead of a locally build one. (#1498) 2017-01-16 07:24:14 +01:00
dontlink-mac [tests] Set LSUIElement in the mac tests' Info.plist so that they don't show an icon in the dock. (#329) 2016-06-30 01:01:11 -07:00
framework-test [tests] Fix framework-test to actually work. (#1297) 2016-12-05 18:35:53 +01:00
fsharp [tests] Add support for building device tests for 32-bit or 64-bit. 2016-10-11 19:52:36 +02:00
fsharplibrary [tests] Add support for building device tests for 32-bit or 64-bit. 2016-10-11 19:52:36 +02:00
generator [generator] Copy [Obsolete] attributes on smart enums. Fixes #46292 (#1104) 2016-11-02 23:18:59 -04:00
introspection [XM] Update ManagedSignature to work on XM and update XAMCORE_3_0 to 4 2017-01-12 13:46:19 -06:00
linker-ios [linker] Inline BinaryCompatibility.TargetsAtLeast_Desktop_V4_5[_1] (#1518) 2017-01-19 08:45:19 -05:00
mac-api-sharpie [tests] Make mdtool verbose on CI, and fix a few xbuild invocation to honor XBUILD_VERBOSITY. (#131) 2016-06-06 13:01:24 +02:00
mac-binding-project [XM] Rework binding project test to try to fix build machine issues (#1474) 2017-01-17 10:06:10 -06:00
mini [tests] Add support for building device tests for 32-bit or 64-bit. 2016-10-11 19:52:36 +02:00
misc [tests] Import 2016-05-26 15:06:52 +02:00
mmptest [XM] AOT support in Xamarin.Mac (#1340) 2017-01-11 14:10:39 -06:00
monotouch-test [tests] Use a different bundle id for different apps that can be installed on the same device. (#1509) 2017-01-16 18:34:57 +01:00
msbuild-mac [XM] AOT support in Xamarin.Mac (#1340) 2017-01-11 14:10:39 -06:00
mtouch [mtouch] Fix an unnecessary re-link when the linker copies assemblies without processing them. (#1534) 2017-01-20 10:45:08 +01:00
no-mmp [tests] Import 2016-05-26 15:06:52 +02:00
qa-regression [tests] Import 2016-05-26 15:06:52 +02:00
scripted Remove XI/Classic support (#926) 2016-09-30 15:02:17 -04:00
scriptingbridge [tests] Import 2016-05-26 15:06:52 +02:00
templates [tests] Automatically run today extension test runs, since there's no UI to manually start it. (#1501) 2017-01-16 16:24:44 +01:00
test-libraries [mtouch] Make sure native symbols from third-party libraries are preserved in dylibs. Fixes #51548. 2017-01-18 12:33:06 +01:00
xammac_tests Port monotouch-test suite to Xamarin.Mac (#1445) 2017-01-12 09:13:56 -09:00
xharness [xharness] Lines containing 'ghprbPull' are probably not build errors. (#1537) 2017-01-20 10:43:49 +01:00
xtro-sharpie merge xcode8.2 into master 2016-12-12 21:26:23 -05:00
.gitignore [xharness] Add support for using the system's Xamarin.iOS/Xamarin.Mac instead of a locally build one. (#1498) 2017-01-16 07:24:14 +01:00
HtmlTransform.xslt [tests] Move HtmlTransform.xslt here from maccore. (#16) 2016-04-28 15:07:26 -04:00
Makefile [xharness] Add support for using the system's Xamarin.iOS/Xamarin.Mac instead of a locally build one. (#1498) 2017-01-16 07:24:14 +01:00
README.md [tests] Update README. (#1207) 2016-11-17 14:18:39 +01:00
common.mk [tests] Import 2016-05-26 15:06:52 +02:00
package-mac-tests.sh [tests] Add scripts to install system dependencies to the XM tests package. (#847) 2016-09-19 10:02:10 -04:00
test-dependencies.sh [system-dependencies] Add logic to auto-provision cmake. (#940) 2016-10-04 10:28:41 +02:00
tests-mac.sln Port monotouch-test suite to Xamarin.Mac (#1445) 2017-01-12 09:13:56 -09:00
tests.sln [tests] Add support for building device tests for 32-bit or 64-bit. 2016-10-11 19:52:36 +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...)

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.