Граф коммитов

4081 Коммитов

Автор SHA1 Сообщение Дата
Manuel de la Pena 022f5d331c [DotNet] Ignore those tests that require Mac OS X if not enabled. 2020-09-24 17:46:22 -04:00
Manuel de la Pena 34fc106bad [xtro] Fix osome ignores. 2020-09-24 11:56:12 -04:00
Manuel de la Pena dcb0c93ab0 [Xcode12] Bring xcode 12 changes into main. 2020-09-23 16:05:22 -04:00
Manuel de la Pena d2677b36fb [Tests] Add better ignore using the configuration class. 2020-09-22 11:59:09 -04:00
Rolf Bjarne Kvinge 7756d957f9
[dotnet] Tell the linker about any xml descriptors we might have. (#9676)
Also add a linker descriptor to the monotouch-test/.NET project file to
preserve the parts of nunit.framework.dll that aren't linker safe.

This fixes an unhandled exception that causes a crash during the
monotouch-test test run when the linker is enabled:

    Unhandled Exception:
    System.NullReferenceException: Object reference not set to an instance of an object

    Thread 11 Crashed:: tid_15403  Dispatch queue: com.apple.root.default-qos
    0   libsystem_kernel.dylib        	0x00007fff5220c33a __pthread_kill + 10
    1   libsystem_pthread.dylib       	0x00007fff522b6e60 pthread_kill + 430
    2   libsystem_c.dylib             	0x00007fff5219bb7c abort + 120
    3   libxamarin-debug.dylib        	0x000000010c93979f xamarin_unhandled_exception_handler + 47
    4   libmonosgen-2.0.dylib         	0x000000010cc04980 mono_invoke_unhandled_exception_hook + 131
    5   libmonosgen-2.0.dylib         	0x000000010cb40166 mono_handle_exception_internal + 5915
    6   libmonosgen-2.0.dylib         	0x000000010cb3ea47 mono_handle_exception + 11
    7   libmonosgen-2.0.dylib         	0x000000010cb8ea06 mono_amd64_throw_exception + 158
    8   ???                           	0x000000010d4125b0 0 + 4517340592
    9   libxamarin-debug.dylib        	0x000000010c9394fb xamarin_process_managed_exception + 379 (runtime.m:2361)
    10  libxamarin-debug.dylib        	0x000000010c939377 xamarin_process_managed_exception_gchandle + 55 (runtime.m:1144)
    11  libxamarin-debug.dylib        	0x000000010c939333 xamarin_ftnptr_exception_handler + 19 (runtime.m:1133)
    12  libmonosgen-2.0.dylib         	0x000000010cb3feeb mono_handle_exception_internal + 5280
    13  libmonosgen-2.0.dylib         	0x000000010cb3ea47 mono_handle_exception + 11
    14  libmonosgen-2.0.dylib         	0x000000010cb8f2dd handle_signal_exception + 67
    15  ???                           	0x000070000fd730d8 0 + 123145568071896
    16  ???                           	0x000000011a3ab99b 0 + 4735023515
    17  ???                           	0x000000011a3aa643 0 + 4735018563
    18  libdispatch.dylib             	0x00007fff52090a0f _dispatch_queue_override_invoke + 1071
    19  libdispatch.dylib             	0x00007fff5209dcc5 _dispatch_root_queue_drain + 350
    20  libdispatch.dylib             	0x00007fff5209e46a _dispatch_worker_thread2 + 102
    21  libsystem_pthread.dylib       	0x00007fff522b39f7 _pthread_wqthread + 220
    22  libsystem_pthread.dylib       	0x00007fff522b2b77 start_wqthread + 15
2020-09-22 09:15:33 +02:00
Manuel de la Pena 26d108b30a [Intro] Fix availabilty test with watchOS 7.0 2020-09-21 21:26:42 -04:00
Manuel de la Pena edd185fa89 [Cecil] Fix tests check to ignore. 2020-09-21 18:14:04 -04:00
Manuel de la Pena e7d2b3c041 [Tests] Ignore those test that expect Xamarin.Mac to be present.
Ignore all the tests until
https://github.com/xamarin/xamarin-macios/issues/9680 is fixed.
2020-09-21 18:09:20 -04:00
Rolf Bjarne Kvinge 39e3184f02
[src] Build the .NET version of our product assemblies using a .NET 5 BCL. (#9637)
* [src] Build the .NET version of our product assemblies using a .NET 5 BCL.

We're not shipping the .NET product assemblies in any stable release, so we
can use a preview version of the .NET 5 BCL.

Also:

* Add all the nuget feeds we need to the top-level NuGet.config, even for .NET
  5/6, there shouldn't be any conflicts with stable feeds since we use exact
  version numbers.

* Generate a top-level global5.json which is copied to every directory that
  needs a .NET 5 global.json (overriding the .NET 3.1 global.json in the root
  directory).

* Use the expected dotnet binary during our local build.

* [tests] Fix the bgen tests to use .NET 5.

* [xharness] Set the current directory to the project directory when running .NET tests.

This way we end up using the dotnet version that's configured in global.json for the tests.
2020-09-21 13:22:44 +02:00
monojenkins ccc8f89d53 [d16-8] [SBApplication][Bug] SBApplication.FromBundleIdentifier<T> should return null when bundle ID is unknown (#9668)
* SB updates + tests

Co-authored-by: Whitney Schmidt <whschm@microsoft.com>
2020-09-18 18:19:23 -04:00
Manuel de la Pena eb9b690fe0 Merge xcode12 into d16-8. 2020-09-18 17:51:52 -04:00
Whitney Schmidt f8eca9fb53
[SBApplication][Bug] SBApplication.FromBundleIdentifier<T> should return null when bundle ID is unknown (#9620)
* update SB bindings, add unit tests
2020-09-18 11:18:26 -04:00
Rolf Bjarne Kvinge 1463967d00
[xharness] Skip the 'dont link / AssemblyBuildTarget: SDK framework (release)' variation by default for tvOS. Fixes #xamarin/maccore@2282. (#9659)
This test variation ends up being too big (1.5 GB), so it doesn't install
properly and the app crashes at startup.

So just skip it.

Fixes https://github.com/xamarin/maccore/issues/2282.
2020-09-18 09:08:32 +02:00
Rolf Bjarne Kvinge 3461d8186f
[monotouch-test] Don't assert any specific value for the ReusedConnection value in UrlSessionTaskTransactionMetricsTest. Fixes #xamarin/maccore@2281. (#9660)
Fixes https://github.com/xamarin/maccore/issues/2281.
2020-09-18 09:08:16 +02:00
Rolf Bjarne Kvinge d53a2336ad
[monotouch-test] Rework CBCentralManagerTest to handle not having permissions. (#9661)
1. Assert that we got permission to CoreBluetooth before doing anything. This
   makes it so that if permission has been denied, or if we're running on the
   bots and permission has not been granted, these tests won't run. It does
   not affect local test runs where permissions haven't been granted nor
   denied.

2. Rework the code to wait for CoreBluetooth to power on in the SetUp method.
   Mark the test as inconclusive if CoreBluetooth never powers on (this
   happens if nobody answers the bluetooth permission dialog, quite typical
   when running tests locally).

Fixes these tests when running locally on a tvOS device:

    MonoTouchFixtures.CoreBluetooth.CBCentralManagerTest
        [FAIL] Constructors
        [FAIL] ScanForPeripherals
2020-09-18 09:07:31 +02:00
Manuel de la Pena 4028e53d98
[Cecil] Try to fix tests by stating the version in the console runner. (#9655)
Try to fix the issue by stating the version of the runner. This change
will not be needed when we merge with main.

fixes https://github.com/xamarin/maccore/issues/2315
2020-09-17 09:03:20 -04:00
Manuel de la Pena 615932d21e
[Tests]Fixed broken tests.sln. (#9656) 2020-09-17 08:01:00 -04:00
Rolf Bjarne Kvinge 2071a13aa4
[mtouch] Refactor how we detect and avoid broken frameworks when building for the simulator. (#9647)
* Use the existing information we have in the Frameworks class to determine
  whether a particular framework works in the simulator or not.
* Show a warning (MX5223) when we run into such a framework, but only if
  the linker is enabled (otherwise we'll often get warnings for API the developer
  doesn't use).
2020-09-17 13:31:29 +02:00
Alex Soto bfc98f8059
[xcode12] Initial bump for Xcode 12 GM (#9644)
* [xcode12] Initial bump for Xcode 12 GM

* [tests][intro] We cannot load CoreNFC framework on iOS simulator anymore

* [tests][xtro] New Metal API are not abstract (before XAMCORE_4_0)

* [tests][intro] Fix crash when CSLocalizedString 'description' selector is called

* [tests][xtro] Add support for excluding platforms

Based on `Make.config` variables `INCLUDE_[IOS|TVOS|WATCH|MAC]`

This required moving some entries (common -> macOS) to keep the
sanitizer happy.

* [xtro] Ignore Intents watchOS differences since they will likely match iOS in the future

* Update to use Xcode 12 GMb instead of the old GM

* [tests][xtro] Remove OSLog for iOS and tvOS (changed in GM)

* [tests][msbuild] Disable FrameworkListTest based on the active/disabled platforms

* [tests][msbuild] Track new directory/file inside CoreML projects

* [mlaunch] Bump maccore and disable mlaunch if mac build is disabled

New commits in xamarin/maccore:

* xamarin/maccore@ba332d4d07 Disable mlaunch if Mac is not built (#2314)

Diff: 87a96d21c9..ba332d4d07

Co-authored-by: Sebastien Pouliot <sebastien.pouliot@microsoft.com>
2020-09-16 11:41:44 +02:00
Sebastien Pouliot 9f7a57ec65
[xcode12][tests] Fix typos (#9640) 2020-09-15 13:09:18 -04:00
Sebastien Pouliot 25c361f43e
[xcode12][intro] Fix running introspection on old macOS versions (#9638)
Most fixes are inside Intents. Some types were not available on macOS
and marked as such, except it backfired.

* Adding `[NoMac]` on `XAMCORE_4_0` was fine
* Adding `[Obsolete]` outside `XAMCORE_4_0` was fine
* Removing the `[Mac (x,y)]` was not quite fine. It's true (since it was never on macOS) but removing it means it default to the oldest (10.9) macOS version we support. This is what the introspection tests were expecting.

Adding an `[Obsoleted (..., 10,0, ...)]` solve this.
2020-09-15 12:59:21 -04:00
Rolf Bjarne Kvinge e1ac701421
[tests] Rework a few tests to not throw exceptions in a background thread. (#9636)
Uncaught exceptions in a background thread will cause the process to crash.
Instead marshal any exceptions to the main thread, which asserts that no
exceptions were thrown.
2020-09-15 16:50:50 +02:00
Sebastien Pouliot a8c5216148
[xcode12] Introspection-based fixes for Big Sur (#9632) 2020-09-15 08:56:24 -04:00
Alex Soto 8383b14382
[xcode12] Rename master to main (#9631)
* Fix links that point to master to point to main instead.
* Implement support in the sample tester for specifying the default branch for
  each sample repo.
* Fix various text / documentation to say 'main' instead of 'master.'
* Push to 'main' instead of 'master' in xamarin-macios-data.
* Fix xharness to make 'main' the special branch with regards to documentation tests as opposed to 'master'.
* Fix various CI to use 'main' instead of 'master'.

This is a backport of PR #9561
2020-09-15 07:09:29 -04:00
Rolf Bjarne Kvinge 4915566c46
[xharness] The linkall tests are green for .NET/Release now. (#9629) 2020-09-14 19:16:13 +02:00
monojenkins ee0516d46a
[Foundation] Fix NSUrl's implicit Uri operators. Fixes #9607. (#9611)
Calling Uri.PathAndQuery is not allowed on a relative Uri, which made the
previous Uri -> NSUrl implicit operator always throw if given a relative
NSUrl.

So I fixed that, added several tests, and found another issue (it turns out
that 'url.RelativePath == url.Path' is not a reliable way to detect absolute
urls, because it's true for relative urls as well) and fixed that too.

Fixes https://github.com/xamarin/xamarin-macios/issues/9607.

Co-authored-by: Rolf Bjarne Kvinge <rolf@xamarin.com>
2020-09-14 08:08:12 +02:00
Manuel de la Pena 2147976458
[Metal] Update framework for xcode 12 beta 6. (#9569)
Co-authored-by: Alex Soto <alex@alexsoto.me>
Co-authored-by: Rolf Bjarne Kvinge <rolf@xamarin.com>
2020-09-11 16:06:22 -04:00
Manuel de la Pena 5a9139bcd6
[AudioToolbox] Update API to xcode 12 beta 6. (#9603)
The most important changes in the API are ignored until we fix issue https://github.com/xamarin/xamarin-macios/issues/9602
2020-09-11 10:36:54 -04:00
Rolf Bjarne Kvinge 1a582ed59a
[tests] Ignore a few link sdk tests in .NET for now. (#9614)
There are easier fish to fry right now, so implementing the linker support for
these tests to pass (metadata reduction and code removal) can wait.

This makes the link sdk/Release variation green for .NET.

Ref: https://github.com/xamarin/xamarin-macios/issues/9612
Ref: https://github.com/xamarin/xamarin-macios/issues/9613
2020-09-10 16:01:19 +02:00
Rolf Bjarne Kvinge a2d50c7d19
[xharness] Add support for adding PropertyGroups if none are applicable when adding a property. (#9616)
Some .NET test projects (monotouch-test) require this to set properties for
some test variations, and .NET projects are quite minimal, making it likely
that they won't have a particular property that needs to be set/modified.

This makes it possible to execute the various monotouch-test variations for
.NET in xharness (some of the variations still fail though, so they're still
ignored by default).
2020-09-10 15:09:51 +02:00
Rolf Bjarne Kvinge eb5206f082
[dotnet-linker] Add OptimizeGeneratedCodeSubStep into the pipeline. (#9608)
Fixes these linkall tests:

    Linker.Shared.OptimizeGeneratedCodeTest
        [FAIL] IsARM64CallingConvention :   optimized: no ldsfld instruction
        Expected: 0
        But was:  1
            at Linker.Shared.BaseOptimizeGeneratedCodeTest.IsARM64CallingConvention() in /Users/rolf/work/maccore/main/xamarin-macios/tests/linker/BaseOptimizeGeneratedCodeTest.cs:line 527
    
    [FAIL] SetupBlockPerfTest :   At least 6x speedup
        Expected: greater than 6
        But was:  1.0876440665344851d
            at Linker.Shared.BaseOptimizeGeneratedCodeTest.SetupBlockPerfTest() in /Users/rolf/work/maccore/main/xamarin-macios/tests/linker/BaseOptimizeGeneratedCodeTest.cs:line 120

And linkall is now green for .NET/Debug.
2020-09-10 08:30:45 +02:00
Rolf Bjarne Kvinge ae1fe7a53d
[Foundation] Fix NSUrl's implicit Uri operators. Fixes #9607. (#9610)
Calling Uri.PathAndQuery is not allowed on a relative Uri, which made the
previous Uri -> NSUrl implicit operator always throw if given a relative
NSUrl.

So I fixed that, added several tests, and found another issue (it turns out
that 'url.RelativePath == url.Path' is not a reliable way to detect absolute
urls, because it's true for relative urls as well) and fixed that too.

Fixes https://github.com/xamarin/xamarin-macios/issues/9607.
2020-09-10 08:29:09 +02:00
Rolf Bjarne Kvinge 941d65f016
[dotnet] Pass the Optimize flags from the extra bundler arguments to the linker configuration. (#9599)
* [dotnet] Pass the Optimize flags from the extra bundler arguments to the linker configuration.

Also call Application.InitializeCommon to initialize the application instance. The
important part here is that InitializeCommon calls Optimizations.Initialize to compute
the default optimizations. It also calls Set*ExceptionMode and sets the default EnableCoopGC
value (so we don't need to call/set those anymore), and it does a few other initialization
tasks which we don't need yet, but eventually will.

And finally remember to parse the bundler arguments before using them in the dotnet
build logic. How did this not cause problems before? 🤦

* [tests] Set the verbosity using the additional args instead of an internal variable.

The internal _BundlerVerbosity variable is overwritten now (with the verbosity
value from the additional args).

* [xharness] Disable tvOS generation for the introspection/.NET test, it incorrect and needs fixing.
2020-09-09 14:52:46 +02:00
Rolf Bjarne Kvinge 7a79845d86
[tests] Add DYNAMIC_REGISTAR when we're using the dynamic registrar in the .NET version of monotouch-test. (#9605)
This makes sure the tests know which registrar we're using, and can act accordingly.
2020-09-09 12:07:53 +02:00
Rolf Bjarne Kvinge 1d3c9f4a04
[UIKit] Sprinkle NullAllowed on UIImage according to Apple's headers. Fixes #9597. (#9598)
Fixes https://github.com/xamarin/xamarin-macios/issues/9597.
2020-09-09 08:49:08 +02:00
Rolf Bjarne Kvinge f1e22e369d
[tools] Refactor the Optimizations class to have no conditionally compiled code. (#9596)
Refactor the Optimizations class to have no conditionally compiled code, which makes
it re-usable from our dotnet-linker code.

Also return any errors or warnings instead of showing/throwing them, which makes
the caller able to show them using whatever means is easiest for the caller.

One test needed an update to the list of valid optimizations, because we now have
a per-platform map of valid optimizations, instead of just a iOS/tvOS/watchOS vs
macOS split ('remove-unsupported-il-for-bitcode' is only valid for watchOS, and now
we say so, while we previously said it was a valid optimization for iOS and tvOS
as well, even though we'd warn about it and do nothing if you tried to set it).
2020-09-08 20:26:28 +02:00
Manuel de la Pena 31659d61ad
[NetworkExtensions] Update framework to Xcode12 beta 6. (#9585)
Co-authored-by: Alex Soto <alex@alexsoto.me>
Co-authored-by: Rolf Bjarne Kvinge <rolf@xamarin.com>
2020-09-08 13:07:34 -04:00
Rolf Bjarne Kvinge d9822057ab
[tests] Prebuilt the Touch.Client projects when packaging the Xamarin.Mac tests. (#9595)
Prebuild the Touch.Client projects for macOS when packaging the Xamarin.Mac
tests, so that when we try to build all the Xamarin.Mac test projects in
parallel, we don't end up trying to build the Touch.Client projects from
multiple build processes at the same time, causing numerous random failures
because all the processes are stomping on eachother.
2020-09-08 14:45:58 +02:00
Rolf Bjarne Kvinge c56b893b68
[tests] Disable some of linkall's SealerTest in .NET/Release until we can implement them. (#9575)
Fixes these test failures:

    Linker.Sealer.SealerTest
    [FAIL] Final :   A
        Expected: True
        But was:  False
            at Linker.Sealer.SealerTest.Final()

    [FAIL] Sealed :   Sealable
        Expected: True
        But was:  False
            at Linker.Sealer.SealerTest.Sealed()

    [FAIL] Virtual :   C
        Expected: False
        But was:  True
            at Linker.Sealer.SealerTest.Virtual()
2020-09-07 10:20:38 +02:00
Sebastien Pouliot 0de4daa1e6
[fileprovider] Update for Xcode 12 beta 6 (#9581)
* [fileprovider] Update for Xcode 12 beta 6

This was quite noisy. Apple removed all API marked as
`FILEPROVIDER_API_AVAILABILITY_V3`.

```
```

Most were bound but they were (majority) decorated with `[NoiOS]` and
`[NoMac]` so they did not generated any bindings.

A few of them were modified or just became macOS-only.

Deprecation warnings also needed to be updated.
2020-09-04 15:46:49 -04:00
Rolf Bjarne Kvinge c1c5b9aac6
[tests] Ignore/fix/adjust several link all tests to make them pass in .NET. (#9570)
This gets linkall to an almost green state (there are still a few more failing
tests, those are a bit more complex to fix and will get seperate PRs).
2020-09-02 08:50:31 +02:00
Rolf Bjarne Kvinge 93eb592fba
[tests] Add test case for issue #9566. (#9567)
LinkAll.Interfaces.InterfaceTest

        [FAIL] Issue9566 : System.InvalidCastException : Specified cast is not valid.
            at LinkAll.Interfaces.InterfaceTest.Issue9566 () [0x00001] in /Users/rolf/work/maccore/whatever/xamarin-macios/tests/linker/ios/link all/InterfacesTest.cs:97
            at (wrapper managed-to-native) System.Reflection.RuntimeMethodInfo.InternalInvoke(System.Reflection.RuntimeMethodInfo,object,object[],System.Exception&)
            at System.Reflection.RuntimeMethodInfo.Invoke (System.Object obj, System.Reflection.BindingFlags invokeAttr, System.Reflection.Binder binder, System.Object[] parameters, System.Globalization.CultureInfo culture) [0x0006a] in
2020-09-02 08:45:58 +02:00
Rolf Bjarne Kvinge c3af3304a8 [tests] Update linkall's CommonLinkAllTest.BindingsAndBeforeInitField[_2] tests to work around linker heuristics.
Also ignore the BindingsAndBeforeInitField test because we're missing a few linker bits to make it work.

Fixes this linkall test failure:

    LinkAll.CommonLinkAllTest
        [FAIL] BindingsAndBeforeInitField :   one
            Expected: 1
            But was:  0
                at LinkAll.CommonLinkAllTest.BindingsAndBeforeInitField() in /Users/rolf/work/maccore/whatever/xamarin-macios/tests/linker/CommonLinkAllTest.cs:line 65
2020-09-01 13:29:05 +02:00
Rolf Bjarne Kvinge 1bbc6c8cbf [tests] Ignore linkall's XmlSerializationTest because .NET's linker doesn't support Xml serialization yet.
Ref: https://github.com/dotnet/runtime/issues/41389#issuecomment-682668670

Fixes this test failure:

    LinkAll.Serialization.Xml.XmlSerializationTest
        [FAIL] GenericProperty_Bug5543 : System.InvalidOperationException : There was an error reflecting type 'LinkAll.Serialization.Xml.XmlResult`1[System.String]'.
            ----> System.InvalidOperationException : There was an error reflecting property 'Result'.
            ----> System.InvalidOperationException : You need to add XmlChoiceIdentifierAttribute to the 'Result' member.
            at System.Xml.Serialization.XmlReflectionImporter.ImportTypeMapping(TypeModel model, String ns, ImportContext context, String dataType, XmlAttributes a, Boolean repeats, Boolean openModel, RecursionLimiter limiter)
            at System.Xml.Serialization.XmlReflectionImporter.ImportTypeMapping(TypeModel model, String ns, ImportContext context, String dataType, XmlAttributes a, RecursionLimiter limiter)
            at System.Xml.Serialization.XmlReflectionImporter.ImportElement(TypeModel model, XmlRootAttribute root, String defaultNamespace, RecursionLimiter limiter)
            at System.Xml.Serialization.XmlReflectionImporter.ImportTypeMapping(Type type, XmlRootAttribute root, String defaultNamespace)
            at System.Xml.Serialization.XmlSerializer..ctor(Type type, String defaultNamespace)
            at System.Xml.Serialization.XmlSerializer..ctor(Type type)
            at LinkAll.Serialization.Xml.XmlSerializationTest.GenericProperty_Bug5543() in /Users/rolf/work/maccore/whatever/xamarin-macios/tests/linker/ios/link all/XmlSerializationTest.cs:line 52
            at System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture)
            --InvalidOperationException
            at System.Xml.Serialization.XmlReflectionImporter.InitializeStructMembers(StructMapping mapping, StructModel model, Boolean openModel, String typeName, RecursionLimiter limiter)
            at System.Xml.Serialization.XmlReflectionImporter.ImportStructLikeMapping(StructModel model, String ns, Boolean openModel, XmlAttributes a, RecursionLimiter limiter)
            at System.Xml.Serialization.XmlReflectionImporter.ImportTypeMapping(TypeModel model, String ns, ImportContext context, String dataType, XmlAttributes a, Boolean repeats, Boolean openModel, RecursionLimiter limiter)
            --InvalidOperationException
            at System.Xml.Serialization.XmlReflectionImporter.CheckAmbiguousChoice(XmlAttributes a, Type accessorType, String accessorName)
            at System.Xml.Serialization.XmlReflectionImporter.ImportAccessorMapping(MemberMapping accessor, FieldModel model, XmlAttributes a, String ns, Type choiceIdentifierType, Boolean rpc, Boolean openModel, RecursionLimiter limiter)
            at System.Xml.Serialization.XmlReflectionImporter.ImportFieldMapping(StructModel parent, FieldModel model, XmlAttributes a, String ns, RecursionLimiter limiter)
            at System.Xml.Serialization.XmlReflectionImporter.InitializeStructMembers(StructMapping mapping, StructModel model, Boolean openModel, String typeName, RecursionLimiter limiter)
2020-09-01 13:29:05 +02:00
Rolf Bjarne Kvinge 22f67c0103 [tests] Adjust linkall's ClassLayoutTest's DefaultLayoutClass and AutoLayoutClass tests to continue outsmarting a somewhat smarter linker.
Fixes these test failures:

    LinkAll.Layout.ClassLayoutTest
        [FAIL] AutoLayoutClass :   Length
            Expected: 1
            But was:  2
                at LinkAll.Layout.ClassLayoutTest.AutoLayoutClass() in /Users/rolf/work/maccore/whatever/xamarin-macios/tests/linker/ios/link all/ClassLayoutTest.cs:line 73

        [FAIL] DefaultLayoutClass :   Length
            Expected: 1
            But was:  2
                at LinkAll.Layout.ClassLayoutTest.DefaultLayoutClass() in /Users/rolf/work/maccore/whatever/xamarin-macios/tests/linker/ios/link all/ClassLayoutTest.cs:line 57
2020-09-01 13:29:05 +02:00
Rolf Bjarne Kvinge bc668916e7 [tests] Ignore linkall's DataContractTest in .NET due to a linker bug.
Ref: https://github.com/mono/linker/issues/1460

Fixes this test failure:

    LinkAll.Serialization.DataContract.DataContractTest
        [FAIL] Flags : System.NullReferenceException : Object reference not set to an instance of an object
            at System.Runtime.Serialization.CodeGenerator.VerifyParameterCount(MethodInfo methodInfo, Int32 expectedCount)
            at System.Runtime.Serialization.CodeGenerator.Call(Object thisObj, MethodInfo methodInfo, Object param1, Object param2)
            at System.Runtime.Serialization.XmlFormatWriterGenerator.CriticalHelper.InternalSerialize(MethodInfo methodInfo, LocalBuilder memberValue, Type memberType, Boolean writeXsiType)
            at System.Runtime.Serialization.XmlFormatWriterGenerator.CriticalHelper.WriteValue(LocalBuilder memberValue, Boolean writeXsiType)
            at System.Runtime.Serialization.XmlFormatWriterGenerator.CriticalHelper.WriteMembers(ClassDataContract classContract, LocalBuilder extensionDataLocal, ClassDataContract derivedMostClassContract)
            at System.Runtime.Serialization.XmlFormatWriterGenerator.CriticalHelper.WriteClass(ClassDataContract classContract)
            at System.Runtime.Serialization.XmlFormatWriterGenerator.CriticalHelper.GenerateClassWriter(ClassDataContract classContract)
            at System.Runtime.Serialization.XmlFormatWriterGenerator.GenerateClassWriter(ClassDataContract classContract)
            at System.Runtime.Serialization.ClassDataContract.CreateXmlFormatWriterDelegate()
            at System.Runtime.Serialization.ClassDataContract.get_XmlFormatWriterDelegate()
            at System.Runtime.Serialization.ClassDataContract.WriteXmlValue(XmlWriterDelegator xmlWriter, Object obj, XmlObjectSerializerWriteContext context)
            at System.Runtime.Serialization.XmlObjectSerializerWriteContext.WriteDataContractValue(DataContract dataContract, XmlWriterDelegator xmlWriter, Object obj, RuntimeTypeHandle declaredTypeHandle)
            at System.Runtime.Serialization.XmlObjectSerializerWriteContext.SerializeWithoutXsiType(DataContract dataContract, XmlWriterDelegator xmlWriter, Object obj, RuntimeTypeHandle declaredTypeHandle)
            at System.Runtime.Serialization.DataContractSerializer.InternalWriteObjectContent(XmlWriterDelegator writer, Object graph, DataContractResolver dataContractResolver)
            at System.Runtime.Serialization.DataContractSerializer.InternalWriteObject(XmlWriterDelegator writer, Object graph, DataContractResolver dataContractResolver)
            at System.Runtime.Serialization.XmlObjectSerializer.WriteObjectHandleExceptions(XmlWriterDelegator writer, Object graph, DataContractResolver dataContractResolver)
            at System.Runtime.Serialization.XmlObjectSerializer.WriteObjectHandleExceptions(XmlWriterDelegator writer, Object graph)
            at System.Runtime.Serialization.DataContractSerializer.WriteObject(XmlWriter writer, Object graph)
            at LinkAll.Serialization.DataContract.DataContractTest.ToXml[TestClass](TestClass obj) in [...]/xamarin-macios/tests/linker/ios/link all/DataContractTest.cs:line 35
            at LinkAll.Serialization.DataContract.DataContractTest.Flags() in [...]/xamarin-macios/tests/linker/ios/link all/DataContractTest.cs:line 73
            at System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture)
2020-09-01 13:29:05 +02:00
Rolf Bjarne Kvinge 3940df936b [tests] Exclude test case in linkall's InterfacesTest.Bug10866 test due to a bugfix in the linker.
Ref: https://github.com/mono/linker/issues/1459
Ref: https://github.com/xamarin/xamarin-macios/issues/9566

Fixes this test failure:

    LinkAll.Interfaces.InterfaceTest
        [FAIL] Bug10866 :   B::Bar
            Expected: null
            But was:  <Void Bar()>
                at LinkAll.Interfaces.InterfaceTest.Bug10866() in /Users/rolf/work/maccore/whatever/xamarin-macios/tests/linker/ios/link all/InterfacesTest.cs:line 91
2020-09-01 13:29:05 +02:00
Rolf Bjarne Kvinge bdb91f9272 [tests] Update linkall's CommonLinkAllTest.TypeConverter_Custom to take into account that .NET will generate assembly attributes by default.
Fixes this test failure:

    LinkAll.CommonLinkAllTest
        [FAIL] TypeConverter_Custom :   ConverterTypeName
            String lengths are both 88. Strings differ at index 43.
            Expected: "...nk all, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null"
            But was:  "...nk all, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null"
            ------------------------------^
                at LinkAll.CommonLinkAllTest.TypeConverter_Custom() in /Users/rolf/work/maccore/whatever/xamarin-macios/tests/linker/CommonLinkAllTest.cs:line 88
2020-09-01 13:29:05 +02:00
Rolf Bjarne Kvinge 1c57da6d4c [tests] Update linkall's CommonLinkAllTest.TypeConverter_BuiltIn to take into account that BooleanConverter is in a different assembly in .NET.
Fixes this test failure:

    LinkAll.CommonLinkAllTest
        [FAIL] TypeConverter_BuiltIn :   ConverterTypeName
            Expected string length 113 but was 142. Strings differ at index 46.
            Expected: "...Model.BooleanConverter, System, Version=2.0.5.0, Culture=n..."
            But was:  "...Model.BooleanConverter, System.ComponentModel.TypeConverte..."
            --------------------------------------------^
                at LinkAll.CommonLinkAllTest.TypeConverter_BuiltIn() in /Users/rolf/work/maccore/whatever/xamarin-macios/tests/linker/CommonLinkAllTest.cs:line 79
2020-09-01 13:29:05 +02:00
Rolf Bjarne Kvinge 6cc233a110 [tests] Make reflection more complicated to work around linker heuristics in linkall's PreserveTest.
This fixes this linkall test failure:

    LinkAll.Attributes.PreserveTest
        [FAIL] PreserveTypeWithoutMembers :   members
            Expected: null
            But was:  <System.String Absent>
                at LinkAll.Attributes.PreserveTest.PreserveTypeWithoutMembers() in /Users/rolf/work/maccore/whatever/xamarin-macios/tests/linker/ios/link all/PreserveTest.cs:line 76

There were more complications added than strictly required to make the above
test pass, but it seems like this way we make sure the linker isn't too smart
for the other tests as well, and we end up testing what we actually want to
test.
2020-09-01 13:29:05 +02:00