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.
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
The calls to `Runtime.GetNSObject<T>` and `NSArray.ArrayFromHandle<T>`
already do the null / `IntPtr.Zero` check.
This generates a bit less code (always a good thing) and reduce the
number of nullability warnings.
Also use `Array.Empty<T>` instead of allocating empty arrays.
before
```
$ grep -r "new " src/build/ | grep "\[0]"
src/build//ios/native/ObjCRuntime/EventArgs.g.cs: return new string [0];
src/build//ios/native/ObjCRuntime/EventArgs.g.cs: return new MPTimedMetadata [0];
src/build//ios/native/ObjCRuntime/EventArgs.g.cs: return new string [0];
src/build//ios/native/ObjCRuntime/EventArgs.g.cs: return new string [0];
src/build//ios/native/AuthenticationServices/ASAuthorizationProviderAuthorizationOperation.g.cs: static IntPtr[] values = new IntPtr [0];
src/build//mac/full/ObjCRuntime/EventArgs.g.cs: return new string [0];
src/build//mac/full/AppKit/NSTextField.g.cs: return new string[0];
src/build//mac/full/AuthenticationServices/ASAuthorizationProviderAuthorizationOperation.g.cs: static IntPtr[] values = new IntPtr [0];
src/build//mac/mobile/ObjCRuntime/EventArgs.g.cs: return new string [0];
src/build//mac/mobile/AppKit/NSTextField.g.cs: return new string[0];
src/build//mac/mobile/AuthenticationServices/ASAuthorizationProviderAuthorizationOperation.g.cs: static IntPtr[] values = new IntPtr [0];
src/build//tvos/tvos/ObjCRuntime/EventArgs.g.cs: return new string [0];
src/build//tvos/tvos/AVFoundation/AVMetadataObjectType.g.cs: static IntPtr[] values = new IntPtr [0];
src/build//watch/watch/ObjCRuntime/EventArgs.g.cs: return new string [0];
src/build//watch/watch/AVFoundation/AVMetadataObjectType.g.cs: static IntPtr[] values = new IntPtr [0];
```
after
```
grep -r "new " src/build/ | grep "\[0]"
src/build//ios/native/AuthenticationServices/ASAuthorizationProviderAuthorizationOperation.g.cs: static IntPtr[] values = new IntPtr [0];
src/build//mac/full/AppKit/NSTextField.g.cs: return new string[0];
src/build//mac/full/AuthenticationServices/ASAuthorizationProviderAuthorizationOperation.g.cs: static IntPtr[] values = new IntPtr [0];
src/build//mac/mobile/AppKit/NSTextField.g.cs: return new string[0];
src/build//mac/mobile/AuthenticationServices/ASAuthorizationProviderAuthorizationOperation.g.cs: static IntPtr[] values = new IntPtr [0];
src/build//tvos/tvos/AVFoundation/AVMetadataObjectType.g.cs: static IntPtr[] values = new IntPtr [0];
src/build//watch/watch/AVFoundation/AVMetadataObjectType.g.cs: static IntPtr[] values = new IntPtr [0];
```
and the remaining are not related to the same generator code.
Apparently file sizes can be real numbers now, because in the manifest of
downloadable simulators there's one entry where the fileSize is a real:
<key>fileSize</key>
<real>2049324382</real>
when every other file size in the manifest is an integer.
So handle real file sizes too, and fix file size parsing to not throw
exceptions if the number can't be parsed. Maybe we'll get imaginary file sizes
too one day...
Fixes this exception:
Unhandled Exception:
System.NullReferenceException: Object reference not set to an instance of an object
at xsiminstaller.MainClass.Main (System.String[] args) [0x00617] in /Users/rolf/work/maccore/d16-6/xamarin-macios/tools/siminstaller/Program.cs:194
Co-authored-by: Rolf Bjarne Kvinge <rolf@xamarin.com>
An earlier `wrap != null` condition ends with a `return` so any check or
code assuming `wrap == null` must always be executed, while any `wrap != null`
will never be.
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.
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
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.
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
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.
Commits:
* mono/mono@beccf5ba43: [2020-02] Use GArray instead of GList when getting custom attributes from an image (#19102)
* mono/mono@5bea89d861: [llvm] Disable running the llvm verifier by default, it was enabled by mistake, and it takes a long time. (#19332)
* mono/mono@4b0424cd68: [2020- 02][debugger] Implementing step through multithreaded code. (#19343)
* mono/mono@2444b38b3c: [2020-02] [dim] Class overriding interface method that was already override by another interface (#19121)
* mono/mono@93a2f4ea39: Fix suspend_policy that will be sent to debugger-libs, because on debugger-libs we want to resume the VM only when it's suspended, but we were sending the wrong suspend_policy in the case of EVENT_KIND_VM_START and mono is started with suspend=y. (#19330)
* mono/mono@0565f6e2c0: Do not access unloading domains in debugger (case 1013579) (#19322)
* mono/mono@b7196c45e8: [jit] Initialize correct class for tls fields (#19300) (#19313)
* mono/mono@88c1989895: [2020-02] [merp] Add breadcrumb for StackHash (#19242)
* mono/mono@d2be7389b1: [2020-02] [corlib] Suppress finalization of underlying console FileStreams (#19164)
Full diff: a7e29665d2...beccf5ba43
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>
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.
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
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.
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
* [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.
Bump mono to 2020-02 head to be in sync with Android.
Co-authored-by: Imran Hameed <imhameed@microsoft.com>
Co-authored-by: Sebastien Pouliot <sebastien.pouliot@microsoft.com>
Co-authored-by: Ankit Jain <radical@gmail.com>
Co-authored-by: Manuel de la Pena <mandel@microsoft.com>
Co-authored-by: Sebastien Pouliot <sebastien.pouliot@gmail.com>
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