From 5fd95007fd0638e487741f830f44c6d5f9c8fc11 Mon Sep 17 00:00:00 2001 From: Rolf Bjarne Kvinge Date: Thu, 25 Mar 2021 07:25:05 +0100 Subject: [PATCH] [tests] Adjust BuildingSameSolutionTwice_ShouldNotRunACToolTwice to work on an M1 machine. (#10954) This test verifies that the build log prints: "execution started with arguments: actool --errors --warnings --notices --output-format xml1 --output-partial-info-plist " However, for M1 machines, we don't call actool directly, we go through 'arch' instead, and this line is printed: Tool arch execution started with arguments: -arch arm64e /usr/bin/xcrun actool --errors --warnings --notices --output-format xml1 --output-partial-info-plist ... So adjust the test to cope with both of these behaviors. --- tests/mmptest/src/MMPTest.cs | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/tests/mmptest/src/MMPTest.cs b/tests/mmptest/src/MMPTest.cs index 59de9db1ad..8271b7b691 100644 --- a/tests/mmptest/src/MMPTest.cs +++ b/tests/mmptest/src/MMPTest.cs @@ -688,7 +688,12 @@ namespace Xamarin.MMP.Tests [Test] public void BuildingSameSolutionTwice_ShouldNotRunACToolTwice () { - const string actool = " execution started with arguments: actool --errors --warnings --notices --output-format xml1 --output-partial-info-plist "; + Func executedActool = (line) => { + if (!line.Contains (" execution started with arguments")) + return false; + return line.Contains ("actool --errors --warnings --notices --output-format xml1 --output-partial-info-plist "); + }; + RunMMPTest (tmpDir => { TI.UnifiedTestConfig test = new TI.UnifiedTestConfig (tmpDir) { AssetIcons = true @@ -697,18 +702,15 @@ namespace Xamarin.MMP.Tests string project = TI.GenerateUnifiedExecutableProject (test); var buildResult = TI.BuildProject (project); - var buildOutput = buildResult.BuildOutput; - Assert.True (buildOutput.Contains (actool), $"Initial build should run actool"); + Assert.True (buildResult.BuildOutputLines.Any (executedActool), $"Initial build should run actool"); buildResult = TI.BuildProject (project); - buildOutput = buildResult.BuildOutput; - Assert.False (buildOutput.Contains (actool), $"Second build should not run actool"); + Assert.False (buildResult.BuildOutputLines.Any (executedActool), $"Second build should not run actool"); TI.RunAndAssert ("touch", new [] { Path.Combine (tmpDir, "Assets.xcassets/AppIcon.appiconset/AppIcon-256@2x.png") }, "touch icon"); buildResult = TI.BuildProject (project); - buildOutput = buildResult.BuildOutput; - Assert.True (buildOutput.Contains (actool), $"Build after touching icon must run actool"); + Assert.True (buildResult.BuildOutputLines.Any (executedActool), $"Build after touching icon must run actool"); }); }