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

3650 Коммитов

Автор SHA1 Сообщение Дата
Manuel de la Pena 3004e7d34b
[Harness] Ensure we do not throw an exception if we do not have tasks. (#8272)
The First extension will throw an exception if the list is empty. Use
FirstOrDefault, check if the devices are null and return the test as
Ignored.

fixes: https://github.com/xamarin/xamarin-macios/issues/8271
2020-04-03 13:23:35 -04:00
Manuel de la Pena d7160b3dcf
[Harness] Completely remove the BCL prefix from the test importer. (#8224)
Remove the last BCLPrefix and move the InfoPlistGenerator to the managed
namespace since it is part of the managed template.
2020-04-03 11:01:56 -04:00
Přemek Vysoký d4cf8301cf
[Harness] Allow to create a process manager with default tool paths (#8278) 2020-04-03 11:00:45 -04:00
Manuel de la Pena feec8d4ef9
[Harness] Remove hardcoded paths to the testing framework dlls. (#8244)
The testing framework dlls come from mono and their paths are harcoded
in the templates. Move the hardcoded paths out to the assembly locator
which know were to find the paths.

This is needed to later allow the cmd to pass the location of the paths.
2020-04-01 15:10:13 -04:00
Manuel de la Pena 1518894394
[Harness] Add the assets as part of the managed template. (#8251)
The assets were being used from the bcl-test directory. Move them as
part of the template. Renamed a file to make things a little easier when
adding the assets (a '.' in the middle of the name made this
complicated).

The template should be selfcotained.
2020-04-01 15:09:08 -04:00
Manuel de la Pena f16561b49f
[Harness] If we cannot connect over tcp use Console.Out as the writer. (#8235)
If we could not connect to the host via tcp, set the writer to be
Console.Out which will fix the NRE and will report the test run in the
runlogs.

fixes: https://github.com/xamarin/xamarin-macios/issues/8130
2020-04-01 14:03:40 -04:00
Přemek Vysoký b14a055265
[Harness] Move code to a shared library (#8234)
- Code that will later be moved to the `dotnet/xharness` repo is first moved to an isolated project before it will be extracted to the new repo and NuGetified
- New project for the shared code and new test project for tests accompanying the moved code are created
- Only Factories are left behind that are used only by XHarness
2020-04-01 13:32:21 -04:00
Sebastien Pouliot 86ab2bc1d1
[tests][link all] Remove test workaround (#8252)
iOS fixed after Xcode 11 release

Fix https://github.com/xamarin/xamarin-macios/issues/6254
2020-04-01 09:00:26 -04:00
Sebastien Pouliot ac01b522f0
[generator] Add missing `EnsureUIThread` for generated `init` and `initWithCoder` (#8250)
Fix https://github.com/xamarin/xamarin-macios/issues/8249
2020-03-31 17:20:44 -04:00
Manuel de la Pena f383593924
[Harness] Merge the Generator and the Factory in a same object and rename namespace. (#8222)
The Generator and the Factory classes are a xamarin-macios thing.
Initially, they were separated because the code that generated the bcl
tests was not inside xharness. That is not longer the case. We can merge
both classes, generalize the namespace and be more prepared to move out
of the xamarin-macios repo.
2020-03-30 23:23:33 -04:00
Manuel de la Pena 63fcc22bad
[Harness] Make sure we do not copy/generate the app sources more than once. (#8243)
Threading is hard, even with async. We reached a situation in which the
src code of the test applications from the template was being generated
more than once. Ideally, we could have a nice solution with
AsyncLazy<bool> and use the lazy async to copy the code, but it was
moved to netcore 5. The fix is a little uglier but valid, lock and
enure we only generate it once. Please note that you CANNOT use a lock
statement inside a async method.

Fixes: https://github.com/xamarin/xamarin-macios/issues/8240
2020-03-30 21:20:37 -04:00
Manuel de la Pena bdce02622f
[Harness] Remove the BCLTestProjectInfo class. (#8221)
Remove two classes that are not really needed and a method. We moved to
named tuples to make things simpler. Unfortunally C# does not support:

```csharp
using MyNamedTuple = (string Name, double value, bool answer);
```

But we have to live with this. Makes the namespace simpler and removes
confusion with the already present project classes that are more widely
used.

* [Harness] Remove the BCLTestProjectInfo class.

The class is not really needed. Move to a tuple, make the definition of
the group test project nicer since the dictionary initiallization makes
it cleaner.
2020-03-30 15:20:50 -04:00
Manuel de la Pena 728442e01f
[Harness] If empty nodes are found, do not crash. (#8201)
Looks like we have cases in which we get empty nodes when listing
devices, which makes the parsing of the nodes fail and crash.

Move the code to a diff method, try to parse the data, if there is an
exception (missing data) return null. If null is returned, do not add
it.

Fixes: https://github.com/xamarin/xamarin-macios/issues/8160
2020-03-30 10:41:38 -04:00
Sebastien Pouliot f1508bff64
[tests][bcl] Ignore some known failures on arm/32 bits (#8216) 2020-03-30 08:26:36 -04:00
Manuel de la Pena 0ffd4faa64
[Harness] Add a new known failure to help the mionitoring person. (#8227)
Looks like mono is not investing much time at the moment fixing
https://github.com/mono/mono/issues/18560

The above error happens always on 32b device tests. Added a new known
failure for the monitoring to use in their task so that they do not have
to goole the issue and they know that is knonw already.
2020-03-30 07:29:52 -04:00
Manuel de la Pena b371133216
[Harness] Verify that issue #8214 is fixed. (#8229)
Added a test in the xml parser that verifies that the parsing of the xml
is correct and that the correct number of failures is reported in the
human readable form.

fixes: https://github.com/xamarin/xamarin-macios/issues/8214
2020-03-30 07:29:22 -04:00
Manuel de la Pena 3623d7a72f
[Harness] Remove not needed classes from the BCLTestImporter. (#8218)
Remove two classes that are not really needed and a method. We moved to
named tuples to make things simpler. Unfortunally C# does not support:

```csharp
using MyNamedTuple = (string Name, double value, bool answer);
```

But we have to live with this. Makes the namespace simpler and removes
confusion with the already present project classes that are more widely
used.
2020-03-30 07:26:15 -04:00
Přemek Vysoký 7d47b073cf
[Harness] Remove AppRunner references from TestReporter (#8212) 2020-03-29 12:02:03 -04:00
Přemek Vysoký 6209719f51
[Harness] Remove Harness as a dependency (#8203) 2020-03-27 12:41:31 -04:00
Alex Soto dddcba9dc4
Merge pull request #8207 from dalexsoto/master-xcode11.4
[xcode11.4] Merge d16-5-xcode11.4 into master
2020-03-27 10:58:32 -04:00
Přemek Vysoký 46a2d96c55
[Harness] Fix XHarness unit tests (#8208)
Co-authored-by: Rolf Bjarne Kvinge <rolf@xamarin.com>
2020-03-27 09:46:54 -04:00
Alex Soto 3ff3e07ebe Merge remote-tracking branch 'xamarin/d16-5-xcode11.4' 2020-03-26 19:59:14 -04:00
Chris Hamons 53964c0af0
[mac] Add NSScrollView.WillStartLiveScrollNotification (#8205)
- https://github.com/xamarin/xamarin-macios/issues/7712
2020-03-26 16:15:50 -05:00
Přemek Vysoký a48667b761
[Harness] Remove TextWriter dependency, refactor Logging (#8184) 2020-03-26 09:59:43 -04:00
Přemek Vysoký 3f3c9af198
Fix BUILD_REVISION env argument (#8197)
Fixes #8185 and some other minor things problems in AppRunner
2020-03-25 12:38:10 -04:00
Manuel de la Pena a59d519775
[BCL] Ignore a failing test on devices. (#8195)
Ignore a failing test on devices. Related mono issue: https://github.com/mono/mono/issues/19308

Mono has to fix the issue, so we ignore in the meantime.



Co-authored-by: Rolf Bjarne Kvinge <rolf@xamarin.com>
2020-03-25 11:24:07 -04:00
Přemek Vysoký d98c515a4c
[Harness] Add strongly typed mlaunch args and escape them (#8167)
Co-authored-by: Premek Vysoky <prvysoky@microsoft.com>
2020-03-25 10:59:29 -04:00
Alex Soto aa73e41254
[xcode11.4][UIKit] Update bindings to Xcode 11.4 Final (#8192)
* [UIKit] Update bindings to Xcode 11.4 Final

* Apply feedback
2020-03-25 10:52:11 -04:00
Manuel de la Pena 0324fbab34
[Harness] Refactor, simplify and fix issues in the result parsing. (#8183)
Refactor result parsing and test it. Make sure that all the possible
corner cases are taken into account. The changes are as follow:

1. Move all the logic to a new class, which will take care of the reustl
parsing.
2. Simplify the parsing method by splitting the noise code to other
functions. There is no need to parse several files in the same method.
3. Add tests that make sure that the correct result is returned when:
  a. The app cannot launch.
  b. The app timesout.
  c. The app crashes.
2020-03-25 02:44:47 -04:00
Alex Soto 96e806c6e2
[FileProvider] Update bindings to Xcode 11.4 Beta 3 (#8075) (#8194) 2020-03-25 00:32:30 -04:00
Sebastien Pouliot aa5e17dfc5
[xcode11.4][intentsui] Add missing [DesignatedInitializer] (#8191) 2020-03-25 00:31:15 -04:00
Sebastien Pouliot 064886a09f
[xcode11.4][arkit] Add final bindings (ARKit 3.5) (#8190) 2020-03-24 22:29:32 -04:00
Alex Soto e8e78ff86e
[d16-5-xcode11.4] Initial bump to Xcode 11.4 Final (#8189) 2020-03-24 20:46:37 -04:00
Sebastien Pouliot e5e93f6c53
Revert "[tests] Adjust expected result of looking for 'mono_native_initialize'. Fixes xamarin/maccore#1809. (#6806)" (#8182)
This reverts commit e4a926e8f2.
2020-03-24 17:36:29 -04:00
Přemek Vysoký 6a58674960
Extract AppBundleInformationParser (#8174) 2020-03-24 10:02:22 +01:00
Sebastien Pouliot e9ff1f854d
It seems 'initWithRequest:cachedResponse:client:' is not called on 10.9 (#8173) 2020-03-23 20:55:51 -04:00
Sebastien Pouliot 9f1ecfa85f
[tests][monotouch-test] Update UrlProtocolTest (#8168)
The _nice_ thing about `NSURLProtocol` is that it does not force the use
of the network - but we inflicted this upon us on tests.

So this updates the test to avoid the network, which should make it
more reliable and not so much influenced by the URL used or the OS
versions where it's executed.

This does not cover as much callback as before. However this it does
test that the NSUrlProtocol is registered correctly (what we care) and
the rest is largely only related the the OS (which is not the target
of our unit tests).

Hopefully fix https://github.com/xamarin/maccore/issues/1956
2020-03-20 21:52:43 -04:00
Rolf Bjarne Kvinge d0b170bf8f
[d16-5-xcode11.4][mtouch/mmp] Only use stdout from xcrun as the path of the file that was found. Fixes #8147. (#8150) (#8164)
xcrun can print stuff to stderr even if it succeeds and prints what it found
to stdout, which means we have to separate stdout and stderr when capturing
xcrun's output.

This also means that we need a few changes to our RunCommand API:

* Add support for capturing stdout and stderr separately by providing
  different callbacks/StringBuilder instances.
* Use overloads instead of default arguments, because with default arguments
  we end up with ambiguous matches in a lot of places with the new overloads.

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

Backport of #8150.
2020-03-20 19:44:58 +01:00
Rolf Bjarne Kvinge dccf99a0ca
[tests] Work around xamarin/maccore#2177 by building test-libraries as part of the build. (#8163)
This is not a complete solution, because it doesn't work when running device
tests, because then we don't build locally. On the other hand, that bug has
never been a problem for device bots, so hopefully that won't change in the
future.

Ref: https://github.com/xamarin/maccore/issues/2177
2020-03-20 19:39:31 +01:00
Přemek Vysoký 29e978e0be
[Harness] Add AppRunner.RunAsync unit tests (#8159)
Co-authored-by: Premek Vysoky <prvysoky@microsoft.com>
2020-03-20 14:18:28 -04:00
Rolf Bjarne Kvinge c6e9932be9
[mtouch/mmp] Only use stdout from xcrun as the path of the file that was found. Fixes #8147. (#8150)
* [mtouch/mmp] Only use stdout from xcrun as the path of the file that was found. Fixes #8147.

xcrun can print stuff to stderr even if it succeeds and prints what it found
to stdout, which means we have to separate stdout and stderr when capturing
xcrun's output.

This also means that we need a few changes to our RunCommand API:

* Add support for capturing stdout and stderr separately by providing
  different callbacks/StringBuilder instances.
* Use overloads instead of default arguments, because with default arguments
  we end up with ambiguous matches in a lot of places with the new overloads.

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

* [tests] Fix mmptest build.

* [mtouch/mmp] Fix process log output.
2020-03-20 17:46:43 +01:00
Přemek Vysoký ec420e6740
[Harness] Make CrashSnapshotReporter injectable and add unit tests (#8129)
* Move AppInstallMonitorLog

* Move Helpers.GenerateStableGuid

* Move DirectoryUtilities

* Move DirectoryUtilities.RootDirectory

* Add CrashSnapshot ctor

* refactor CrashReportSnapshot

* Add WrenchLog

* Move stuff out of Harness

* Remove RootDirectory

* Revert RootDirectory

* Remove Initialize() calls

* Make CrashReportSnapshot injectable

* Remove Harness dependency from CrashReportSnapshot

* Add device snapshot tests

* Trim down IHarness and make properties of Harness readonly

* Memoize xcoderoot

* Use MlaunchArguments

* Add MlaunchArguments docs

* Add CrashReportSnapshot docs

* Rename method

* Rename class

* Refactor CrashSnapshotReporter

* Inject AppRunner

* Indent parameters

* Indent parameters

* Fix unit tests

* Fix gathering crash logs

* Add crash logs to output

* Fix getting xcode root

* Fix alignment

Co-authored-by: Premek Vysoky <prvysoky@microsoft.com>
2020-03-20 11:42:43 +01:00
Rolf Bjarne Kvinge fcbb90982f
[tests] Remove test that used Xamarin.Mac/Classic. (#8151)
This test need substantial updates to work with Xamarin.Mac/Unified, and
there's very little gain in doing so, so just remove it.
2020-03-20 11:26:58 +01:00
Manuel de la Pena 79a089cd0d
[Harness] Generalize XmlResultParser. (#8156)
First step to try and clean up the psring of results and ensure that we
are doing the correct thing. We have several issue there. We want to
move all the complicated logic out of AppRunner and test the different
outputs and the full result matrix.

This commit first allows to use an instance class for the parsing, later
we will move things out. Step by step
2020-03-19 17:42:51 -04:00
Manuel de la Pena a4b71841df
[Harness] Create a more general TestAssemblyDefinition. (#8149)
XHarness TestAssemblyDefinition is very particular on the way we deal
with the mono test assemblies, in the general case, it only contains the
assembly name, but in the xamarin-macios it calculates the name of the
assembly using the platform.

Create an interface so that the command line was its own implementaiton
and move as much as possible to use the AssemblyLocator class. Later we
can add two simpler implementations for the more general cases.

Move the AssemblyLocator out of the Templates namespace since it makes
more sense.
2020-03-19 13:40:13 -04:00
Přemek Vysoký f8d744cf54
Create DeviceLogCapturer factory and inject it (#8154)
Co-authored-by: Premek Vysoky <prvysoky@microsoft.com>
2020-03-19 13:38:35 -04:00
Přemek Vysoký 5422d4f9b8
Inject ProcessManager into SimulatorDevice (#8145)
Co-authored-by: Premek Vysoky <prvysoky@microsoft.com>
2020-03-19 13:37:21 -04:00
Přemek Vysoký a5fbe513a3
Increase wait time for crash logs (#8152)
Co-authored-by: Premek Vysoky <prvysoky@microsoft.com>
2020-03-19 11:13:06 -04:00
Rolf Bjarne Kvinge 4d7186028e
[mtouch/mmp] Improve target framework code. (#8137)
* Unify target framework code between mtouch and mmp.
* Simplify the code in mmp: have three possible valid target frameworks for
  most of code, and add special code to handle setting any other valid target
  frameworks to redirect to one of those three valid target frameworks (and
  warn if given any of those valid, but not "main", target frameworks). Any
  other code can then depend on the target framework having exactly one of
  those specific values, which means we can make IsUnified* variables
  convenience properties instead.
* Unify a bit more of the argument parsing code between mtouch and mmp, since
  that made a few other things easier.
* Add TargetFramework.IsValidFramework to have one validation implementation.
* Move the implementation of TargetFramework.MonoFrameworkDirectory to mmp
  itself, it's not really related to the target framework.
* Remove Driver.IsUnified and IsClassic from mmp, they're not used anymore.
* Formally deprecate --xamarin-[full|system]-framework in mmp, they've really been deprecated for many years.
* Remove LinkerOptions.TargetFramework, it's not used anymore.
* Get rid of mmp's userTargetFramework fried, it's duplicated with the
  targetFramework field.
* Add a few tests, and tweak others a bit.

Breaking changes:

* Both mtouch and mmp require --target-framework now. The only direct
  consumers should be the MSBuild tasks, which already pass --target-framework
  all the time. This simplifies code, and removes assumptions.
2020-03-19 09:28:09 +01:00
Přemek Vysoký 16cbf4a025
Create CaptureLogFactory and make CaptureLog injectable (#8141)
Co-authored-by: Premek Vysoky <prvysoky@microsoft.com>
2020-03-18 18:39:10 -04:00
Manuel de la Pena 4449b0c4c1
[Harness] Remove the code that check if the test dlls were downloaded. (#8131)
Initially the location of the test dlls of the downloaded artefact and the compiled mono were different. That was no longer the case and therefore there was a lot of code that could be removed since the wasDownloaded variable was set to be always true.

We remove the not needed code that will calculate a diff path if mono was compiled and use the AssemblyLocator class to point to the correct root path were test dlls will be found.

Co-authored-by: Přemek Vysoký <premek.vysoky@microsoft.com>
2020-03-18 16:54:47 -04:00
Rolf Bjarne Kvinge bacd958be0 [mtouch/mmp] Rework how we find developer tools. Partial fix for #4634 and fixes #8005. (#8121) (#8128)
Partial fix for https://github.com/xamarin/xamarin-macios/issues/4634.
Fixes https://github.com/xamarin/xamarin-macios/issues/8005.
2020-03-18 13:07:08 -04:00
Přemek Vysoký fbbd5ceede
[Harness] Move Timestamp and TTY utilities to Helpers (#8138)
Co-authored-by: Premek Vysoky <prvysoky@microsoft.com>
2020-03-18 12:10:25 -04:00
Rolf Bjarne Kvinge dae93e0396
[tests] Adjust MT5107 to work when external verbosity is higher, and make it faster. (#8136)
It runs in 36s instead of 47s on my machine now.
2020-03-18 14:56:47 +01:00
Přemek Vysoký 5f2905c5a4
[Harness] Move utilities out of Harness.cs (#8125)
Co-authored-by: Premek Vysoky <prvysoky@microsoft.com>
2020-03-17 14:42:21 -04:00
Alex Soto 3e3cd33f0c
[NetworkExtension] Update bindings to Xcode 11.4 Beta 3 (#8126)
* [NetworkExtension] Update bindings to Xcode 11.4 Beta 3

* Update src/networkextension.cs

* Update src/networkextension.cs

Co-Authored-By: Rolf Bjarne Kvinge <rolf@xamarin.com>

* Update src/networkextension.cs

Co-Authored-By: Rolf Bjarne Kvinge <rolf@xamarin.com>

* Apply feedback

* Update src/networkextension.cs

Co-authored-by: Rolf Bjarne Kvinge <rolf@xamarin.com>
2020-03-17 13:23:36 -04:00
Rolf Bjarne Kvinge 13a56ffb95
[mtouch/mmp] Rework how we find developer tools. Partial fix for #4634 and fixes #8005. (#8121)
Partial fix for https://github.com/xamarin/xamarin-macios/issues/4634.
Fixes https://github.com/xamarin/xamarin-macios/issues/8005.
2020-03-17 15:49:39 +01:00
Přemek Vysoký 723ec1857c
[Harness] Refactor simple listeners (#8120)
* Add RunMode, DeviceClass

* Inject dependencies into AppRunner

* Add all readonly fields to ctor

* Add basic AppRunner tests

* Add first proper Install test

* Add Uninstall tests

* Refactor listener ctors

* Update tests/xharness/Harness.cs

Co-Authored-By: Rolf Bjarne Kvinge <rolf@xamarin.com>

* Use InvalidOperationException

* Hide fields

* Add TODO

Co-authored-by: Premek Vysoky <prvysoky@microsoft.com>
Co-authored-by: Rolf Bjarne Kvinge <rolf@xamarin.com>
2020-03-17 10:16:19 +01:00
Manuel de la Pena 5209b19ef4
[Harness] Move all test project generation to the template object. (#8122)
At this point the BCLTestProjectGenerator class just represents a configuration class that knows about the project that are particular to xamarin-macios. All the logic that creates the projects has been moved to the XamariniOSTemplate which creates the project using the information passed by the config class.

At this stage, we have the ability to generate test projects by simply passing the info classes, which can be built either by a class (like the generator one) or a command line. We have fully decoupled the project generation from Xharness.

Tests have been added or moved to the correct location.
2020-03-16 18:52:41 -04:00
Whitney Schmidt e085125ab7
[StoreKit] Update bindings for Xcode 11.4 beta 3 (#8104)
* initial commit of StoreKit changes

* frameworks.cs to 6,2

* respond to round 1 feedback

* move StoreKit into COMMON_FRAMEWORKS

* fix manuel formatting suggestions

* add availability attributes to everything, add comments with questions

* remove extra [NoWatch], fix copyright
2020-03-16 16:54:16 -04:00
Přemek Vysoký d1666d524d
Add MLaunchArgument classes (#8123)
Co-authored-by: Premek Vysoky <prvysoky@microsoft.com>
2020-03-16 16:09:27 -04:00
Přemek Vysoký 26903778fb
[Harness] Refactor and unit-test AppRunner (#8117)
Co-authored-by: Rolf Bjarne Kvinge <rolf@xamarin.com>
2020-03-16 09:26:46 -04:00
Manuel de la Pena 82bd730ee3
[Harness] Add several fixes to the crash reports. (#8107)
The name of the tests is picked up in a more inner node than
expected. Fwd the test name to make sure that noe all
crashes/timeouts/launches have the same name.
Add extra information when we have a timeout. We want to know the
name and the bot used to ensure that it is easier to identify patterns.
Timeout tests now have:

test title as: App Timeout {AppName} {Variation} on bot {device_name}
message: AppName} {Variation} Test run timed out after {timeout.TotalMinutes} minute(s) on bot {device_name}.
Build issues now have:

test title: App Build {projectTask.TestName} {projectTask.Variation}
That way we know the exact app that failed to build and the exact app that timeout and the device used to run it.
2020-03-13 18:15:02 -04:00
Přemek Vysoký ef9f7e4e9b
[Harness] Make Harness properties immutable (#8093)
Co-authored-by: Premek Vysoky <prvysoky@microsoft.com>
2020-03-13 10:41:02 -04:00
Manuel de la Pena e96c56bf3c
[Harness] Fix bug in TCCDb editing that is missing using the watchapp id. (#8098)
The wrong var name was used and the table was not correctly updated.
Updated tests to take into account the new \n in the sql.
2020-03-12 13:46:29 -04:00
Manuel de la Pena 7332c92263
[Harness] Move the templates src to be embedded resources. (#8090)
Move the project templates to be a resource in the dll. That way we can
move all the code outside of xharness and used it outside. This is not a
fill refactor but a first step to decouple the bcl test generation from
the xamarin-macios project.

XHarness should not see a difference, everythign works and simply makes
the dlls larger due to the new resources.

The code is going to take into account that the mono team will want to
use and unmanaged template with no dependencies on Xamarin.iOS and
Xamarin.Mac.



Co-Authored-By: Rolf Bjarne Kvinge <rolf@xamarin.com>

Co-authored-by: Rolf Bjarne Kvinge <rolf@xamarin.com>
2020-03-12 13:45:47 -04:00
Rolf Bjarne Kvinge 0b0f6ab043
[xharness] Improve TCC database editing. (#8094)
* Delete any previous entries before adding new ones in all simulators.
* Separate statements by newlines, so logs are easier to parse by humans.
2020-03-12 15:19:32 +01:00
Rolf Bjarne Kvinge 8be4333f43
[xharness] Rework how we build test-libraries a bit. (#8095)
* It's built in parallel with populating the tests.
* A failure isn't silently ignored, it's now shown in the html report.
2020-03-12 15:18:05 +01:00
Rolf Bjarne Kvinge 800d63bb4d Merge remote-tracking branch 'origin/master' into dotnet-bgen 2020-03-12 10:37:12 +01:00
Rolf Bjarne Kvinge 5dda97a0ef [xharness] Unset a few environment variables when running .NET tests. 2020-03-12 10:36:59 +01:00
Manuel de la Pena 16a84bd7f7
[Harness] Move the project templates out of the harness dir. (#8088)
Move the project templates to be a resource in the dll. That way we can
move all the code outside of xharness and used it outside. This is not a
fill refactor but a first step to decouple the bcl test generation from
the xamarin-macios project.

XHarness should not see a difference, everythign works and simply makes
the dlls larger due to the new resources.

The code is going to take into account that the mono team will want to
use and unmanaged template with no dependencies on Xamarin.iOS and
Xamarin.Mac.
2020-03-11 20:10:07 -04:00
Manuel de la Pena ed77f3bfd1
[Harness] Add extra tests for the SimDevice and Simulator classes. (#8079)
Add tests for the SimDevice and Simulators classes that ensure that the
process is correctly called and the xml with the simulators parsed and
returns the correct number of sims.
2020-03-11 20:09:38 -04:00
Manuel de la Pena afb11d65cc
[Harness] Add more context to crashes and timeouts. (#8078)
Update the generation of the xml to include a more descriptive title
than "AppCrash". After this commit the name of the testcase and the test
follow this pattern:

- "App Crash {ApplicationName} {Variation}"

This will make it easier to filter since the an example failure will be:

"App Crash Monotouch (Debug)"

Note, the '()' in the example are part of the variation and that is
build by xharness and passed to the runner.

Fixes: https://github.com/xamarin/xamarin-macios/issues/8077
2020-03-11 17:09:21 -04:00
Manuel de la Pena 4b3d2d1cb4
[Harness] Refactor simulators and devices listing. (#8086)
Moved the implementations under Hardare. Add the following to simplify
the testing of the AppRunner:

1. Add interfaces for the listing/loading of devices and simulators.
2. Add a special class for mlaunch args. That way we are sure that
arguments are correctly passed and we do not have typos.
3. Added tests for the new classes and for the device and devices
classes.
4. Added tests for the management of the TCC db.

Tests for the SimDevice and Simulators will come in a following PR. The
only reason for it is that I realize that the commit was getting to
large.

Co-authored-by: Rolf Bjarne Kvinge <rolf@xamarin.com>
Co-authored-by: Přemek Vysoký <premek.vysoky@microsoft.com>
2020-03-11 17:06:40 -04:00
Rolf Bjarne Kvinge 067c88e2f4 [xharness] Fix merge problem. 2020-03-11 12:36:09 +01:00
Rolf Bjarne Kvinge dac68f33b4 Merge remote-tracking branch 'origin/master' into dotnet-bgen 2020-03-11 12:01:31 +01:00
Rolf Bjarne Kvinge f2063efefb
Revert "[Harness] Move utilities out from Harness.cs, refactor AppRunner fields (#8074)" (#8082)
* Revert "[Harness] Refactor simulators and devices listing. (#8064)"

This reverts commit e53b686ef6.

* Revert "[Harness] Move utilities out from Harness.cs, refactor AppRunner fields (#8074)"

This reverts commit 78dd3b861c.
2020-03-11 10:38:03 +01:00
Manuel de la Pena e53b686ef6
[Harness] Refactor simulators and devices listing. (#8064)
Moved the implementations under Hardware. Add the following to simplify
the testing of the AppRunner:

1. Add interfaces for the listing/loading of devices and simulators.
2. Add a special class for mlaunch args. That way we are sure that
arguments are correctly passed and we do not have typos.
3. Added tests for the new classes and for the device and devices
classes.
4. Added tests for the management of the TCC db.

Tests for the SimDevice and Simulators will come in a following PR. The
only reason for it is that I realize that the commit was getting to
large.


Co-Authored-By: Rolf Bjarne Kvinge <rolf@xamarin.com>
Co-Authored-By: Přemek Vysoký <premek.vysoky@microsoft.com>
2020-03-10 15:10:37 -04:00
Rolf Bjarne Kvinge 7108f59f8b Merge remote-tracking branch 'origin/master' into dotnet-bgen 2020-03-10 19:27:46 +01:00
Přemek Vysoký 78dd3b861c
[Harness] Move utilities out from Harness.cs, refactor AppRunner fields (#8074)
Move all the extension methods to a class. After this refactor, we will
be able to DI the manager in the other classes and assert that the
processes are called with the correct parameters without the need of
launching them.

Also added tests for the manager. We create a dummy console app that
will be executed by the tests. The console app has a number of
parameters that will be used to ensure that the new process behaves as
we want:

- Use the passed exit code.
- Create child proecesses if needed.
- Sleep to force a timeout.
- Writer messages to stdout and stderr.

Our tests call the dummy app and ensures that the results match the
behaviour expected by the dummy app.

Co-authored-by: Manuel de la Pena <mandel@microsoft.com>
Co-authored-by: Premek Vysoky <prvysoky@microsoft.com>
Co-authored-by: Rolf Bjarne Kvinge <rolf@xamarin.com>
2020-03-10 12:44:18 -04:00
Rolf Bjarne Kvinge 5c323cebb4 Merge remote-tracking branch 'origin/master' into dotnet-bgen 2020-03-10 13:50:11 +01:00
Rolf Bjarne Kvinge d7d9baef2d Use full path to the 'dotnet' executable.
This way we don't have to change PATH on bots. It always makes it easier to
use a different location for the executable in the future if we wished to.
2020-03-10 13:41:16 +01:00
Přemek Vysoký fa7ffbcabc
[Harness] Split out Targets, Utils and remove external links (#8061)
* [Harness] Refactor process management to be testable.

Move all the extension methods to a class. After this refactor, we will
be able to DI the manager in the other classes and assert that the
processes are called with the correct parameters without the need of
launching them.

Also added tests for the manager. We create a dummy console app that
will be executed by the tests. The console app has a number of
parameters that will be used to ensure that the new process behaves as
we want:

- Use the passed exit code.
- Create child proecesses if needed.
- Sleep to force a timeout.
- Writer messages to stdout and stderr.

Our tests call the dummy app and ensures that the results match the
behaviour expected by the dummy app.

* Apply suggestions from code review

Co-Authored-By: Přemek Vysoký <premek.vysoky@microsoft.com>

* Move out utils into a separate namespace

* Move Cache to the test project

* Fix namespaces after merge

* Remove unneeded code

* Move Target files

* Sort csproj

* Refactor Targets

* Rename Cache to TempDirectory

* Fix using

* Move ProjectFileExtensions

* Remove dead code

* Move Extensions

* Add empty StringUtilsTests

* Add StringUtils tests

* Revert refactorings

* Update tests/xharness/Utilities/StringUtils.cs

Co-Authored-By: Rolf Bjarne Kvinge <rolf@xamarin.com>

* Update tests/xharness/Utilities/StringUtils.cs

Co-Authored-By: Rolf Bjarne Kvinge <rolf@xamarin.com>

* Add better formatarguments test

* Update tests/xharness/Utilities/StringUtils.cs

Co-Authored-By: Rolf Bjarne Kvinge <rolf@xamarin.com>

Co-authored-by: Manuel de la Pena <mandel@microsoft.com>
Co-authored-by: Premek Vysoky <prvysoky@microsoft.com>
Co-authored-by: Rolf Bjarne Kvinge <rolf@xamarin.com>
2020-03-10 13:12:33 +01:00
Rolf Bjarne Kvinge 1fc2f8e3c2 [xharness] Add support for running the generator tests in .NET mode.
This also meant adding support for running .NET tests in xharness. Some
refactoring was done to extract common code to shared members, in order to
avoid duplicating a lot of code.
2020-03-09 19:49:26 +01:00
Rolf Bjarne Kvinge 7a1a8bbf0b [bgen] Add netcore version of the generator tests. 2020-03-09 19:49:26 +01:00
Rolf Bjarne Kvinge bcefeb37b6
[xharness] Handle UTF8 text better. (#8065)
* Set UTF8 as the encoding for process output.
* Serve plain text as UTF-8 plain text from our test server.

This makes emojiis render as emojiis 😁😁😁
2020-03-09 18:40:46 +01:00
Rolf Bjarne Kvinge bd29f99aaa
[xharness] Rename XBuildTask to MSBuildTask. (#8067)
We're not using xbuild anymore, and haven't for quite a while.
2020-03-09 16:44:49 +01:00
Rolf Bjarne Kvinge 57db46af17
[tests] Don't assume test assemblies are at a specific distance from the root directory. (#8066)
The RootPath finds the top '.git' directory, which should be good enough
always, so use that implementation instead.
2020-03-09 16:44:29 +01:00
Alex Soto f5b3a6f1c4
Merge remote-tracking branch 'xamarin/xcode11.4' into d16-5-xcode11.4 2020-03-08 13:16:04 -04:00
Alex Soto 3e4ba1baae
[Metal] Update bindings to Xcode 11.4 Beta 3 (#8055) 2020-03-06 18:10:24 -05:00
Whitney Schmidt f4d0ee251c
remove non-bindings, add wkwebview to .ignore (#8054) 2020-03-06 10:26:59 -05:00
Sebastien Pouliot 2be35fb1c8
[mtouch][mmp] Share error.cs and make it safer against FormatException (#8047)
* [mtouch][mmp] Share error.cs and make it safer against FormatException

Beside the obvious code sharing [1] this makes the error reporting code
safer against `FormatException`.

Even with code review this happened a few times in the past - we get
a string that can't format correctly in some error handling code. This
means the `FormatException` must be fixed before we can see the
underlying root issue (delaying bug fixes and support).

Recent changes made for localization makes it harder to review the
original strings (and even harder for translated strings) for
correctness. This means we can end up with something like

```
String.Format ("{0} {1}", "foo");
``

and easily miss it (since they split between different files) if there
are several changes inside a PR.

Finally sprinkle some unit tests :)

[1] we should move everything to use `ProductException` but that will be
for another PR...
2020-03-06 09:34:16 -05:00
Manuel de la Pena 597b7d7b0b
[Harness] Refactor process management to be testable. (#8053)
Move all the extension methods to a class. After this refactor, we will
be able to DI the manager in the other classes and assert that the
processes are called with the correct parameters without the need of
launching them.

Also added tests for the manager. We create a dummy console app that
will be executed by the tests. The console app has a number of
parameters that will be used to ensure that the new process behaves as
we want:

- Use the passed exit code.
- Create child proecesses if needed.
- Sleep to force a timeout.
- Writer messages to stdout and stderr.

Our tests call the dummy app and ensures that the results match the
behaviour expected by the dummy app.


Co-authored-by: Přemek Vysoký <premek.vysoky@microsoft.com>
2020-03-06 09:11:33 -05:00
Přemek Vysoký 65a7168c66
[Harness] Split out classes from Jenkins.cs to separate files (#8046)
Co-authored-by: Premek Vysoky <prvysoky@microsoft.com>
2020-03-06 06:00:34 -05:00
Alex Soto a8f38e3696
[AutomaticAssessmentConfiguration] Update bindings to Xcode 11.4 Beta 3 (#8049)
* [AutomaticAssessmentConfiguration] Update bindings to Xcode 11.4 Beta 3
2020-03-05 19:48:28 -05:00
Rolf Bjarne Kvinge 7744ad82db
[linker] No need to support monotouch.dll anymore. (#8050) 2020-03-05 22:05:08 +01:00
Manuel de la Pena cd35f26d6f
[Harness] Add listeners tests.
Provide tests that will ensure that the Tcp listener and File listener
will work correctly. Tests ensure that both listeners receive the data
and write it in the ILog

The tcp test is an interesting one because it redirects the call of the
method to a diff callback that will write the data in a stream to check
the final result.
2020-03-05 06:41:52 -05:00
Sebastien Pouliot 0129618de8
[mtouch] Add `force-rejected-types-removal` optimization (#8009) (#8042)
This optimization can be enabled when it's not possible to use the
managed linker (e.g. **Don't link**) or when the managed linker cannot
remove references to deprecated types that would cause an application
to be rejected by Apple.

References to the existing types will be renamed, e.g. `UIWebView` to
`DeprecatedWebView`, in every assemblies.

The type definition is also renamed (for validity) and all custom
attributes on the types and their members will be removed.
Code inside the members will be replaced with a
`throw new NotSupportedException ();`.

The msbuild test app `MyReleaseBuild` has been updated to test that the
optimization is working as expected (device builds are slow so reusing
this test has little impact in test time).

Basically the test ensure that `UIWebView` is used and cannot be removed
by the compiler (optimization) or the managed linker (since it's
referenced). Since the optimization is enabled then we can `grep` then
final `.app` directory to ensure there's no mention of `UIWebView` inside
any of the files that would be submitted.

The application can be run, by itself, and will turn green if OK, red if
`DeprecatedWebView` can't be found (skeleton replacement for `UIWebView`)
or orange if a `NotSupportedException` is thrown.

Finally introspection tests have been updated to skip over the deprecated
(and renamed) types. It should not be an issue right now, since this
optimization is not enabled by default, but it made testing easier.
2020-03-04 21:21:41 -05:00
Alex Soto af4ed93b65
[PassKit] Update bindings to Xcode 11.4 Beta 3 (#8041)
* [PassKit] Update bindings to Xcode 11.4 Beta 3

* Implement feedback

* Update src/PassKit/PKEnums.cs

* Update src/PassKit/PKEnums.cs

* Fix attributes
2020-03-04 20:23:42 -05:00
Sebastien Pouliot bdd39b529e
[mtouch][mmp] Add a `--warn-on-type-ref=X` option (#8038)
Using this option it's possible to test for the presence of a type
reference in both pre-linked and post-linked assemblies.

This makes it possible to detect if
* a 3rd party assemblies are using some specific type you would like to avoid;
* a type reference has been removed during the build (e.g. linker)

Notes:
* Custom attributes are encoded differently and not included in the assembly type references metadata.
* Assembly that define a type `X` do not have a reference (but the definition) of the type (and won't be reported).

If either the pre or post-linked warnings are not useful then it's possible
 to add `-nowarn:150x` to exclude the results.

E.g.
* `-nowarn:1502` would not report references in pre-linked assemblies;
* `-nowarn:1503` would not report references in post-linked assemblies;

Finally `-warnaserror:150x` can be used to stop a build that would not
satisfy either the pre or post-linked condition.

* `-warnaserror:1502` would not report references in pre-linked assemblies;
* `-warnaserror:1503` would not report references in post-linked assemblies;

_side note_ this was first done on `d16-6` to ease backports as `master`
has multiple changes for localization. A similar PR will be done for
`master` once merged.
2020-03-04 17:28:39 -05:00
Manuel de la Pena 0c085cd719
[XHarness] Add tests for all the logging classes. (#8032)
Move to use interfaces, that will let us later add tests that will
verify that all the correct logging is performed. As an example, added a
test for XmlResultParser that ensures that the failures are correctly
generated. The test uses Moq to pass the different paths to be used and
later be able to verify the wirtten xml.


Co-authored-by: Přemek Vysoký <premek.vysoky@microsoft.com>
2020-03-04 15:27:52 -05:00
Alex Soto ac8fb30f5d
[xcode11.4] Initial commit for Xcode 11.4 Beta 3 support (#8034)
* [xcode11.4] Initial commit for Xcode 11.4 Beta 3 support

* [monotouch-test] Adjust `TextFieldTest.EmptySelection` to 13.4 changes
2020-03-04 11:24:02 -05:00
Sebastien Pouliot 004b50f590
[tests][monotouch-test] Tweak UIWebView tests to work in every case (#8033)
so if we optimize (to remove references) the tests will be ignored.
Doing this based on define was wrong since we have different (and more)
configurations executed on devices,
2020-03-03 17:07:10 -05:00
Sebastien Pouliot c2ca09dc69
[corefoundation] Fix TypeInitializationException in OSLog (#7962)
`Default` property was using a nil-handle which is incorrect since
* we don't allow that (this is generally a bad sign)
* it does not map to `OS_LOG_DEFAULT`

Since `Default` was assigned in the type (static) constructor then
the whole type became unusable :(

Header `log.h` shows that the right definition requires us to load a
field and use it.

```
define OS_LOG_DEFAULT OS_OBJECT_GLOBAL_OBJECT(os_log_t, _os_log_default)
```

While `NULL` can actually be used for disabled (not exposed) by this
contradicting (nullability-wise) macro

```
define OS_LOG_DISABLED ((os_log_t _Nonnull)NULL)
```

Also adds unit tests. A more general tests for `.cctor` will be added
to introspection tests in a separate PR.

Fixes https://github.com/xamarin/xamarin-macios/issues/7959
2020-03-03 16:38:43 -05:00
Manuel de la Pena 169cecfe93
[Harness] Refactor a little the code for logging to simplify testing. (#8021)
Move to use interfaces, that will let us later add tests that will
verify that all the correct logging is performed. As an example, added a
test for XmlResultParser that ensures that the failures are correctly
generated. The test uses Moq to pass the different paths to be used and
later be able to verify the wirtten xml.
2020-03-03 13:59:44 -05:00
Alex Soto 709a90599e Merge remote-tracking branch 'xamarin/xcode11.4' into d16-5-xcode11.4-merge 2020-03-03 10:57:24 -05:00
Alex Soto 5cc1406ec4
[Intents] Update bindings from Xcode 10.3 to Xcode 11.4 Beta 2 (#8025)
* [Intents] Update bindings from Xcode 10.3 to Xcode 11.4 Beta 2

* Fix breaking change and apply feedback

* actually add the bug number 🙄
2020-03-03 06:49:56 -05:00
Rolf Bjarne Kvinge eeff89f895
[monotouch-test] Improve NWBrowserTest.TestStateChangesHandler to not assert on background threads. (#8022)
Asserts will throw an exception when the assert fails, which will crash the
app if it happens on a background thread. So marshal any exceptions to the
main thread.

Solves this (by turning it into a normal NUnit assert failure):

    Unhandled Exception:
    NUnit.Framework.AssertionException:   newResult first run
      Expected: null
      But was:  <Network.NWBrowseResult>
    2020-02-28 19:47:41.214499-0500 monotouchtest[46412:20292304] Unhandled managed exception:   newResult first run
      Expected: null
      But was:  <Network.NWBrowseResult>
     (NUnit.Framework.AssertionException)

    =================================================================
    	Native Crash Reporting
    =================================================================
    Got a SIGABRT while executing native code. This usually indicates
    a fatal error in the mono runtime or one of the native libraries
    used by your application.
    =================================================================

    =================================================================
    	Native stacktrace:
    =================================================================
    	0x107c028c5 - /Users/builder/Library/Developer/CoreSimulator/Devices/E7C088E5-575C-42B7-ADFB-8144438C78A5/data/Containers/Bundle/Application/E3172E17-F6D2-4BC0-8770-379689518F78/monotouchtest.app/monotouchtest : mono_dump_native_crash_info
    	0x107bf6f85 - /Users/builder/Library/Developer/CoreSimulator/Devices/E7C088E5-575C-42B7-ADFB-8144438C78A5/data/Containers/Bundle/Application/E3172E17-F6D2-4BC0-8770-379689518F78/monotouchtest.app/monotouchtest : mono_handle_native_crash
    	0x107c01f1b - /Users/builder/Library/Developer/CoreSimulator/Devices/E7C088E5-575C-42B7-ADFB-8144438C78A5/data/Containers/Bundle/Application/E3172E17-F6D2-4BC0-8770-379689518F78/monotouchtest.app/monotouchtest : sigabrt_signal_handler
    	0x7fff40be642d - /Applications/Xcode113.app/Contents/Developer/Platforms/AppleTVOS.platform/Library/Developer/CoreSimulator/Profiles/Runtimes/tvOS.simruntime/Contents/Resources/RuntimeRoot/usr/lib/system/libsystem_platform.dylib : _sigtramp
    	0x7ff295501cb0 - Unknown
    	0x7fff40ad6a1c - /Applications/Xcode113.app/Contents/Developer/Platforms/AppleTVOS.platform/Library/Developer/CoreSimulator/Profiles/Runtimes/tvOS.simruntime/Contents/Resources/RuntimeRoot/usr/lib/system/libsystem_c.dylib : abort
    	0x107e3d33f - /Users/builder/Library/Developer/CoreSimulator/Devices/E7C088E5-575C-42B7-ADFB-8144438C78A5/data/Containers/Bundle/Application/E3172E17-F6D2-4BC0-8770-379689518F78/monotouchtest.app/monotouchtest : xamarin_unhandled_exception_handler.cold.1
    	0x107e30c09 - /Users/builder/Library/Developer/CoreSimulator/Devices/E7C088E5-575C-42B7-ADFB-8144438C78A5/data/Containers/Bundle/Application/E3172E17-F6D2-4BC0-8770-379689518F78/monotouchtest.app/monotouchtest : xamarin_unhandled_exception_handler
    	0x107cb7525 - /Users/builder/Library/Developer/CoreSimulator/Devices/E7C088E5-575C-42B7-ADFB-8144438C78A5/data/Containers/Bundle/Application/E3172E17-F6D2-4BC0-8770-379689518F78/monotouchtest.app/monotouchtest : mono_invoke_unhandled_exception_hook
    	0x107bf69ea - /Users/builder/Library/Developer/CoreSimulator/Devices/E7C088E5-575C-42B7-ADFB-8144438C78A5/data/Containers/Bundle/Application/E3172E17-F6D2-4BC0-8770-379689518F78/monotouchtest.app/monotouchtest : mono_handle_exception_internal
    	0x107bf4ed9 - /Users/builder/Library/Developer/CoreSimulator/Devices/E7C088E5-575C-42B7-ADFB-8144438C78A5/data/Containers/Bundle/Application/E3172E17-F6D2-4BC0-8770-379689518F78/monotouchtest.app/monotouchtest : mono_handle_exception
    	0x107b76019 - /Users/builder/Library/Developer/CoreSimulator/Devices/E7C088E5-575C-42B7-ADFB-8144438C78A5/data/Containers/Bundle/Application/E3172E17-F6D2-4BC0-8770-379689518F78/monotouchtest.app/monotouchtest : mono_amd64_throw_exception
    	0x1085c95b0 - Unknown
    	0x107e30a25 - /Users/builder/Library/Developer/CoreSimulator/Devices/E7C088E5-575C-42B7-ADFB-8144438C78A5/data/Containers/Bundle/Application/E3172E17-F6D2-4BC0-8770-379689518F78/monotouchtest.app/monotouchtest : xamarin_process_managed_exception
    	0x107bf671e - /Users/builder/Library/Developer/CoreSimulator/Devices/E7C088E5-575C-42B7-ADFB-8144438C78A5/data/Containers/Bundle/Application/E3172E17-F6D2-4BC0-8770-379689518F78/monotouchtest.app/monotouchtest : mono_handle_exception_internal
    	0x107bf4ed9 - /Users/builder/Library/Developer/CoreSimulator/Devices/E7C088E5-575C-42B7-ADFB-8144438C78A5/data/Containers/Bundle/Application/E3172E17-F6D2-4BC0-8770-379689518F78/monotouchtest.app/monotouchtest : mono_handle_exception
    	0x107b76019 - /Users/builder/Library/Developer/CoreSimulator/Devices/E7C088E5-575C-42B7-ADFB-8144438C78A5/data/Containers/Bundle/Application/E3172E17-F6D2-4BC0-8770-379689518F78/monotouchtest.app/monotouchtest : mono_amd64_throw_exception
    	0x1085c95b0 - Unknown
    	0x11aed4ceb - Unknown
    	0x7fff3fa7ecfe - /Applications/Xcode113.app/Contents/Developer/Platforms/AppleTVOS.platform/Library/Developer/CoreSimulator/Profiles/Runtimes/tvOS.simruntime/Contents/Resources/RuntimeRoot/usr/lib/libnetwork.dylib : nw_parallel_array_apply_with_range
    	0x7fff3f975077 - /Applications/Xcode113.app/Contents/Developer/Platforms/AppleTVOS.platform/Library/Developer/CoreSimulator/Profiles/Runtimes/tvOS.simruntime/Contents/Resources/RuntimeRoot/usr/lib/libnetwork.dylib : __nw_browser_notify_browse_result_changes_locked_block_invoke.100
    	0x7fff409c9848 - /Applications/Xcode113.app/Contents/Developer/Platforms/AppleTVOS.platform/Library/Developer/CoreSimulator/Profiles/Runtimes/tvOS.simruntime/Contents/Resources/RuntimeRoot/usr/lib/system/libdispatch.dylib : _dispatch_call_block_and_release
    	0x7fff409ca7b9 - /Applications/Xcode113.app/Contents/Developer/Platforms/AppleTVOS.platform/Library/Developer/CoreSimulator/Profiles/Runtimes/tvOS.simruntime/Contents/Resources/RuntimeRoot/usr/lib/system/libdispatch.dylib : _dispatch_client_callout
    	0x7fff409d9d69 - /Applications/Xcode113.app/Contents/Developer/Platforms/AppleTVOS.platform/Library/Developer/CoreSimulator/Profiles/Runtimes/tvOS.simruntime/Contents/Resources/RuntimeRoot/usr/lib/system/libdispatch.dylib : _dispatch_root_queue_drain
    	0x7fff409da39b - /Applications/Xcode113.app/Contents/Developer/Platforms/AppleTVOS.platform/Library/Developer/CoreSimulator/Profiles/Runtimes/tvOS.simruntime/Contents/Resources/RuntimeRoot/usr/lib/system/libdispatch.dylib : _dispatch_worker_thread2
    	0x7fff40bee6b6 - /Applications/Xcode113.app/Contents/Developer/Platforms/AppleTVOS.platform/Library/Developer/CoreSimulator/Profiles/Runtimes/tvOS.simruntime/Contents/Resources/RuntimeRoot/usr/lib/system/libsystem_pthread.dylib : _pthread_wqthread
    	0x7fff40bed827 - /Applications/Xcode113.app/Contents/Developer/Platforms/AppleTVOS.platform/Library/Developer/CoreSimulator/Profiles/Runtimes/tvOS.simruntime/Contents/Resources/RuntimeRoot/usr/lib/system/libsystem_pthread.dylib : start_wqthread
2020-03-02 17:27:27 +01:00
Sebastien Pouliot 54f2dae935
[mtouch] Add `force-rejected-types-removal` optimization (#8009)
This optimization can be enabled when it's not possible to use the
managed linker (e.g. **Don't link**) or when the managed linker cannot
remove references to deprecated types that would cause an application
to be rejected by Apple.

References to the existing types will be renamed, e.g. `UIWebView` to
`DeprecatedWebView`, in every assemblies.

The type definition is also renamed (for validity) and all custom
attributes on the types and their members will be removed.
Code inside the members will be replaced with a
`throw new NotSupportedException ();`.

The msbuild test app `MyReleaseBuild` has been updated to test that the
optimization is working as expected (device builds are slow so reusing
this test has little impact in test time).

Basically the test ensure that `UIWebView` is used and cannot be removed
by the compiler (optimization) or the managed linker (since it's
referenced). Since the optimization is enabled then we can `grep` then
final `.app` directory to ensure there's no mention of `UIWebView` inside
any of the files that would be submitted.

The application can be run, by itself, and will turn green if OK, red if
`DeprecatedWebView` can't be found (skeleton replacement for `UIWebView`)
or orange if a `NotSupportedException` is thrown.

Finally introspection tests have been updated to skip over the deprecated
(and renamed) types. It should not be an issue right now, since this
optimization is not enabled by default, but it made testing easier.
2020-03-02 09:20:29 -05:00
Manuel de la Pena 8664a96f72
[Harness] When on device, check if we got a tcp exception on a crash. (#8015)
Some crashes are reported as tcp connection issues because they happen
before the app had the chance to write anything in the log. In that
case, we checked for the presence of the file, and if not present we
decided it was a tcp issue when it is not the case.

In this commit, we check for the tcp erorr message in the main_log so
that we are certain that the issue was with the connection and not
anyother.

Testingis simple, ran tests without the phone being part of the same
network and test with a branch that has a crash. For example the one in
https://github.com/xamarin/xamarin-macios/pull/8009 hash 83240612e8
2020-02-29 08:45:48 -05:00
Rolf Bjarne Kvinge 47291a95b4
[src] Simplify/remove defines. (#8011)
* XAMARIN_MAC: Used once, replace with MONOMAC.
* UNIFIED: Use once elsewhere, replace with __UNIFIED__.
* OBJECT_REF_TRACKING: not used anywhere.
* XAMARIN_MODERN: not used anywhere.
* NET_2_0: not used anywhere.

Also update the README a bit.
2020-02-29 00:22:58 +01:00
Rolf Bjarne Kvinge ad15106af4
[msbuild] Add support for Metal in the simulator. Fixes #7392. (#7983) (#7991)
* [msbuild] Provide the correct value for the operating system for tvOS and watchOS to a few tasks. Fixes #6200. (#7226)

The problem with #6200 was that we'd pass -mios-version-min=x.y to the metal
tool even for tvOS apps. This fixes it so that now pass -mtvos-version-min.

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

* [msbuild] Add support for Metal in the simulator. Fixes #7392. (#7983)
2020-02-28 19:59:03 +01:00
Manuel de la Pena dc57f88e9f
[Xharness] We support diff xml outputs. Allow to pass the desired one. (#7971)
We support different outputs, lets add the avility for the caller to
decide which one to use. We default to NUnit V3 due to or dependency to
it in VSTS.
2020-02-27 20:10:48 -05:00
Manuel de la Pena b9a45930ab
[Harness] Remove dead code. (#7990)
We do not longer compile the bcl tests, but we consume them as part or
mono. The old BCL targets and classes are not needed. As you can see,
the lists were empty.
2020-02-26 21:21:09 -05:00
Manuel de la Pena 3710528e0d
[Harness] Add tests for the xml result parser. (#7988)
Add tests to make sure that we can be safe when we make changes to that
part of the code.

Some methods are not tested but due to dependencies. Will work un
separating things a little to keep moving fwd.
2020-02-26 19:50:37 -05:00
monojenkins fe451491f6
[xcode11.4] [tests] Add `.cctor` execution to introspection (#7987)
This will spot cases like https://github.com/xamarin/xamarin-macios/issues/7959
where a type (static) constructor can fail at runtime, leading to
`TypeLoadException`

Ideally it's covered by it's own tests but it's better covered twice
than never :)

On iOS 64bits [1] simulator we hit some failures [2], later, if the
`.cctor` is executed. It's not a big deal to avoid those types since
we it will be executed on devices later.

[1] API not present on 32bits

[2] Fixing the following triggers similar failures for `DCDevice`

```
ApiClassPtrTest.VerifyClassPtr: class_ptr and RegisterAttribute are different: NFCIso15693CustomCommandConfiguration
Expected: 0
But was: 140735471513712

ApiSelectorTest.StaticMethods: 7 errors found in 2788 static selector validated:
CoreNFC.NFCIso15693ReaderSession : readingAvailable
CoreNFC.NFCNdefMessage : ndefMessageWithData:
CoreNFC.NFCNdefPayload : wellKnownTypeURIPayloadWithString:
CoreNFC.NFCNdefPayload : wellKnownTypeURIPayloadWithURL:
CoreNFC.NFCNdefPayload : wellKnownTypeTextPayloadWithString:locale:
CoreNFC.NFCNdefReaderSession : readingAvailable
CoreNFC.NFCReaderSession : readingAvailable
Expected: 0
But was: 7
```

Co-authored-by: Sebastien Pouliot <sebastien.pouliot@gmail.com>
2020-02-26 16:16:04 -05:00
Sebastien Pouliot 98b8ac8321
[tests] Add `.cctor` execution to introspection (#7976)
This will spot cases like https://github.com/xamarin/xamarin-macios/issues/7959
where a type (static) constructor can fail at runtime, leading to
`TypeLoadException`

Ideally it's covered by it's own tests but it's better covered twice
than never :)

On iOS 64bits [1] simulator we hit some failures [2], later, if the
`.cctor` is executed. It's not a big deal to avoid those types since
we it will be executed on devices later.

[1] API not present on 32bits

[2] Fixing the following triggers similar failures for `DCDevice`

```
ApiClassPtrTest.VerifyClassPtr: class_ptr and RegisterAttribute are different: NFCIso15693CustomCommandConfiguration
Expected: 0
But was: 140735471513712

ApiSelectorTest.StaticMethods: 7 errors found in 2788 static selector validated:
CoreNFC.NFCIso15693ReaderSession : readingAvailable
CoreNFC.NFCNdefMessage : ndefMessageWithData:
CoreNFC.NFCNdefPayload : wellKnownTypeURIPayloadWithString:
CoreNFC.NFCNdefPayload : wellKnownTypeURIPayloadWithURL:
CoreNFC.NFCNdefPayload : wellKnownTypeTextPayloadWithString:locale:
CoreNFC.NFCNdefReaderSession : readingAvailable
CoreNFC.NFCReaderSession : readingAvailable
Expected: 0
But was: 7
```
2020-02-26 15:03:59 -05:00
Manuel de la Pena 3d32ab52a7
[Harness] Move BCLTestImport sources to their rightful place. (#7985)
We initially added a cmd to do the bcl test import generation that has
never been used.

We are moving the bcl test importer code to xharness and creating a
NUnit test project to run the tests that we already added. Unit tests
pass.
2020-02-26 14:10:36 -05:00
Manuel de la Pena d1eec8b3d0
[Harness] Add extra labels to allow to select a smaller set of tests. (#7937)
It will be nice to be able to have a smaller set of tests to be ran by
xharness. In this commit we add a set of labels to be able to divide the
test in the following groups:

* Xamarin - all tests BUT monotouch.
* Monotouch - just monotouch tests.
* Old BCL - The BCL tests that are based on NUnit
* New BCL - The BCL tests that are based on xUnit.
* mscorlib - Just the test that exercise mscorlib (and the different
groups, mscorlib 1, mscorlib 2 etc..)

This will allow to parallelize the execution of the full test suit in
different agents in VSTS.
2020-02-25 22:47:05 -05:00
Manuel de la Pena f3b02e2575
[Harness] Fix false crash report. (#7979)
fixes: https://github.com/xamarin/xamarin-macios/issues/7978
2020-02-25 22:46:27 -05:00
Sebastien Pouliot 9a8855117b
[corefoundation] Fix TypeInitializationException in OSLog (#7962)
`Default` property was using a nil-handle which is incorrect since
* we don't allow that (this is generally a bad sign)
* it does not map to `OS_LOG_DEFAULT`

Since `Default` was assigned in the type (static) constructor then
the whole type became unusable :(

Header `log.h` shows that the right definition requires us to load a
field and use it.

```
define OS_LOG_DEFAULT OS_OBJECT_GLOBAL_OBJECT(os_log_t, _os_log_default)
```

While `NULL` can actually be used for disabled (not exposed) by this
contradicting (nullability-wise) macro

```
define OS_LOG_DISABLED ((os_log_t _Nonnull)NULL)
```

Also adds unit tests. A more general tests for `.cctor` will be added
to introspection tests in a separate PR.

Fixes https://github.com/xamarin/xamarin-macios/issues/7959
2020-02-25 08:55:37 -05:00
Alex Soto dd83fbed2d
[UIKit] Update bindings to Xcode 11.4 Beta 2 (#7963) 2020-02-25 06:50:39 -05:00
Alex Soto 69c19184b1
[WatchKit] Update bindings to Xcode 11.2 Beta 2 (#7965) 2020-02-24 19:36:03 -05:00
Manuel de la Pena 09c4c80c21
[Harness] Add start-time to work around a bug in the publishing tool. (#7951)
The publishing tool is a little fragile. In run
https://devdiv.visualstudio.com/DevDiv/_build/results?buildId=3490479&view=logs&j=67d14776-f827-5fe4-2625-2db4b5987fd1&t=fa262eec-9d97-5ba4-b4cc-a9292beecd8f
I noticed that valid test runs with a failing test (launch issues) were
not being uploaded.

I found out that the reason is a flaw in the logic on the parser of the
publishing tool. The tool assumes, that if there is no start-time, there
are no test results (do remember that NUnitV3 is schemaless we don't
know exactly what attrs are compulsory).

The culprint is line: https://dev.azure.com/mseng/AzureDevOps/_git/AzureDevOps?path=%2FTa%2FTasks%2FPublishTestResults%2FParser%2FNUnitResultParser.cs&version=GBmaster&line=473&lineEnd=473&lineStartColumn=63&lineEndColumn=64&lineStyle=plain

Basically:

```csharp
 if (testRunNode?.Attributes?["start-time"] != null) {
   // import test data
 }

 // do nothing interesting since there is no data
```

This commit fixes it by setting the start time as the current one, we
dont care since it is a failure xml result.
2020-02-21 14:00:14 -05:00
Manuel de la Pena 8554b84b67
[Harness] Do not add the variation two times to failure messages. (#7950)
AppName should only be the app name since we are passing the varation as
a parameter too. Else we end up with $"{appname} {variation} {variation}".
2020-02-21 10:24:21 -05:00
Sebastien Pouliot d83e13edf1
[mtouch][mmp] Add a `--warn-on-type-ref=X` option (#7949)
Using this option it's possible to test for the presence of a type
reference in both pre-linked and post-linked assemblies.

This makes it possible to detect if
* a 3rd party assemblies are using some specific type you would like to avoid;
* a type reference has been removed during the build (e.g. linker)

Notes:
* Custom attributes are encoded differently and not included in the assembly type references metadata.
* Assembly that define a type `X` do not have a reference (but the definition) of the type (and won't be reported).

If either the pre or post-linked warnings are not useful then it's possible
 to add `-nowarn:150x` to exclude the results.

E.g.
* `-nowarn:1502` would not report references in pre-linked assemblies;
* `-nowarn:1503` would not report references in post-linked assemblies;

Finally `-warnaserror:150x` can be used to stop a build that would not
satisfy either the pre or post-linked condition.

* `-warnaserror:1502` would not report references in pre-linked assemblies;
* `-warnaserror:1503` would not report references in post-linked assemblies;

_side note_ same as https://github.com/xamarin/xamarin-macios/pull/7925
except that this one uses the localized mtouch/mmp errors only in master (so far)
2020-02-20 22:25:23 -05:00
Sebastien Pouliot 1ce5eeb3dc
[mtouch][mmp] Fix possible exception when logging strings with `{x}` (#7941)
We can end up with a format that has `{x}` inside it and no argument. If
this is logged (which depends on verbosity level) then we end up with an
uncaught exceptions and either `MT0000` or `MM0000` errors.

This happens in #7904 due to other, unrelated, issues (a variable is not
expanded) but this can happen in other circumstances, e.g. a file could
be named `{x}.cs`.

The easy fix is to use the right `Console.WriteLine` overload if there
are no arguments provided. This is always good since it avoid an non
required call to `String.Format`.

Fixes https://github.com/xamarin/xamarin-macios/issues/7904
2020-02-20 14:52:25 -05:00
Manuel de la Pena ca26ef62d5
[Harness] Close message element correctly in NUnit3. (#7946)
Xml should be:
```
<failure>
  <message>Foo</message>
  <stack-trace>Bar</stack-trace>
</failure>
```

But we generate:

```
<failure>
  <message>Foo
    <stack-trace>Bar</stack-trace>
  </message>
</failure>
```

Makes the parsing of the failures impossible.
2020-02-20 11:15:57 -05:00
Manuel de la Pena 5b0361d911
[Harness] Provide device name in those errors where is device specific. (#7947)
In order to simplify the monitoring job add the device name to the
following failures:

* Installation
* Launch
* Tcp Connection

All the above are most of the time due to a misconfigured device. The
device name is useful information for the monitoring person to be able
to reach IT and address the issue.
2020-02-20 11:15:40 -05:00
Manuel de la Pena 44bd2c8589
[Harness] Fix merge mistake. (#7940) 2020-02-19 18:39:05 -05:00
Alex Soto cbe129fad0
[xcode11.4] Add support for Xcode 11.4 Beta 2 (#7944) 2020-02-19 18:33:06 -05:00
Manuel de la Pena c68b94bb89
[Tests] Update MT4134 tests for the new Xcode 11.4 (#7931)
New frameworks were added and the test needs to be updated.
2020-02-19 16:13:34 -05:00
Manuel de la Pena 271a7c5e6c
[Harness] Ensure that the crashed var is out and is propagated to the rest of the code. (#7938)
The parsing code set the crashed variable, but it was not set as an
output variable, that meant that the value was not used. Further in the
code we use the variable to decide if we had a crash or not. Most of the
time, there is no probel since if we have a real crash, we will get the
crash reports and to the right thing, but in the case of tcp connection
issues we do not have them, and therefore the crash xml result is not
created.

Bonus: the local logs variable was hidding a variable in another scope,
fixed that.
2020-02-19 13:18:34 -05:00
Manuel de la Pena 35c04caa1b
[Harness] If there is not BuildTask, do not add logs. (#7936)
xharness does not only allow to run tests in CI, but also helps to run
specific project. That feature is used for the mtouch tests. In that
scenario, we do not have a build task and therefore we will not have the
build logs.

fixes: https://github.com/xamarin/maccore/issues/2154
2020-02-19 11:25:44 -05:00
Manuel de la Pena af784d6613
[Harness] Create xml unit test failure when an application timesout. (#7929)
If we are in VSTS and we want to have correct reportings we need to
generate a test failure when the applicaiton times out. If not, we have
a missmatch between the results from xharness (we have failures) and
VSTS (success).
2020-02-18 10:28:06 -05:00
Manuel de la Pena f9c502579b
[Harness] Create a xml crash file when we do not have a result file. (#7928)
On devices that cannot reach the host via TCP we do not have a log, this
means that in the if statement needs to have a case for it.

The main problem is that when the device cannot connect to the host, we
do not get a log OR a crash reason from the crash logs. It makes sense
not to have a crash reason, because the app did not crash. In these
sitations, we have to create a xml crash report (since we really do not
know if we can parse the file) that will tell vsts that there was an
issue. Adding the main log will let the monitoring person see the
results of the test run.
2020-02-18 09:16:10 -05:00
Manuel de la Pena 9d11429de3
[Tests] Fix AudioQueueTest.Properties test. (#7930)
From the documentation of
https://developer.apple.com/documentation/audiotoolbox/audio_converter_services?language=objc
I think we can deduce that we are hitting a 'hwiu' which is Hardware in
use. Could make sense if we did not clean up properly. Switching to use
the software implementation should fix the flacky test.

fixes: https://github.com/xamarin/maccore/issues/1614
2020-02-18 09:09:47 -05:00
Manuel de la Pena 8f58afe857
[Harness] Add a prefix to the final xml to be imported. (#7914)
Because the PublishTest task is taking a regular expression, it is
importing the test results more than one, which gives wrong stats. Add a
prefix to better filter those files we are interested in (thos with
attachments).

As a bonus, refactored the xml failure code for less copy pasting and to
have a single place where we had to add the prefix.
2020-02-17 12:27:22 -05:00
Manuel de la Pena 5475256f51
[XHarness] Close left open html tags. (#7915) 2020-02-17 12:18:31 -05:00
Manuel de la Pena 65df0e650e
[Harness] Use fullname for test-case in the xunit xslt. (#7912)
After reading the code of the parser used in VSTS I found out that name
is not used, but fullname. That attribute is the one used in their xml
parser to set the 'testCaseResultData.AutomatedTestName'.

Parser src: https://dev.azure.com/mseng/AzureDevOps/_git/AzureDevOps?path=%2FTa%2FTasks%2FPublishTestResults%2FParser%2FNUnitResultParser.cs&_a=contents&version=GBmaster
2020-02-17 12:18:09 -05:00
Manuel de la Pena 00c3867ca9
[Xhanress] If we fail to install the application, report it as an test failure. (#7902)
VSTS does not provide a good way to report an app installation issue,
but we can fake a failure in the test when the installation does not
happen.

In the case of the installation failure a xml test result is generated
that will expose all the required information and will attach all the
needed logs (install logs). An example of the generated result can be
seen here: https://gist.github.com/mandel-macaque/2274bcd8785eebd636b98142e228afa9
2020-02-14 17:28:00 -05:00
Manuel de la Pena d2eb074bb4
[XHarness] If there is a build error, report it as a test failure. (#7903)
If there is a build error generate a xml that will be imported by VSTS
and will be reported as a test failure.

Examnple of the error: https://gist.github.com/mandel-macaque/dab2a5a4f3d21a81c172a8c8450d2448
2020-02-14 17:27:35 -05:00
Manuel de la Pena 6fde517698
[Harness] If app does not launch or crash, create a test failure. (#7906)
Make sure that when we are running on VSTS we do get test failures when
the application cannot be launched or crashes.
2020-02-14 17:27:01 -05:00
Rolf Bjarne Kvinge f9d9f6becf
[tests] Simulator dylibs can either have min OS version 7.0 or 8.0. Fixes xamarin/maccore#2153. (#7895)
Fixes https://github.com/xamarin/maccore/issues/2153.
2020-02-14 20:20:55 +01:00
Rolf Bjarne Kvinge d2f3733a1d
[tests] Ignore Xamarin.MMP.Tests.WarningTests.MM0135 on macOS 10.15+. Fixes xamarin/maccore#2035. (#7896)
Ignore Xamarin.MMP.Tests.WarningTests.MM0135 on macOS 10.15+, because this
test requires Xcode 9.4, which doesn't work on macOS 10.15+.

Fixes https://github.com/xamarin/maccore/issues/2035.
2020-02-14 20:17:04 +01:00
Manuel de la Pena 4bdbf3035f
[XHarness] Add ids to the xunit to nunit transformed tests. (#7889)
The NUnit3 xml requires an id for the tests, but xunit does not provide
one. Add an extension object to the xslt that will return a very lame id
so that the test uploader does not complain.

fixes: https://github.com/xamarin/xamarin-macios/issues/7888
2020-02-14 12:45:32 -05:00
Manuel de la Pena f41a64fd29
[Harness] Attach build logs to NUnit V3 xml results. (#7855)
Get the previous task ID and use it to build the log directory of the
builds, then add all the combined files as attachments.

Fixes: https://github.com/xamarin/xamarin-macios/issues/7854
2020-02-13 16:51:14 -05:00
Alex Soto b437313fe0
[UIKit] Update bindings to Xcode 11.4 Beta 1 (#7887) 2020-02-13 16:12:07 -05:00
Alex Soto 91172a80c4
[PassKit] Update bindings to Xcode 11.4 Beta 1 (#7885) 2020-02-13 14:42:14 -05:00
monojenkins 86000d0c3b
[XHarness] Generate TestReorts for NUnit V3. (#7881)
Now that we have NUnit V3 xml results, do generate the test report for
those correctly.

Co-authored-by: Manuel de la Pena <mandel@microsoft.com>
2020-02-13 11:59:15 -05:00
Alex Soto efe0e25e66
[CallKit] Update bindings to Xcode 11.4 Beta 1 (#7860) 2020-02-13 10:04:24 -05:00
Alex Soto 19e6e07ce2
[CoreLocation] Update to Xcode 11.4 Beta 1 (#7867) 2020-02-13 07:03:00 -05:00
Rolf Bjarne Kvinge c517281f1c
Make the smcs script obsolete, and don't use it in tests anymore. (#7878)
Don't remove the entire script, because I believe there's code out there that
checks for the existence of the smcs script to determine whether Xamarin.iOS
is installed or not.
2020-02-13 08:37:52 +01:00
Manuel de la Pena 2cfc456787
[Harness] Add code that will generate custom xml results with failures. (#7874)
There are two cases that are not currently considered in VSTS that we
need to report:

1. The application could not be built.
2. The application crashed.

In those cases we do not have xml to be imported by VSTS. What we are
going to do is create 'fake' test runs that will encapsulate a build
error or a crash to be imported by VSTS with the needed attachments.

This code just writes custom errors. The generated results are like the
following:

* [NUnit V2](ihttps://gist.github.com/mandel-macaque/7207f6acb5a90895adf84f40a05e0b21)
* [NUnit V3](https://gist.github.com/mandel-macaque/99898c0570cde2e54e38d8af5991f824)
* [xUnit](https://gist.github.com/mandel-macaque/4591cc06d3db0e46de6a0bf886804f13)
2020-02-12 22:06:24 -05:00
Alex Soto d75b482e59
[GameKit] Update bindings to Xcode 11.4 Beta 1 (#7869)
* [GameKit] Update bindings to Xcode 11.4 Beta 1

* Fix message
2020-02-12 19:26:45 -05:00
Alex Soto d01d9cbb05
[CoreGraphics] Update bindings to Xcode 11.4 Beta 1 (#7865) 2020-02-12 18:35:47 -05:00
Alex Soto 08bb76928f
[AVFoundation] Update bindings to Xcode 11.4 Beta 1 (#7859) 2020-02-12 18:34:17 -05:00
Alex Soto fdba4ebdba
[ClassKit] Update bindings to Xcode 11.4 Beta 1 (#7862) 2020-02-12 18:23:52 -05:00
Alex Soto 56fa148802
[CarPlay] Update bindings to Xcode 11.4 Beta 1 (#7861) 2020-02-12 18:23:32 -05:00
Alex Soto 72e322c3cb
[AuthenticationServices] Update bindings to Xcode 11.4 Beta 1 (#7858) 2020-02-12 18:22:56 -05:00
Alex Soto 278049cdbb
[AppKit] Update bindings to Xcode 11.4 Beta 1 (#7857) 2020-02-12 18:22:24 -05:00
Manuel de la Pena 89d21f959c
[Harness] Add support for NUnit V3 in the new bcl tests. (#7870)
Add the required changes in the xunit runner to write NUnit V3 xml
result files so that we can have attachments in VSTS.
2020-02-12 18:17:11 -05:00
Manuel de la Pena 9303bb2dc5
[Xcode11.4][XHarness] Add logs to VSTS test runs. (#7844) (#7866)
As per the documentation of the VSTS test uploader (https://docs.microsoft.com/en-us/azure/devops/pipelines/tasks/test/publish-test-results?view=azure-devops&tabs=yaml#attachments-support)
the tests support the addition of attachments. We want to be able to
access the logs of the different tests runs, this is achieved the
following way:

1. Move TouchUnit to use NUnit V3 which allows to add attachments.
2. Once the tests are ran, add the attachments to the following nodes:
   1. The very first test-suite. This will allow to have the logs for
   succesul tests.
   2. Add logs to failing tests. Reduces the number of clicks to be done
   to access to the logs when a test case fails.
3. Modify the assembly name of the test-suit to match the name of the
application. This ensures two things.
   1. We have a consistent name for the file column in VSTS, that can be
   used to see recurrent failing tests.
   2. The name is more readable, since if not, it will contain the UUID
   of the device.

Logs are not added to succesful tests because it will have the following
problems:

* Larger data storage usage.
* Longer upload time. The addtion of the logs per tests (succesful or
failed) was tested and resulted in an upload time LONGER than 6 hours
for all TouchUnit, NUnit blc tests and xUnit bcl tests.

In order for this to be useful, the task in the pipeline SHOULD NOT
merge test runs. We should have a test run PER application so that we do
not mix the logs.

Co-Authored-By: Rolf Bjarne Kvinge <rolf@xamarin.com>
2020-02-12 18:16:30 -05:00
Manuel de la Pena 4544fb8fcd
[XHarness] Add NUnit3 support to the old bcl tests. (#7846)
Move the old bcl tests based on NUnit to use the NUnit V3 output so that
we can add logs to the vsts imported tests.

Follow up of PR: https://github.com/xamarin/xamarin-macios/pull/7844
2020-02-12 07:38:40 -05:00
Manuel de la Pena 35c010db63
[XHarness] USe static variables for common test names. (#7837) (#7853)
One of the reason why we lost the TestReport was because the xml added
from the new code did not use the same name for the log as the expected
one (https://github.com/xamarin/xamarin-macios/pull/7835/files#diff-03773861bcef485bf343300f31b60b0eR374).

If we are going to be using the description as a way to decide what is
going to be done with it, lets use static vars so that we do not have
logs added with the wrong name.
2020-02-12 07:36:43 -05:00
Manuel de la Pena 1a0b2bbcc0
[XHarness] Generate TestReorts for NUnit V3. (#7851)
Now that we have NUnit V3 xml results, do generate the test report for
those correctly.
2020-02-11 20:28:28 -05:00
Alex Soto cee4b5e5a1
[xcode11.4] Add xcode 11.4 b1 initial support (#7805)
* [xcode11.4] Add xcode 11.4 b1 initial support

* [xtro] re-enable PDFKit

* Disable watchOS and fix xtro

Unfortunately watchOS simulator hangs when we try to deploy to it
and it keeps our tests timing out. Disabling for now until we
can investigate more.

Disables PDFKit on xtro in macOS

* [jenkins] Switch to use the catalina bot group (#7819)

* Bump maccore to get fix for launching the simulator for watch apps.

New commits in xamarin/maccore:

* xamarin/maccore@546270c8f9 [Xamarin.Hosting] Fix the name of the notification we get when the simulator has launched. (#2145)

Diff: 55957e908d..546270c8f9

* [tests] Diable watch due to time out, enable 10,15,4 in intro, fix min version

* Bump macios-binaries to get updated binary mlaunch as well.

New commits in xamarin/macios-binaries:

* xamarin/macios-binaries@f8c6e63 Bump mlaunch to xamarin/maccore@546270c8f9

Diff: eb6980e8b6..f8c6e63228

* [msbuild] Reflect ibtool changes in our tests

Looks like Apple reverted some changes introduces in Xcode 11
in ibtool, for more context see xamarin/xamarin-macios#6970

* [mtouch] Workaround strange behavior of realpath.

Co-authored-by: Sebastien Pouliot <sebastien.pouliot@gmail.com>
Co-authored-by: Rolf Bjarne Kvinge <rolf@xamarin.com>
2020-02-11 20:25:43 -05:00
monojenkins 0c89f403a4
[xcode11.4] [XHarness] Do write the TestReport when we have xUnit results. (#7849)
Add code to write the TestReport when we have xunit results. Also
refactored code for the NUnit format to not use LINQ, it will use less
memory and in the future we can move to async (not now since it might
raise other problems).

fixes: https://github.com/xamarin/xamarin-macios/issues/7826

Co-authored-by: Manuel de la Pena <mandel@microsoft.com>
2020-02-11 18:43:39 -05:00
Manuel de la Pena be9a8b1e81
[XHarness] Add logs to VSTS test runs. (#7844)
As per the documentation of the VSTS test uploader (https://docs.microsoft.com/en-us/azure/devops/pipelines/tasks/test/publish-test-results?view=azure-devops&tabs=yaml#attachments-support)
the tests support the addition of attachments. We want to be able to
access the logs of the different tests runs, this is achieved the
following way:

1. Move TouchUnit to use NUnit V3 which allows to add attachments.
2. Once the tests are ran, add the attachments to the following nodes:
   1. The very first test-suite. This will allow to have the logs for
   succesul tests.
   2. Add logs to failing tests. Reduces the number of clicks to be done
   to access to the logs when a test case fails.
3. Modify the assembly name of the test-suit to match the name of the
application. This ensures two things.
   1. We have a consistent name for the file column in VSTS, that can be
   used to see recurrent failing tests.
   2. The name is more readable, since if not, it will contain the UUID
   of the device.

Logs are not added to succesful tests because it will have the following
problems:

* Larger data storage usage.
* Longer upload time. The addtion of the logs per tests (succesful or
failed) was tested and resulted in an upload time LONGER than 6 hours
for all TouchUnit, NUnit blc tests and xUnit bcl tests.

In order for this to be useful, the task in the pipeline SHOULD NOT
merge test runs. We should have a test run PER application so that we do
not mix the logs.


Co-Authored-By: Rolf Bjarne Kvinge <rolf@xamarin.com>
2020-02-11 14:03:16 -05:00
Rolf Bjarne Kvinge 29b9e75db9
Remove code that refers to /Developer/MonoTouch. (#7840)
It's about time.
2020-02-11 15:26:15 +01:00
Manuel de la Pena bd171282cf
[XHarness] USe static variables for common test names. (#7837)
One of the reason why we lost the TestReport was because the xml added
from the new code did not use the same name for the log as the expected
one (https://github.com/xamarin/xamarin-macios/pull/7835/files#diff-03773861bcef485bf343300f31b60b0eR374).

If we are going to be using the description as a way to decide what is
going to be done with it, lets use static vars so that we do not have
logs added with the wrong name.
2020-02-11 06:42:21 -05:00
Manuel de la Pena 072c262b9b
[XHarness] Do write the TestReport when we have xUnit results. (#7835)
Add code to write the TestReport when we have xunit results. Also
refactored code for the NUnit format to not use LINQ, it will use less
memory and in the future we can move to async (not now since it might
raise other problems).

fixes: https://github.com/xamarin/xamarin-macios/issues/7826
2020-02-10 21:44:33 -05:00
Sebastien Pouliot 7cbf90c5c6
[tests] Add cecil-based unit tests (#7825)
Only one to start... it's been discussed before but we generally
found other ways to do them. Let's continue to pick the best place
but we now have more options :)
2020-02-10 17:23:12 -05:00
Marius Ungureanu f841b1eb51
Use sizeof instead of Marshal.Sizeof (#7558) 2020-02-10 14:41:31 -05:00
Manuel de la Pena 359bbbb50b [XHarness] Refactor xml code to make the AppRunner class cleaner. (#7794)
There is a lot of logic related to xml in the AppRunner making it more
complicated than needed. Move the methods to a hlper class.
2020-02-10 10:58:50 -05:00
Manuel de la Pena 101c944bfc [Xharness] Fix all xml parsing issues and ensure that the xml can be consumed by VSTS. (#7768)
We ping the tcp listener to know that we have a tcp connection, that is
written in the xml logs, which means that parsing will not work. Ignore
the ping, parse xml, and make sure that the xml that will be consume by
vsts is valid.

This PR also fixes https://github.com/xamarin/maccore/issues/827 which does not longer happen.
2020-02-10 10:58:36 -05:00
Manuel de la Pena 9e45badf78 [Xharness] Add workaround when we could not share the internet in bots. (#7755)
Looks like we have issues with the internet sharing in the VSTS bots,
this means that now that we always try to parse the XML on CI, we get an
exception, catch it and do not show the results.

The workaround simply tries to read the xml, if possible, we will parse
it, else deal with the text only log. The fix will show the results, but
it is a workaround for a configuration issue in the CI.
2020-02-10 10:58:25 -05:00
Manuel de la Pena abf9dfc997 [Harness] Unify the CI properties. (#7750)
Unify the harness properties to just look at InCI and remove all the
other ones. There is no real need to have differences between jenkins
and VSTS and Wrench is gone.
2020-02-10 10:58:13 -05:00
Manuel de la Pena 2fb329bc96 [XHarness] If in CI, no matter which, use the Xml output. (#7745)
We used to test only on Jenkins, and if the build version had jenkins on
it, rather than doing so, just check if we are in the CI by looking if
BUILD_REVISION is present in the env.
2020-02-10 10:58:00 -05:00
monojenkins 6f712aeaef
[Harness] Just try to generate the report when is NUnit. (#7828)
Use the xml parsing helper methods to decide if the xml can be parsed
and if we will be able to generate the report. That way we avoid an
exception that makes the CI noise.

Co-authored-by: Manuel de la Pena <mandel@microsoft.com>
2020-02-10 10:40:59 -05:00
Sebastien Pouliot 482a63dc56
Update sampletester docs and fix typos (#7822) 2020-02-10 08:10:40 -05:00
Manuel de la Pena 829af5eec3 [Harness] Just try to generate the report when is NUnit.
Use the xml parsing helper methods to decide if the xml can be parsed
and if we will be able to generate the report. That way we avoid an
exception that makes the CI noise.
2020-02-08 02:19:40 +00:00
Manuel de la Pena c169895499 [Harness] Just try to generate the report when is NUnit.
Use the xml parsing helper methods to decide if the xml can be parsed
and if we will be able to generate the report. That way we avoid an
exception that makes the CI noise.
2020-02-07 17:00:26 -05:00
Manuel de la Pena 1f80ebe15e [XHarness] Refactor xml code to make the AppRunner class cleaner. (#7794)
There is a lot of logic related to xml in the AppRunner making it more
complicated than needed. Move the methods to a hlper class.
2020-02-06 08:54:26 -05:00
Manuel de la Pena 8acfe3859e [Xharness] Fix all xml parsing issues and ensure that the xml can be consumed by VSTS. (#7768)
We ping the tcp listener to know that we have a tcp connection, that is
written in the xml logs, which means that parsing will not work. Ignore
the ping, parse xml, and make sure that the xml that will be consume by
vsts is valid.

This PR also fixes https://github.com/xamarin/maccore/issues/827 which does not longer happen.
2020-02-06 08:54:00 -05:00
Manuel de la Pena d9bbdcf065 [Xharness] Add workaround when we could not share the internet in bots. (#7755)
Looks like we have issues with the internet sharing in the VSTS bots,
this means that now that we always try to parse the XML on CI, we get an
exception, catch it and do not show the results.

The workaround simply tries to read the xml, if possible, we will parse
it, else deal with the text only log. The fix will show the results, but
it is a workaround for a configuration issue in the CI.
2020-02-06 08:53:34 -05:00
Manuel de la Pena fc0dd8812b [Harness] Unify the CI properties. (#7750)
Unify the harness properties to just look at InCI and remove all the
other ones. There is no real need to have differences between jenkins
and VSTS and Wrench is gone.
2020-02-06 08:53:13 -05:00
Manuel de la Pena 2aad661b4c [XHarness] If in CI, no matter which, use the Xml output. (#7745)
We used to test only on Jenkins, and if the build version had jenkins on
it, rather than doing so, just check if we are in the CI by looking if
BUILD_REVISION is present in the env.
2020-02-06 08:52:57 -05:00
Manuel de la Pena fe2b014d6a
[XHarness] Refactor xml code to make the AppRunner class cleaner. (#7794)
There is a lot of logic related to xml in the AppRunner making it more
complicated than needed. Move the methods to a hlper class.
2020-02-05 21:23:44 -05:00
Manuel de la Pena 0144c3b94f
[Xharness] Fix all xml parsing issues and ensure that the xml can be consumed by VSTS. (#7768)
We ping the tcp listener to know that we have a tcp connection, that is
written in the xml logs, which means that parsing will not work. Ignore
the ping, parse xml, and make sure that the xml that will be consume by
vsts is valid.

This PR also fixes https://github.com/xamarin/maccore/issues/827 which does not longer happen.
2020-02-04 11:03:38 -05:00
Sebastien Pouliot 4cc97e6767
Merge pull request #7785 from spouliot/d16-5-sampletester-update
[d16-5][tests][sampletester] Backport fixes from master
2020-02-04 08:33:00 -05:00
Rolf Bjarne Kvinge 04aef86638
[mtouch] Auto-change settings where they're honored for extensions. Fixes #7780. (#7786)
When building extensions, we first store all the mtouch arguments in a file
when msbuild builds the extension, and then when msbuild builds the main
project, we load those arguments again and actually build the extension at the
same time as we build the main app.

As such, it's important to make sure that when we reload the extension
arguments we end up with the exact same build configuration as the first time.

Unfortunately that was not the case regarding the interpreter: we
automatically set the 'EnableRepl' value in Main according to whether the
interpreter was enabled or not, but Main is not called after re-loading the
arguments when building extensions.

Fix this by moving the logic that automatically sets 'EnableRepl' to somewhere
that is executed when re-loading arguments when building extensions.

Fixes https://github.com/xamarin/xamarin-macios/issues/7780.
2020-02-04 12:35:36 +01:00
Sebastien Pouliot a381447e14 [tests][sampletester] Allow project(s) removal (#7766)
Most false positives are (so far) because `nuget restore` fails - both
due to network issues and a mono issue [1].

This PR allows to filter/remove some projects from a solution before
nuget is invoked. This can reduce the number of packages to download
which, beside reducing false positives, is good performance wise.

It also allows some project (e.g. Xappy.iOS) to build even if some other
projects (e.g. Xappy.UWP) in the solution can't be built.

[1] https://github.com/mono/mono/issues/15418
2020-02-03 15:57:49 -05:00
Alex Soto 80d458519f [SampleTester] Add 4 new samples (#7758)
* [SampleTester] Add 4 new samples

New samples added:

* https://github.com/xamarin/xamarin-forms-samples/tree/master/UserInterface/Xaminals
* https://github.com/davidortinau/Xappy
* https://github.com/Microsoft/SmartHotel360-Mobile
* https://github.com/microsoft/ConferenceVision

* Update new samples known failures

* Add timeout option and removed extra not needed data

* Fix whitespaces...

* Disable Xappy and add CodesignKey option

CodesignKey allows you to use and set it per csproj basis.

Xappy is failing on the UWP csproj, we diable it for now until
we add a way to remove certain projects.

* Update tests/sampletester/ProcessHelper.cs

Co-Authored-By: Rolf Bjarne Kvinge <rolf@xamarin.com>

Co-authored-by: Rolf Bjarne Kvinge <rolf@xamarin.com>
2020-02-03 15:57:42 -05:00
Sebastien Pouliot 889473ec07 [tests][sampletester] Only provide '/verbosity:diag' one time (#7763) 2020-02-03 15:57:34 -05:00
Rolf Bjarne Kvinge 1d0dd15bd4 [sample-tester] Collect app size and build duration statistics. (#7602)
* [sample-tester] Collect app size and build duration statistics.

* Always publish performance data.

* [mmp] Add support for MMP_ENV_OPTIONS to mirror mtouch's MTOUCH_ENV_OPTIONS.

* [sample-tester] Make mmp/mtouch show timing information, and get the diagnostic msbuild log.

* Collect task and target info.

* Add more perf data and a baseline test.

* Redo the base test a bit.

* More tweaks.

* More tweaks.

* Huh?

* Debug stuff.

* diagnostics.

* Better diagnostics.

* cleanup

* tmp

* Use a separate stage to push data.

* Next attempt.

* Unique artifact names.

* Make the right name unique.

* More progress

* Improvements

* Don't need new maccore.

* cleanup

* Remove debug spew.

* Realign stuff.

* duh

* More path fixes.

* zippity zip.

* Show publishing errors.

* dependencies

* Not fake results anymore.

* Tweaks

* Merge xml files

* [sampletester] Bump nuget timeout to 5 minutes.

The TodoREST.iOS test seems to use a lot of packages, and it can apparently
take a while to restore them, so give a few more minutes.

* Improvements.

* Fix glob.

* [sampletester] Fix fetching of sample repository and hash.

* [sampletester] Centralize verbosity for mtouch and mmp.
2020-02-03 15:57:25 -05:00
Rolf Bjarne Kvinge 5c4b339ed3
[mtouch] Auto-change settings where they're honored for extensions. Fixes #7780. (#7781)
When building extensions, we first store all the mtouch arguments in a file
when msbuild builds the extension, and then when msbuild builds the main
project, we load those arguments again and actually build the extension at the
same time as we build the main app.

As such, it's important to make sure that when we reload the extension
arguments we end up with the exact same build configuration as the first time.

Unfortunately that was not the case regarding the interpreter: we
automatically set the 'EnableRepl' value in Main according to whether the
interpreter was enabled or not, but Main is not called after re-loading the
arguments when building extensions.

Fix this by moving the logic that automatically sets 'EnableRepl' to somewhere
that is executed when re-loading arguments when building extensions.

Fixes https://github.com/xamarin/xamarin-macios/issues/7780.
2020-02-03 18:23:34 +01:00
Waleed Chaudhry 00985a55e2
[Localization] mtouch/mmp C# (#7710) 2020-01-31 15:02:52 -05:00
Rolf Bjarne Kvinge 65b872e7e9
[xharness] Improve TCC database editing. (#7773)
* Acquire permission for the microphone (the microphone permission dialog is
  not a blocking dialog, which is why things have worked so far).

* Set the last_modified field in the TCC database to now instead of 1970.
  Apparently some permissions time out (kTCCServiceMediaLibrary), which means
  that the last_modified field is important to get right.
2020-01-30 17:54:07 +01:00
Rolf Bjarne Kvinge 47ebd0d947
[xharness] Fix simctl arguments. (#7772)
* [xharness] Fix simctl arguments.

* Fix another case.
2020-01-30 12:07:02 +01:00
Sebastien Pouliot de8ad75978
[tests][sampletester] Allow project(s) removal (#7766)
Most false positives are (so far) because `nuget restore` fails - both
due to network issues and a mono issue [1].

This PR allows to filter/remove some projects from a solution before
nuget is invoked. This can reduce the number of packages to download
which, beside reducing false positives, is good performance wise.

It also allows some project (e.g. Xappy.iOS) to build even if some other
projects (e.g. Xappy.UWP) in the solution can't be built.

[1] https://github.com/mono/mono/issues/15418
2020-01-29 13:12:09 -05:00
Alex Soto d66cf8aa52
[SampleTester] Add 4 new samples (#7758)
* [SampleTester] Add 4 new samples

New samples added:

* https://github.com/xamarin/xamarin-forms-samples/tree/master/UserInterface/Xaminals
* https://github.com/davidortinau/Xappy
* https://github.com/Microsoft/SmartHotel360-Mobile
* https://github.com/microsoft/ConferenceVision

* Update new samples known failures

* Add timeout option and removed extra not needed data

* Fix whitespaces...

* Disable Xappy and add CodesignKey option

CodesignKey allows you to use and set it per csproj basis.

Xappy is failing on the UWP csproj, we diable it for now until
we add a way to remove certain projects.

* Update tests/sampletester/ProcessHelper.cs

Co-Authored-By: Rolf Bjarne Kvinge <rolf@xamarin.com>

Co-authored-by: Rolf Bjarne Kvinge <rolf@xamarin.com>
2020-01-28 15:40:52 -05:00
Sebastien Pouliot a2a48c4e00
[tests][sampletester] Only provide '/verbosity:diag' one time (#7763) 2020-01-28 14:45:29 -05:00
Manuel de la Pena 7130b16d98
[Xharness] Add workaround when we could not share the internet in bots. (#7755)
Looks like we have issues with the internet sharing in the VSTS bots,
this means that now that we always try to parse the XML on CI, we get an
exception, catch it and do not show the results.

The workaround simply tries to read the xml, if possible, we will parse
it, else deal with the text only log. The fix will show the results, but
it is a workaround for a configuration issue in the CI.
2020-01-28 14:44:34 -05:00
Manuel de la Pena afaaf10d77
[Harness] Unify the CI properties. (#7750)
Unify the harness properties to just look at InCI and remove all the
other ones. There is no real need to have differences between jenkins
and VSTS and Wrench is gone.
2020-01-24 07:47:44 -05:00
Manuel de la Pena 088dd2a9b2
[XHarness] If in CI, no matter which, use the Xml output. (#7745)
We used to test only on Jenkins, and if the build version had jenkins on
it, rather than doing so, just check if we are in the CI by looking if
BUILD_REVISION is present in the env.
2020-01-23 18:28:12 -05:00
Sebastien Pouliot 0de4c73eb1
Revert "[CoreServices] Completing FSEventStream bindings (#7507)" (#7741)
This reverts commit 80825d6b6d.

Tests breaks under macOS 10.15.

Also some of the changes I requested on the original PR were not
made and several methods are missing validation. There might be
other stuff too (only found this out while looking at the test
failure).
2020-01-22 17:03:16 -05:00
monojenkins 0c4af7daa1 [d16-5] [registrar] Fixes NSString trampoline code generation in static registrar (#7738)
* [registrar] Fixes NSString trampoline code generation in static registrar

Fixes xamarin/xamarin-macios#7733

This was introduced as a side effect of commit 8425129, we
used to generate `id foo` instead of the full block signature
in the trampoline code used by the static registrar, this is
the reason we never caught this condition before.

Added registrar test.

* Move tests to the appropiate test file

Co-authored-by: Alex Soto <alex@alexsoto.me>
2020-01-22 16:27:38 -05:00
Alex Soto 621fc8089a
[registrar] Fixes NSString trampoline code generation in static registrar (#7735)
* [registrar] Fixes NSString trampoline code generation in static registrar

Fixes xamarin/xamarin-macios#7733

This was introduced as a side effect of commit 8425129, we
used to generate `id foo` instead of the full block signature
in the trampoline code used by the static registrar, this is
the reason we never caught this condition before.

Added registrar test.

* Move tests to the appropiate test file
2020-01-22 15:03:18 -05:00
Bruno Garcia 455ed695bf fix: Template typos execution, transition (#7723)
* fix: Execution typo

* fix: transiton -> transition
2020-01-20 15:29:23 +01:00
Rolf Bjarne Kvinge 54b07b2f2d
[msbuild] Build the MSBuild task assemblies for netstandard2.0. (#7706)
* Bump Xamarin.MacDev.

New commits in xamarin/Xamarin.MacDev:

* xamarin/Xamarin.MacDev@210c664 Adds net451 to Xamarin.MacDev.csproj
* xamarin/Xamarin.MacDev@64db365 [winios] Changes provisioning profiles default path
* xamarin/Xamarin.MacDev@d34430a Switch to short-form projects and build for both net461 and netstandard2.0. (#68)

Diff: 0f578f51e6..210c664e56

* [msbuild] Update to latest Mono.Cecil.

The older version doesn't support netstandard2.0.

No code changes were required.

* [msbuild] Remove unused usings.

* [msbuild] Make ILMerge work when building for netstandard2.0.

Also unify/deduplicate the ILMerge logic between Xamarin.iOS and Xamarin.Mac.

* [msbuild] Build for netstandard2.0 in addition to net461.

* [msbuild] Use custom project configurations to support running the tests for both netstandard2.0 and net461.

Use custom project configurations to support running the tests for when the
tasks assembly is built for netstandard2.0 and net461.

* [tests] Make command-line based 'make test-ios-tasks' run tests for both netstandard2.0 and net461.

* [xharness] Add test configuration to run iOS MSBuild tests using either netstandard2.0 or net461.

* [msbuild] Make the netstandard2.0-buils task assemblies the default.

* [msbuild] ILRepack lib assemblies, not ref assemblies.

Ask MSBuild to copy lib assemblies to the output folder when building for
netstandard2.0, this way we can easily find the actual implementation
libraries to pass to ILRepack.

* [msbuild] Merge System.Text.Encodings.Web.dll as well.

* [xharness] Fix build of MSBuild tests for iOS.
2020-01-16 18:22:48 +01:00
Rolf Bjarne Kvinge 34c0a9e106
[xharness] Fix two compiler warnings. (#7703)
* [xharness] Fix two compiler warnings.

Fixes these warnings:

    Jenkins.cs(538,37): warning CS1998: This async method lacks 'await' operators and will run synchronously. Consider using the 'await' operator to await non-blocking API calls, or 'await Task.Run(...)' to do CPU-bound work on a background thread.
    Jenkins.cs(877,14): warning CS1998: This async method lacks 'await' operators and will run synchronously. Consider using the 'await' operator to await non-blocking API calls, or 'await Task.Run(...)' to do CPU-bound work on a background thread.

* [xharness] Simplify async code a bit.
2020-01-14 08:17:58 +01:00
Rolf Bjarne Kvinge c4e15ed6b6
[msbuild] Convert project files to sdk-style project files. (#7698)
* [msbuild] Convert to short-form csproj.

* [msbuild] Make asserts more useful.

* [msbuild] Make tests ignore the actual location of the test assembly.

* [msbuild] Short-style projects default to deterministic builds, which is not compatible with wildcard versions.

* [msbuild] Adjust test.

* Update .gitignore.

* Bump NUnit.ConsoleRunner version.

* [msbuild] Fix indentation.

* [msbuild] Simplify csproj.
2020-01-14 08:16:02 +01:00
Rolf Bjarne Kvinge 3a75f75b1d
[tests] Add check to make sure we don't have different Xcodes configured, because diagnosing any problems is time-consuming. (#7695) 2020-01-10 18:41:18 +01:00
Manuel de la Pena 8dd672801c
[CoreFoundation] Add some helper methods to make DispatchData easier to use. (#7690)
Add the following methods:

1. FromReadOnlySpan - Allows to create DispatchData from Spans.
2. ToArray - Return a managed copy of the data.

Fixes: https://github.com/xamarin/xamarin-macios/issues/7446
2020-01-09 22:47:21 -05:00
Waleed Chaudhry 729e241e4a
[Localization] Add generator error messages (#7531) 2020-01-08 16:07:46 -05:00
Chris Hamons 7950155faf [mmp] Set ThrowManagedException in debug apps if unset (#7667)
- https://github.com/xamarin/xamarin-macios/issues/5738
- There are a number of managed exceptions Apple can throw at you during
debugging, such as expanding a NSColor in the wrong colorspace
- Throwing a managed exception is a nicer debugging experience, and
during debug we don't care about any performance penality.
2020-01-08 08:00:41 -05:00
Manuel de la Pena ac8e52c2e2
[Foundation] Add support to ignore the cookies in the NSUrlSessionHandler. (#7677)
This change allows to ignore the use of cookies and cookie containers in
the NSUrlSessionHandler. There are two different cookie containers to
consider:

1. The native NSHttoCookieStorage.
2. The managed CookieContainer.

If the native one is set to null, the native code will not use a cookie
storage, which is used as a flag to ignore the managed one.

There is an interesting situation, we allow different types of sessions.
From the cookie storage point of view, Default and Background sessions
are the same, but Ephemeral is not, since we only want to store in ram
the cookies and do not share them.

This supposes a problem because Apple does not provide any API that will
allow to determine the session type use in the configuration. The
workaround has been to hide the direct native call for the configuration
and add an enum value that can later be accessed in the
NSUrlSessionHandler. Of course things cannot be that easy. When a
session is created with the configuration, it creates a copy, and the
internal session configuration does not longer have the flag, therefore,
we need to store the session type in the handler.

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

Co-authored-by: Chris Hamons <chris.hamons@xamarin.com>
2020-01-07 18:37:17 -05:00
Pramit Mallick 80825d6b6d [CoreServices] Completing FSEventStream bindings (#7507) 2020-01-07 15:14:27 -05:00
Pramit Mallick cd9a151c98 [xharness] Run duration (#7661)
Update the label used in xharness to be more clear about the run duration.
2020-01-07 13:38:27 -05:00
monojenkins 01ff50a27c [d16-5] [Makefile] Make csc strict and fix some small errors. (#7671)
Make csc to bee more strict when compiling the projects and mix some
small errors we had in the bindings.

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


Co-authored-by: Manuel de la Pena <mandel@microsoft.com>
2020-01-06 16:53:22 -05:00
monojenkins 2139efecb5 [xharness] Only run 'dont link' on release configuration (#7672)
The 32bits **debug** binaries are now too big for Apple's native linker
to process, which gives us (non useful) build errors on the bots.

This will still run the release builds configuration of the tests since
they are smaller and still within the limits of the tooling.

Co-authored-by: Sebastien Pouliot <sebastien.pouliot@gmail.com>
2020-01-06 16:53:01 -05:00
Manuel de la Pena e98780ec8d
[Introspection] Allow introspection to test CAMetalLayer when xcode 11 and simulator. (#7670)
The order of the check matters, we only skip with a sim && not on
xcode11.

The other whay around will do the wrong short circuit. Since if we are
not on Xcode11 we will always skip, including device, which is not
correct.

Fixes: https://github.com/xamarin/xamarin-macios/issues/6243.
2020-01-05 18:34:20 -05:00
Manuel de la Pena 65191eda86
[MMP] Allow to compile assemblies that do have a comma. (#7675)
Users sometimes add commas to their asseblies. Make sure we can handle
that case.

Fixes: https://github.com/xamarin/xamarin-macios/issues/6726
2020-01-02 21:56:39 -05:00
Sebastien Pouliot fc9b3fa8ae [xharness] Only run 'dont link' on release configuration (#7662)
The 32bits **debug** binaries are now too big for Apple's native linker
to process, which gives us (non useful) build errors on the bots.

This will still run the release builds configuration of the tests since
they are smaller and still within the limits of the tooling.
2020-01-02 15:06:54 -05:00
Manuel de la Pena f9e3cab385
[Foundation] Add some missing C bindings in NSFileManager. (#7664)
Add the bindings since Enviroment does not provide all/same information.

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


Co-authored-by: Pramit Mallick <prmallic@microsoft.com>
2020-01-02 14:05:56 -05:00
Manuel de la Pena 8a52fcd812
[Makefile] Make csc strict and fix some small errors. (#7665)
* [Makefile] Make csc strict and fix some small errors.

Make csc to bee more strict when compiling the projects and mix some
small errors we had in the bindings.

Fixes: https://github.com/xamarin/xamarin-macios/issues/5398
2020-01-02 13:57:22 -05:00
Manuel de la Pena fffa889f22
[Foundation] Add CookieContainer support in NSUrlSessionHandler. (#7654)
There are two important things to look at this:

1. That we do set the cookies that are present in the CookieContainer in
the request. That is, we need to set Cookie headers for all of them.
2. That if we receive a Set-Cookie from the server, the CookieContainer
gets correctly updated else we will have issues since we do not respect
the data sent from the server side.

Tests show both that we are setting the Cookie header and that we honour
the Set-Cookie header.

Fixes: https://github.com/xamarin/xamarin-macios/issues/5665
2019-12-27 15:36:47 -05:00
monojenkins d69625bb44 [Tests] Update the tests.sln to take into account the new splitted tests. (#7658) 2019-12-27 11:18:19 -05:00
Manuel de la Pena a25e676e5e
[Tests] Update the tests.sln to take into account the new splitted tests. (#7655) 2019-12-27 11:17:40 -05:00
monojenkins 1beca5dc7f [BCL Tests] Make sure that the xUnit runner is not too greedy. (#7656)
The tests in xunit are ran in parallel, the default number of threads is
to large which is making the iOS watchdog kill the process before we are
done with the tests.

The default value is either 0 (use as many as possible) of the
Enviroment.ProcessorsCount value, in our case we divide that by two to
make sure we do not use too much CPU.

Fixes: https://github.com/xamarin/maccore/issues/2083

Co-authored-by: Manuel de la Pena <mandel@microsoft.com>
2019-12-27 11:17:03 -05:00
Manuel de la Pena 87cdcf4b3c
[BCL Tests] Make sure that the xUnit runner is not too greedy. (#7653)
The tests in xunit are ran in parallel, the default number of threads is
to large which is making the iOS watchdog kill the process before we are
done with the tests.

The default value is either 0 (use as many as possible) of the
Enviroment.ProcessorsCount value, in our case we divide that by two to
make sure we do not use too much CPU.

Fixes: https://github.com/xamarin/maccore/issues/2083
2019-12-27 11:15:50 -05:00
monojenkins 49d853a23d [d16-5] [Test] Bump mono and use the new splited tests. (#7648)
Bump mono to get the new splited test dlls and add them to be ran in
xharness. Special logic is used for mscorlib so we make sure that all
the 'parts' of the test dll do have the same configurations.

Co-authored-by: Manuel de la Pena <mandel@microsoft.com>
Co-authored-by: Waleed Chaudhry <54864665+wachaudh@users.noreply.github.com>
2019-12-23 23:57:19 -05:00
Manuel de la Pena 4c6181e904
[Test] Bump mono and use the new splited tests. (#7626)
Bump mono to get the new splited test dlls and add them to be ran in
xharness. Special logic is used for mscorlib so we make sure that all
the 'parts' of the test dll do have the same configurations.


Co-Authored-By: Waleed Chaudhry <54864665+wachaudh@users.noreply.github.com>
2019-12-23 18:39:41 -05:00
monojenkins 441912e20d [xharness] Fix 32 bit device tests selection (#7639)
**Problem**

32 bit tests could only be executed with 64 bit tests. E.g: `run-ios-32-tests` didn't work on its own, only `run-ios-tests,run-ios-32-tests` worked

**Solution**

- Change the logic so that 32 bit tests are only looking for `IncludeiOS32` and 64 bit tests only `IncludeiOS64`
- To keep `run-ios-tests` and `skip-ios-tests` working, hack `SetEnabled` so `IncludeiOS` also sets `IncludeiOS32` and `IncludeiOS64`.
  Otherwise the way the code is currently organised we'd have to use `skip-ios-32-tests` and `skip-ios-64-tests`.

Co-authored-by: Vincent Dondain <vidondai@microsoft.com>
2019-12-23 13:07:43 -05:00
Manuel de la Pena 2c0366cc0d
[Foundation] Provide a strong dictionary for proxy configuration. (#7640)
Although we provide the correct property to set the proxy configuration,
we do not add a strong dict that will make it nicer for users. This
fixes that API.

Fixes: https://github.com/xamarin/xamarin-macios/issues/5811
2019-12-21 11:01:32 -05:00
monojenkins db7ccd7d2f [xharness] Do not trace the reflection exceptions used for the BCL. (#7635) 2019-12-20 15:10:15 -05:00
monojenkins 5d6d0a84d3 [xharness] Do not trace the reflection exceptions used for the BCL. (#7634) 2019-12-20 14:23:18 -05:00
Manuel de la Pena f33ed7ac12
[xharness] Do not trace the reflection exceptions used for the BCL. (#7631) 2019-12-20 11:36:03 -05:00
Rolf Bjarne Kvinge 0ec82e7cca
[sample-tester] Collect app size and build duration statistics. (#7602)
* [sample-tester] Collect app size and build duration statistics.

* Always publish performance data.

* [mmp] Add support for MMP_ENV_OPTIONS to mirror mtouch's MTOUCH_ENV_OPTIONS.

* [sample-tester] Make mmp/mtouch show timing information, and get the diagnostic msbuild log.

* Collect task and target info.

* Add more perf data and a baseline test.

* Redo the base test a bit.

* More tweaks.

* More tweaks.

* Huh?

* Debug stuff.

* diagnostics.

* Better diagnostics.

* cleanup

* tmp

* Use a separate stage to push data.

* Next attempt.

* Unique artifact names.

* Make the right name unique.

* More progress

* Improvements

* Don't need new maccore.

* cleanup

* Remove debug spew.

* Realign stuff.

* duh

* More path fixes.

* zippity zip.

* Show publishing errors.

* dependencies

* Not fake results anymore.

* Tweaks

* Merge xml files

* [sampletester] Bump nuget timeout to 5 minutes.

The TodoREST.iOS test seems to use a lot of packages, and it can apparently
take a while to restore them, so give a few more minutes.

* Improvements.

* Fix glob.

* [sampletester] Fix fetching of sample repository and hash.

* [sampletester] Centralize verbosity for mtouch and mmp.
2019-12-20 16:27:36 +01:00
Alex Soto 3d927e0466
[xharness] Fix ExecuteCommandAsync args parameter 2019-12-18 12:22:00 -05:00
Alex Soto d527862915
[xharness] Fix ExecuteCommandAsync args parameter 2019-12-18 12:19:22 -05:00
Alex Soto f1f867af03
Merge branch 'd16-5' into d16-5-xcode11.3 2019-12-18 12:01:21 -05:00
Vincent Dondain fd3f86d912 Bump to mono:2019-10 (#7192) (#7547)
* Fixed
`/Users/builder/jenkins/workspace/xamarin-macios/xamarin-macios/builds/mono-ios-sdk-destdir/ios-sources/external/linker/src/linker/Linker.Steps/OutputStep.cs(110,15): error CS0246: The type or namespace name ‘OutputException’ could not be found (are you missing a using directive or an assembly reference?) [/Users/builder/jenkins/workspace/xamarin-macios/xamarin-macios/tools/mmp/mmp.csproj]`
* Changed the name of the method that is used from linker. Because of this commit 6be26771b9
* Added `OutputException.cs` file on `mtouch.csproj`.
* Removing enter_gc_safe and exit_gc_safe because now it's already gc_safe in this part of code, after a mono change.
* Added known exceptions to LLVM exception list.
* Needs `ifdef` because of this https://github.com/mono/mono/pull/17260.
* Bump MIN_MONO_VERSION to 6.8.0.41 and point MIN_MONO_URL to the PR.
* Add ENABLE_IOS=1 and ENABLE_MAC=1.
* Added switch to disable packaged mono build
* [Tests] Ignore tests that fail on 32b.
    Ignore the test on 32b, and filled issue: https://github.com/mono/mono/issues/17752
* [Tests] Ignore a couple of tests causing OOM.
    Hopefully fixes https://github.com/xamarin/maccore/issues/1659 for good.
* Ignore `MM0135` test on Catalina+ because it needs Xcode 9.4.
* [monotouch-test] Add null checks for teardown when test didn't run because of a too early OS version.
* [CFNetwork]: Http 2.0 requires OS X 10.11 or later.
    Check whether `_HTTPVersion2_0` is available and fallback to HTTP 1.1 otherwise.

* #7346
* This bumps Mono to use https://github.com/mono/mono/pull/17645 (which is the 2019-10 backport
of https://github.com/mono/mono/pull/17628).
* The big user-visible change is in regards to certificate validation, everything below are just
some minor adjustments to tests.

CoreFX uses a completely new `HttpClientHandler` implementation called `SocketsHttpHandler`,
which you can find at https://github.com/dotnet/corefx/tree/release/3.0/src/System.Net.Http/src/System/Net/Http/SocketsHttpHandler.

Since this is not based on the web stack anymore, it does not use any of the related APIs such
as `ServicePointManager` or `WebException`.

There is a new API called `HttpClientHandler.ServerCertificateCustomValidationCallback`.
- https://docs.microsoft.com/en-us/dotnet/api/system.net.http.httpclienthandler.servercertificatecustomvalidationcallback?view=netframework-4.8
- c1778515a3/src/System.Net.Http/src/System/Net/Http/HttpClientHandler.Unix.cs (L154)
- c1778515a3/src/System.Net.Http/src/System/Net/Http/HttpClientHandler.Windows.cs (L383)

The `ServicePointManager.ServerCertificateValidationCallback` is no longer invoked and on
certificate validation failure, `AuthenticationException` (from `System.Security.Authentication`)
is thrown instead of `WebException`.

At the moment, the `NSUrlSessionHandler` still uses it's own validation callback and also still
throws `WebException` on failure; we should probably look into making this consistent with the
other handlers.

* `HttpContent.SerializeToStreamAsync()` is now `protected` (changed from `protected internal`).
  - src/Foundation/NSUrlSessionHandler.cs: changed overload accordingly.
  - src/System.Net.Http/CFContentStream.cs: likewise.

* `HttpHeaders.GetKnownHeaderKind()` is an internal Mono API.
   There is a new internal API called `System.Net.Http.PlatformHelper.IsContentHeader(key)`
   which exists in both the old as well as the new implementation.
   The correct way of doing it with the CoreFX handler is
   `HeaderDescriptor.TryGet (key, out var descriptor) && descriptor.HeaderType == HttpHeaderType.Content`

* `HttpClientHandler.MaxRequestContentBufferSize` is now longer supported, you can set it to
  any non-negative value, the getter will always return 0.
  See c1778515a3/src/System.Net.Http/src/System/Net/Http/HttpClientHandler.Core.cs (L18).
  - tests/linker/ios/link sdk/HttpClientHandlerTest.cs: removed assertion from test.

* `HttpMessageInvoker.handler` is a `protected private` field - in the CoreFX handler, it is
  called `_handler` and `private`.  This is accessed via reflection by some of the tests, which are
  now using the new name.
  - tests/mmptest/src/MMPTest.cs: here
  - tests/mtouch/MTouch.cs: here

* tests/monotouch-test/System.Net.Http/MessageHandlers.cs:
  Adjust `RejectSslCertificatesServicePointManager` to reflect the certificate validation
  changes described above.
  - FIXME: There was an `Assert.Ignore()` related to `NSUrlSessionHandler` and macOS 10.10;
    I removed that to reenable the test because the description linked to an old issue in
    the private repo that was referenced by several "Merged" PR's, so it looked to me that
    this might have already been fixed - and I also didn't see why it would fail there.
2019-12-18 11:40:47 -05:00
monojenkins 8e363024b7 [d16-5] [Tests] Split groups so that they work on iOS 32b. (#7616)
After this commit we will have more application but they will be the
appropiate size so that they can be built with the linker for iOS 32b.
It is important to note that the following apps WILL CONTINUE to fail
since the dlls need to be splitted in mono:

* mscorlib tests
* Mono BCL tests group 5 - Which is monotouch_System.Core_xunit-test.dll
and is too large.
2019-12-18 11:16:49 -05:00
monojenkins 7a22053587 [xcode11.3] [Tests] Split groups so that they work on iOS 32b. (#7617)
After this commit we will have more application but they will be the
appropiate size so that they can be built with the linker for iOS 32b.
It is important to note that the following apps WILL CONTINUE to fail
since the dlls need to be splitted in mono:

* mscorlib tests
* Mono BCL tests group 5 - Which is monotouch_System.Core_xunit-test.dll
and is too large.
2019-12-18 11:16:29 -05:00
Alex Soto 9ac17bdbcf
Merge remote-tracking branch 'xamarin/xcode11.3' into master-xcode11.3 2019-12-17 19:25:11 -05:00
Alex Soto 01c1d04877
Merge remote-tracking branch 'xamarin/xcode11.3' into d16-5 2019-12-17 18:56:12 -05:00
Manuel de la Pena 867dcfaa77
[Tests] Split groups so that they work on iOS 32b. (#7612)
After this commit we will have more application but they will be the
appropiate size so that they can be built with the linker for iOS 32b.
It is important to note that the following apps WILL CONTINUE to fail
since the dlls need to be splitted in mono:

* mscorlib tests
* Mono BCL tests group 5 - Which is monotouch_System.Core_xunit-test.dll
and is too large.
2019-12-17 17:09:28 -05:00
monojenkins aaafa2df6f [xharness] Don't try to parse log files that don't exist. (#7614)
Makes xharness throw fewer exceptions, which makes tracing output simpler to read.
2019-12-17 17:04:00 -05:00