Imported Upstream version 5.20.0.180

Former-commit-id: ff953ca879339fe1e1211f7220f563e1342e66cb
This commit is contained in:
Xamarin Public Jenkins (auto-signing)
2019-02-04 20:11:37 +00:00
parent 0e2d47d1c8
commit 0510252385
3360 changed files with 83827 additions and 39243 deletions

View File

@@ -12,16 +12,19 @@ KEYFILE = ../msfinal.pub
LIB_MCS_FLAGS = \
/d:MICROSOFT_BUILD_DLL
TEST_MCS_FLAGS = $(LIB_MCS_FLAGS)
TEST_RESOURCE_FILES = \
Test/resources/FunctionalTestReferenceProject.csproj \
Test/resources/FunctionalTestReferenceProject3.csproj \
Test/resources/Microsoft.Build.Test.csproj \
Test/resources/Microsoft.Build.csproj
TEST_MCS_FLAGS = $(LIB_MCS_FLAGS) $(foreach r, $(TEST_RESOURCE_FILES), -resource:$(r),$(r))
TEST_LIB_REFS = $(XBUILD_UTILITIES)
TEST_NUNITLITE_APP_CONFIG_RUNTIME=Test/test-config-file-$(PROFILE)
EXTRA_DISTFILES = \
Microsoft.Build.Internal/ExpressionParser.jay \
Test/FunctionalTestReferenceProject.csproj \
Test/FunctionalTestReferenceProject3.csproj \
Test/Microsoft.Build.Test.csproj \
Test/Microsoft.Build.csproj
$(TEST_RESOURCE_FILES)
EXPR_PARSER = Microsoft.Build.Internal/ExpressionParser

View File

@@ -1,4 +1,5 @@
../../test-helpers/NunitHelpers.cs
../../test-helpers/TestResourceHelper.cs
FunctionalTest.cs
Microsoft.Build.Construction/ProjectItemElementTest.cs
Microsoft.Build.Construction/ProjectRootElementTest.cs

View File

@@ -36,6 +36,8 @@ using Microsoft.Build.Evaluation;
using System.IO;
using System.Globalization;
using MonoTests.Helpers;
namespace MonoTests.Microsoft.Build
{
[TestFixture]
@@ -55,29 +57,27 @@ namespace MonoTests.Microsoft.Build
project.Save (projectFileName);
Assert.AreEqual (projectGuid, GetProjectId (project), "#01");
FileAssert.AreEqual (String.Format ("Test{0}FunctionalTestReferenceProject.csproj",
Path.DirectorySeparatorChar), String.Format ("Test{0}FunctionalTestProject.csproj",
Path.DirectorySeparatorChar), "#02");
FileAssert.AreEqual (TestResourceHelper.GetFullPathOfResource ("Test/resources/FunctionalTestReferenceProject.csproj"),
String.Format ("Test{0}FunctionalTestProject.csproj", Path.DirectorySeparatorChar), "#02");
}
[Test]
public void TestLoadAndSave ()
{
var project = ProjectRootElement.Open (Path.Combine ("Test", "Microsoft.Build.csproj"));
var project = ProjectRootElement.Open (TestResourceHelper.GetFullPathOfResource ("Test/resources/Microsoft.Build.csproj"));
var projectFileName = String.Format ("Test{0}FunctionalTestProject2.csproj",
Path.DirectorySeparatorChar);
project.Save (projectFileName);
Assert.AreEqual (new Guid ("{B2012E7F-8F8D-4908-8045-413F2BD1022D}"), GetProjectId (project),
"#03");
FileAssert.AreEqual (Path.Combine ("Test", "Microsoft.Build.csproj"), projectFileName, "#04");
FileAssert.AreEqual (TestResourceHelper.GetFullPathOfResource ("Test/resources/Microsoft.Build.csproj"), projectFileName, "#04");
}
[Test]
public void TestLoadAndSave3 ()
{
var referenceProject = String.Format (
"Test{0}FunctionalTestReferenceProject3.csproj", Path.DirectorySeparatorChar);
var referenceProject = TestResourceHelper.GetFullPathOfResource ("Test/resources/FunctionalTestReferenceProject3.csproj");
var project = ProjectRootElement.Open (referenceProject);
var projectFileName = String.Format ("Test{0}FunctionalTestProject3.csproj",
Path.DirectorySeparatorChar);

View File

@@ -31,12 +31,8 @@ namespace MonoTests.Microsoft.Build.Construction
// This creator does not fill FullPath...
var root = ProjectRootElement.Create (xml);
// Expected to run from mcs/class/lib/profile/tests
var dir_name = Path.GetDirectoryName (new Uri (GetType ().Assembly.CodeBase).LocalPath);
var namespace_path = Path.Combine (Directory.GetParent (dir_name).Parent.Parent.FullName, "Microsoft.Build");
Assert.IsNull (root.FullPath, "#2");
Assert.AreEqual (namespace_path, root.DirectoryPath, "#3");
Assert.AreEqual (Environment.CurrentDirectory, root.DirectoryPath, "#3");
}
[Test]
@@ -45,10 +41,7 @@ namespace MonoTests.Microsoft.Build.Construction
var root = ProjectRootElement.Create ();
root.FullPath = "test" + Path.DirectorySeparatorChar + "foo.xml";
// Expected to run from mcs/class/lib/profile/tests
var dir_name = Path.GetDirectoryName (new Uri (GetType ().Assembly.CodeBase).LocalPath);
var namespace_path = Path.Combine (Directory.GetParent (dir_name).Parent.Parent.FullName, "Microsoft.Build");
var full = Path.Combine (namespace_path, "test", "foo.xml");
var full = Path.Combine (Environment.CurrentDirectory, "test", "foo.xml");
Assert.AreEqual (full, root.FullPath, "#1");
Assert.AreEqual (Path.GetDirectoryName (full), root.DirectoryPath, "#1");
}

View File

@@ -162,6 +162,7 @@ namespace MonoTests.Microsoft.Build.Execution
public void FirstUsingTaskTakesPrecedenceCommon (bool importFirst, bool buildShouldSucceed)
{
string thisAssembly = new Uri (GetType ().Assembly.CodeBase).LocalPath;
Directory.CreateDirectory ("Test");
string filename = "Test/ProjectTargetInstanceTest.FirstUsingTaskTakesPrecedence.Import.proj";
string imported_xml = string.Format (@"<Project DefaultTargets='Foo' xmlns='http://schemas.microsoft.com/developer/msbuild/2003'>
<UsingTask TaskName='MonoTests.Microsoft.Build.Execution.MyTask' AssemblyFile='{0}' />