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

3650 Коммитов

Автор SHA1 Сообщение Дата
Sebastien Pouliot e5100b74d3
[uniformtypeidentifiers] Update for Xcode 12 beta 2 (#9039)
Includes support for `UTType`-based `[Field]` in the generator as an
hundred (or so) of them were added. Unit test shows the field-based
properties are working as expected.
2020-07-09 08:50:57 -04:00
Manuel de la Pena f76253b0a8
[CallKit] Add support for Xcode 12 beta 1. (#9004)
There are two method not bound due to a dependency on AVAudioSession that
does not seem to be exposed on Mac OS X.

Related issue: https://github.com/xamarin/maccore/issues/2257

Co-authored-by: Rolf Bjarne Kvinge <rolf@xamarin.com>
2020-07-08 22:53:47 -04:00
Sebastien Pouliot 5bf1073cdb
[corebluetooth] Update for Xcode 12 beta 2 (#9037) 2020-07-08 17:27:02 -04:00
Manuel de la Pena 10b3ddba31
[xharness] Make ConsoleLog thread-safe. Fixes #8569. (#8864) (#9038)
Fixes https://github.com/xamarin/xamarin-macios/issues/8569.

Co-authored-by: Rolf Bjarne Kvinge <rolf@xamarin.com>
2020-07-08 15:42:33 -04:00
monojenkins 9c8d1cc5f2
[tests][xtro] Fix NSUrl-based categories (#9034)
We were using the managed name, e.g. `NSUrl`, instead of the native name,
e.g. `NSURL`, when dealing with categories.

To fix this we must resolve the type and this caused issues as other
assemblies (e.g. OpenTK) were not already loaded/cached and some type
could not be resolved (and this throw exceptions)

The runner now loads all assemblies before starting to visit them.

The fix solved a known issue (iOS-NetworkExtension.ignore), some API
that were already bound (common-Foundation.ignore) and also caught an
additional API where we missed a `[NullAllowed]` on a return value
2020-07-08 13:23:43 -04:00
Sebastien Pouliot de306cd96d
Bump for Xcode 12 beta 2 (#9027)
* [arkit] Remove fields (from beta2) to fix introspection
* [tests][introspection] AVMutableMediaSelection is as bad as it's non mutable parent
* [tools] Update IsFrameworkBroken (remove CoreAudioTypes and MediaPlayer)
* [tests][monotouch-test] MKPinAnnotationView seems fixed in beta 2
* [tests][xtro] Update ARKit todo (with previous fix)
2020-07-08 09:26:24 -04:00
Manuel de la Pena c0781c4a13
[CoreLocation] Add support for Xcode 12 beta 1. (#9001)
A number of APIs added and deprecated in the same release. We will see
that is that about.

The status property move to be a instance property in CLLocationManager,
we expose those and add a deprecation warning. That needs to be ignored in xtro due to issue https://github.com/xamarin/xamarin-macios/issues/9026


Co-authored-by: Rolf Bjarne Kvinge <rolf@xamarin.com>
2020-07-07 17:55:15 -04:00
Manuel de la Pena 93103e23ed
[CFNetwork] Add support for xcode 12 beta 1. (#9006) 2020-07-07 17:53:50 -04:00
Sebastien Pouliot 579ef29d52
[replaykit] Update for xcode12 beta 1 (#9025) 2020-07-07 13:45:52 -04:00
monojenkins 110f13759c
[tests] Skip a few networking tests on macOS 10.9. Fixes #xamarin/maccore@2221. (#9021)
Fixes https://github.com/xamarin/maccore/issues/2221.

Co-authored-by: Rolf Bjarne Kvinge <rolf@xamarin.com>
2020-07-07 15:56:43 +02:00
Manuel de la Pena 5fae175cf6
[ARKit] Add support for Xcode 12 beta 1. (#9002)
PInvoke that is missing is due to a dependency with Visio which is not
yet updated.



Co-authored-by: Rolf Bjarne Kvinge <rolf@xamarin.com>
2020-07-07 09:37:16 -04:00
Manuel de la Pena bae53fac16
[AVKit] Add support for Xcode 12 beta 1. (#9005) 2020-07-06 10:57:31 -04:00
Manuel de la Pena 599249fd27
[ClassKit] Add support for Xcode 12 beta 1. (#9008) 2020-07-06 10:56:54 -04:00
Manuel de la Pena 347a4959b1
[AddSupport] Updting binding xcode 12 beta 1. (#8999) 2020-07-06 10:55:40 -04:00
Sebastien Pouliot ae548380c4
[xcode12][security] Update for beta 1 (#8969) 2020-06-29 15:02:16 -04:00
Sebastien Pouliot c21caece19
[xcode12][usernotificationui] Update for beta 1 (add macOS support) (#8970) 2020-06-26 21:54:25 -04:00
Sebastien Pouliot e582c501c0
[xcode12][notificationcenter] Update for beta 1 (#8968) 2020-06-26 20:01:34 -04:00
Sebastien Pouliot 039f58c876
[xcode12][linkpresentation] Update for beta 1 (add tvOS support) (#8965) 2020-06-26 20:00:54 -04:00
Sebastien Pouliot c188f593fe
[xcode12][watchkit] Update for beta 1 (#8967) 2020-06-26 20:00:16 -04:00
Sebastien Pouliot b6c3e1a84f
[xcode12][tvmlkit] Update for beta 1 (#8966) 2020-06-26 17:14:35 -04:00
Sebastien Pouliot 1bb720b687
[xcode12][appclip] Update for beta 1 (#8964) 2020-06-26 17:13:30 -04:00
Sebastien Pouliot f427b5e91d
[xcode12] Bump for beta 1 (#8935)
Known issues https://github.com/xamarin/xamarin-macios/issues/8943
2020-06-26 14:02:44 -04:00
monojenkins ad92cdb6a2
[xharness] Add crash reports to a logs collection we care about. (#8960)
Add crash reports to a logs collection we care about, instead of to a logs
collection that's promptly forgotten.

This makes sure crash reports actually show up in the html report.

Co-authored-by: Rolf Bjarne Kvinge <rolf@xamarin.com>
2020-06-26 14:18:47 +02:00
monojenkins bf4b5f4db8
[xcode12] [ImageIO] Update bindings for Xcode11 (#8942) 2020-06-25 15:28:29 -04:00
Rolf Bjarne Kvinge e6afca196c
[xcode12] Backport a few linker changes. (#8926)
* [linker] Fix infinite queue found with nullability PR (#8337)

and removed previous workaround

Replace previous attempt https://github.com/xamarin/xamarin-macios/pull/8336

* [linker] Remove code to deal with ExportedTypes (#8632)

This is now supported by upstream mono/linker

* [linker] Remove internal [NullablePublicOnly] attribute from apps (#8568)

I've only seen it with .net5 so far but it's better handled in master
and flow back into the branch

* [linker] Update custom attributes that can be removed (#8535)

Some are no longer part of the SDK (or converted into new ones
at build time), others were new (and missing).

A full list of attributes and their usage frequency in what we ship can
be seen in https://gist.github.com/spouliot/ca03c6da7d4d75670ca77749350eb8a2

Also update tests: no need to check for removals of stuff that does not
exists anymore.

Co-authored-by: Sebastien Pouliot <sebastien.pouliot@gmail.com>
2020-06-23 09:01:36 +02:00
monojenkins 5f71492418
[xcode12] [AppKit] NSTextView allows passing nil to PasteAsPlainText and PasteAsRichText. (#8923)
* [AppKit] NSTextView allows passing nil to PasteAsPlainText and PasteAsRichText.

This is documented in Apple's documentation, their headers, and even proved
experimentally.

* Update xtro.

Co-authored-by: Rolf Bjarne Kvinge <rolf@xamarin.com>
2020-06-23 08:53:47 +02:00
monojenkins 5e75a06b32
[runtime] Remove memcpy usage from Runtime.CloneMemory (#8925)
instead use `Buffer.MemoryCopy`.

Currently only used from `CGDataProvider`. Added unit tests for the
public/indirect, usage of the API (we had none).

Co-authored-by: Sebastien Pouliot <sebastien.pouliot@microsoft.com>
2020-06-23 08:52:32 +02:00
monojenkins 2525b21d23
[AppKit][Tests] Do not fail when we cannot create a NSPasteboard. (#8914)
The test has started failign more commonly, but only in a number of old
OS versions and not all the time. The function should return a new
Pasteboard, but it is true that we are not releasing the old ones,
meaning that the pasteboard is left after the app is done as stated by
the apple documenation.

The test has been updated to:

1. Release the pasteboard.
2. Be inconclusive if the pasteboard service could not create a new one.

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

Co-authored-by: Manuel de la Pena <mandel@microsoft.com>
2020-06-22 15:35:31 +02:00
monojenkins fdaa8e01be
[tools] Remove MD5 from tooling (#8774)
Note: affected tools are not included in the code shipping inside the SDK

Usage of deprecated cryptographic algorithms is not approved anymore,
even if not used for cryptographic purpose.

MD5 was used to create immutable GUID since it's output is 128bits which
is just what a GUID wants as it's input (16 bytes). The same can be
achieved (even if a bit slower) with a newer/longer hash function

https://devdiv.visualstudio.com/DevDiv/_workitems/edit/1128148
2020-06-05 09:02:41 -04:00
monojenkins c22a1a72c5
[sharpie] Bump version of sharpie and accommodate xtro to new output (#8760)
Co-authored-by: Alex Soto <alex@alexsoto.me>
2020-06-04 15:17:09 -04:00
monojenkins b492f5a33e
[runtime] Remove Classic code. (#8722)
Co-authored-by: Rolf Bjarne Kvinge <rolf@xamarin.com>
2020-06-02 16:14:17 +02:00
Rolf Bjarne Kvinge 952037b7a3
[tests] Remove Classic code from all tests. (#8707) 2020-05-29 16:43:06 +02:00
Alex Soto bb5a3d353a
[Tests] Use safe listed password by our Credentials Scanner tool (#8580) (#8652) 2020-05-21 20:47:43 -04:00
Alex Soto 1614d569cc
[d16-7] Merge Xcode11.5 Support and include provisionator changes (#8645)
New commits in xamarin/maccore:

* xamarin/maccore@ef861db73e [devops] Enhance Xcode renaming script (#2208)

Diff: 92a06f7303..ef861db73e
2020-05-21 14:11:27 -04:00
monojenkins 4d7dfaafd1
[d16-7] [Foundation] Do not get in an infinite loop with empty creds. (#8548)
As described in the issue, when the credentials for the base auth are set
to be empty the request reaches a timeout.

The inner issue is that when we have empty credentials the query that
is performed to the credentials db of the system throws an exception.
This exception is not raised to our code, but simply prints out in stderr.

When this situation occurs we get in an infinite loop in which we keep
sending the same credentials, we get another challenge, but the OS does
not do the right thing, we believe that we have to provide the creds
again (which are the same) and we get another challenge.. this goes on
an on until we reach the timeout.

Fortunately we know the number of failed challenges and the failure
response. With this information we can deduce if we already sent the
credentials, and if we did, do not set them again. In this case, the OS
sees no credentials in out delegate, uses the default handler and
correctly returns a 401.

fixes: https://github.com/xamarin/xamarin-macios/issues/8342
Fixes: https://github.com/xamarin/xamarin-macios/issues/8344

Co-authored-by: Manuel de la Pena <mandel@microsoft.com>
2020-05-07 22:21:36 -04:00
monojenkins bced85e1af
[corelocation] Adds platform specific nullability attributes to CoreLocation (#8503)
Co-authored-by: Cosmin Stirbu <stirbucosmin@gmail.com>
2020-05-04 14:59:08 -04:00
monojenkins 09a5d7a111
[d16-7][avfoundation] Added nullability attributes to AVFoundation (#8495)
* Added nullability attributes to AVFoundation

* Revert AVPlayerItem FromAsset nullability attributes changes to keep existing tests passing and allow backwards compatibility

* Documents common-AVFoundation.ignore entry related to Foundation.NSNumber[] AVFoundation.AVVideoCompositionInstruction::get_RequiredSourceTrackIDs()

!extra-null-allowed! 'Foundation.NSNumber[] AVFoundation.AVVideoCompositionInstruction::get_RequiredSourceTrackIDs()' has a extraneous [NullAllowed] on return type

Co-authored-by: Cosmin Stirbu <stirbucosmin@gmail.com>
2020-05-04 11:00:45 -04:00
monojenkins 85e4ce178a
[corelocation] Added missing nullability attributes to CoreLocation (#8477)
Co-authored-by: Cosmin Stirbu <stirbucosmin@gmail.com>
2020-04-29 17:20:36 -04:00
Manuel de la Pena aed4af1ce0
[Bump Mono] Bump mono to the latest of 2020-02. (#8457)
* [Bump Mono] Bump mono to the latest of 2020-02.

Commits:

  * mono/mono@051408e0be: Bump CoreFX to pickup https://github.com/mono/corefx/pull/398. (#19566)

Full diff: 58b04da0d7...051408e0be

Bump and match android: https://github.com/xamarin/xamarin-android/pull/4608

* Remove already fixed warning in mono.
2020-04-27 09:50:33 -04:00
monojenkins 50d3d7bdc2
[Harness] Fix HML report for NUnitTestTasks. (#8379)
PR https://github.com/xamarin/xamarin-macios/pull/8184 removed the
inheritance with TextWriter, therefore the `as` will return null and we
will not generate the Html report. In this particular case, we do not
need an ILog, we just use it to get a path to the correct location,
therefore, we can create the file using the full path and pass it to the
xslt.

Fixes: https://github.com/xamarin/xamarin-macios/issues/8364
2020-04-14 12:03:25 -04:00
monojenkins d76c86f233
[d16-7] [Harness] Ensure that the generator tests are set when we modify the sources. (#8378)
fixes: https://github.com/xamarin/xamarin-macios/issues/8363
2020-04-14 11:33:56 -04:00
monojenkins 731963e6f8
[d16-7] [AppKit] Allow static properties to execute on non-UI threads. (#8339)
VSMac has failing tests when they query the NSScrees.Screens property
which the following swift code shows that it can be executed in a diff
thread:

```swift
import Cocoa
import AppKit

DispatchQueue.global(qos: .background).async {
    print("This is run on the background queue")

    print(Thread.current)
    var screens = NSScreen.screens
    print (screens.count)
}
```

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


Co-authored-by: Manuel de la Pena <mandel@microsoft.com>
2020-04-10 16:25:00 -04:00
Sebastien Pouliot 15938de198
[generator] Add C#8 nullability into generated code (#7570) (#8333)
Goals
* Reflect Apple nullability annotations in our bindings using C#8
* No warnings when building bindings

Non-Goals
* Update (add or fix) `[NullAllowed]` to match Apple headers (next phase)
* Make the generator or internal code fully nullable aware (`nowarn` is used)

Notes
* Apple's own annotations are not 100% accurate :(
* Where known issue exists we have _fixed_ our attributes to match reality :)
* We also do additional null-checks internally that might seems not required (better safe than sorry).
2020-04-10 12:38:14 -04:00
monojenkins 015fd895c5
[d16-7] [xtro][bindings] Add xtro support for nullability and fix some bindings (#8341)
Enabling this will ensure that future bindings (and Xcode updates that
change nullability information) are spotted right away.

The binding fixes are **not** complete, i.e. what was done was mostly
to debug the xtro rule and find corner cases. The backlog will be
_ignored_ so the builds won't fail.
2020-04-10 12:37:16 -04:00
Přemek Vysoký 530f2a2bfa
[Harness] Rename device management classes (Devices, Simulators, ILoadAsync) (#8295) 2020-04-06 14:33:27 -04:00
Manuel de la Pena 6c9f62f56e
[Introspection] Fix a false typo in mac modern typo tests. (#8294)
Add Sha as an allowed word in the typo tests, it is a well known
acronym.
2020-04-06 14:31:46 -04:00
Přemek Vysoký b4a262eb42
Fix unit tests, make Devices fields readonly (#8293) 2020-04-06 10:57:31 -04:00
Manuel de la Pena ab476d7fa2
[Harness] Fix the generation of the sources. (#8289)
The name of the dll changed, ergo the prefix changed.
2020-04-06 09:52:18 -04:00
Přemek Vysoký ce9f9278b6
[Harness] Move TestImporter into the shared library (#8283) 2020-04-03 18:28:49 -04:00
Manuel de la Pena 10333b0d0f
[Harness] Make sure TestsTasks do not share an id. (#8273)
Threading is hard, part 2. We could have a situation in which two tasks
that are instantiated async use the same id. The id is later used to
build the logs directory etc.. When they share the id we end up in a
situation in which the logs overlap.

fixes: https://github.com/xamarin/xamarin-macios/issues/8146
2020-04-03 14:43:04 -04:00
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