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

1282 Коммитов

Автор SHA1 Сообщение Дата
Rolf Bjarne Kvinge c640775699 [dotnet] Bump to .NET 6.0.100-alpha.1.20556.2. and net6.0
New commits in spouliot/Touch.Unit:

* spouliot/Touch.Unit@f8768d9 Advance into the world of net6.0

Diff: 9abe69e6f5..f8768d99ef
2020-11-10 11:41:06 +01:00
Rolf Bjarne Kvinge 26e720943f
[tests] Bump Xamarin.MacDev.Tests to net472 (#9986) 2020-10-28 17:48:04 +01:00
Rolf Bjarne Kvinge 9cf78cf399
[tests] Clean up Xamarin.MacDev.Tasks.Tests. (#9975)
* Remove a lot of dead code.
* Use TestBase.CreateTask<T> to create tasks (and set required properties for all
  tasks) instead of instantiating tasks directly. This required subclassing TestBase
  in a few places, as well as making a few helper methods instance methods instead
  of static methods.
* Bump to net472.
* A few other misc simplifications.
2020-10-28 08:13:18 +01:00
Rolf Bjarne Kvinge ebef5e3e6b
[xharness] Automatically run the msbuild tests if something in the msbuild or tests/msbuild directories changed. (#9976) 2020-10-27 21:45:57 +01:00
Manuel de la Pena e64aeb4ada
[Xharness] Bring xharness changes to d16-8 (#9951)
* [xharness] Add support for skipping more test variations.

* [xharness] Add the dotnet introspection project file to our list of projects, and mark it as a .NET project.

* [xharness] Clearly label .NET projects as such.

* [xharness] Disable project generation for .NET projects for now.

* [xharness] Create DotNetBuildTasks when we need to build .NET projects.

* [xharness] Improve project cloning to take into account default inclusion 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.

* [xharness] Add a GetDotNetExecutable callback and an MSBuildPath property to [I]ProcessManager.

* [xharness] Retrieve a .NET project's OutputPath by running MSBuild.

.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.

* [xharness] Skip the old simulator variation for introspection/dotnet for now.

* [xharness] Try to not have log directories with spaces in them. (#8976)

The simulators won't write stdout/stderr to a path with a space.

* [xharness] Don't generate makefile targets for .NET projects.

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.

* [xharness] Add support for generating a tvOS version of .NET iOS projects. (#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.

* [xharness] Use Cecil to inspect assemblies, instead of Reflection. (#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.

* [xharness] Don't group simulators when running in server mode. (#9098)

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.

* [xharness] Fix finding testable types in test assemblies. Fixes #xamarin/maccore@2267. (#9103)

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

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

* [xharness] Parse NUnit v2 xml reports correctly. (#9110)

* [xharness] De-asyncify template expansion. (#9104)

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).

* [xharness] Improve code to not throw exceptions in the first place instead of catching and ignoring. (#9118)

* [xharness] Try harder to make lldb quit after trying to get a backtrace. (#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).

* [xharness] Improve process killing a bit. (#9120)

* Log what we're doing.
* Wait a bit after sending SIGABRT, to allow for the OS to create any crash
  reports.

* [xharness] Don't try to write cleaned xml into the same file as the dirty xml was. (#9122)

* [xharness] Don't replace existing files, instead add new files, when providing human-readable logs. (#9123)

This makes understanding what's going on much easier.

* [xharness] Fix BCL project generation for watchOS projects. (#9131)

Reading from a file named as the actual content of the watchOS template doesn't
_quite_ work. Instead just use the content directly.

* [xharness] Only try to parse the build log if we have a build log. (#9130)

* [xharness] Don't generate into the same directory/files for macOS Modern 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.

* [xharness] Disable default inclusion behavior for the introspection .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.

* [xharness] Generate BCL projects asynchronously. (#9083)

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).

* [xharness] Document the test loading process a little bit.

* [xharness] Generate projects into a subdirectory for each project.

Because it's cumbersome to keep the build working when the same directory has
multiple project files.

* [xharness] Remove a lot of special-casing for the mono-native tests.

It's not needed anymore.

* [xharness] Store attribute in local variable instead of fetching it twice.

* [xharness] Make ProjectFileExtensions.GetInfoPListInclude a bit clearer.

Add a comment to document what's supposed to happen, and simplify the code a little bit.

* [xharness] Add support for specifying whether variations should be generated for Xamarin.iOS projects.

* [xharness] Don't generate variations for BCL projects using the normal procedure, we generate them differently already.

This makes it possible to remove some dead code.

* [xharness] Add a TestPlatform value to TestProject, and use it to indicate that a TestProject might be of a specific platform already.

* [xharness] Make the templates path an input parameter for the BCL templates.

* [xharness] Make the BCL project generation generate each project file into its own subdirectory.

* [tests] Put the iOS and macOS mono-native templates in their own directory.

This makes it possible to remove a few conditions in the code.

* [xharness] Simplify the MonoNativeInfo class a bit by removing the custom Mac-specific subclass (there's almost no difference anymore).

* [tests] Move bindings-test[-mac].csproj to their own directory.

* [xharness] Fix compiler warning. (#9147)

* [xharness] Fix logic to not create makefile targets to run BCL tests. (#9148)

According to the existing code, we're already not supposed to create makefile
targets for BCL tests. However, the code to detect BCL tests wasn't quite
reliable, so we ended up creating makefile targets for some BCL tests.

So always use the same logic to detect BCL tests.

Also remove a lot of dead code to generate makefile code for BCL tests.

* [tests] Set the correct mono-native link mode and flavor defines in the csproj itself.

This makes it possible to simplify a lot of C# code.

* [xharness] Remove a redundant ToArray.

* [xharness] Allow for null environment variables to mlaunch. (#9140)

It's a valid scenario to set a null environment variable.

This happens when changing InCI to always return true (to test locally what's
done on the bots), in which case we try to forward BUILD_REVISION to mlaunch,
but BUILD_REVISION isn't necessarily set. Not forwarding it to mlaunch should
not cause problems in most tests, so just allow this scenario.

* [xharness] Generate makefile targets for non-executable projects. (#9158)

It turns out some Xamarin.Mac projects are library projects (for unit tests),
and we still need to generate makefile targets for those (because we use them
to build Xamarin.Mac tests to run on older macOS bots).

* [xharness] Backport Touch.Unit fix for command line parsing. (#9165)

Apply https://github.com/spouliot/Touch.Unit/pull/78 to the duplicated file.

* [tests] Info.plists should be inside LogicalName, not Link.

This makes it possible to simplify a bit more code inside xharness as well.

* Merge remote-tracking branch 'origin/main' into xharness-a-directory-per-project

* [xharness] Fix finding Info.plist, and add some tests too.

* [xharness] Fix how .NET projects are ignored. (#9168)

* [xharness] Fix how .NET projects are ignored.

Now they're actually ignored if .NET tests are not included.

* Fix compile error.

* Merge remote-tracking branch 'origin/main' into xharness-a-directory-per-project

* [xharness] If we're not generating projects in the Target class, the project path equals the template path.

* [xharness] Make restoring nugets the default for all test projects. (#9237)

But don't do it for .NET projects, since 'dotnet build' automatically restores.

* [xharness] Improve restoring NuGets for Xamarin.Mac projects in the makefile by depending on the csproj files in addition to the packages.conf files. (#9242)

Packages are listed in the csproj when we're using package references.

Also only list files in git, otherwise we pick up all the generated project files as well.

* [tests] Migrate the sample tests to use package references. (#9244)

* [tests] Switch msbuild-mac to use package references. (#9245)

And don't specify the solution path anymore, because we can restore using just
the csproj just fine now.

* [xharness] Mark the .NET tests project as a .NET project so that we don't try to call nuget restore on it. (#9251)

* [xharness] Mark the .NET tests project as a .NET project so that we don't try to call nuget restore on it.

* [xharness] Mark the .NET generator project as a .NET project as well.

* [xharness] Resolve relative project references using the referencing project's directory. (#9252)

Otherwise it would end up being resolved from the current directory, which is
not dependable.

* [xharness] Don't try to parse a build log that doesn't exist. (#9253)

* [xharness] Add support for generating/duplicating projects with a Touch.Client reference.

This also means removing support for generating/duplicating MonoTouch.NUnit references,
since we're not using those anymore.

* [tests] Remove dead code related to GuiUnit and the GuiUnit submodule.

* [xharness] Change how we run macOS unit tests to work with Touch.Client.

This is very similar to how we run iOS unit tests.

* [xharness] Add the Touch.Client projects to our solutions instead of MonoTouch.NUnitLite.

* [tests] The upstream NUnitLine isn't linker safe, so add an xml file to make sure linking doesn't remove too much.

In particular NUnit uses reflection to get a private method, and the linker removes
the corresponding private method:

1c680b4dc8/src/NUnitFramework/framework/Internal/TestExecutionContext.cs (L552)

So add an xml definition to keep this private method, and modify project files to
pass the xml definition to mtouch and mmp.

Some care needs to be taken to make sure xharness is still able to clone these project
files.

* [xharness] Add support for finding/setting the main Xamarin import among multiple imports.

This is required for the previous commit, where we added an additional import to
a few project files to pass an xml definition to mtouch/mmp.

* [xharness] Use LogFile instead of ResultFile in macOS BCL tests to match the Touch.Client usage.

* [tests] Restore projects before building them from the command line.

* [xharness] Implement Log.GetReader for all loggers. (#9257)

This makes it easier to write code that parses logs, since that code won't
have to worry about if a particular log supports GetReader or not.

* [xharness] Fix main log parsing by not requiring it to come from a file. (#9258)

Not all types of logs have files, but all types of logs have a reader (or will
have soon due to PR #9257).

* [xharness] Improve parsing of NUnitV2 xml reports to fix an issue with failures in parameterized tests. (#9259)

We weren't properly reporting all failures when there were multiple failures
in parameterized tests, because we'd incorrectly skip too many xml nodes when
we were looking for the next test failure.

* Merge remote-tracking branch 'origin/main' into HEAD

* Remove wrongly added dir. (#9301)

Someone (Manuel) uses an IDE that uses .idea to store user settings and
that got added by accident.

* [Harness] Fix some typos. (#9303)

* [xharness] Make it possible to include .NET tests by setting a label. (#9298)

This also means that setting 'run-all-tests' enables the .NET tests, which
means they'll now start running on internal Jenkins (as was the intention from
the beginning).

* [xharness] Look at the exact NUnit version an NUnit project is referencing to figure out how to run it in a makefile. (#9322)

* [xharness] Add support for adding PropertyGroups for unknown platform/configuration values in a csproj. Fixes xamarin/maccore@2277. (#9347)

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

* [xharness] Add support for getting the default AssemblyName for projects. (#9369)

In .NET projects there's a default value for most properties, which means that
there won't necessarily be an AssemblyName property in a csproj. We need to know the
AssemblyName, so calculate it from the csproj filename (which is how .NET does it).

This turned out slighly complicated, because we're pass an XmlDocument around,
and the XmlDocument doesn't know the file from where it was loaded, so we need
to keep that information separately.

* [xharness] Add the .NET version of interdependent-binding-projects to our lineup

* [xharness] Enhance ResolveAllPaths to understand $(RootTestsDirectory).

This requires passing the root directory around in multiple places, since ResolveAllPaths
doesn't have access to the static class where we define the root directory.

Also call ResolveAllPaths in a few more places to ensure paths everywhere are resolved.

* [xharness] Do not mark DeviceLoaders as loaded when loading fails (#9367)

* [xharness] Make sure MSBUILD_EXE_PATH is not set when executing dotnet.

Something ends up confused, and dotnet hangs.

* [xharness] Bump timeout for the .NET tests.

More tests take longer to run!

* [xharness] Don't clone the same project multiple times when reached through different project references.

Problem:

1. interdependent-binding-project references binding-test and bindings-test2.
2. bindings-test2 references bindings-test.

This means bindings-test is reached through 2 projects: both
interdependent-binding-projects and bindings-test2, and previously we'd
process each of these references separately, effectively making two separate
clones of the bindings-test project.

Instead keep track of all referenced projects from the leaf project, and if we
encounter a project we've already cloned, use that directly.

* [dotnet] Add support for consuming binding projects. (#9376)

* Port the interdependent-binding-projects test to .NET (it's the simplest
  test project we have with binding projects).
* Add a lot of the shared source code for mtouch/mmp to dotnet-linker, and
  make it compile. Most issues were fixed by adding a few stubbed out classes,
  since there are large chunks of the mtouch/mmp code we're not using yet, so
  stubbing out while things are being implemented works fine.
* Add a step in dotnet-linker for loading the linker output (the linked
  assemblies) into our bundler code.
* Add another step in dotnet-linker to extract native resources from binding
  libraries.
* Augment the build process to take into account the native resources we found
  in any binding libraries.

* [xharness] Make it possible to make a project ignored by default from its initial definition.

Make it possible to make a project ignored by default from its initial definition,
and which takes precedence over any other selection criteria.

This way it's possible to make the .NET version of monotouch-test show up in the
web view, which makes it runnable locally (for testing), while at the same time it
will never be run on CI.

* [xharness] Add monotouch-test to the .NET lineup.

* [xharness] Improve resolving paths in project files.

* Properties may contain a list of files, separated by semi-colon, so if we find
  any semi-colons, treat each entry as a separate path.

* Treat anything that starts with a variable as a full path, because either the
  variable is a full path, or it will be updated according to the new project location
  and resolve correctly.

* [xharness] Process '$(RootTestsDirectory)' before bailing due to any other variables when resolving paths in project files. (#9467)

While keeping '$(RootTestsDirectory)' as-is works fine when building the
project using MSBuild, xharness itself may end up encountering it (in
particular when listing referenced projects), and at that point will end up
confused. So just always resolve '$(RootTestsDirectory)' to the actual
directory to keep other parts of xharness happy.

Fixes this problem (as seen in PR #9460):

    Harness exception for 'interdependent-binding-projects': System.IO.DirectoryNotFoundException: Could not find a part of the path "/Users/builder/jenkins/workspace/xamarin-macios-pr-builder/tests/external/Touch.Unit/Touch.Client/dotnet/iOS/Touch.Client-iOS.dotnet.csproj".
        at System.IO.FileStream..ctor (System.String path, System.IO.FileMode mode, System.IO.FileAccess access, System.IO.FileShare share, System.Int32 bufferSize, System.Boolean anonymous, System.IO.FileOptions options) [0x0015e] in /Users/builder/jenkins/workspace/build-package-osx-mono/2020-02/external/bockbuild/builds/mono-x64/mcs/class/corlib/System.IO/FileStream.cs:223
        at System.IO.FileStream..ctor (System.String path, System.IO.FileMode mode, System.IO.FileAccess access, System.IO.FileShare share, System.Int32 bufferSize, System.Boolean isAsync, System.Boolean anonymous) [0x00000] in /Users/builder/jenkins/workspace/build-package-osx-mono/2020-02/external/bockbuild/builds/mono-x64/mcs/class/corlib/System.IO/FileStream.cs:149
        at System.IO.FileStream..ctor (System.String path, System.IO.FileMode mode, System.IO.FileAccess access) [0x00000] in /Users/builder/jenkins/workspace/build-package-osx-mono/2020-02/external/bockbuild/builds/mono-x64/mcs/class/corlib/System.IO/FileStream.cs:86
        at (wrapper remoting-invoke-with-check) System.IO.FileStream..ctor(string,System.IO.FileMode,System.IO.FileAccess)
        at Microsoft.DotNet.XHarness.iOS.Shared.Utilities.PListExtensions.LoadWithoutNetworkAccess (System.Xml.XmlDocument doc, System.String filename) [0x00001] in /Users/builder/jenkins/workspace/xamarin-macios-pr-builder/tests/xharness/Microsoft.DotNet.XHarness.iOS.Shared/Utilities/PlistExtensions.cs:17
        at Microsoft.DotNet.XHarness.iOS.Shared.TestProject.CreateCopyAsync (Microsoft.DotNet.XHarness.iOS.Shared.Logging.ILog log, Microsoft.DotNet.XHarness.iOS.Shared.Execution.IProcessManager processManager, Microsoft.DotNet.XHarness.iOS.Shared.Tasks.ITestTask test, System.String rootDirectory, System.Collections.Generic.Dictionary`2[TKey,TValue] allProjectReferences) [0x0010c] in /Users/builder/jenkins/workspace/xamarin-macios-pr-builder/tests/xharness/Microsoft.DotNet.XHarness.iOS.Shared/TestProject.cs:98
        at Microsoft.DotNet.XHarness.iOS.Shared.TestProject.CreateCopyAsync (Microsoft.DotNet.XHarness.iOS.Shared.Logging.ILog log, Microsoft.DotNet.XHarness.iOS.Shared.Execution.IProcessManager processManager, Microsoft.DotNet.XHarness.iOS.Shared.Tasks.ITestTask test, System.String rootDirectory, System.Collections.Generic.Dictionary`2[TKey,TValue] allProjectReferences) [0x00811] in /Users/builder/jenkins/workspace/xamarin-macios-pr-builder/tests/xharness/Microsoft.DotNet.XHarness.iOS.Shared/TestProject.cs:168
        at Microsoft.DotNet.XHarness.iOS.Shared.Tasks.TestTasks.RunInternalAsync () [0x00117] in /Users/builder/jenkins/workspace/xamarin-macios-pr-builder/tests/xharness/Microsoft.DotNet.XHarness.iOS.Shared/Tasks/TestTask.cs:274

* [tests] Port dont link to .NET (#9488)

There are a few test failures, so it's ignored by default in xharness for now.

* [xharness] don't link is now green on .NET!

* [tests] Port link sdk to .NET

* [xharness] link sdk is now green on .NET!

At least the Debug configuration is, there's still a test failure in the Release
configuration, so skip that for now.

* [tests] Port link all to .NET (#9515)

* [tests] Port link all to .NET

* [tests] Exclude link all tests in .NET that reference OpenTK-1.0.dll

OpenTK-1.0.dll isn't supported yet.

* [tests] Exclude link all tests using API that isn't available anymore in .NET.

* [xharness] Use the local 'ignore' variable instead of fetching 'test.TestProject.Ignore' for every test when generating test variations. (#9518)

* [xharness] Enable monotouch-test/.NET by default, but ignore all variations. (#9526)

* [xharness] Enable monotouch-test/.NET by default, but ignore all variations.

The default (Debug) configuration is green now, but the rest of the variations aren't yet.

* [tests] Ignore LocaleTest.InitRegionInfo in .NET because it needs globalization data.

Ref: https://github.com/xamarin/xamarin-macios/issues/8906

I can't reproduce locally, because it's ignored for me:

    [INCONCLUSIVE] InitRegionInfo : You can construct locale without countries
        at MonoTouchFixtures.Foundation.LocaleTest.InitRegionInfo() in [...]/xamarin-macios/tests/monotouch-test/Foundation/LocaleTest.cs:line 47

but this should fix this monotouch-test test failure (I'm guessing that 'IV'
stands for 'Invariant', which is all the current .NET version ships with):

    MonoTouchFixtures.Foundation.LocaleTest
        [FAIL] InitRegionInfo :   Name
            String lengths are both 2. Strings differ at index 0.
            Expected: "US"
            But was:  "IV"
            -----------^
                 :    at MonoTouchFixtures.Foundation.LocaleTest.InitRegionInfo() in /Users/builder/jenkins/workspace/xamarin-macios-pr-builder/tests/monotouch-test/Foundation/LocaleTest.cs:line 49

* [xharness] Enable the .NET tests when a file containing 'dotnet' is modified. (#9510)

* [xharness] Enable the .NET tests when a file containing 'dotnet' is modified.

This also required adding support for using regex as file names when selecting
which tests to run.

* Remove redundant dotnet prefix.

* [xharness] Rename variables to match usage.

* [dotnet] Use net5.0-[ios|tvos|watchos|macos] TargetFrameworks. (#9532)

* [dotnet] Set TargetPlatformSupported when the right TargetPlatformIdentifier is used.

* [dotnet] Generate a list of valid OS versions for each platform, and add it to the SupportedTargetPlatform item group.

The generated files: https://gist.github.com/rolfbjarne/765c4e4b38b1b017380c9378d9666317

* [dotnet] Define and set the default platform version if it's not set in the TargetFramework variable.

* [dotnet] Switch to using the new-style TargetFramework values.

This includes bumping spouliot/Touch.Unit to get new-style TargetFramework values for Touch.Client.

* spouliot/Touch.Unit@89afaf7 [Touch.Client] Use the right TargetFrameworks for watchOS and macOS as well. (#92)
* spouliot/Touch.Unit@fd0e576 [Touch.Client] Use the right TargetFrameworks. (#91)
* spouliot/Touch.Unit@40f47db [Touch.Client] Add a macOS and watchOS version for .NET. (#90)
* spouliot/Touch.Unit@1d4b8c0 Add .gitignore for NuGet.config and global.json. (#89)
* spouliot/Touch.Unit@49441f3 Call `mlaunch` instead of `mtouch` (#88)
* spouliot/Touch.Unit@b157cf4 Fix a few markdown issues found by markdownlint. (#87)

Diff: d7f55a6167..89afaf7e05

* [dotnet] Document the script that generates the lists of the target platform versions a little bit better.

* [dotnet] Make the [Platform]SupportedTargetPlatform variables public.

This matches how Android and Windows do it:

* https://github.com/xamarin/xamarin-android/pull/5007
* 18ee4eac8b/src/Tasks/Microsoft.NET.Build.Tasks/targets/Microsoft.NET.WindowsSupportedTargetPlatforms.props

* [xharness] Update the TargetFramework value when creating project variations.

* [dotnet] Pass the Optimize flags from the extra bundler arguments to the linker configuration. (#9599)

* [dotnet] Pass the Optimize flags from the extra bundler arguments to the linker configuration.

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

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

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

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

* [xharness] Disable tvOS generation for the introspection/.NET test, it incorrect and needs fixing.

* [dotnet-linker] Add OptimizeGeneratedCodeSubStep into the pipeline. (#9608)

Fixes these linkall tests:

    Linker.Shared.OptimizeGeneratedCodeTest
        [FAIL] IsARM64CallingConvention :   optimized: no ldsfld instruction
        Expected: 0
        But was:  1
            at Linker.Shared.BaseOptimizeGeneratedCodeTest.IsARM64CallingConvention() in /Users/rolf/work/maccore/main/xamarin-macios/tests/linker/BaseOptimizeGeneratedCodeTest.cs:line 527

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

And linkall is now green for .NET/Debug.

* [xharness] Add support for adding PropertyGroups if none are applicable when adding a property. (#9616)

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

This makes it possible to execute the various monotouch-test variations for
.NET in xharness (some of the variations still fail though, so they're still
ignored by default).

* [tests] Ignore a few link sdk tests in .NET for now. (#9614)

There are easier fish to fry right now, so implementing the linker support for
these tests to pass (metadata reduction and code removal) can wait.

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

Ref: https://github.com/xamarin/xamarin-macios/issues/9612
Ref: https://github.com/xamarin/xamarin-macios/issues/9613

* [xharness] The linkall tests are green for .NET/Release now. (#9629)

* [xharness] Skip the 'dont link / AssemblyBuildTarget: SDK framework (release)' variation by default for tvOS. Fixes #xamarin/maccore@2282. (#9659)

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

So just skip it.

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

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

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

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

Also:

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

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

* Use the expected dotnet binary during our local build.

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

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

This way we end up using the dotnet version that's configured in global.json for the tests.

* [xharness] Fix typo in test case creating two identical test cases. (#9702)

* [xharness] Use XmlReaderSettings to ignore stuff we don't care about 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.

* [xharness] Fix rendering human-readable results for parameterized tests. 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 https://github.com/xamarin/xamarin-macios/issues/9400.

* [dotnet-linker] Add a CollectUnmarkedMembersStep that will keep linked 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

* [xharness] Only run xammac variations if macOS tests are included. (#9729)

This fixes a build error with a xammac test variation that is executed even if
the macOS build is disabled.

* [xharness] The dotnet version of introspection/iOS 10.3 works fine now. (#9728)

* [xharness] Disable iOS 32-bit simulator tests, they don't work on Xcode 12+. (Re)fixes #xamarin/maccore@2284. (#9732)

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

* Undo does changes that ship and we do not want to bring with us.

* Fix issues that do not allow compilation.

* Fix mtouch tests.

* Ignore generated files.

Co-authored-by: Rolf Bjarne Kvinge <rolf@xamarin.com>
Co-authored-by: Přemek Vysoký <premek.vysoky@microsoft.com>
2020-10-26 16:05:40 -04:00
Rolf Bjarne Kvinge 02ce88fa7f
[xharness] Create device variations for the .NET tests. (#9947)
They're all disabled by default for now, since device builds for .NET hasn't
been implemented yet.
2020-10-22 16:32:14 +02:00
Rolf Bjarne Kvinge 673e20e4b4
[xharness] Make the MSBuildTask capable of building .NET projects. (#9941)
Merge DotNetBuildTask into MSBuildTask to simplify creation of build tasks -
these tasks are very similar, and we instantiate MSBuildTasks in over a dozen
places, and this way we don't have to update every instantiation to check if
an MSBuildTask or a DotNetBuildTask should be created.

The end result is that code that does 'new MSBuildTask (...)' will just work
without updates for .NET projects.
2020-10-22 08:45:14 +02:00
Rolf Bjarne Kvinge 565003d3a3
[xharness] Give the MSBuild tests 30 more minutes to finish. Fixes #xamarin/maccore@2623. (#9927)
Fixes https://github.com/xamarin/maccore/issues/2326.
2020-10-21 08:56:33 +02:00
Rolf Bjarne Kvinge 0269d25f79
[xharness] Announce to the world that we're creating UTF8 documents. (#9926)
This makes emojiis in the html report render properly 😁
2020-10-20 14:35:05 +02:00
Rolf Bjarne Kvinge 890077adfa [tests] Enable the workload resolver. 2020-10-16 14:27:57 +02:00
Rolf Bjarne Kvinge e92809f38c
[tests] Split the iOS msbuild tests in two. (#9860)
Split the iOS msbuild tests in two:

* Xamarin.MacDev.Tasks.Tests: contains in-process unit tests for tasks.
* Xamarin.MacDev.Tasks: contains larger tests that either invoke targets or a complete
  build. These are currently in-process, but will become out-of-process soon to make
  it possible to run them with dotnet.

Also make the new projects non-iOS-specific, because the macOS msbuild tests will
be moved here as well soon.

There is some duplicated code between these two test projects now (all files
that show up as new are copies of existing files), this will be cleaned up in
later pull requests.
2020-10-15 08:45:43 +02:00
Rolf Bjarne Kvinge 9ade64930f
[msbuild] Move all the msbuild tests to tests/msbuild to put all the tests together. (#9824)
* [msbuild] Move msbuild/tests to tests/msbuild to put all the tests together.

* [tests] Move test projects for Xamarin.Mac to tests/common/TestProjects

* [tests] Move test projects for Xamarin.iOS to tests/common/TestProjects
2020-10-09 16:06:19 +02:00
Rolf Bjarne Kvinge 3f0cac77b7
[xharness] Disable iOS 32-bit simulator tests, they don't work on Xcode 12+. (Re)fixes #xamarin/maccore@2284. (#9732)
Fixes https://github.com/xamarin/maccore/issues/2284.
2020-09-30 18:11:10 +02:00
Rolf Bjarne Kvinge c0bd03b09f
[xharness] The dotnet version of introspection/iOS 10.3 works fine now. (#9728) 2020-09-30 08:21:52 +02:00
Rolf Bjarne Kvinge 5c113d225d
[xharness] Only run xammac variations if macOS tests are included. (#9729)
This fixes a build error with a xammac test variation that is executed even if
the macOS build is disabled.
2020-09-30 08:21:24 +02:00
Rolf Bjarne Kvinge b111ce0e5c
[dotnet-linker] Add a CollectUnmarkedMembersStep that will keep linked 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
2020-09-29 16:41:47 +02:00
Rolf Bjarne Kvinge 5aed65d45e
[xharness] Fix rendering human-readable results for parameterized tests. 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 https://github.com/xamarin/xamarin-macios/issues/9400.
2020-09-25 19:18:37 +02:00
Manuel de la Pena 764734d20a
[Main][Xcode12] Add support for Xcode 12 2020-09-25 12:58:29 -04:00
Rolf Bjarne Kvinge 5ced9ee978
[xharness] Use XmlReaderSettings to ignore stuff we don't care about 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.
2020-09-25 18:17:47 +02:00
Rolf Bjarne Kvinge 3b38f2242e
[xharness] Fix typo in test case creating two identical test cases. (#9702) 2020-09-25 17:30:04 +02:00
Manuel de la Pena dcb0c93ab0 [Xcode12] Bring xcode 12 changes into main. 2020-09-23 16:05:22 -04:00
Rolf Bjarne Kvinge 8bda9174fd
Bump to Xcode 12.2 beta 1. (#9665)
* Bump to Xcode 12.2 beta 1.

* [tests] Fix xtro and intro

* Fix wrong availability

* Fix monotouch tests

* Disable watchOS tests and bump iOS version to the right one

watchOS tests have been disabled because Xcode 12.2 Beta is
broken, you cannot create a watch app and deploy, Xcode just
crashes when you try to list simulators, If you try to use
our tools at the moment of deploying we get:

> error HE0046: Failed to install the app 'app' on the device 'watchOS 7.1 (18R5552f) - Apple Watch Series 6 - 44mm': Unable To Install ???app???

* Fix macOS check and bump both versions to satisfy commit distance check, luckily we have infinite numbers!!

Co-authored-by: Alex Soto <alex@alexsoto.me>
2020-09-23 08:11:26 -04:00
Rolf Bjarne Kvinge 39e3184f02
[src] Build the .NET version of our product assemblies using a .NET 5 BCL. (#9637)
* [src] Build the .NET version of our product assemblies using a .NET 5 BCL.

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

Also:

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

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

* Use the expected dotnet binary during our local build.

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

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

This way we end up using the dotnet version that's configured in global.json for the tests.
2020-09-21 13:22:44 +02:00
Manuel de la Pena eb9b690fe0 Merge xcode12 into d16-8. 2020-09-18 17:51:52 -04:00
Rolf Bjarne Kvinge 1463967d00
[xharness] Skip the 'dont link / AssemblyBuildTarget: SDK framework (release)' variation by default for tvOS. Fixes #xamarin/maccore@2282. (#9659)
This test variation ends up being too big (1.5 GB), so it doesn't install
properly and the app crashes at startup.

So just skip it.

Fixes https://github.com/xamarin/maccore/issues/2282.
2020-09-18 09:08:32 +02:00
Alex Soto 8383b14382
[xcode12] Rename master to main (#9631)
* Fix links that point to master to point to main instead.
* Implement support in the sample tester for specifying the default branch for
  each sample repo.
* Fix various text / documentation to say 'main' instead of 'master.'
* Push to 'main' instead of 'master' in xamarin-macios-data.
* Fix xharness to make 'main' the special branch with regards to documentation tests as opposed to 'master'.
* Fix various CI to use 'main' instead of 'master'.

This is a backport of PR #9561
2020-09-15 07:09:29 -04:00
Rolf Bjarne Kvinge 4915566c46
[xharness] The linkall tests are green for .NET/Release now. (#9629) 2020-09-14 19:16:13 +02:00
Rolf Bjarne Kvinge 1a582ed59a
[tests] Ignore a few link sdk tests in .NET for now. (#9614)
There are easier fish to fry right now, so implementing the linker support for
these tests to pass (metadata reduction and code removal) can wait.

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

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

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

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

And linkall is now green for .NET/Debug.
2020-09-10 08:30:45 +02:00
Rolf Bjarne Kvinge 941d65f016
[dotnet] Pass the Optimize flags from the extra bundler arguments to the linker configuration. (#9599)
* [dotnet] Pass the Optimize flags from the extra bundler arguments to the linker configuration.

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

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

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

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

* [xharness] Disable tvOS generation for the introspection/.NET test, it incorrect and needs fixing.
2020-09-09 14:52:46 +02:00
Rolf Bjarne Kvinge d2788511b6
[dotnet] Use net5.0-[ios|tvos|watchos|macos] TargetFrameworks. (#9532)
* [dotnet] Set TargetPlatformSupported when the right TargetPlatformIdentifier is used.

* [dotnet] Generate a list of valid OS versions for each platform, and add it to the SupportedTargetPlatform item group.

The generated files: https://gist.github.com/rolfbjarne/765c4e4b38b1b017380c9378d9666317

* [dotnet] Define and set the default platform version if it's not set in the TargetFramework variable.

* [dotnet] Switch to using the new-style TargetFramework values.

This includes bumping spouliot/Touch.Unit to get new-style TargetFramework values for Touch.Client.

* spouliot/Touch.Unit@89afaf7 [Touch.Client] Use the right TargetFrameworks for watchOS and macOS as well. (#92)
* spouliot/Touch.Unit@fd0e576 [Touch.Client] Use the right TargetFrameworks. (#91)
* spouliot/Touch.Unit@40f47db [Touch.Client] Add a macOS and watchOS version for .NET. (#90)
* spouliot/Touch.Unit@1d4b8c0 Add .gitignore for NuGet.config and global.json. (#89)
* spouliot/Touch.Unit@49441f3 Call `mlaunch` instead of `mtouch` (#88)
* spouliot/Touch.Unit@b157cf4 Fix a few markdown issues found by markdownlint. (#87)

Diff: d7f55a6167..89afaf7e05

* [dotnet] Document the script that generates the lists of the target platform versions a little bit better.

* [dotnet] Make the [Platform]SupportedTargetPlatform variables public.

This matches how Android and Windows do it:

* https://github.com/xamarin/xamarin-android/pull/5007
* 18ee4eac8b/src/Tasks/Microsoft.NET.Build.Tasks/targets/Microsoft.NET.WindowsSupportedTargetPlatforms.props

* [xharness] Update the TargetFramework value when creating project variations.
2020-08-31 09:27:19 +02:00
Rolf Bjarne Kvinge 48090369db
[xharness] Enable the .NET tests when a file containing 'dotnet' is modified. (#9510)
* [xharness] Enable the .NET tests when a file containing 'dotnet' is modified.

This also required adding support for using regex as file names when selecting
which tests to run.

* Remove redundant dotnet prefix.

* [xharness] Rename variables to match usage.
2020-08-27 19:15:56 +02:00
Rolf Bjarne Kvinge e77a737c08
[xharness] Enable monotouch-test/.NET by default, but ignore all variations. (#9526)
* [xharness] Enable monotouch-test/.NET by default, but ignore all variations.

The default (Debug) configuration is green now, but the rest of the variations aren't yet.

* [tests] Ignore LocaleTest.InitRegionInfo in .NET because it needs globalization data.

Ref: https://github.com/xamarin/xamarin-macios/issues/8906

I can't reproduce locally, because it's ignored for me:

    [INCONCLUSIVE] InitRegionInfo : You can construct locale without countries
        at MonoTouchFixtures.Foundation.LocaleTest.InitRegionInfo() in [...]/xamarin-macios/tests/monotouch-test/Foundation/LocaleTest.cs:line 47

but this should fix this monotouch-test test failure (I'm guessing that 'IV'
stands for 'Invariant', which is all the current .NET version ships with):

    MonoTouchFixtures.Foundation.LocaleTest
        [FAIL] InitRegionInfo :   Name
            String lengths are both 2. Strings differ at index 0.
            Expected: "US"
            But was:  "IV"
            -----------^
                 :    at MonoTouchFixtures.Foundation.LocaleTest.InitRegionInfo() in /Users/builder/jenkins/workspace/xamarin-macios-pr-builder/tests/monotouch-test/Foundation/LocaleTest.cs:line 49
2020-08-27 16:54:08 +02:00
Rolf Bjarne Kvinge a65ff94b4c
[xharness] Use the local 'ignore' variable instead of fetching 'test.TestProject.Ignore' for every test when generating test variations. (#9518) 2020-08-27 08:27:47 +02:00
Rolf Bjarne Kvinge 30b1a8acbd
[tests] Port link all to .NET (#9515)
* [tests] Port link all to .NET

* [tests] Exclude link all tests in .NET that reference OpenTK-1.0.dll

OpenTK-1.0.dll isn't supported yet.

* [tests] Exclude link all tests using API that isn't available anymore in .NET.
2020-08-27 08:07:50 +02:00
Rolf Bjarne Kvinge 09e3631cb1 [xharness] link sdk is now green on .NET!
At least the Debug configuration is, there's still a test failure in the Release
configuration, so skip that for now.
2020-08-26 10:05:21 +02:00
Rolf Bjarne Kvinge 809a12647f [tests] Port link sdk to .NET 2020-08-26 09:58:47 +02:00
Rolf Bjarne Kvinge ebbd1e6738 [xharness] don't link is now green on .NET! 2020-08-25 18:18:34 +02:00
Rolf Bjarne Kvinge 9eab011a4b
[tests] Port dont link to .NET (#9488)
There are a few test failures, so it's ignored by default in xharness for now.
2020-08-25 17:04:01 +02:00
Rolf Bjarne Kvinge ccdd577f9f
[xharness] Process '$(RootTestsDirectory)' before bailing due to any other variables when resolving paths in project files. (#9467)
While keeping '$(RootTestsDirectory)' as-is works fine when building the
project using MSBuild, xharness itself may end up encountering it (in
particular when listing referenced projects), and at that point will end up
confused. So just always resolve '$(RootTestsDirectory)' to the actual
directory to keep other parts of xharness happy.

Fixes this problem (as seen in PR #9460):

    Harness exception for 'interdependent-binding-projects': System.IO.DirectoryNotFoundException: Could not find a part of the path "/Users/builder/jenkins/workspace/xamarin-macios-pr-builder/tests/external/Touch.Unit/Touch.Client/dotnet/iOS/Touch.Client-iOS.dotnet.csproj".
        at System.IO.FileStream..ctor (System.String path, System.IO.FileMode mode, System.IO.FileAccess access, System.IO.FileShare share, System.Int32 bufferSize, System.Boolean anonymous, System.IO.FileOptions options) [0x0015e] in /Users/builder/jenkins/workspace/build-package-osx-mono/2020-02/external/bockbuild/builds/mono-x64/mcs/class/corlib/System.IO/FileStream.cs:223
        at System.IO.FileStream..ctor (System.String path, System.IO.FileMode mode, System.IO.FileAccess access, System.IO.FileShare share, System.Int32 bufferSize, System.Boolean isAsync, System.Boolean anonymous) [0x00000] in /Users/builder/jenkins/workspace/build-package-osx-mono/2020-02/external/bockbuild/builds/mono-x64/mcs/class/corlib/System.IO/FileStream.cs:149
        at System.IO.FileStream..ctor (System.String path, System.IO.FileMode mode, System.IO.FileAccess access) [0x00000] in /Users/builder/jenkins/workspace/build-package-osx-mono/2020-02/external/bockbuild/builds/mono-x64/mcs/class/corlib/System.IO/FileStream.cs:86
        at (wrapper remoting-invoke-with-check) System.IO.FileStream..ctor(string,System.IO.FileMode,System.IO.FileAccess)
        at Microsoft.DotNet.XHarness.iOS.Shared.Utilities.PListExtensions.LoadWithoutNetworkAccess (System.Xml.XmlDocument doc, System.String filename) [0x00001] in /Users/builder/jenkins/workspace/xamarin-macios-pr-builder/tests/xharness/Microsoft.DotNet.XHarness.iOS.Shared/Utilities/PlistExtensions.cs:17
        at Microsoft.DotNet.XHarness.iOS.Shared.TestProject.CreateCopyAsync (Microsoft.DotNet.XHarness.iOS.Shared.Logging.ILog log, Microsoft.DotNet.XHarness.iOS.Shared.Execution.IProcessManager processManager, Microsoft.DotNet.XHarness.iOS.Shared.Tasks.ITestTask test, System.String rootDirectory, System.Collections.Generic.Dictionary`2[TKey,TValue] allProjectReferences) [0x0010c] in /Users/builder/jenkins/workspace/xamarin-macios-pr-builder/tests/xharness/Microsoft.DotNet.XHarness.iOS.Shared/TestProject.cs:98
        at Microsoft.DotNet.XHarness.iOS.Shared.TestProject.CreateCopyAsync (Microsoft.DotNet.XHarness.iOS.Shared.Logging.ILog log, Microsoft.DotNet.XHarness.iOS.Shared.Execution.IProcessManager processManager, Microsoft.DotNet.XHarness.iOS.Shared.Tasks.ITestTask test, System.String rootDirectory, System.Collections.Generic.Dictionary`2[TKey,TValue] allProjectReferences) [0x00811] in /Users/builder/jenkins/workspace/xamarin-macios-pr-builder/tests/xharness/Microsoft.DotNet.XHarness.iOS.Shared/TestProject.cs:168
        at Microsoft.DotNet.XHarness.iOS.Shared.Tasks.TestTasks.RunInternalAsync () [0x00117] in /Users/builder/jenkins/workspace/xamarin-macios-pr-builder/tests/xharness/Microsoft.DotNet.XHarness.iOS.Shared/Tasks/TestTask.cs:274
2020-08-24 17:48:59 +02:00
Rolf Bjarne Kvinge 04866dd0b7 [xharness] Improve resolving paths in project files.
* Properties may contain a list of files, separated by semi-colon, so if we find
  any semi-colons, treat each entry as a separate path.

* Treat anything that starts with a variable as a full path, because either the
  variable is a full path, or it will be updated according to the new project location
  and resolve correctly.
2020-08-21 18:47:33 +02:00
Rolf Bjarne Kvinge b2ad96ec40 [xharness] Add monotouch-test to the .NET lineup. 2020-08-21 18:47:33 +02:00
Rolf Bjarne Kvinge 64641f66e8 [xharness] Make it possible to make a project ignored by default from its initial definition.
Make it possible to make a project ignored by default from its initial definition,
and which takes precedence over any other selection criteria.

This way it's possible to make the .NET version of monotouch-test show up in the
web view, which makes it runnable locally (for testing), while at the same time it
will never be run on CI.
2020-08-21 18:47:33 +02:00
Manuel de la Pena dbaaa51786 [Harness] Use readers over paths. (#8534)
As issue https://github.com/xamarin/xamarin-macios/issues/8533 states,
not all loggers support the BullPath property, all of them do support
the GetReader one. We move the creation of the failures to use the
readers and reduce the chances of getting an exception.

fixes: https://github.com/xamarin/xamarin-macios/issues/8533
2020-08-20 21:35:03 -04:00
Rolf Bjarne Kvinge b0efe7356c [xharness] Don't replace existing files, instead add new files, when providing human-readable logs. (#9123)
This makes understanding what's going on much easier.
2020-08-20 21:32:57 -04:00
Rolf Bjarne Kvinge 1faa7447a5 [xharness] Don't try to write cleaned xml into the same file as the dirty xml was. (#9122) 2020-08-20 21:30:59 -04:00
Sebastien Pouliot d81c3dd517
[xharness] Make monotouch-test (all optimization) aware of IncludesiOS32 (#9401)
Only happens on internal Jenkins
ref: https://github.com/xamarin/maccore/issues/2284
2020-08-20 14:44:52 -04:00
Rolf Bjarne Kvinge 558af9612a [dotnet] Add support for consuming binding projects. (#9376)
* Port the interdependent-binding-projects test to .NET (it's the simplest
  test project we have with binding projects).
* Add a lot of the shared source code for mtouch/mmp to dotnet-linker, and
  make it compile. Most issues were fixed by adding a few stubbed out classes,
  since there are large chunks of the mtouch/mmp code we're not using yet, so
  stubbing out while things are being implemented works fine.
* Add a step in dotnet-linker for loading the linker output (the linked
  assemblies) into our bundler code.
* Add another step in dotnet-linker to extract native resources from binding
  libraries.
* Augment the build process to take into account the native resources we found
  in any binding libraries.
2020-08-20 08:35:12 +02:00
Rolf Bjarne Kvinge 695ca8d680 [xharness] Don't clone the same project multiple times when reached through different project references.
Problem:

1. interdependent-binding-project references binding-test and bindings-test2.
2. bindings-test2 references bindings-test.

This means bindings-test is reached through 2 projects: both
interdependent-binding-projects and bindings-test2, and previously we'd
process each of these references separately, effectively making two separate
clones of the bindings-test project.

Instead keep track of all referenced projects from the leaf project, and if we
encounter a project we've already cloned, use that directly.
2020-08-18 15:22:24 +02:00
Rolf Bjarne Kvinge 138ebc7288 [xharness] Bump timeout for the .NET tests.
More tests take longer to run!
2020-08-17 19:59:05 +02:00
Rolf Bjarne Kvinge ea30bc9cea [xharness] Make sure MSBUILD_EXE_PATH is not set when executing dotnet.
Something ends up confused, and dotnet hangs.
2020-08-17 11:09:06 +02:00
Přemek Vysoký b1f7bd44d9
[xharness] Do not mark DeviceLoaders as loaded when loading fails (#9367) 2020-08-17 08:27:48 +02:00
Rolf Bjarne Kvinge 9fddbbda58 [xharness] Enhance ResolveAllPaths to understand $(RootTestsDirectory).
This requires passing the root directory around in multiple places, since ResolveAllPaths
doesn't have access to the static class where we define the root directory.

Also call ResolveAllPaths in a few more places to ensure paths everywhere are resolved.
2020-08-14 18:33:29 +02:00
Rolf Bjarne Kvinge 5a5a53e1a9 [xharness] Add the .NET version of interdependent-binding-projects to our lineup 2020-08-14 18:33:28 +02:00
Rolf Bjarne Kvinge b28997fa8a
[xharness] Add support for getting the default AssemblyName for projects. (#9369)
In .NET projects there's a default value for most properties, which means that
there won't necessarily be an AssemblyName property in a csproj. We need to know the
AssemblyName, so calculate it from the csproj filename (which is how .NET does it).

This turned out slighly complicated, because we're pass an XmlDocument around,
and the XmlDocument doesn't know the file from where it was loaded, so we need
to keep that information separately.
2020-08-14 10:32:23 +02:00
Rolf Bjarne Kvinge d36853c8cd
[xharness] Add support for adding PropertyGroups for unknown platform/configuration values in a csproj. Fixes xamarin/maccore@2277. (#9347)
Fixes https://github.com/xamarin/maccore/issues/2277.
2020-08-12 10:35:18 +02:00
Rolf Bjarne Kvinge 200608ce77
[xharness] Look at the exact NUnit version an NUnit project is referencing to figure out how to run it in a makefile. (#9322) 2020-08-10 10:47:45 +02:00
Rolf Bjarne Kvinge f2b8dc3d48
[xharness] Make it possible to include .NET tests by setting a label. (#9298)
This also means that setting 'run-all-tests' enables the .NET tests, which
means they'll now start running on internal Jenkins (as was the intention from
the beginning).
2020-08-07 07:59:14 +02:00
Manuel de la Pena f147fe91cf
[Harness] Fix some typos. (#9303) 2020-08-06 17:37:57 -04:00
Manuel de la Pena 90bf04f608
Remove wrongly added dir. (#9301)
Someone (Manuel) uses an IDE that uses .idea to store user settings and
that got added by accident.
2020-08-06 16:35:26 -04:00
Manuel de la Pena 3348ad244c [Harness] Add support to create tunnels. (#8446)
* [Harness] Add support to create tunnels.

Add support to create tunnels in case the devices cannot connect to
the host. This option is false by default, which means that unless told
otherwise xharness will try to se a tcp connection over the WiFi.

We are not setting it as default because the devices in DDFun will have
access to an unrestricted network. Nevertheless after this PR we will
create a new one with the following logic:

1. Try to use the tcp connection using the network.
2. If devices cannot connect to the host via the network, fall back to
the tcp tunnel.

This change executes a tunnel process per test application, most of the
cases out of the 150 test application we execute, most of them (maybe 98%
but most % are made up) will pass, and just a few of them will fail. The
reason is that there is a daemon in the OS that gets underwater.

Rather than tryingt o find a hacky way to re-use the tunnel, lets KISS
and if we need to hack that, do it as an enhancement.
2020-08-05 18:54:43 -04:00
Manuel de la Pena 5616caa302 [Harness] Move all common code to the shared lib. (#8389)
Moved all the code that can be shared with the CLI to the common
library. We neede some small changes, but mainly due to namespaces and a
forgotten interface implemenation (was already implemented, was missing
in the class).

This was fun :)
2020-08-05 18:52:39 -04:00
Manuel de la Pena d4af4e8ae5 [Harness] Refactor TestProject to be moved to the common lib. (#8388)
Refactor TestProject so that we can move all the tasks to the common
assembly. We had to remove all the references from Harness, that
included the MonoNativeInfo.
2020-08-05 18:52:21 -04:00
Manuel de la Pena e24b1f735b [Harness] Refactor RunDeviceTask. (#8386)
Move most/all of the logic to a helper class so that it later can be
used in the CLI.
2020-08-05 18:52:08 -04:00
Manuel de la Pena 2e33c03b55 [Harness] Generalize the RunTestTask to allow it to be used in the CLI. (#8380)
Move all the logic outside and use it as a Composition pattern, later
this class can be used in the CLI so that we share the logic of building
and tested.
2020-08-05 18:51:54 -04:00
Manuel de la Pena 62c277704a [Harness] Donet doest not need to restore. (#8383)
Removed line due to a bad merge, re-add it.
2020-08-05 18:51:38 -04:00
Manuel de la Pena c56b3f68ae [Harness] Create IBuildToolTask and use it in the RunTestTask. (#8375)
In order to de-couple the RunTestTask from Jenkins, create an interface
to be implemented, which is pass to use as a member (Composition
pattern). In order to do that, do not expose Jenkins as a property of
the interface because it is required just by the base constructor.

Moving the the use an interface meant a lot of small changes that
should have no real effect (the compiler should have caught any possible
issues).
2020-08-05 18:51:26 -04:00
Manuel de la Pena 711afda56e [Harness] Refactor certain class names to simplify the extraction of the RunTestTask. (#8372)
The initial idea of the refactoring looked nice but as soon as we want
to get the RunTestTask out of jenkins, we have a number of naming
issues. Move the tools to not use the *Task postfix so that it is
cleaner and we can later extra the RunTestTask better.


Co-authored-by: Rolf Bjarne Kvinge <rolf@xamarin.com>
Co-authored-by: Přemek Vysoký <premek.vysoky@microsoft.com>
2020-08-05 18:51:14 -04:00
Manuel de la Pena 2a84bb37d1 [Harness] Generalize MSBuildTask and DotnetBuildTask. (#8306)
Move all the logic outside of the Jenkins namespace. Rework a little the
inheritance to make it nicer in the constructors.

Co-authored-by: Rolf Bjarne Kvinge <rolf@xamarin.com>
Co-authored-by: Přemek Vysoký <premek.vysoky@microsoft.com>
2020-08-05 18:49:25 -04:00
Manuel de la Pena 7c739e7ff1 [Harness] Generalize the BuildProjectTask (#8299)
Use composition to generalize the BuildProjectTask to later reuse it in
the CLI.

Co-Authored-By: Rolf Bjarne Kvinge <rolf@xamarin.com>
2020-08-05 18:39:35 -04:00
Manuel de la Pena 7c2650a87f [Harness] Move BuildToolTask to a more general namespace. (#8287)
Move the task and use composition so that we can reuse the code. This
will later allow other projects to use the class without the need of
Jenkins or Harness and just implement the base class.



Co-authored-by: Rolf Bjarne Kvinge <rolf@xamarin.com>
Co-authored-by: Přemek Vysoký <premek.vysoky@microsoft.com>
2020-08-05 18:25:45 -04:00
Manuel de la Pena 55665e8e4d [Harness] Move to create a more general TestTasks class to be reused. (#8286)
Some of the Jenkins test tasks are very useful and do A LOT of stuff. So
we try to generalize the base class, to later be able to share the most
usebul ones in the shared lib.

Co-authored-by: Rolf Bjarne Kvinge <rolf@xamarin.com>
2020-08-05 18:25:24 -04:00
Rolf Bjarne Kvinge 85b50a0347 Merge remote-tracking branch 'origin/main' into HEAD 2020-08-04 10:39:46 +02:00
Rolf Bjarne Kvinge 691e8eac7a
[xharness] Improve parsing of NUnitV2 xml reports to fix an issue with failures in parameterized tests. (#9259)
We weren't properly reporting all failures when there were multiple failures
in parameterized tests, because we'd incorrectly skip too many xml nodes when
we were looking for the next test failure.
2020-08-03 18:51:30 +02:00
Rolf Bjarne Kvinge 7e9a60d690
[xharness] Fix main log parsing by not requiring it to come from a file. (#9258)
Not all types of logs have files, but all types of logs have a reader (or will
have soon due to PR #9257).
2020-08-03 18:51:09 +02:00
Rolf Bjarne Kvinge f7cd7d3cad
[xharness] Implement Log.GetReader for all loggers. (#9257)
This makes it easier to write code that parses logs, since that code won't
have to worry about if a particular log supports GetReader or not.
2020-08-03 18:51:01 +02:00
Rolf Bjarne Kvinge cad850fae7 [tests] Restore projects before building them from the command line. 2020-08-03 11:53:18 +02:00
Rolf Bjarne Kvinge 62719b6f7b [xharness] Use LogFile instead of ResultFile in macOS BCL tests to match the Touch.Client usage. 2020-08-03 11:53:18 +02:00
Rolf Bjarne Kvinge 09edb8558d [xharness] Add support for finding/setting the main Xamarin import among multiple imports.
This is required for the previous commit, where we added an additional import to
a few project files to pass an xml definition to mtouch/mmp.
2020-08-03 11:53:17 +02:00
Rolf Bjarne Kvinge 96615bbd67 [tests] The upstream NUnitLine isn't linker safe, so add an xml file to make sure linking doesn't remove too much.
In particular NUnit uses reflection to get a private method, and the linker removes
the corresponding private method:

1c680b4dc8/src/NUnitFramework/framework/Internal/TestExecutionContext.cs (L552)

So add an xml definition to keep this private method, and modify project files to
pass the xml definition to mtouch and mmp.

Some care needs to be taken to make sure xharness is still able to clone these project
files.
2020-08-03 11:53:17 +02:00
Rolf Bjarne Kvinge 1cc265838a [xharness] Add the Touch.Client projects to our solutions instead of MonoTouch.NUnitLite. 2020-08-03 11:53:17 +02:00
Rolf Bjarne Kvinge e4aaf6a8d6 [xharness] Change how we run macOS unit tests to work with Touch.Client.
This is very similar to how we run iOS unit tests.
2020-08-03 11:53:17 +02:00
Rolf Bjarne Kvinge fcb8446eb5 [tests] Remove dead code related to GuiUnit and the GuiUnit submodule. 2020-08-03 11:53:17 +02:00
Rolf Bjarne Kvinge 349a6b6d5a [xharness] Add support for generating/duplicating projects with a Touch.Client reference.
This also means removing support for generating/duplicating MonoTouch.NUnit references,
since we're not using those anymore.
2020-08-03 11:53:17 +02:00
Rolf Bjarne Kvinge 77771f7893
[xharness] Don't try to parse a build log that doesn't exist. (#9253) 2020-07-31 19:32:33 +02:00
Rolf Bjarne Kvinge 1e6e17cb2d
[xharness] Resolve relative project references using the referencing project's directory. (#9252)
Otherwise it would end up being resolved from the current directory, which is
not dependable.
2020-07-31 16:50:34 +02:00
Rolf Bjarne Kvinge cc06a93976
[xharness] Mark the .NET tests project as a .NET project so that we don't try to call nuget restore on it. (#9251)
* [xharness] Mark the .NET tests project as a .NET project so that we don't try to call nuget restore on it.

* [xharness] Mark the .NET generator project as a .NET project as well.
2020-07-31 16:50:10 +02:00
Rolf Bjarne Kvinge e3cb32c23b
[tests] Switch msbuild-mac to use package references. (#9245)
And don't specify the solution path anymore, because we can restore using just
the csproj just fine now.
2020-07-31 11:20:09 +02:00
Rolf Bjarne Kvinge 43102c09bf
[tests] Migrate the sample tests to use package references. (#9244) 2020-07-31 11:19:57 +02:00
Rolf Bjarne Kvinge 631073dafe
[xharness] Improve restoring NuGets for Xamarin.Mac projects in the makefile by depending on the csproj files in addition to the packages.conf files. (#9242)
Packages are listed in the csproj when we're using package references.

Also only list files in git, otherwise we pick up all the generated project files as well.
2020-07-30 17:00:41 +02:00
Rolf Bjarne Kvinge d304198536
[xharness] Make restoring nugets the default for all test projects. (#9237)
But don't do it for .NET projects, since 'dotnet build' automatically restores.
2020-07-30 16:19:53 +02:00
Rolf Bjarne Kvinge 815de988d3 [xharness] If we're not generating projects in the Target class, the project path equals the template path. 2020-07-27 11:31:19 +02:00
Rolf Bjarne Kvinge b5a1251592 Merge remote-tracking branch 'origin/main' into xharness-a-directory-per-project 2020-07-27 11:20:16 +02:00
Rolf Bjarne Kvinge e0986916e5
[xharness] Fix how .NET projects are ignored. (#9168)
* [xharness] Fix how .NET projects are ignored.

Now they're actually ignored if .NET tests are not included.

* Fix compile error.
2020-07-24 14:56:08 +02:00
Sebastien Pouliot 142ff3127b
[xcode12] Bump for beta 3 (#9162)
* Disable iOS 32bits simulator based tests
2020-07-24 08:52:33 -04:00
Rolf Bjarne Kvinge 96034db9d1 [xharness] Fix finding Info.plist, and add some tests too. 2020-07-24 09:13:33 +02:00
Rolf Bjarne Kvinge 4a2236f7e0 Merge remote-tracking branch 'origin/main' into xharness-a-directory-per-project 2020-07-23 15:37:06 +02:00
Rolf Bjarne Kvinge 1eb0c2cd3b [tests] Info.plists should be inside LogicalName, not Link.
This makes it possible to simplify a bit more code inside xharness as well.
2020-07-23 15:34:58 +02:00
Rolf Bjarne Kvinge 568dc5d32a
[xharness] Backport Touch.Unit fix for command line parsing. (#9165)
Apply https://github.com/spouliot/Touch.Unit/pull/78 to the duplicated file.
2020-07-23 15:32:54 +02:00
Rolf Bjarne Kvinge 14d95df81a
[xharness] Generate makefile targets for non-executable projects. (#9158)
It turns out some Xamarin.Mac projects are library projects (for unit tests),
and we still need to generate makefile targets for those (because we use them
to build Xamarin.Mac tests to run on older macOS bots).
2020-07-23 08:31:45 +02:00
Rolf Bjarne Kvinge 7fab4abf96
[xharness] Allow for null environment variables to mlaunch. (#9140)
It's a valid scenario to set a null environment variable.

This happens when changing InCI to always return true (to test locally what's
done on the bots), in which case we try to forward BUILD_REVISION to mlaunch,
but BUILD_REVISION isn't necessarily set. Not forwarding it to mlaunch should
not cause problems in most tests, so just allow this scenario.
2020-07-22 18:13:17 +02:00
Rolf Bjarne Kvinge bdada6e21b Merge remote-tracking branch 'origin/main' into xharness-a-directory-per-project 2020-07-22 10:36:23 +02:00
Rolf Bjarne Kvinge 554845905a [xharness] Remove a redundant ToArray. 2020-07-22 10:35:36 +02:00
Rolf Bjarne Kvinge e47a995797 [tests] Set the correct mono-native link mode and flavor defines in the csproj itself.
This makes it possible to simplify a lot of C# code.
2020-07-22 10:33:03 +02:00
Rolf Bjarne Kvinge 9cfe57bffa
[xharness] Fix logic to not create makefile targets to run BCL tests. (#9148)
According to the existing code, we're already not supposed to create makefile
targets for BCL tests. However, the code to detect BCL tests wasn't quite
reliable, so we ended up creating makefile targets for some BCL tests.

So always use the same logic to detect BCL tests.

Also remove a lot of dead code to generate makefile code for BCL tests.
2020-07-22 08:28:38 +02:00
Rolf Bjarne Kvinge 35c44e82fc
[xharness] Fix compiler warning. (#9147) 2020-07-22 08:28:08 +02:00
Rolf Bjarne Kvinge cff47214ec [tests] Move bindings-test[-mac].csproj to their own directory. 2020-07-21 17:24:15 +02:00
Rolf Bjarne Kvinge 6d26599997 [xharness] Simplify the MonoNativeInfo class a bit by removing the custom Mac-specific subclass (there's almost no difference anymore). 2020-07-21 17:24:15 +02:00
Rolf Bjarne Kvinge 5fa43d073e [tests] Put the iOS and macOS mono-native templates in their own directory.
This makes it possible to remove a few conditions in the code.
2020-07-21 17:24:15 +02:00
Rolf Bjarne Kvinge f2d9764123 [xharness] Make the BCL project generation generate each project file into its own subdirectory. 2020-07-21 17:24:15 +02:00
Rolf Bjarne Kvinge 52c56933dc [xharness] Make the templates path an input parameter for the BCL templates. 2020-07-21 17:24:15 +02:00
Rolf Bjarne Kvinge ca0885b33e [xharness] Add a TestPlatform value to TestProject, and use it to indicate that a TestProject might be of a specific platform already. 2020-07-21 17:24:15 +02:00
Rolf Bjarne Kvinge 6a59d2b87b [xharness] Don't generate variations for BCL projects using the normal procedure, we generate them differently already.
This makes it possible to remove some dead code.
2020-07-21 17:24:15 +02:00
Rolf Bjarne Kvinge e3fdcf59ca [xharness] Add support for specifying whether variations should be generated for Xamarin.iOS projects. 2020-07-21 17:24:15 +02:00
Rolf Bjarne Kvinge a510af6078 [xharness] Make ProjectFileExtensions.GetInfoPListInclude a bit clearer.
Add a comment to document what's supposed to happen, and simplify the code a little bit.
2020-07-21 17:24:15 +02:00
Rolf Bjarne Kvinge cbe780d734 [xharness] Store attribute in local variable instead of fetching it twice. 2020-07-21 17:24:14 +02:00
Rolf Bjarne Kvinge 1c52a14566 [xharness] Remove a lot of special-casing for the mono-native tests.
It's not needed anymore.
2020-07-21 17:24:14 +02:00
Rolf Bjarne Kvinge 8e6e17ea89 [xharness] Generate projects into a subdirectory for each project.
Because it's cumbersome to keep the build working when the same directory has
multiple project files.
2020-07-21 17:24:14 +02:00
Rolf Bjarne Kvinge ba61b68f11 [xharness] Document the test loading process a little bit. 2020-07-21 17:24:14 +02:00
Rolf Bjarne Kvinge 4a10ba51db
[xharness] Generate BCL projects asynchronously. (#9083)
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).
2020-07-21 17:14:36 +02:00
Rolf Bjarne Kvinge f9fbf56544
[xharness] Disable default inclusion behavior for the introspection .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.
2020-07-21 14:48:52 +02:00
Rolf Bjarne Kvinge 7d47d8742d
[xharness] Don't generate into the same directory/files for macOS Modern 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.
2020-07-21 13:15:14 +02:00
Rolf Bjarne Kvinge 858e44aa4d
[xharness] Only try to parse the build log if we have a build log. (#9130) 2020-07-20 14:32:52 +02:00
Rolf Bjarne Kvinge 121032e8f9
[xharness] Fix BCL project generation for watchOS projects. (#9131)
Reading from a file named as the actual content of the watchOS template doesn't
_quite_ work. Instead just use the content directly.
2020-07-20 14:32:42 +02:00
Rolf Bjarne Kvinge ba7e73b5dd
[xharness] Don't replace existing files, instead add new files, when providing human-readable logs. (#9123)
This makes understanding what's going on much easier.
2020-07-20 10:27:07 +02:00
Rolf Bjarne Kvinge 64bc5ea6eb
[xharness] Don't try to write cleaned xml into the same file as the dirty xml was. (#9122) 2020-07-20 10:20:33 +02:00
Rolf Bjarne Kvinge 4f78e8c51b
[xharness] Improve process killing a bit. (#9120)
* Log what we're doing.
* Wait a bit after sending SIGABRT, to allow for the OS to create any crash
  reports.
2020-07-17 18:24:58 +02:00
Rolf Bjarne Kvinge a4d19dad29
[xharness] Try harder to make lldb quit after trying to get a backtrace. (#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).
2020-07-17 17:34:03 +02:00
Rolf Bjarne Kvinge 3cd9bafbcc
[xharness] Improve code to not throw exceptions in the first place instead of catching and ignoring. (#9118) 2020-07-17 17:33:13 +02:00
Rolf Bjarne Kvinge c394c12c54
[xharness] De-asyncify template expansion. (#9104)
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).
2020-07-17 11:09:09 +02:00
Rolf Bjarne Kvinge 92821b5dec
[xharness] Parse NUnit v2 xml reports correctly. (#9110) 2020-07-17 08:50:00 +02:00
Rolf Bjarne Kvinge 7509c6bfcd
[xharness] Fix finding testable types in test assemblies. Fixes #xamarin/maccore@2267. (#9103)
Apparently a null namespace when using Reflection can be an empty namespace in Cecil.

Fixes https://github.com/xamarin/maccore/issues/2267.
2020-07-16 17:16:25 +02:00
Rolf Bjarne Kvinge 4b0fd5529c
[xharness] Don't group simulators when running in server mode. (#9098)
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.
2020-07-16 08:20:51 +02:00
Rolf Bjarne Kvinge 7beb88089a
[xharness] Use Cecil to inspect assemblies, instead of Reflection. (#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.
2020-07-15 09:01:31 +02:00
Rolf Bjarne Kvinge 64c63279b3
[xharness] Add support for generating a tvOS version of .NET iOS projects. (#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.
2020-07-13 17:12:11 +02: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
Rolf Bjarne Kvinge 2e11f0bf4e [xharness] Don't generate makefile targets for .NET projects.
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.
2020-07-03 11:31:45 +02:00
Rolf Bjarne Kvinge 6f6b8e281b Merge remote-tracking branch 'origin/main' into dotnet-xharness-introspection 2020-07-03 11:12:50 +02:00
Rolf Bjarne Kvinge e4523d8f9d
[xharness] Try to not have log directories with spaces in them. (#8976)
The simulators won't write stdout/stderr to a path with a space.
2020-07-01 08:28:30 +02:00
Rolf Bjarne Kvinge 650e6e134e [xharness] Skip the old simulator variation for introspection/dotnet for now. 2020-06-30 19:01:07 +02:00
Rolf Bjarne Kvinge 76f456cc0f [xharness] Retrieve a .NET project's OutputPath by running MSBuild.
.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.
2020-06-30 19:01:07 +02:00
Rolf Bjarne Kvinge 73881846e2 [xharness] Add a GetDotNetExecutable callback and an MSBuildPath property to [I]ProcessManager. 2020-06-30 19:01:06 +02:00
Rolf Bjarne Kvinge 5d257bfb8f [xharness] Improve project cloning to take into account default inclusion 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.
2020-06-30 19:01:06 +02:00
Rolf Bjarne Kvinge 1b703c5fdd [xharness] Create DotNetBuildTasks when we need to build .NET projects. 2020-06-30 19:01:06 +02:00
Rolf Bjarne Kvinge 55cc695697 [xharness] Disable project generation for .NET projects for now. 2020-06-30 19:01:06 +02:00
Rolf Bjarne Kvinge c42803cfde [xharness] Clearly label .NET projects as such. 2020-06-30 19:00:40 +02:00
Rolf Bjarne Kvinge 989cda8b2d [xharness] Add the dotnet introspection project file to our list of projects, and mark it as a .NET project. 2020-06-30 19:00:40 +02:00
Rolf Bjarne Kvinge 55a9697b66 [xharness] Add support for skipping more test variations. 2020-06-30 18:58:42 +02:00
Rolf Bjarne Kvinge b465739d23
[xharness] Disable diagnostics when killing Xcode processes. (#8961)
We won't get any useful information anyway, because we won't get stack traces.
2020-06-29 10:10:20 +02: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
Rolf Bjarne Kvinge 56a896d371
[xharness] Don't access the simulator tasks if we failed to created them. (#8950)
This fixes this:

    Unexpected exception: System.AggregateException: One or more errors occurred. (One or more errors occurred. (ApplicationName='[...]/xamarin-macios/_ios-build/Library/Frameworks/Xamarin.iOS.framework/Versions/Current/bin/mlaunch', CommandLine='--listsim=/var/folders/43/h027tm1n101cdrq2_b6n9n2m0000gn/T/tmp12c3d415.tmp --output-format=XML', CurrentDirectory='', Native error= Cannot find the specified file)) ---> System.AggregateException: One or more errors occurred. (ApplicationName='[...]/xamarin-macios/_ios-build/Library/Frameworks/Xamarin.iOS.framework/Versions/Current/bin/mlaunch', CommandLine='--listsim=/var/folders/43/h027tm1n101cdrq2_b6n9n2m0000gn/T/tmp12c3d415.tmp --output-format=XML', CurrentDirectory='', Native error= Cannot find the specified file) ---> System.ComponentModel.Win32Exception: ApplicationName='[...]/xamarin-macios/_ios-build/Library/Frameworks/Xamarin.iOS.framework/Versions/Current/bin/mlaunch', CommandLine='--listsim=/var/folders/43/h027tm1n101cdrq2_b6n9n2m0000gn/T/tmp12c3d415.tmp --output-format=XML', CurrentDirectory='', Native error= Cannot find the specified file
      at System.Diagnostics.Process.StartWithCreateProcess (System.Diagnostics.ProcessStartInfo startInfo) [0x0029f] in /Users/builder/jenkins/workspace/build-package-osx-mono/2020-02/external/bockbuild/builds/mono-x64/mcs/class/System/System.Diagnostics/Process.cs:778
      at System.Diagnostics.Process.Start () [0x0003a] in /Users/builder/jenkins/workspace/build-package-osx-mono/2020-02/external/bockbuild/builds/mono-x64/mcs/class/referencesource/System/services/monitoring/system/diagnosticts/Process.cs:2006
      at (wrapper remoting-invoke-with-check) System.Diagnostics.Process.Start()
      at Microsoft.DotNet.XHarness.iOS.Shared.Execution.ProcessManager.RunAsyncInternal (System.Diagnostics.Process process, Microsoft.DotNet.XHarness.iOS.Shared.Logging.ILog log, Microsoft.DotNet.XHarness.iOS.Shared.Logging.ILog stdout, Microsoft.DotNet.XHarness.iOS.Shared.Logging.ILog stderr, System.Nullable`1[T] timeout, System.Collections.Generic.Dictionary`2[TKey,TValue] environmentVariables, System.Nullable`1[T] cancellationToken, System.Nullable`1[T] diagnostics) [0x00469] in [...]/xamarin-macios/tests/xharness/Microsoft.DotNet.XHarness.iOS.Shared/Execution/ProcessManager.cs:185
      at Microsoft.DotNet.XHarness.iOS.Shared.Hardware.SimulatorLoader+<>c__DisplayClass16_0.<LoadDevices>b__0 () [0x00107] in [...]/xamarin-macios/tests/xharness/Microsoft.DotNet.XHarness.iOS.Shared/Hardware/SimulatorLoader.cs:65
      at Microsoft.DotNet.XHarness.iOS.Shared.Hardware.SimulatorLoader.LoadDevices (Microsoft.DotNet.XHarness.iOS.Shared.Logging.ILog log, System.Boolean includeLocked, System.Boolean forceRefresh, System.Boolean listExtraData) [0x00155] in [...]/xamarin-macios/tests/xharness/Microsoft.DotNet.XHarness.iOS.Shared/Hardware/SimulatorLoader.cs:54
      at Microsoft.DotNet.XHarness.iOS.Shared.Hardware.SimulatorLoader.FindOrCreateDevicesAsync (Microsoft.DotNet.XHarness.iOS.Shared.Logging.ILog log, System.String runtime, System.String devicetype, System.Boolean force) [0x0023c] in [...]/xamarin-macios/tests/xharness/Microsoft.DotNet.XHarness.iOS.Shared/Hardware/SimulatorLoader.cs:156
      at Microsoft.DotNet.XHarness.iOS.Shared.Hardware.SimulatorLoader.FindSimulators (Microsoft.DotNet.XHarness.iOS.Shared.TestTarget target, Microsoft.DotNet.XHarness.iOS.Shared.Logging.ILog log, System.Boolean create_if_needed, System.Boolean min_version) [0x00267] in [...]/xamarin-macios/tests/xharness/Microsoft.DotNet.XHarness.iOS.Shared/Hardware/SimulatorLoader.cs:277
      at Xharness.Jenkins.TestTasks.RunSimulatorTask.FindSimulatorAsync () [0x0005a] in [...]/xamarin-macios/tests/xharness/Jenkins/TestTasks/RunSimulatorTask.cs:53
      at Xharness.Jenkins.Jenkins.CreateRunSimulatorTasksAsync () [0x004ee] in [...]/xamarin-macios/tests/xharness/Jenkins/Jenkins.cs:558
       --- End of inner exception stack trace ---
      at System.Threading.Tasks.Task.ThrowIfExceptional (System.Boolean includeTaskCanceledExceptions) [0x00011] in /Users/builder/jenkins/workspace/build-package-osx-mono/2020-02/external/bockbuild/builds/mono-x64/external/corert/src/System.Private.CoreLib/src/System/Threading/Tasks/Task.cs:2027
      at System.Threading.Tasks.Task`1[TResult].GetResultCore (System.Boolean waitCompletionNotification) [0x0002b] in /Users/builder/jenkins/workspace/build-package-osx-mono/2020-02/external/bockbuild/builds/mono-x64/external/corert/src/System.Private.CoreLib/src/System/Threading/Tasks/Future.cs:496
      at System.Threading.Tasks.Task`1[TResult].get_Result () [0x00000] in /Users/builder/jenkins/workspace/build-package-osx-mono/2020-02/external/bockbuild/builds/mono-x64/external/corert/src/System.Private.CoreLib/src/System/Threading/Tasks/Future.cs:466
      at Xharness.Jenkins.Jenkins+<>c__DisplayClass72_0.<PopulateTasksAsync>b__0 (System.Threading.Tasks.Task`1[TResult] v) [0x0001e] in [...]/xamarin-macios/tests/xharness/Jenkins/Jenkins.cs:941
      at System.Threading.Tasks.ContinuationTaskFromResultTask`1[TAntecedentResult].InnerInvoke () [0x00024] in /Users/builder/jenkins/workspace/build-package-osx-mono/2020-02/external/bockbuild/builds/mono-x64/external/corert/src/System.Private.CoreLib/src/System/Threading/Tasks/TaskContinuation.cs:155
      at System.Threading.Tasks.Task.Execute () [0x00000] in /Users/builder/jenkins/workspace/build-package-osx-mono/2020-02/external/bockbuild/builds/mono-x64/external/corert/src/System.Private.CoreLib/src/System/Threading/Tasks/Task.cs:2319
    --- End of stack trace from previous location where exception was thrown ---
2020-06-26 10:27:10 +02:00
Rolf Bjarne Kvinge 79fccc3065
[xharness] Automatically detect and use .NET 5 (#8909)
Automatically detect which .NET version to use based on the global.json reachable from the project directory.

Due to how things are designed, some parts of the code wants the dotnet
executable before the code in question knows the project directory, which
isn't possible anymore. So there's a minor change to pass around a lambda that
can calculate the path to the executable instead of the executable itself.
2020-06-25 08:46:03 +02:00
Manuel de la Pena 8c081605a0
[DevOps] Allow to use vsdrops AND xamarin storage. (#8916)
Use both in those labs that support xamarin-storage so that we have a
backup. To do so, move the parameter to be a bool but keep the rest of
the logic the same.


Co-authored-by: Rolf Bjarne Kvinge <rolf@xamarin.com>
2020-06-24 18:01:51 -04:00
Rolf Bjarne Kvinge ea3aa68426
[xharness] Implement parsing the trx files that .NET produces. (#8919) 2020-06-23 08:54:28 +02:00
Rolf Bjarne Kvinge 36a1ec4fc1
[xharness] Set the working directory to the project directory when building projects. (#8910)
This is particularly important when we have global.json and NuGet.config in
the project directory, because those are looked up starting with the current
directory, so those two need to match.
2020-06-22 10:25:19 +02:00
Manuel de la Pena 34362be245
[Harness] Add an extra index that will use full uris. (#8889)
Vsdrops does not support serving a static html. Therefore we need to use
full uris that will be used to download the logs. To make things less
dangerous, we leave the xamarin-storage report as it was and create a
new one for vsdrops.

This means that:

1. xamarin-storage index.html is left as is.
2. vsdrops_index.html contains full uris to download (the env var will
   have to be set in the step) and js and css are in the header.
3. because we use and env var, jenkins won't generate the
   vsdrops_index.html only device pipelines will.

For this to take effect needs updates in the device pipelines. The
solution is not yet optimal since we need to add some workaround to
rather than make the monitoring person open a text file, we should
display it in the browser.

Co-authored-by: Chris Hamons <chris.hamons@xamarin.com>
2020-06-18 19:51:14 -04:00
Manuel de la Pena 9ddb35720b
[Harness] Add a more general IHarness interface. (#8868)
In order to be able to test the TestSelectro in PR
https://github.com/xamarin/xamarin-macios/pull/8768 we need a more
general interface to mock and ensure that the correct properties are set
by the TestSelector.
2020-06-16 16:04:38 -04:00
Rolf Bjarne Kvinge 24719920dc
[xharness] Make ConsoleLog thread-safe. Fixes #8569. (#8864)
Fixes https://github.com/xamarin/xamarin-macios/issues/8569.
2020-06-16 17:39:06 +02:00
Rolf Bjarne Kvinge 95e42b9266
Rename master to main. (#8851)
* Fix links that point to master to point to main instead.
* Implement support in the sample tester for specifying the default branch for
  each sample repo.
* Fix various text / documentation to say 'main' instead of 'master.'
* Push to 'main' instead of 'master' in xamarin-macios-data.
* Fix xharness to make 'main' the special branch with regards to documentation tests as opposed to 'master'.
* Fix various CI to use 'main' instead of 'master'.
* Bump maccore

    New commits in xamarin/maccore:

    * xamarin/maccore@ed6d146822 Rename 'master' to 'main'. (#2233)

    Diff: 424fa26148..ed6d146822
2020-06-16 15:51:44 +02:00
Rolf Bjarne Kvinge f236e2fc94
[xharness] Don't ignore a failure to restore nugets. (#8852) 2020-06-16 08:07:37 +02:00
Rolf Bjarne Kvinge 8917f2224b
[xharness] Always use nuget to restore nugets, and always use xibuild to run nuget. (#8845) 2020-06-15 09:17:02 +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
Sebastien Pouliot 97d2504d51
[tools] Remove MD5 from tooling (#8769)
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-04 22:14:13 -04:00
Rolf Bjarne Kvinge aec9c93bee
[dotnet] Add tests for our various platforms. (#8708)
* [tests] Add a unit test project to test our net5 support.

* [tests] Fix clearing environment variables when launching processes.

* [tests] Add net5 macOS test app.

* [tests] Add net5 tvOS test app.

* [tests] Add net5 watchOS test app.

* [msbuild] Exclude CreateAppBundleDependsOn from net5 builds as well.

* [msbuild] We're not required to know the signing identity to figure out the app extension bundle name.
2020-05-29 17:58:34 +02:00
Rolf Bjarne Kvinge bebbeb18a3
[msbuild] Improve xharness and makefiles make it easier to run both iOS and Mac MSBuild tests. (#8709)
It even looks like running the Xamarin.Mac MSBuild tests from the command line
has never worked... so fix that as well.
2020-05-29 17:50:46 +02:00
Rolf Bjarne Kvinge 952037b7a3
[tests] Remove Classic code from all tests. (#8707) 2020-05-29 16:43:06 +02:00
Manuel de la Pena da6e6f2800
[Harness] Move logic to create the device tests our of Jenkins.cs (#8699)
Making Jenkins just orchestrate. Later this class will be testable.
2020-05-28 22:32:48 -04:00
Manuel de la Pena d241d8dae1
[Harness] Create a TestServer that will serve the Xharness page. (#8706)
Move all the logic of the server to its own class to later be able to
add tests in Jenkins (make sure that we do run it) and in the server
itself (check that files are server, correct actions are executed etc..)

At this point Jenkins just creates the tests tasks via other objects and
executes in server mode or not depending on the env.
2020-05-28 12:54:45 -04:00
Rolf Bjarne Kvinge 2b2f1d08dc
[tests] Remove Classic code from all tests. (#8702) 2020-05-28 16:35:09 +02:00
Manuel de la Pena 8b69ddb960
[Harness] Remove logic that builds sim tasks. (#8697)
One step closer to make the Jenkins class just know how to spin the
tasks and what tests are selected. This new class, once we can have a
clean Jenkins class will be testeable.
2020-05-28 09:34:27 -04:00
Manuel de la Pena 46b36b4252
[Harness] Remove not needed private var by Jenkins. (#8698) 2020-05-28 07:44:20 -04:00
Manuel de la Pena 0f3435bff1
[Harness] Fix markdown take two. (#8701)
The grouping of the tasks was moved to the html report. This meant that
the markdown was not getting all the correct tasks. Move the grouping of
the tasks out of the hml report and use it with the markdown so that
both reports have the same data.

Also fixes an issue when tests failed and did not appear correctly in
the comment such as in comment: https://github.com/xamarin/xamarin-macios/pull/8698#issuecomment-635006243
2020-05-28 07:43:54 -04:00
Manuel de la Pena 8d433815c4
[Harness] Fix issues in the markdown when reporting failures. (#8696)
The failures are aggregated tasks, we need to get the, use the key as
the name of the test and use the rest of the data from the ITestTask.
The reason is that the ITestTask.Name was modified by Jenkins.cs to
group them.

fixes: https://github.com/xamarin/xamarin-macios/issues/8695
2020-05-27 17:03:06 -04:00
Rolf Bjarne Kvinge af1323f4c5
[xharness] Always capture stdout/stderr from the simulator to actual files. (#8689)
This avoids confusion when tests are run locally using 'make runner' (and
would print the simulator's stdout/stderr to the terminal) versus when run on
bots (and would write the simulator's stdout/stderr to separate files that
would show up in the html report).
2020-05-27 15:31:20 +02:00
Rolf Bjarne Kvinge a3516c33aa
[xharness] Add crash reports to a logs collection we care about. (#8690)
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.
2020-05-27 15:27:32 +02:00
Manuel de la Pena 488bce571e
[Harness] Refactor Hml generation. (#8686)
This is a step towards trying to make the modification of the html
easier for other team members, the are just to small logical changes:

1. Removed the GenerateReportImpl to a HtmlReportWriter.
2. Do not make the HtmlReportWriter call the Marckdown one, the are
independent.

There is room for improvement, since there are some collections
re-calculated. That change will come once we have this out of the way.

At some point, we ought to be able to make changes in the html just be
as hard as they should be (html + css, we are not experts on that).
2020-05-26 22:11:09 -04:00
Manuel de la Pena a512056c95
[Harness] Make sure that the error knowledgebase is used in device runs. (#8682)
The knowledgebase was just added in the simulator case, not in the
device. That meant that the tcp error was not reported.

Also added another possible case of tcp errors to be picked up and be
shown as a known error (device throws a diff error when on airplane
mode).

fixes: https://github.com/xamarin/xamarin-macios/issues/8659
2020-05-26 17:58:44 -04:00
Manuel de la Pena 17e413fa7b
[Harness] Move the logic to reload the simulators outside Jenkins. (#8658)
Following other PRs, try to reduce the work of the Jenkins class to
orchestrate the different classes and move any other logic to classes
with a single concern. Add tests for the new class.
2020-05-25 20:03:04 -04:00
Manuel de la Pena efd7fa6d46
[Harness] Move the resource manager implementation out of Jenkins. (#8660)
Move the resource management out of Jenkins. Add tests to the new class.
2020-05-25 16:10:50 -04:00
Manuel de la Pena 98016a760e
[Harness] Move the periodic command execution logic out of Jenkins. (#8657)
Move the logic out, Jenkins class should just orchestrate all the diff
tasks but should not know how they are executed.
2020-05-25 10:00:57 -04:00
Rolf Bjarne Kvinge d10a387ffa
[tests] Port cecil-tests to new-style csproj. (#8663)
Also switch xharness to build the csproj instead of running the makefile to
build the tests, because that way xharness is able to automatically use the
correct NUnit runner depending on the NUnit version the tests are using.
2020-05-25 14:47:20 +02:00
Rolf Bjarne Kvinge b601c5c62a
[xharness] Make AppBundleInformationParser.ParseFromProject async and make it take an ILog and a IProcessManager. (#8662)
This will be required in a later PR.
2020-05-25 14:47:10 +02:00
Rolf Bjarne Kvinge e73bf6cb29
[xharness] Don't use the MSBuild xml namespace when processing sdk-style projects. (#8647)
* [xharness] Don't use the MSBuild xml namespace when processing sdk-style projects.

The sdk-style projects don't use MSBuild's xml namespace, which means that it
will be added to every node we create if we use it.

* Fix merge conflict resolution failure.
2020-05-25 11:42:41 +02:00
Rolf Bjarne Kvinge eb3c1eeb0f
[xharness] Fix showing unit test failure list and summary when there are many failing tests. (#8649)
We'd check for more than 100 tests in the wrong location, and completely break
out of showing anything at all.
2020-05-25 09:34:01 +02:00
Manuel de la Pena 465ba9b2e7
[Harness] Move the Markdown code out of Jenkins + tests. (#8651)
Move the generation of the markdown out and add tests. Make sure that
the report writes the expected results and specially that it shows the
known issues.
2020-05-21 23:56:30 -04:00
Manuel de la Pena ea514286ba
[Harness] Move the definition of the tasks outside of the jenkins class. (#8635)
Create some enumerables that will state the tests to run, that way, if
new tests need to be added, there will not be a need to edit the
jenkins class.

Add tests to ensure that all the tests are added. That away we will make
sure that tests are not removed by accident.
2020-05-21 12:48:05 -04:00
Manuel de la Pena 406026cd1a
[Harness] When we have a known issue, add it to the markdown. (#8633)
If we have a knonw issue, lets add the message and the link to the
markdown so that the monitoring person does not need to look at the
html page.

fixes: https://github.com/xamarin/xamarin-macios/issues/8625
2020-05-20 21:58:09 -04:00
Manuel de la Pena 37fb9ded52
[Harness] Remove not longer used method. (#8618) 2020-05-19 17:55:05 -04:00
Manuel de la Pena 7d320fb9b6
[Harness] Move GetColor method out of Jekins. (#8616)
Reduce the logic that is not related to the execution of tests out of
jenkins. Add tests.
2020-05-19 15:37:56 -04:00
Manuel de la Pena 02f73a567e
[Harness] Remove methods that are already present in the KnowledgeBase class. (#8619) 2020-05-19 13:57:09 -04:00
Manuel de la Pena 2187eadf05
[Harness] Move the generation of the variations out. (#8611)
Try to make the Jenkins class do a single task. Move the generation of
the variations logic out (which is hard to test atm, but will be doable
in a second round).

Moved some useful methos also out and add tests.
2020-05-19 11:13:31 -04:00
Manuel de la Pena edb4fe8d27
[Harness] Move GitHub to be a VCS interface to simplify testing. (#8579)
Move to be a non static class so that we can later easily test the
TestSelector class.
2020-05-12 16:14:40 -04:00
Manuel de la Pena 52afa11bbd
[Harness] Fix broken tests. (#8551)
Tests are not ran as part of the CI and got borken again. Fix them, will
add them as part of the CI once they land fixed.
2020-05-11 09:52:24 -04:00
Rolf Bjarne Kvinge 1457f8666d
[jenkins] Add support for specifying custom labels using a file. (#8549)
This makes it possible to select what should be done on CI when building a
commit on internal Jenkins (as opposed to when building a pull request, in
which case labels can be set on the pull request).
2020-05-08 15:44:41 +02:00
Manuel de la Pena 0664584f4b
[Harness] Rollback change to use full path. (#8546)
The GetReader from the install log is broken and requires a re-eng.
Rollback to using the fullpath, not as nice, but that way we do not have
exceptions.

We are using issue #8545 to track the actual bug in the logs when we
request a Reader, if the reader cannot be created we should not be
throwing an exception, whats more, that reader should not be null since
otherwise we would not get the install logs.
2020-05-07 20:18:15 -04:00
Manuel de la Pena 531ba21a49
[Harness] Use readers over paths. (#8534)
As issue https://github.com/xamarin/xamarin-macios/issues/8533 states,
not all loggers support the BullPath property, all of them do support
the GetReader one. We move the creation of the failures to use the
readers and reduce the chances of getting an exception.

fixes: https://github.com/xamarin/xamarin-macios/issues/8533
2020-05-06 18:58:10 -04:00
Manuel de la Pena b58bb1b50b
[Harness] Do not use the tunnel bore in the mtouch tests. (#8531)
The change in xamarin/xamarin-macios/@617777ae73ccefdddd5711fe9628243b399492be
forgot to ignore the use of the tunnel in some cases. Is not the root of
the exception, but is the root of the tests failing after that commit.

fixes: https://github.com/xamarin/maccore/issues/2217
2020-05-06 17:34:24 -04:00
Manuel de la Pena 02e09cb655
[Harness] Refactor the selection of the tests out of Jenkins.cs (#8515)
Move the test selection logic out. Tests will land after we refactor the
Github class, which we depend on, to not be static, so that we can test
the different paths.
2020-05-05 15:26:41 -04:00
Manuel de la Pena 16ad7e642d
[Harness] Small refactor to get the knowledge base out of jenkins. (#8502)
* [Harness] Small refactor to get the knowledge base out of jenkins.

Some small changes to make things a little easier to understand:

* Add a new method in case we find known install issues.
* enable nullable, lets go step by step.
* Move logic outside Jenkins.cs
* Add tests! \o/
2020-05-04 15:09:19 -04:00
Manuel de la Pena 617777ae73
[Harness] Add support to create tunnels. (#8446)
* [Harness] Add support to create tunnels.

Add support to create tunnels in case the devices cannot connect to
the host. This option is false by default, which means that unless told
otherwise xharness will try to se a tcp connection over the WiFi.

We are not setting it as default because the devices in DDFun will have
access to an unrestricted network. Nevertheless after this PR we will
create a new one with the following logic:

1. Try to use the tcp connection using the network.
2. If devices cannot connect to the host via the network, fall back to
the tcp tunnel.

This change executes a tunnel process per test application, most of the
cases out of the 150 test application we execute, most of them (maybe 98%
but most % are made up) will pass, and just a few of them will fail. The
reason is that there is a daemon in the OS that gets underwater.

Rather than tryingt o find a hacky way to re-use the tunnel, lets KISS
and if we need to hack that, do it as an enhancement.
2020-05-04 13:21:38 -04:00
Rolf Bjarne Kvinge cb234697f5
[msbuild] Remove the net461 version of the msbuild task assemblies. (#8419)
The netstandard2.0 version has been the default for a few weeks now, and no
problems have been found, so just delete the net461 version.

This speeds up testing a bit, since we won't be testing the net461 version
anymore.
2020-04-20 09:59:22 +02:00
Manuel de la Pena 7a2573a99b
[Harness] Move all common code to the shared lib. (#8389)
Moved all the code that can be shared with the CLI to the common
library. We neede some small changes, but mainly due to namespaces and a
forgotten interface implemenation (was already implemented, was missing
in the class).

This was fun :)
2020-04-17 18:14:55 -04:00
Manuel de la Pena e0b6ff480c
[Harness] Refactor TestProject to be moved to the common lib. (#8388)
Refactor TestProject so that we can move all the tasks to the common
assembly. We had to remove all the references from Harness, that
included the MonoNativeInfo.
2020-04-16 20:20:53 -04:00
Manuel de la Pena a6dcd40c8b
[Harness] Refactor RunDeviceTask. (#8386)
Move most/all of the logic to a helper class so that it later can be
used in the CLI.
2020-04-16 10:25:24 -04:00
Manuel de la Pena 969d5d92ed
[Harness] Generalize the RunTestTask to allow it to be used in the CLI. (#8380)
Move all the logic outside and use it as a Composition pattern, later
this class can be used in the CLI so that we share the logic of building
and tested.
2020-04-14 18:39:58 -04:00
Manuel de la Pena bbffb308e8
[Harness] Donet doest not need to restore. (#8383)
Removed line due to a bad merge, re-add it.
2020-04-14 15:03:12 -04:00
Manuel de la Pena dbc89f01a4
[Harness] Create IBuildToolTask and use it in the RunTestTask. (#8375)
In order to de-couple the RunTestTask from Jenkins, create an interface
to be implemented, which is pass to use as a member (Composition
pattern). In order to do that, do not expose Jenkins as a property of
the interface because it is required just by the base constructor.

Moving the the use an interface meant a lot of small changes that
should have no real effect (the compiler should have caught any possible
issues).
2020-04-14 13:11:55 -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
Manuel de la Pena c150679630
[Harness] Refactor certain class names to simplify the extraction of the RunTestTask. (#8372)
The initial idea of the refactoring looked nice but as soon as we want
to get the RunTestTask out of jenkins, we have a number of naming
issues. Move the tools to not use the *Task postfix so that it is
cleaner and we can later extra the RunTestTask better.


Co-authored-by: Rolf Bjarne Kvinge <rolf@xamarin.com>
Co-authored-by: Přemek Vysoký <premek.vysoky@microsoft.com>
2020-04-14 08:04:35 -04:00
Manuel de la Pena 98d21d742c
[Harness] Ensure that the generator tests are set when we modify the sources. (#8371)
fixes: https://github.com/xamarin/xamarin-macios/issues/8363

Co-authored-by: Rolf Bjarne Kvinge <rolf@xamarin.com>
2020-04-14 07:58:24 -04:00
Manuel de la Pena 5e0131db27
[Harness] Fix HML report for NUnitTestTasks. (#8367)
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-13 13:51:48 -04:00
Rolf Bjarne Kvinge f3ee011797
[xharness] Automatically generate xharness make dependencies. (#8324) 2020-04-13 09:26:55 +02:00
Manuel de la Pena a2f57b38d6
[Harness] Generalize MSBuildTask and DotnetBuildTask. (#8306)
Move all the logic outside of the Jenkins namespace. Rework a little the
inheritance to make it nicer in the constructors.

Co-authored-by: Rolf Bjarne Kvinge <rolf@xamarin.com>
Co-authored-by: Přemek Vysoký <premek.vysoky@microsoft.com>
2020-04-10 16:50:50 -04:00
Manuel de la Pena e668545555
[Harness] Generalize the BuildProjectTask (#8299)
Use composition to generalize the BuildProjectTask to later reuse it in
the CLI.

Co-Authored-By: Rolf Bjarne Kvinge <rolf@xamarin.com>
2020-04-08 20:09:10 -04:00
Manuel de la Pena 5b99859321
[Harness] Move BuildToolTask to a more general namespace. (#8287)
Move the task and use composition so that we can reuse the code. This
will later allow other projects to use the class without the need of
Jenkins or Harness and just implement the base class.



Co-authored-by: Rolf Bjarne Kvinge <rolf@xamarin.com>
Co-authored-by: Přemek Vysoký <premek.vysoky@microsoft.com>
2020-04-08 15:03:33 -04:00
Přemek Vysoký db921689a9
[Harness] Remove launchTimeout parameter from TestReporter, move factories (#8322) 2020-04-08 11:32:47 -04:00
Rolf Bjarne Kvinge 28d97d6b6b
[xharness] Don't overwrite variations. (#8312)
This means different variations of tests won't show up as identical in the
html report.
2020-04-08 16:19:58 +02:00
Rolf Bjarne Kvinge 82f3bacc57
[xharness] .NET projects don't need 'nuget restore', they're always restored automatically. (#8313) 2020-04-08 16:19:52 +02:00
Rolf Bjarne Kvinge da2090c460
[tests] Move mmptest/regression to mmp-regression. (#8314)
dotnet doesn't like projects within projects in the file system, because of
default inclusion behavior, where the top project will want to include the
source files for the nested projects.

There are ways around that, but the easiest is to just make sure there aren't
projects within other project directories.
2020-04-08 16:19:47 +02:00
Rolf Bjarne Kvinge 3d7a38e464
[mtouch/mmp] Use a single SdkVersions.cs in tools/common. (#8318)
No need to have two identical files around.
2020-04-08 16:19:34 +02:00
Rolf Bjarne Kvinge f69ef4f696
Setting an environment variable to null doesn't work in .netcore. (#8316)
There is a difference between mono and .netcore with regards to environment
variables when launching processes.

For the following example:

    process.StartInfo.EnvironmentVariables ["FOO"] = null;

.netcore will launch the process with an empty FOO variable, while mono will
launch the process with no FOO variable set.

So unstead remove the variable from the collection of environment variables
(this works fine even if the collection doesn't contain the variable).

Ref: https://github.com/dotnet/runtime/issues/34446
2020-04-08 16:19:08 +02:00
Manuel de la Pena f891076bd8
[Harness] Move to create a more general TestTasks class to be reused. (#8286)
Some of the Jenkins test tasks are very useful and do A LOT of stuff. So
we try to generalize the base class, to later be able to share the most
usebul ones in the shared lib.

Co-authored-by: Rolf Bjarne Kvinge <rolf@xamarin.com>
2020-04-07 20:20:38 -04:00
Přemek Vysoký 530f2a2bfa
[Harness] Rename device management classes (Devices, Simulators, ILoadAsync) (#8295) 2020-04-06 14:33:27 -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
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
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
Přemek Vysoký a48667b761
[Harness] Remove TextWriter dependency, refactor Logging (#8184) 2020-03-26 09:59:43 -04:00