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

22 Коммитов

Автор SHA1 Сообщение Дата
Rolf Bjarne Kvinge 36af029204
Change all null checking expressions to use 'is' and 'is not'. (#18176)
Change all null checking expressions to use 'is null' and 'is not null'
instead of '== null' and '!= null'.

This was mostly done with sed, so code can probably be improved in many
other ways with manual inspection, but that will come over time.

Also add code to the autoformat script to automatically fix these issues in the future.
2023-05-05 17:52:19 +02:00
Rolf Bjarne Kvinge 7659696c23
[autoformat] Add xharness.csproj. (#16322) 2022-10-13 23:10:08 +02:00
Manuel de la Pena d36d87f11e
[CI] Checkout the head ref rather than the merge or a reset, this should fix issues with the test selector. (#14496) 2022-03-25 11:38:52 -04:00
Rolf Bjarne Kvinge 2972e1b715
Fix some whitespace issues in various files. (#12399)
* Remove BOM
* Add EOL at end of file.
2021-08-11 10:06:46 +02:00
Manuel de la Pena b686ab69c8
[CI][XHarness] Ensure we filter the tests to run. (#11035)
VSTS does not longer have a file with the pat yet it does allow to use
an env variable with the pat provided by the keyvault. Before this
change we have been running all the tests which results in several extra
hours when we do not need to. For example, if nothing was changed in
msbuild, do not run its tests which are 45 mins long.

Changes are:

* provide pat in the env.
* update xharness to use an env var, do not longer read from a file.

fixes: https://github.com/xamarin/xamarin-macios/issues/10923
2021-03-31 07:18:35 -04:00
Přemek Vysoký 0fba63cdc7
[xharness] Remove Microsoft.DotNet.XHarness.iOS.Shared project and use NuGet instead (#9980) 2020-11-13 11:05:10 -05: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
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 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
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
Přemek Vysoký 6209719f51
[Harness] Remove Harness as a dependency (#8203) 2020-03-27 12:41:31 -04:00
Přemek Vysoký a48667b761
[Harness] Remove TextWriter dependency, refactor Logging (#8184) 2020-03-26 09:59:43 -04:00
Manuel de la Pena 597b7d7b0b
[Harness] Refactor process management to be testable. (#8053)
Move all the extension methods to a class. After this refactor, we will
be able to DI the manager in the other classes and assert that the
processes are called with the correct parameters without the need of
launching them.

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

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

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


Co-authored-by: Přemek Vysoký <premek.vysoky@microsoft.com>
2020-03-06 09:11:33 -05:00
Manuel de la Pena 169cecfe93
[Harness] Refactor a little the code for logging to simplify testing. (#8021)
Move to use interfaces, that will let us later add tests that will
verify that all the correct logging is performed. As an example, added a
test for XmlResultParser that ensures that the failures are correctly
generated. The test uses Moq to pass the different paths to be used and
later be able to verify the wirtten xml.
2020-03-03 13:59:44 -05:00
Rolf Bjarne Kvinge 8c4e284ac7
[xharness] Fix finding labels in pull requests. (#6009)
Looks like this regressed in
61bf0db817 (diff-b01110f512ec4a442e37213063a11758R39);
since then no manual labels have been applied to test runs in public jenkins.
2019-05-08 15:04:28 +02:00
Rolf Bjarne Kvinge 0075415c39
[xharness] Add support for GitHub authentication, and use it in Jenkins. (#5380)
This makes it much less probable to hit any rate limits, because authenticated
rate limits are much higher (5000 requests/hour vs 60 requests/hour).
2019-01-11 15:48:16 +01:00
Rolf Bjarne Kvinge 61bf0db817
[tests] Run tests-docs using xharness. (#5372)
Jenkins has a limitation where you can't mark a step a failure, it has to
*fail* to be reported as such.

This means that running multiple tests, and reporting a failure if any of
those tests fail is not possible.

We run into this with the normal test run + the docs tests; where we currently
don't show a red result in the UI if any of those fail.

So incorporate the test-docs step into xharness, so that we only have one
thing to in the Jenkinsfile, which makes it possible for us to fail the test
run step properly.

This also required a few upgrades to xharness to get more info for pull
requests, since the logic to enable the docs tests is a bit more complicated
than anything else we have (if the current branch (or the target branch for a
PR) is 'master' AND xamarin mode is enabled).
2019-01-10 16:43:02 +01:00
Chris Hamons d7c2a45ca9
Add 'NoBindingEmbedding' style binding project support (#5167)
- Existing binding projects embed the native libraries within the assembly as managed resource
- This does not scale well and has performance implications
- This PR creates a new property, NoBindingEmbedding which when true processes the building and consumption of binding projects differently.
- Existing binding projects are not affected, they will continue as is
- I've written a full XM test suite and ported a subset to iOS. Since iOS only supports checked in projects, and I didn't want to make the existing situation worse by adding more, I only wrote tests that could use the existing test projects.
    -When we complete some form of msbuild testing reform, we'll revisit these tests.
- Remove two files in MyiOSFrameworkBinding that are not used (we use copies elsewhere)
- Remove unnecessary sleep and fix broken touch command
- Output failing test log to console instead of test output
    - VSfM does not handle thousands of lines of test failure message well
- Add ability to generate binding projects with LinkWith
2018-12-12 09:55:57 -05:00
Rolf Bjarne Kvinge 0d0a1f59eb [xharness] Don't hit the network to load xml files. (#1415) 2017-01-02 08:58:14 +01:00
Rolf Bjarne Kvinge 45fd1c3bb0 [xharness] Fix listing modified files for pull requests. (#1252)
The previous method of getting the base and head sha from the pull request
doesn't work if the pull request has been rebased.

Example: https://github.com/xamarin/xamarin-macios/pull/1238

Resulted in this [1]:

    Fetching modified files for commit range cf07825667aa444c988c82b7e29cefc5f8ba7bcd..6aa2b9517ac35374dfa4ded41d1e2ff52778da07
    git diff-tree --no-commit-id --name-only -r cf07825667aa444c988c82b7e29cefc5f8ba7bcd..6aa2b9517ac35374dfa4ded41d1e2ff52778da07
    Found 20 modified file(s) in the pull request #1238.
        Makefile
        Versions-ios.plist.in
        Versions-mac.plist.in
        external/llvm
        external/mono
        msbuild/Xamarin.Mac.Tasks.Core/Tasks/MmpTaskBase.cs
        msbuild/Xamarin.Mac.Tasks/Xamarin.Mac.Common.props
        msbuild/Xamarin.Mac.Tasks/Xamarin.Mac.Common.targets
        msbuild/Xamarin.iOS.Tasks.Core/Tasks/MTouchTaskBase.cs
        msbuild/Xamarin.iOS.Tasks.Core/Xamarin.iOS.Common.props
        msbuild/Xamarin.iOS.Tasks.Core/Xamarin.iOS.Common.targets
        src/Makefile
        src/UIKit/UIScreen.cs
        src/appkit.cs
        src/generator-diff.mk
        tests/introspection/ApiTypoTest.cs
        tests/introspection/Mac/MacApiTypoTest.cs
        tests/introspection/Mac/introspection-mac.csproj
        tests/xharness/Harness.cs
        versions-check.csharp

which is listing way too many files.

[1]: https://jenkins.mono-project.com/job/xamarin-macios-pr-builder/2118/Test_Report/Harness.log
2016-11-28 13:44:12 +01:00
Rolf Bjarne Kvinge 15b25359c6 [xharness] Determine additional tests to run based on the modified files in a pull request. (#1166)
Example log output when bumping mono:

> Found 1 modified file(s) in the pull request #1161.
>     external/mono
> Enabled 'mtouch' tests because the modified file 'external/mono' matches prefix 'external/mono'
> Enabled 'mmp' tests because the modified file 'external/mono' matches prefix 'external/mono'
> Enabled 'bcl' tests because the modified file 'external/mono' matches prefix 'external/mono'
> Found 1 label(s) in the pull request #1161: cla-already-signed

Or when changing the static registrar:

> Found 1 modified file(s) in the pull request #1164.
>     tools/common/StaticRegistrar.cs
> Enabled 'mtouch' tests because the modified file 'tools/common/StaticRegistrar.cs' matches prefix 'tools/common'
> Enabled 'mmp' tests because the modified file 'tools/common/StaticRegistrar.cs' matches prefix 'tools/common'
> Found 2 label(s) in the pull request #1164: cla-already-signed, run-mmp-tests
> Enabled 'mmp' tests because the label 'run-mmp-tests' is set.
2016-11-14 10:43:35 +01:00
Rolf Bjarne Kvinge f1420510da [xharness] Add support to configure which tests to run on Jenkins by using labels on pull requests. (#1082) 2016-11-02 16:46:32 +01:00