[macos] Mmp should quote paths when passing arguments to clang. Fixes #56850 (#2140)

* [macos] Mmp should quote paths when passing arguments to clang.  Fixes #56850

* Use the merged Quote from stringutils

* Fix driver also

* Fix tests
This commit is contained in:
Timothy Risi 2017-06-15 01:15:59 -08:00 коммит произвёл Rolf Bjarne Kvinge
Родитель 9accdb3888
Коммит 43f5679323
6 изменённых файлов: 39 добавлений и 4 удалений

Просмотреть файл

@ -7,6 +7,7 @@ using System.Text;
using System.Text.RegularExpressions; using System.Text.RegularExpressions;
using NUnit.Framework; using NUnit.Framework;
using System.Reflection; using System.Reflection;
using Xamarin.Utils;
namespace Xamarin.MMP.Tests namespace Xamarin.MMP.Tests
{ {
@ -132,7 +133,7 @@ namespace Xamarin.MMP.Tests
} else } else
buildArgs.Append (" build "); buildArgs.Append (" build ");
buildArgs.Append (csprojTarget); buildArgs.Append (StringUtils.Quote (csprojTarget));
Func <string> getBuildProjectErrorInfo = () => { Func <string> getBuildProjectErrorInfo = () => {
string csprojText = "\n\n\n\tCSProj: \n" + File.ReadAllText (csprojTarget); string csprojText = "\n\n\n\tCSProj: \n" + File.ReadAllText (csprojTarget);

Просмотреть файл

@ -76,6 +76,9 @@
<Compile Include="..\mtouch\Cache.cs"> <Compile Include="..\mtouch\Cache.cs">
<Link>Cache.cs</Link> <Link>Cache.cs</Link>
</Compile> </Compile>
<Compile Include="..\..\tools\common\StringUtils.cs">
<Link>StringUtils.cs</Link>
</Compile>
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<None Include="Info.plist" /> <None Include="Info.plist" />

Просмотреть файл

@ -12,9 +12,9 @@ namespace Xamarin.MMP.Tests
[TestFixture] [TestFixture]
public partial class MMPTests public partial class MMPTests
{ {
public static void RunMMPTest (Action <string> test) public static void RunMMPTest (Action <string> test, string directoryName = null)
{ {
test (Cache.CreateTemporaryDirectory ()); test (Cache.CreateTemporaryDirectory (directoryName));
} }
// TODO - We have multiple tests using this. It doesn't take that long, but is it worth caching? // TODO - We have multiple tests using this. It doesn't take that long, but is it worth caching?
@ -92,6 +92,31 @@ namespace Xamarin.MMP.Tests
}); });
} }
[Test]
public void Unified_Static_Registrar_With_SpaceTest ()
{
if (!PlatformHelpers.CheckSystemVersion (10, 11))
return;
RunMMPTest (tmpDir => {
// First in 64-bit
TI.UnifiedTestConfig test = new TI.UnifiedTestConfig (tmpDir) { CSProjConfig = "<MonoBundlingExtraArgs>--registrar=static</MonoBundlingExtraArgs><XamMacArch>x86_64</XamMacArch>" };
// Mobile
TI.TestUnifiedExecutable (test);
// XM45
test.XM45 = true;
TI.TestUnifiedExecutable (test);
// Now 32-bit
test.CSProjConfig = "<MonoBundlingExtraArgs>--registrar=static</MonoBundlingExtraArgs><XamMacArch>i386</XamMacArch>";
// Mobile
TI.TestUnifiedExecutable (test);
// XM45
test.XM45 = true;
TI.TestUnifiedExecutable (test);
}, "test withSpace");
}
[Test] [Test]
public void XM_45_NotAddingIncorrectDependencies_LicenseTest () public void XM_45_NotAddingIncorrectDependencies_LicenseTest ()
{ {

Просмотреть файл

@ -79,6 +79,9 @@
</Compile> </Compile>
<Compile Include="src\RoslynSmokeTests.cs" /> <Compile Include="src\RoslynSmokeTests.cs" />
<Compile Include="src\RuntimeTests.cs" /> <Compile Include="src\RuntimeTests.cs" />
<Compile Include="..\..\tools\common\StringUtils.cs">
<Link>StringUtils.cs</Link>
</Compile>
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<ProjectReference Include="..\..\external\guiunit\src\framework\GuiUnit_NET_4_5.csproj"> <ProjectReference Include="..\..\external\guiunit\src\framework\GuiUnit_NET_4_5.csproj">

Просмотреть файл

@ -1051,6 +1051,9 @@
<Link>ProjectTestHelpers.cs</Link> <Link>ProjectTestHelpers.cs</Link>
</Compile> </Compile>
<Compile Include="Unified45.cs" /> <Compile Include="Unified45.cs" />
<Compile Include="..\..\tools\common\StringUtils.cs">
<Link>StringUtils.cs</Link>
</Compile>
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<None Include="Info.plist" /> <None Include="Info.plist" />

Просмотреть файл

@ -1340,7 +1340,7 @@ namespace Xamarin.Bundler {
args.Append ("-liconv -x objective-c++ "); args.Append ("-liconv -x objective-c++ ");
args.Append ("-I").Append (StringUtils.Quote (Path.Combine (GetXamMacPrefix (), "include"))).Append (' '); args.Append ("-I").Append (StringUtils.Quote (Path.Combine (GetXamMacPrefix (), "include"))).Append (' ');
if (registrarPath != null) if (registrarPath != null)
args.Append (registrarPath).Append (' '); args.Append (StringUtils.Quote (registrarPath)).Append (' ');
args.Append ("-fno-caret-diagnostics -fno-diagnostics-fixit-info "); args.Append ("-fno-caret-diagnostics -fno-diagnostics-fixit-info ");
if (link_flags != null) if (link_flags != null)
args.Append (link_flags + " "); args.Append (link_flags + " ");