Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Xharness] Bring xharness changes to d16-8 #9951

Merged
merged 116 commits into from
Oct 26, 2020
Merged

Conversation

mandel-macaque
Copy link
Member

Bring all the changes in xharness, but those in xharness, so that device tests work.

…sion behavior for .NET projects.

.NET projects will include files from the current directory by default, which
means that if we clone the project file and write the cloned project file in a
different directory, we'll have to add an automatically included files into
the cloned file manually.
.NET projects are vastly simplified, which means that the OutputPath can't be
determined by reading the project file itself, it has to be calculated by
MSBuild.

So that's exactly what we do: we run MSBuild on the project file and get it to
print the property we're interested in.
The simulators won't write stdout/stderr to a path with a space.
They end up with the same make targets as non-.NET targets, which prints
warnings in the terminal when running make.

We're not using the makefile targets much anymore, so postpone implementing
them for .NET until we need them for some reason.
…ects. (#9032)

* [xharness] Add support for generating a tvOS version of .NET iOS projects.

And use it to run the tvOS version of introspection for .NET.

* [xharness] Change according to reviews.
…9082)

This is slightly faster - ~0.95s vs ~1.4s - (probably because reflection tries
to load a lot of other referenced assemblies, which may or may not exist,
causing exceptions (if they don't exist) or spend time loading them (which
Cecil won't)).

It also avoids a lot of exception details showing up when tracing xharness
execution.
Grouping simulators means we have to wait until we know which simulators are
available, because we group by the simulator's UDID.

When running in server mode, we don't need to group simulator test runs,
because we run the as the user chooses, not in any particular order.

This way the test list loads faster at startup, since we don't have to wait
until we've loaded the simulators before we can show the list.
…rin/maccore@2267. (#9103)

Apparently a null namespace when using Reflection can be an empty namespace in Cecil.

Fixes xamarin/maccore#2267.
This avoids:

* Getting the resource stream for every template expansion
* Reading the resource stream
* A lot of async code.

Instead just read the resource stream once, into a string, and return that.

This speeds up the startup by ~10% (from ~0.96s to ~0.83s on my machine).
…ce. (#9119)

When a process times out, we try to print a stack trace for all threads. This
involves executing "lldb --source <script>", where the script contains:

	process attach --pid 1234
	thread list
	thread backtrace all
	detach
	quit

Basically we attach to the project, and ask lldb to print stack traces.

The problem:

    16:09:02.9522580 Printing backtrace for pid=25276
    16:09:02.9528060 /usr/bin/lldb --source /var/folders/q7/mkzwrzcn7bzf3g2v38f3c1cw0000gn/T/tmp58e75d85.tmp
    16:09:04.6127570 (lldb) command source -s 0 '/var/folders/q7/mkzwrzcn7bzf3g2v38f3c1cw0000gn/T/tmp58e75d85.tmp'
    16:09:04.6130020 Executing commands in '/var/folders/q7/mkzwrzcn7bzf3g2v38f3c1cw0000gn/T/tmp58e75d85.tmp'.
    16:09:04.6130200 (lldb) process attach --pid 25276
    16:09:05.6458750 error: attach failed: Error 1
    16:09:05.7529100 25276 Execution timed out after 1200 seconds and the process was killed.
    16:09:05.7588770 Execution timed out after 1200 seconds.

If any of those commands fail, the subsequent commands aren't executed. This
includes the final "quit" command, which means we end up waiting forever for
lldb to do its thing, when lldb doesn't think it needs to do anything at all.

The fix: pass two different scripts. It turns out subsequent scripts are
executed even if previous scripts fail, so we do the equivalent of:

     lldb --source <attach script> --source <quit script>

And now lldb will quit no matter what the attach script does (it still works
even if the attach script succeeds, in which case we'll ask lldb to quit
twice).
* Log what we're doing.
* Wait a bit after sending SIGABRT, to allow for the OS to create any crash
  reports.
…providing human-readable logs. (#9123)

This makes understanding what's going on much easier.
Reading from a file named as the actual content of the watchOS template doesn't
_quite_ work. Instead just use the content directly.
…ern and macOS Full. (#9121)

* [xharness] Don't generate into the same directory/files for macOS Modern and macOS Full.

This meant that we were overwriting some generated files, which meant that we
were executing the Modern set of tests instead of the Full set of tests for at
least some configurations.

* Add a few ignored tests to the System.Configuration test now that we actually run it.
…NET tests. (#9137)

It gets too annoying to keep track of which files are where with the project
cloning we're doing, if files are implicitly included.
Split the BCL project generation in two: one part that figures out which
projects to generate, and which is done synchronously (because we need it to
compute the list of tests), then split out the actual generation and run it on
a background thread (since that doesn't have to happen until we want to
execute those tests).

This speeds up launching xharness in server mode significantly (from ~2s to
~0.2s).
Because it's cumbersome to keep the build working when the same directory has
multiple project files.
rolfbjarne and others added 15 commits October 21, 2020 16:01
…le when adding a property. (#9616)

Some .NET test projects (monotouch-test) require this to set properties for
some test variations, and .NET projects are quite minimal, making it likely
that they won't have a particular property that needs to be set/modified.

This makes it possible to execute the various monotouch-test variations for
.NET in xharness (some of the variations still fail though, so they're still
ignored by default).
There are easier fish to fry right now, so implementing the linker support for
these tests to pass (metadata reduction and code removal) can wait.

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

Ref: #9612
Ref: #9613
…release)' variation by default for tvOS. Fixes #xamarin/maccore@2282. (#9659)

This test variation ends up being too big (1.5 GB), so it doesn't install
properly and the app crashes at startup.

So just skip it.

Fixes xamarin/maccore#2282.
… BCL. (#9637)

* [src] Build the .NET version of our product assemblies using a .NET 5 BCL.

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

Also:

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

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

* Use the expected dotnet binary during our local build.

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

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

This way we end up using the dotnet version that's configured in global.json for the tests.
…when parsing xml. (#9703)

At the very least this makes stepping through code while debugging much
faster, since stepping through whitespace and comments is useless.
…ts. Fixes #9400. (#9704)

We weren't probably parsing nested test-suite elements in the xml, so
implement parsing of test-suite elements using recursion, which is easier and
less error-prone (and turns out to work fine too).

Also use TextReader/Writer instead of StreamReader/Writer in a few places.
This makes it easier to write tests, since TextReader/Writer can use in-memory
streams (no need to mess with temporary files).

Fixes #9400.
…d away types around for the static registrar. (#9722)

The static registrar may need access to types that have been linked away, so
store unmarked types so that the static registrar can access them later.

This also makes all the monotouch-test variations green, so enable them all.

Fixes this monotouch-test when all optimizations are enabled:

    MonoTouchFixtures.ObjCRuntime.RegistrarTest
        [FAIL] TestProtocolRegistration :   UIApplicationDelegate/17669
            Expected: True
            But was:  False
                at MonoTouchFixtures.ObjCRuntime.RegistrarTest.TestProtocolRegistration() in xamarin-macios/tests/monotouch-test/ObjCRuntime/RegistrarTest.cs:line 1350
…9729)

This fixes a build error with a xammac test variation that is executed even if
the macOS build is disabled.
@mandel-macaque mandel-macaque added the pr-change-not-shipping The PR only touch files that are not shipped to customers label Oct 22, 2020
@monojenkins
Copy link
Collaborator

Build failure
Provisioning succeeded
Build succeeded
API Diff (from stable)
🔥 Failed to compare API and create generator diff 🔥
    ** Error: Working directory isn't clean:
    HEAD detached at 62d9b1f
    Untracked files:
    (use "git add ..." to include in what will be committed)
    tests/BundledResources/generated-projects/
    tests/EmbeddedResources/generated-projects/
    tests/bindings-framework-test/generated-projects/
    tests/bindings-test/iOS/generated-projects/
    tests/bindings-test2/generated-projects/
    tests/framework-test/generated-projects/
    tests/fsharp/generated-projects/
    tests/fsharplibrary/generated-projects/
    tests/interdependent-binding-projects/generated-projects/
    tests/introspection/iOS/generated-projects/
    tests/linker/ios/dont link/generated-projects/
    tests/linker/ios/link all/generated-projects/
    tests/linker/ios/link sdk/generated-projects/
    tests/monotouch-test/generated-projects/
    
    nothing added to commit but untracked files present (use "git add" to track)
    Search for Comparing API & creating generator diff in the log to view the complete log.
🔥 Test run failed 🔥

Test results

26 tests failed, 81 tests passed.

Failed tests

  • monotouch-test/iOS Unified 64-bits - simulator/Debug: TimedOut
  • monotouch-test/iOS Unified 64-bits - simulator/Debug (LinkSdk): TimedOut
  • monotouch-test/iOS Unified 64-bits - simulator/Debug (static registrar): TimedOut
  • monotouch-test/iOS Unified 64-bits - simulator/Release (all optimizations): TimedOut
  • framework-test/iOS Unified 64-bits - simulator/Debug: TimedOut
  • fsharp/iOS Unified 64-bits - simulator/Debug: TimedOut
  • interdependent-binding-projects/iOS Unified 64-bits - simulator/Debug: TimedOut
  • introspection/iOS Unified 64-bits - simulator/Debug: TimedOut
  • dont link/iOS Unified 64-bits - simulator/Debug: TimedOut
  • dont link/iOS Unified 64-bits - simulator/Release: TimedOut
  • link all/iOS Unified 64-bits - simulator/Debug: TimedOut
  • link all/iOS Unified 64-bits - simulator/Release: TimedOut
  • link sdk/iOS Unified 64-bits - simulator/Debug: TimedOut
  • link sdk/iOS Unified 64-bits - simulator/Release: TimedOut
  • mono-native-compat/iOS Unified 64-bits - simulator/Debug: TimedOut
  • mono-native-compat/iOS Unified Today Extension 64-bits - simulator/Debug: TimedOut
  • mono-native-unified/iOS Unified 64-bits - simulator/Debug: TimedOut
  • mono-native-unified/iOS Unified Today Extension 64-bits - simulator/Debug: TimedOut
  • [NUnit] Mono BCL tests group 1/iOS Unified 64-bits - simulator/Debug: TimedOut
  • [NUnit] Mono BCL tests group 2/iOS Unified 64-bits - simulator/Debug: TimedOut
  • [xUnit] Mono BCL tests group 3/iOS Unified 64-bits - simulator/Debug: TimedOut
  • [xUnit] Mono BCL tests group 4/iOS Unified 64-bits - simulator/Debug: TimedOut
  • [xUnit] Mono BCL tests group 5/iOS Unified 64-bits - simulator/Debug: TimedOut
  • [xUnit] Mono SystemCoreXunit Part 1/iOS Unified 64-bits - simulator/Debug: TimedOut
  • [xUnit] Mono SystemCoreXunit Part 2/iOS Unified 64-bits - simulator/Debug: TimedOut
  • [xUnit] Mono SystemXunit/iOS Unified 64-bits - simulator/Debug: TimedOut

@mandel-macaque mandel-macaque added the run-all-tests Run all our tests. label Oct 23, 2020
@monojenkins
Copy link
Collaborator

Build failure
Provisioning succeeded
Build succeeded
API Diff (from stable)
🔥 Failed to compare API and create generator diff 🔥
    Failed to build src/
    Search for Comparing API & creating generator diff in the log to view the complete log.
🔥 Test run failed 🔥

Test results

24 tests failed, 990 tests' device not found, 123 tests passed.

Failed tests

  • monotouch-test/iOS Unified 32-bits - simulator/Debug: TimedOut
  • framework-test/iOS Unified 32-bits - simulator/Debug: TimedOut
  • fsharp/iOS Unified 32-bits - simulator/Debug: TimedOut
  • interdependent-binding-projects/iOS Unified 32-bits - simulator/Debug: TimedOut
  • introspection/iOS Unified 32-bits - simulator/Debug: TimedOut
  • dont link/iOS Unified 32-bits - simulator/Debug: TimedOut
  • dont link/iOS Unified 32-bits - simulator/Release: TimedOut
  • link all/iOS Unified 32-bits - simulator/Debug: TimedOut
  • link all/iOS Unified 32-bits - simulator/Release: TimedOut
  • link sdk/iOS Unified 32-bits - simulator/Debug: TimedOut
  • link sdk/iOS Unified 32-bits - simulator/Release: TimedOut
  • mono-native-compat/iOS Unified 32-bits - simulator/Debug: TimedOut
  • mono-native-unified/iOS Unified 32-bits - simulator/Debug: TimedOut
  • [NUnit] Mono BCL tests group 1/iOS Unified 32-bits - simulator/Debug: TimedOut
  • [NUnit] Mono BCL tests group 2/iOS Unified 32-bits - simulator/Debug: TimedOut
  • [xUnit] Mono BCL tests group 3/iOS Unified 32-bits - simulator/Debug: TimedOut
  • [xUnit] Mono BCL tests group 4/iOS Unified 32-bits - simulator/Debug: TimedOut
  • [xUnit] Mono BCL tests group 5/iOS Unified 32-bits - simulator/Debug: TimedOut
  • mscorlib Part 1/iOS Unified 32-bits - simulator/Debug: TimedOut
  • mscorlib Part 2/iOS Unified 32-bits - simulator/Debug: TimedOut
  • mscorlib Part 3/iOS Unified 32-bits - simulator/Debug: TimedOut
  • [xUnit] Mono SystemCoreXunit Part 1/iOS Unified 32-bits - simulator/Debug: TimedOut
  • [xUnit] Mono SystemCoreXunit Part 2/iOS Unified 32-bits - simulator/Debug: TimedOut
  • [xUnit] Mono SystemXunit/iOS Unified 32-bits - simulator/Debug: TimedOut

@mandel-macaque
Copy link
Member Author

sim32 failures are known with the current xcode version.

@mandel-macaque mandel-macaque merged commit e64aeb4 into d16-8 Oct 26, 2020
@mandel-macaque mandel-macaque deleted the d16-8-xharness branch October 26, 2020 20:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
pr-change-not-shipping The PR only touch files that are not shipped to customers run-all-tests Run all our tests.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

8 participants