Skip to content

Conversation

@pjcollins
Copy link
Member

@pjcollins pjcollins commented Jul 11, 2019

Adds new mac_msbuild_tests, mac_msbuilddevice_tests, and
mac_timezonedevice_tests jobs to azure-pipelines.yaml to run the
msbuild tests against our installers.

Other changes and fixes:

  • Removes the dependency on the generated XABuildPaths.cs file so that
    test assemblies can be built and executed on different environments.

  • Standardizes Android SDK and NDK path and OS information lookup to
    reduce some code duplication and better allow for toolchain path
    overriding.

  • Updates Mono to 6.0.0.313 and .NET Core to 2.1.701 for our macOS
    building and test stages.

  • Introduces a new UsesDevice test category to allow us to filter
    execution of tests which will be skipped or behave differently when
    a device or emulator is attached.

  • Updates clean tests to ignore the FileListAbsolute.txt file now used
    by the clean target on macOS.

  • Updates the ParallelScope attribute for some multi source tests to
    avoid NuGet restore related issues occurring on macOS. This should
    ensure that dynamically generated test case instances don't run in
    parallel with eachother, but still allows for parallel execution
    against other tests or fixtures. I believe that this is not occurring
    on Jenkins because our test NuGet dependencies have been cached for
    quite some time. On Azure Pipelines, we're more often dealing with
    clean machines, and parallel attempts to restore/install into global
    cache paths were occasionally failing as shown below:

    NuGet.targets(121,5): error : Could not find file "/Users/vsts/.local/share/NuGet/v3-cache/1ca707a4d90792ce8e42453d4e350886a0fdaa4d$ps:_api.nuget.org_v3_index.json/nupkg_sqlitepclraw.core.1.1.8.dat"
    NuGet.targets(121,5): error : The file '/Users/vsts/.nuget/packages/xamarin.android.support.compat/28.0.0.1/.nupkg.metadata' already exists.
    NuGet.targets(121,5): error : Could not find file "/Users/vsts/.nuget/packages/xamarin.forms/3.4.0.1008975/2omeck77.h7w"
    
  • Attaches relevant build log file paths to the test result xml rather
    than dumping the full log to the test output. It's a bit painful to
    scroll through diagnostic build output to see which tests failed.
    Build logs can now be viewed directly in the 'attachments' tab of
    each test failure in Azure Pipelines:

image

@pjcollins
Copy link
Member Author

I'm not yet entirely sold on us needing to be able to build the msbuild test assemblies (Xamarin.Android.Build.Tests.dll, Xamarin.Android.Build.Tests.Commercial.dll, and MSBuildDeviceIntegration.dll) against a system installation. I may rework this to instead upload these assemblies during the mac build stage, and download and run them in later stages.

@pjcollins pjcollins force-pushed the installer-msbuild-tests branch from d30d0b2 to 1de52ae Compare July 11, 2019 22:06
@dellis1972
Copy link
Contributor

@pjcollins given my recent experience with azure pipelines, I think uploading the unit test binaries and downloading them for the test phase would make sense. If we have already built them.. might as well use them :)

@pjcollins pjcollins force-pushed the installer-msbuild-tests branch 4 times, most recently from fc9d2b5 to efae816 Compare July 15, 2019 21:07
@pjcollins
Copy link
Member Author

@jonathanpeppers @dellis1972 do we need to build the Xamarin.Android.Build.Tests suite in both Debug and Release and run it twice for full coverage? Or is the project configuration used for each test set on the test level, and independent of the configuration of the build of the actual test assembly? On a quick search I don't see us using /p:Configuration anywhere in the test harness.

@jonathanpeppers
Copy link
Member

jonathanpeppers commented Jul 15, 2019

I don't think the Configuration of the Xamarin.Android.Build.Tests project matters, and we shouldn't need to run it twice.

There is a XABuildPaths.cs file in Xamarin.ProjectTools that has:

using System;
using System.IO;

namespace Xamarin.Android.Build
{
	public static class Paths
	{
		public const string Configuration = "Debug";
		public const string TopDirectory = @"C:\src\xamarin-android";

		public static readonly string PrefixDirectory = Path.Combine (TopDirectory, "bin", Configuration);
		public static readonly string BinDirectory = Path.Combine (PrefixDirectory, "bin");
		public static readonly string XABuildScript = Path.Combine (BinDirectory, "xabuild");
		public static readonly string XABuildExe = Path.Combine (BinDirectory, "xabuild.exe");
		public static readonly string TestOutputDirectory = Path.Combine (TopDirectory, "bin", "TestDebug");
	}
}

I think xaprepare generates this file now, and it will say Debug/Release here depending on the configuration used with make prepare + make all.

@pjcollins pjcollins force-pushed the installer-msbuild-tests branch from efae816 to 89ec082 Compare July 17, 2019 17:15
@pjcollins pjcollins changed the title [tests/ci] Add MSBuild test stage to Azure Pipelines [tests/ci] Add MSBuild test jobs to Azure Pipelines Jul 17, 2019
@pjcollins pjcollins force-pushed the installer-msbuild-tests branch from 89ec082 to 1cbc771 Compare July 17, 2019 18:24
@pjcollins
Copy link
Member Author

I've reworked this to upload and use previously built MSBuild test assemblies. This should now be ready for review and merge once the new stages are green.

