[xharness] Add support for the introspection tests. (#151)

* [xharness] Add support for the introspection tests.

* [tests] Add support for mac introspection tests to xharness.
This commit is contained in:
Rolf Bjarne Kvinge 2016-06-08 19:45:31 +02:00
Родитель 06c18bd887
Коммит e450dae136
10 изменённых файлов: 82 добавлений и 21 удалений

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

@ -291,6 +291,10 @@ wrench-mac-binding-project:
cd mac-binding-project && $(MAKE)
cd mac-binding-project && git clean -xfdq
wrench-mac-introspection:
$(Q) $(MAKE) run-mac-introspection
$(Q) $(MAKE) clean-mac-introspection
else
wrench-mac-%:
@echo "Mac tests have been disabled [$@]"

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

@ -26,10 +26,18 @@ using System.Reflection;
using System.Text;
using NUnit.Framework;
#if XAMCORE_2_0
#if MONOMAC
using AppKit;
#else
using UIKit;
#endif
using Foundation;
#else
#if MONOMAC
using MonoMac.AppKit;
#else
using MonoTouch.UIKit;
#endif
using MonoTouch.Foundation;
#endif

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

@ -6,8 +6,8 @@
<ProjectGuid>{FD385098-B3FD-4331-92BF-CC1F918E3334}</ProjectGuid>
<ProjectTypeGuids>{42C0BBD9-55CE-4FC1-8D90-A7348ABAFB23};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
<OutputType>Exe</OutputType>
<RootNamespace>dontlink</RootNamespace>
<AssemblyName>dontlink-mac</AssemblyName>
<RootNamespace>introspection</RootNamespace>
<AssemblyName>introspection</AssemblyName>
<MonoMacResourcePrefix>Resources</MonoMacResourcePrefix>
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion>
</PropertyGroup>
@ -46,6 +46,7 @@
</PropertyGroup>
<ItemGroup>
<Reference Include="System" />
<Reference Include="System.Core" />
<Reference Include="System.Drawing" />
<Reference Include="XamMac" />
</ItemGroup>
@ -112,7 +113,7 @@
</Compile>
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\..\external\guiunit\src\framework\GuiUnit_NET_4_5.csproj">
<ProjectReference Include="..\..\..\external\guiunit\src\framework\GuiUnit_NET_4_5.csproj">
<Project>{D12F0F7B-8DE3-43EC-BA49-41052D065A9B}</Project>
<Name>GuiUnit_NET_4_5</Name>
</ProjectReference>

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

@ -0,0 +1,23 @@
Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio 2012
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "introspection-mac", "introspection-mac.csproj", "{FD385098-B3FD-4331-92BF-CC1F918E3334}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "GuiUnit_NET_4_5", "..\..\..\external\guiunit\src\framework\GuiUnit_NET_4_5.csproj", "{D12F0F7B-8DE3-43EC-BA49-41052D065A9B}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|x86 = Debug|x86
Release|x86 = Release|x86
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{FD385098-B3FD-4331-92BF-CC1F918E3334}.Debug|x86.ActiveCfg = Debug|x86
{FD385098-B3FD-4331-92BF-CC1F918E3334}.Debug|x86.Build.0 = Debug|x86
{FD385098-B3FD-4331-92BF-CC1F918E3334}.Release|x86.ActiveCfg = Release|x86
{FD385098-B3FD-4331-92BF-CC1F918E3334}.Release|x86.Build.0 = Release|x86
{D12F0F7B-8DE3-43EC-BA49-41052D065A9B}.Debug|x86.ActiveCfg = Debug|Any CPU
{D12F0F7B-8DE3-43EC-BA49-41052D065A9B}.Debug|x86.Build.0 = Debug|Any CPU
{D12F0F7B-8DE3-43EC-BA49-41052D065A9B}.Release|x86.ActiveCfg = Release|Any CPU
{D12F0F7B-8DE3-43EC-BA49-41052D065A9B}.Release|x86.Build.0 = Release|Any CPU
EndGlobalSection
EndGlobal

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

@ -164,19 +164,19 @@
<None Include="Info.plist" />
</ItemGroup>
<ItemGroup>
<InterfaceDefinition Include="LaunchScreen.storyboard" />
<InterfaceDefinition Include="LaunchScreen.storyboard" Condition="'$(TargetFrameworkIdentifier)' != 'Xamarin.WatchOS'" />
</ItemGroup>
<ItemGroup>
<ImageAsset Include="Assets.xcassets\AppIcons.appiconset\Contents.json" />
<ImageAsset Include="Assets.xcassets\AppIcons.appiconset\Icon-app-60%403x.png" />
<ImageAsset Include="Assets.xcassets\AppIcons.appiconset\icon-app-57.png" />
<ImageAsset Include="Assets.xcassets\AppIcons.appiconset\icon-app-57%402x.png" />
<ImageAsset Include="Assets.xcassets\AppIcons.appiconset\icon-app-60%402x.png" />
<ImageAsset Include="Assets.xcassets\AppIcons.appiconset\icon-app-72.png" />
<ImageAsset Include="Assets.xcassets\AppIcons.appiconset\icon-app-72%402x.png" />
<ImageAsset Include="Assets.xcassets\AppIcons.appiconset\icon-app-76.png" />
<ImageAsset Include="Assets.xcassets\AppIcons.appiconset\icon-app-76%402x.png" />
<ImageAsset Include="Assets.xcassets\AppIcons.appiconset\icon-app-83.5%402x.png" />
<ImageAsset Condition="'$(TargetFrameworkIdentifier)' != 'Xamarin.WatchOS'" Include="Assets.xcassets\AppIcons.appiconset\Contents.json" />
<ImageAsset Condition="'$(TargetFrameworkIdentifier)' != 'Xamarin.WatchOS'" Include="Assets.xcassets\AppIcons.appiconset\Icon-app-60%403x.png" />
<ImageAsset Condition="'$(TargetFrameworkIdentifier)' != 'Xamarin.WatchOS'" Include="Assets.xcassets\AppIcons.appiconset\icon-app-57.png" />
<ImageAsset Condition="'$(TargetFrameworkIdentifier)' != 'Xamarin.WatchOS'" Include="Assets.xcassets\AppIcons.appiconset\icon-app-57%402x.png" />
<ImageAsset Condition="'$(TargetFrameworkIdentifier)' != 'Xamarin.WatchOS'" Include="Assets.xcassets\AppIcons.appiconset\icon-app-60%402x.png" />
<ImageAsset Condition="'$(TargetFrameworkIdentifier)' != 'Xamarin.WatchOS'" Include="Assets.xcassets\AppIcons.appiconset\icon-app-72.png" />
<ImageAsset Condition="'$(TargetFrameworkIdentifier)' != 'Xamarin.WatchOS'" Include="Assets.xcassets\AppIcons.appiconset\icon-app-72%402x.png" />
<ImageAsset Condition="'$(TargetFrameworkIdentifier)' != 'Xamarin.WatchOS'" Include="Assets.xcassets\AppIcons.appiconset\icon-app-76.png" />
<ImageAsset Condition="'$(TargetFrameworkIdentifier)' != 'Xamarin.WatchOS'" Include="Assets.xcassets\AppIcons.appiconset\icon-app-76%402x.png" />
<ImageAsset Condition="'$(TargetFrameworkIdentifier)' != 'Xamarin.WatchOS'" Include="Assets.xcassets\AppIcons.appiconset\icon-app-83.5%402x.png" />
</ItemGroup>
<ItemGroup>
<BundleResource Include="..\xamarin1.png">

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

@ -134,6 +134,7 @@ namespace xharness
//var bcl_suites = new string[] { "mscorlib", "System", "System.Core", "System.Data", "System.Net.Http", "System.Numerics", "System.Runtime.Serialization", "System.Transactions", "System.Web.Services", "System.Xml", "System.Xml.Linq", "Mono.Security", "System.ComponentModel.DataAnnotations", "System.Json", "System.ServiceModel.Web", "Mono.Data.Sqlite" };
foreach (var p in test_suites)
TestProjects.Add (Path.GetFullPath (Path.Combine (RootDirectory, p + "/" + p + ".csproj")));
TestProjects.Add (Path.GetFullPath (Path.Combine (RootDirectory, "introspection", "Mac", "introspection-mac.csproj")));
foreach (var p in hard_coded_test_suites)
HardCodedTestProjects.Add (Path.GetFullPath (Path.Combine (RootDirectory, p + "/" + p + ".csproj")));
//foreach (var p in fsharp_test_suites)
@ -169,7 +170,7 @@ namespace xharness
TestProjects.Add (Path.GetFullPath (Path.Combine (RootDirectory, p + "/" + p + ".fsproj")));
foreach (var p in bcl_suites)
TestProjects.Add (Path.GetFullPath (Path.Combine (RootDirectory, "bcl-test/" + p + "/" + p + ".csproj")));
TestProjects.Add (Path.GetFullPath (Path.Combine (RootDirectory, "introspection", "iOS", "introspection-ios.csproj")));
BclTests.AddRange (bcl_suites);
WatchOSContainerTemplate = Path.GetFullPath (Path.Combine (RootDirectory, "watchos/Container"));

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

@ -4,6 +4,15 @@ namespace xharness
{
public class MacTarget : Target
{
protected override bool FixProjectReference (string name)
{
switch (name) {
case "GuiUnit_NET_4_5":
return false;
default:
return base.FixProjectReference (name);
}
}
public string SimplifiedName {
get {
return Name.EndsWith ("-mac", StringComparison.Ordinal) ? Name.Substring (0, Name.Length - 4) : Name;

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

@ -112,16 +112,21 @@ namespace xharness
allTargetNames.Add (MakeMacClassicTargetName (target, MacTargetNameType.Build));
allTargetCleanNames.Add (MakeMacClassicTargetName (target, MacTargetNameType.Clean));
// mdtool can only find referenced projects if the referenced
// projects are included in the solution. This requires us to
// build the solution (if it exists), not the project.
var slnPath = Path.ChangeExtension (target.ProjectPath, "sln");
var fileToBuild = File.Exists (slnPath) ? slnPath : target.ProjectPath;
writer.WriteTarget (MakeMacClassicTargetName (target, MacTargetNameType.Build), "$(GUI_UNIT_PATH)/bin/net_4_5/GuiUnit.exe");
writer.WriteLine ("\t$(Q) $(MDTOOL) build {0}", target.ProjectPath);
writer.WriteLine ("\t$(Q) $(MDTOOL) build {0}", fileToBuild);
writer.WriteLine ();
writer.WriteTarget (MakeMacClassicTargetName (target, MacTargetNameType.Clean), "");
writer.WriteLine ("\t$(Q) $(MDTOOL) build -t:clean {0}", target.ProjectPath);
writer.WriteLine ("\t$(Q) $(MDTOOL) build -t:clean {0}", fileToBuild);
writer.WriteLine ();
writer.WriteTarget (MakeMacClassicTargetName (target, MacTargetNameType.Exec), "");
writer.WriteLine ("\t$(Q) ./{0}/bin/x86/Debug/{0}.app/Contents/MacOS/{0}", make_escaped_name);
writer.WriteLine ("\t$(Q) {0}/bin/x86/Debug/{1}.app/Contents/MacOS/{1}", Path.GetDirectoryName (target.ProjectPath), make_escaped_name);
writer.WriteLine ();
writer.WriteTarget (MakeMacClassicTargetName (target, MacTargetNameType.Run), "");
@ -144,7 +149,7 @@ namespace xharness
writer.WriteLine ();
writer.WriteTarget (MakeMacUnifiedTargetName (target, MacTargetNameType.Exec), "");
writer.WriteLine ("\t$(Q) ./{0}/bin/x86/Debug{1}/{0}.app/Contents/MacOS/{0}", make_escaped_name, target.Suffix);
writer.WriteLine ("\t$(Q) {2}/bin/x86/Debug{1}/{0}.app/Contents/MacOS/{0}", make_escaped_name, target.Suffix, Path.GetDirectoryName (target.ProjectPath));
writer.WriteLine ();
writer.WriteTarget (MakeMacUnifiedTargetName (target, MacTargetNameType.Run), "");

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

@ -321,12 +321,15 @@ namespace xharness
return imports [0].Attributes ["Project"].Value;
}
public static void FixProjectReferences (this XmlDocument csproj, string suffix)
public static void FixProjectReferences (this XmlDocument csproj, string suffix, Func<string, bool> fixCallback = null)
{
var nodes = csproj.SelectNodes ("/*/*/*[local-name() = 'ProjectReference']");
if (nodes.Count == 0)
return;
foreach (XmlNode n in nodes) {
var name = n ["Name"].InnerText;
if (fixCallback != null && !fixCallback (name))
continue;
var include = n.Attributes ["Include"];
include.Value = include.Value.Replace (".csproj", suffix + ".csproj");
include.Value = include.Value.Replace (".fsproj", suffix + ".fsproj");

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

@ -61,6 +61,11 @@ namespace xharness
public string LanguageGuid { get { return IsFSharp ? FSharpGuid : CSharpGuid; } }
protected virtual bool FixProjectReference (string name)
{
return true;
}
protected virtual void ProcessProject ()
{
if (SupportsBitcode) {
@ -84,7 +89,7 @@ namespace xharness
foreach (var k in newProperties.Keys)
inputProject.SetTopLevelPropertyGroupValue (k, newProperties[k]);
inputProject.FixProjectReferences (Suffix);
inputProject.FixProjectReferences (Suffix, FixProjectReference);
inputProject.SetAssemblyReference ("OpenTK", "OpenTK-1.0");
inputProject.SetProjectTypeGuids (IsBindingProject ? BindingsProjectTypeGuids : ProjectTypeGuids);
inputProject.SetImport ("$(MSBuildExtensionsPath)\\Xamarin\\" + (IsBindingProject ? BindingsImports : Imports));
@ -142,6 +147,8 @@ namespace xharness
{
targetDirectory = Path.GetDirectoryName (TemplateProjectPath);
Name = Path.GetFileName (targetDirectory);
if (string.Equals (Name, "ios", StringComparison.OrdinalIgnoreCase) || string.Equals (Name, "mac", StringComparison.OrdinalIgnoreCase))
Name = Path.GetFileName (Path.GetDirectoryName (targetDirectory));
ProjectPath = Path.Combine (targetDirectory, Path.GetFileNameWithoutExtension (TemplateProjectPath) + ProjectFileSuffix + "." + ProjectFileExtension);