xamarin-android/build-tools/bundle
Jonathan Pryor e9daf5ea35 [Xamarin.Android.Bcl-Tests] Add BCL test project. (#872)
What do we want? (with apologies to 48e3fc26)
**MOAR** Unit tests!

Specifically, we want to run the BCL unit tests which mono generates:

	$ cd external/mono/mcs/class/corlib
	$ make PROFILE=monodroid test
	# creates `monodroid_corlib_test.dll`

Creation of `monodroid_*_test.dll` assemblies and the
`make PROFILE=monodroid test` target is a relatively recent
development, for which I need to buy the #runtime team some beers.

In terms of `mono-runtimes.targets`, we can build *all* of the BCL
unit test assemblies with:

	$ cd external/mono/mcs/class
	$ make -i do-test PROFILE=monodroid

Now that we can create them, how do we *use* them? That's the trickier
bit: they need to be built within mono, as part of the existing BCL
build process. This in turn means that the BCL unit test assemblies
need to be distributed as part of the mono bundle, as we don't want to
rebuild the mono repo "from scratch" just for the unit tests.

Update `build-tools/mono-runtimes/ProfileAssemblies.projitems` to
include a new `@(MonoTestAssembly)` item group which contains all of
the BCL unit test assemblies and related files which should be
included into `bundle-*.zip`. Additionally, add
`ProfileAssemblies.projitems` to `@(VersionFile)` witihin
`bundle-path.targets`, so that if anything within
`ProfileAssemblies.projitems` changes, we rebuild the bundle.

Once we *have* the BCL unit test assemblies, and their dependencies,
we need to *run* them. The new `Xamarin.Android.Bcl-Tests.csproj`
project is a Xamarin.Android application project which will execute
the unit tests.

There's just one small problem: Xamarin.Android apps want to use
`Xamarin.Android.NUnitLite.dll`. The BCL unit test assemblies instead
build against their own `nunitlite.dll`, which has no Xamarin.Android
integration or support. How do we use the new test assemblies?

*Force* a fix by using `remap-assembly-ref` to "rename" the
`nunitlite` assembly reference to `Xamarin.Android.NUnitLite.dll`.
This *cannot* be done as part of the `mono-runtimes.mdproj` build, as
`Xamarin.Android.NUnitLite.dll` won't yet exist. Instead, remap the
assemblies within `Xamarin.Android.Bcl-Tests.targets`, and distribute
the remapped assemblies with the application.

Finally, address one other "small" problem: not all of the unit tests
pass! Some of these are for reasons we don't know, and others will
require changes to `mono`.

Update `Xamarin.Android.NUnitLite` to allow *filtering* of tests:

	namespace Xamarin.Android.NUnitLite {

	  partial class TestSuiteActivity {
	    public  ITestFilter   Filter          {get; set;}

	    public  virtual void  UpdateFilter ();
	  }

	  partial class TestSuiteInstrumentation {
	    public  ITestFilter   Filter          {get; set;}

	    public  virtual void  UpdateFilter ();
	  }
	}

`TestSuiteActivity.UpdateFilter()` is called by
`TestSuiteActivity.OnCreate()`, *after* `GetIncludedCategories()` and
`GetExcludedCategories()` are called, to allow subclasses to alter the
`ITestFilter` which is used to determine which tests are executed.

`TestSuiteInstrumentation.UpdateFilter()` is called by
`TestSuiteInstrumentation.OnStart()`, *after*
`GetIncludedCategories()` and `GetExcludedCategories()` are called, to
allow subclasses to alter the `ITestFilter` which is used to determine
which tests are executed.

`Xamarin.Android.Bcl_Tests` overrides both of these and updates the
`Filter` property so that "known failing" tests are excluded. This
allows us to skip failing tests, giving us time to properly fix them
in time while allowing the rest of this PR to be merged.

The skipped tests include:

  * MonoTests.System.Reflection.AssemblyTest.GetReferencedAssemblies
  * MonoTests.System.ServiceModel.Description.WebInvokeAttributeTest.RejectTwoParametersWhenNotWrapped
2017-10-03 21:48:08 +02:00
..
bundle-path.targets [Xamarin.Android.Bcl-Tests] Add BCL test project. (#872) 2017-10-03 21:48:08 +02:00
bundle.mdproj [android-toolchain] Windows build support (#743) 2017-08-23 11:27:35 -04:00
bundle.targets [bundle] Create the bundle 2017-09-05 17:21:52 -04:00