Skip to content

Commit

Permalink
[xharness] Add support for getting the default AssemblyName for proje…
Browse files Browse the repository at this point in the history
…cts. (#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.
  • Loading branch information
rolfbjarne authored Aug 14, 2020
1 parent 33ecd58 commit b28997f
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 1 deletion.
Original file line number Diff line number Diff line change
@@ -1,8 +1,17 @@
using System.IO;
using System.Runtime.CompilerServices;
using System.Xml;

namespace Microsoft.DotNet.XHarness.iOS.Shared.Utilities {
public static class PListExtensions {
static ConditionalWeakTable<XmlDocument, string> doc_to_filename = new ConditionalWeakTable<XmlDocument, string> ();

public static string GetFilename (this XmlDocument doc)
{
doc_to_filename.TryGetValue (doc, out var rv);
return rv;
}

public static void LoadWithoutNetworkAccess (this XmlDocument doc, string filename)
{
using (var fs = new FileStream (filename, FileMode.Open, FileAccess.Read)) {
Expand All @@ -14,6 +23,7 @@ public static void LoadWithoutNetworkAccess (this XmlDocument doc, string filena
doc.Load (reader);
}
}
doc_to_filename.Add (doc, filename);
}

public static void LoadXmlWithoutNetworkAccess (this XmlDocument doc, string xml)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -246,7 +246,10 @@ public static void SetAssemblyName (this XmlDocument csproj, string value)

public static string GetAssemblyName (this XmlDocument csproj)
{
return csproj.SelectSingleNode ("/*/*/*[local-name() = 'AssemblyName']").InnerText;
var assemblyNameNode = csproj.SelectSingleNode ("/*/*/*[local-name() = 'AssemblyName']");
if (assemblyNameNode != null)
return assemblyNameNode.InnerText;
return Path.GetFileNameWithoutExtension (csproj.GetFilename ());
}

public static void SetPlatformAssembly (this XmlDocument csproj, string value)
Expand Down

8 comments on commit b28997f

@xamarin-release-manager
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🔥 Pipeline scripts tests failed on VSTS: device tests iOS (DDFun) 🔥

The tests of the scripts used in the pepeline failed. The build was cancelled.

Pipeline on Agent

@xamarin-release-manager
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🔥 Tests failed catastrophically on VSTS: device tests iOS (DDFun) 🔥

Failed provisioning profiles.

Pipeline on Agent

@xamarin-release-manager
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🔥 Pipeline scripts tests failed on VSTS: device tests tvOS (DDFun) 🔥

The tests of the scripts used in the pepeline failed. The build was cancelled.

Pipeline on Agent

@xamarin-release-manager
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🔥 Tests failed catastrophically on VSTS: device tests tvOS (DDFun) 🔥

Failed provisioning profiles.

Pipeline on Agent

@xamarin-release-manager
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Jenkins job (on internal Jenkins) succeeded

Provisioning succeeded
Build succeeded
✅ Packages built successfully

View packages

API Diff (from stable)
API Diff (from PR only) (no change)
Generator Diff (no change)
Test run succeeded

@xamarin-release-manager
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

❌ Device tests failed on VSTS: device tests tvOS (Cambridge) ❌

Device tests failed on VSTS: device tests tvOS (Cambridge).

Test results

16 tests failed, 134 tests passed.

Failed tests

  • monotouch-test/tvOS - device/Debug: Failed
  • monotouch-test/tvOS - device/AssemblyBuildTarget: dylib (debug): Failed
  • monotouch-test/tvOS - device/AssemblyBuildTarget: SDK framework (debug): Failed
  • monotouch-test/tvOS - device/AssemblyBuildTarget: dylib (debug, profiling): Failed
  • monotouch-test/tvOS - device/AssemblyBuildTarget: SDK framework (debug, profiling): Failed
  • monotouch-test/tvOS - device/Release: Failed
  • monotouch-test/tvOS - device/AssemblyBuildTarget: SDK framework (release): Failed
  • monotouch-test/tvOS - device/Debug (dynamic registrar): Failed
  • monotouch-test/tvOS - device/Release (all optimizations): Failed
  • monotouch-test/tvOS - device/Debug (all optimizations): Failed
  • monotouch-test/tvOS - device/Debug: SGenConc: Failed
  • monotouch-test/tvOS - device/Debug (interpreter): Failed
  • monotouch-test/tvOS - device/Debug (interpreter -mscorlib): Failed
  • monotouch-test/tvOS - device/Release (interpreter -mscorlib): Failed
  • dont link/tvOS - device/AssemblyBuildTarget: SDK framework (release): Crashed
  • [NUnit] Mono BCL tests group 2/tvOS - device/AssemblyBuildTarget: SDK framework (debug, profiling): Failed

Pipeline on Agent XI-A-Batman

@xamarin-release-manager
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

❌ Device tests failed on VSTS: device tests iOS (Cambridge) ❌

Device tests failed on VSTS: device tests iOS (Cambridge).

Test results

7 tests failed, 143 tests passed.

Failed tests

  • [NUnit] Mono BCL tests group 1/iOS Unified 64-bits - device/Debug: Crashed
  • monotouch-test/iOS Unified 64-bits - device/AssemblyBuildTarget: dylib (debug): HarnessException (Harness exception for 'monotouch-test': System.ArgumentException: '.', hexadecimal value 0x00, is an invalid character.
    at System.Xml.XmlEncodedRawTextWriter.InvalidXmlChar (System.Int32 ch, System.Char* pDst, System.Boolean entitize) [0x00026] in /Users/builder/jenkins/workspace/build-package-osx-mono/2020-02/external/bockbuild/builds/mono-x64/mcs/class/referencesource/System.Xml/System/Xml/Core/XmlEncodedRawTextWriter.cs:1420
    at System.Xml.XmlEncodedRawTextWriter.WriteCDataSection (System.String text) [0x00251] in /Users/builder/jenkins/workspace/build-package-osx-mono/2020-02/external/bockbuild/builds/mono-x64/mcs/class/referencesource/System.Xml/System/Xml/Core/XmlEncodedRawTextWriter.cs:1370
    at System.Xml.XmlEncodedRawTextWriter.WriteCData (System.String text) [0x0012a] in /Users/builder/jenkins/workspace/build-package-osx-mono/2020-02/external/bockbuild/builds/mono-x64/mcs/class/referencesource/System.Xml/System/Xml/Core/XmlEncodedRawTextWriter.cs:470
    at System.Xml.XmlEncodedRawTextWriterIndent.WriteCData (System.String text) [0x00007] in /Users/builder/jenkins/workspace/build-package-osx-mono/2020-02/external/bockbuild/builds/mono-x64/mcs/class/referencesource/System.Xml/System/Xml/Core/XmlEncodedRawTextWriter.cs:1750
    at System.Xml.XmlWellFormedWriter.WriteCData (System.String text) [0x00029] in /Users/builder/jenkins/workspace/build-package-osx-mono/2020-02/external/bockbuild/builds/mono-x64/mcs/class/referencesource/System.Xml/System/Xml/Core/XmlWellFormedWriter.cs:771
    at Microsoft.DotNet.XHarness.iOS.Shared.XmlResultParser.WriteFailure (System.Xml.XmlWriter writer, System.String message, System.IO.StreamReader stderr) [0x0003d] in /Users/xamarinqa/agent/_work/17/s/xamarin-macios/tests/xharness/Microsoft.DotNet.XHarness.iOS.Shared/XmlResultParser.cs:843
    at Microsoft.DotNet.XHarness.iOS.Shared.XmlResultParser.GenerateNUnitV3Failure (System.Xml.XmlWriter writer, System.String title, System.String message, System.IO.StreamReader stderr) [0x00319] in /Users/xamarinqa/agent/_work/17/s/xamarin-macios/tests/xharness/Microsoft.DotNet.XHarness.iOS.Shared/XmlResultParser.cs:894
    at Microsoft.DotNet.XHarness.iOS.Shared.XmlResultParser.GenerateFailureXml (System.String destination, System.String title, System.String message, System.IO.StreamReader stderrReader, Microsoft.DotNet.XHarness.iOS.Shared.XmlResultJargon jargon) [0x0004f] in /Users/xamarinqa/agent/_work/17/s/xamarin-macios/tests/xharness/Microsoft.DotNet.XHarness.iOS.Shared/XmlResultParser.cs:949
    at Microsoft.DotNet.XHarness.iOS.Shared.XmlResultParser.GenerateFailure (Microsoft.DotNet.XHarness.iOS.Shared.Logging.ILogs logs, System.String source, System.String appName, System.String variation, System.String title, System.String message, System.IO.StreamReader stderr, Microsoft.DotNet.XHarness.iOS.Shared.XmlResultJargon jargon) [0x000a1] in /Users/xamarinqa/agent/_work/17/s/xamarin-macios/tests/xharness/Microsoft.DotNet.XHarness.iOS.Shared/XmlResultParser.cs:967
    at Microsoft.DotNet.XHarness.iOS.Shared.TestReporter.GenerateXmlFailures (System.String failureMessage, System.Boolean crashed, System.String crashReason) [0x0031b] in /Users/xamarinqa/agent/_work/17/s/xamarin-macios/tests/xharness/Microsoft.DotNet.XHarness.iOS.Shared/TestReporter.cs:432
    at Microsoft.DotNet.XHarness.iOS.Shared.TestReporter.ParseResult () [0x006c3] in /Users/xamarinqa/agent/_work/17/s/xamarin-macios/tests/xharness/Microsoft.DotNet.XHarness.iOS.Shared/TestReporter.cs:519
    at Xharness.AppRunner.RunAsync () [0x01528] in /Users/xamarinqa/agent/_work/17/s/xamarin-macios/tests/xharness/AppRunner.cs:429
    at Xharness.TestTasks.RunDevice.RunTestAsync () [0x00a8f] in /Users/xamarinqa/agent/_work/17/s/xamarin-macios/tests/xharness/TestTasks/RunDevice.cs:162
    at Xharness.TestTasks.RunDevice.RunTestAsync () [0x0123e] in /Users/xamarinqa/agent/_work/17/s/xamarin-macios/tests/xharness/TestTasks/RunDevice.cs:228
    at Xharness.TestTasks.RunTest.ExecuteAsync () [0x001b9] in /Users/xamarinqa/agent/_work/17/s/xamarin-macios/tests/xharness/TestTasks/RunTest.cs:108
    at Microsoft.DotNet.XHarness.iOS.Shared.Tasks.TestTasks.RunInternalAsync () [0x00226] in /Users/xamarinqa/agent/_work/17/s/xamarin-macios/tests/xharness/Microsoft.DotNet.XHarness.iOS.Shared/Tasks/TestTask.cs:283 )
  • framework-test/iOS Unified 64-bits - device/AssemblyBuildTarget: SDK framework (debug): Failed (Install failed, exit code: 137.)
  • [NUnit] Mono BCL tests group 2/iOS Unified 64-bits - device/AssemblyBuildTarget: dylib (debug, profiling): Failed (Install failed, exit code: 137.)
  • mscorlib Part 1/iOS Unified 64-bits - device/Release: Failed (Install failed, exit code: 137.)
  • mscorlib Part 1/iOS Unified 64-bits - device/Debug: SGenConc: BuildFailure
  • mscorlib Part 2/iOS Unified 64-bits - device/AssemblyBuildTarget: SDK framework (debug, profiling): Failed (Install failed, exit code: 137.)

Pipeline on Agent XI-IRON-MAN

@xamarin-release-manager
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

❌ Device tests failed on VSTS: device tests iOS32b (Cambridge) ❌

Device tests failed on VSTS: device tests iOS32b (Cambridge).

Test results

17 tests failed, 144 tests passed.

Failed tests

  • monotouch-test/iOS Unified 32-bits - device/Debug: Failed
  • monotouch-test/iOS Unified 32-bits - device/AssemblyBuildTarget: dylib (debug): Failed
  • monotouch-test/iOS Unified 32-bits - device/AssemblyBuildTarget: SDK framework (debug): Failed
  • monotouch-test/iOS Unified 32-bits - device/AssemblyBuildTarget: dylib (debug, profiling): Failed
  • monotouch-test/iOS Unified 32-bits - device/AssemblyBuildTarget: SDK framework (debug, profiling): Failed
  • monotouch-test/iOS Unified 32-bits - device/Release: Failed
  • monotouch-test/iOS Unified 32-bits - device/Release: UseThumb: Failed
  • monotouch-test/iOS Unified 32-bits - device/AssemblyBuildTarget: SDK framework (release): Failed
  • monotouch-test/iOS Unified 32-bits - device/Release (all optimizations): Failed
  • monotouch-test/iOS Unified 32-bits - device/Debug (all optimizations): Failed
  • monotouch-test/iOS Unified 32-bits - device/Debug: SGenConc: Failed
  • mscorlib Part 1/iOS Unified 32-bits - device/Debug: TimedOut
  • mscorlib Part 1/iOS Unified 32-bits - device/AssemblyBuildTarget: SDK framework (debug, profiling): TimedOut
  • mscorlib Part 1/iOS Unified 32-bits - device/Release: BuildFailure Known issue: Undefined symbol ___multi3 on Release Mode.
  • mscorlib Part 1/iOS Unified 32-bits - device/Release: UseThumb: BuildFailure Known issue: Undefined symbol ___multi3 on Release Mode.
  • mscorlib Part 1/iOS Unified 32-bits - device/AssemblyBuildTarget: SDK framework (release): BuildFailure Known issue: Undefined symbol ___multi3 on Release Mode.
  • [NUnit] Mono BCL tests group 2/iOS Unified 32-bits - device/Release: UseThumb: TimedOut

Pipeline on Agent XI-CAPTAIN-MARVEL

Please sign in to comment.