@pjcollins pjcollins marked this pull request as ready for review July 17, 2019 18:27
@pjcollins pjcollins requested a review from dellis1972 July 17, 2019 18:27
@pjcollins pjcollins force-pushed the installer-msbuild-tests branch from 1cbc771 to 278adc3 Compare July 17, 2019 18:39
@pjcollins pjcollins force-pushed the installer-msbuild-tests branch from 278adc3 to 187d2af Compare July 17, 2019 23:20
@pjcollins pjcollins requested a review from grendello as a code owner July 17, 2019 23:20
@pjcollins pjcollins force-pushed the installer-msbuild-tests branch 2 times, most recently from fa804e8 to 36de836 Compare July 18, 2019 01:16
@pjcollins pjcollins added the do-not-merge PR should not be merged. label Jul 18, 2019
@pjcollins pjcollins force-pushed the installer-msbuild-tests branch 2 times, most recently from 5a80c29 to 89fe0f3 Compare July 18, 2019 16:40
pjcollins and others added 15 commits July 31, 2019 14:17
This will hopefully address what appear to be temp file related NuGet
restore failures occurring in certain msbuild tests when running on the
Azure Pipeline macOS hosted pools:

    NuGet.targets(114,5): error : Could not find file "/Users/vsts/.nuget/packages/xamarin.forms/3.4.0.1008975/sdac2g7w.wcv"
Allows us to filter execution of tests which will be skipped or behave
differently when a device or emulator is attached.
We're hitting NuGet restore related issues on macOS when running tests
with multiple test case sources in parallel. I believe that this is not
occurring on Jenkins because all NuGet depdencies for tests there have
been cached for quite some time. On Azure Pipelines, we're more often
dealing with clean machines, and parallel attempts to restore/install
into global cache paths are occasionally failing:

    NuGet.targets(121,5): error : Could not find file "/Users/vsts/.local/share/NuGet/v3-cache/1ca707a4d90792ce8e42453d4e350886a0fdaa4d$ps:_api.nuget.org_v3_index.json/nupkg_sqlitepclraw.core.1.1.8.dat"
    NuGet.targets(121,5): error : The file '/Users/vsts/.nuget/packages/xamarin.android.support.compat/28.0.0.1/.nupkg.metadata' already exists.
    NuGet.targets(121,5): error : Could not find file "/Users/vsts/.nuget/packages/xamarin.forms/3.4.0.1008975/2omeck77.h7w"

The fix is to update the `ParallelScope` attribute associated with these
affected tests to ensure that dynamically generated instances don't run
in parallel with eachother. This still allows for parallel execution
against other tests or fixtures.
We're seeing intermittent failures on Jenkins and Azure Pipelines in the
following tests, ensuring that they don't run in parallel will hopefully
resolve this:

    Xamarin.Android.Build.Tests.IncrementalBuildTest.InvalidAndroidResource
    Xamarin.Android.Build.Tests.BuildTest.BuildBasicApplicationAppCompa
    Xamarin.Android.Build.Tests.BuildTest.BuildWithResolveAssembliesFailure
@pjcollins pjcollins force-pushed the installer-msbuild-tests branch from a859dfc to efba667 Compare July 31, 2019 19:36
@pjcollins pjcollins force-pushed the installer-msbuild-tests branch from c78cccf to 91f5c48 Compare August 1, 2019 01:55
@dellis1972
Copy link
Contributor

@pjcollins this seems to be working :) Device tests are running and passing 🏆 :D nice job

@dellis1972
Copy link
Contributor

The Jenkins MacOS failures seem to be the same as all the other PR's

@pjcollins
Copy link
Member Author

@dellis1972 I've noticed we still seem to have a few brittle tests, the following have been failing on Jenkins:

  • Xamarin.Android.Build.Tests.IncrementalBuildTest.InvalidAndroidResource
  • Xamarin.Android.Build.Tests.BuildTest.BuildBasicApplicationAppCompat
  • Xamarin.Android.Build.Tests.BuildTest.BuildWithResolveAssembliesFailure

I saw similar failures on Azure Pipelines but this change to stop running them in parallel seemed to reduce or eliminate the failure rate for those tests on Azure. Unfortunately that change did not fix the Jenkins failures though.

I think we should be good to merge this as is, it doesn't introduce any new failures to Jenkins. We may still have some individual test clean up to do but given the size of this thing I would rather get it in sooner than later and look to clean up any tests which are still misbehaving separately.

@pjcollins pjcollins merged commit 1bb9b02 into dotnet:master Aug 1, 2019
@pjcollins pjcollins deleted the installer-msbuild-tests branch August 1, 2019 18:58
jonpryor pushed a commit that referenced this pull request Aug 9, 2019
Adds new `mac_msbuild_tests`,  `mac_msbuilddevice_tests`, and
`mac_timezonedevice_tests` jobs to azure-pipelines.yaml to run the
msbuild tests against our installers.

Other changes and fixes:

  * Removes the dependency on the generated XABuildPaths.cs file so that
    test assemblies can be built and executed on different environments.

  * Standardizes Android SDK and NDK path and OS information lookup to
    reduce some code duplication and better allow for toolchain path
    overriding.

  * Updates Mono to 6.0.0.313 and .NET Core to 2.1.701 for our macOS
    building and test stages.

  * Introduces a new `UsesDevice` test category to allow us to filter
    execution of tests which will be skipped or behave differently when
    a device or emulator is attached.

  * Updates clean tests to ignore the `FileListAbsolute.txt` file which is
     no longer deleted by the clean target on macOS.

  * Updates the ParallelScope attribute for some multi source tests to
    avoid NuGet restore and intermittent failures occurring on macOS.

  * Attaches relevant build log file paths to the test result xml rather
    than dumping the full log to the test output. It's a bit painful to
    scroll through diagnostic build output to see which tests failed.
    Build logs can now be viewed directly in the 'attachments' tab of
    each test failure in Azure Pipelines:
@github-actions github-actions bot locked and limited conversation to collaborators Jan 29, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants