// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
using System;
+using System.IO;
using Microsoft.Build.BuildEngine;
using NUnit.Framework;
</Project>
";
+ if (Path.DirectorySeparatorChar == '\\') {
+ documentString = documentString.Replace ("/home", "c:/home");
+ documentString = documentString.Replace ("/tmp", "c:/tmp");
+ }
+
var engine = new Engine (Consts.BinPath);
var project = engine.CreateNewProject ();
project.LoadXml (documentString);
[TestFixture]
public class TargetTest {
+ static bool isMono = Type.GetType ("Mono.Runtime", false) != null;
Engine engine;
Project project;
bool Build (string projectXml, ILogger logger)
{
- if (Environment.OSVersion.Platform == PlatformID.Win32NT) {
+ if (!isMono) {
var reader = new StringReader (projectXml);
var xml = XmlReader.Create (reader);
- return BuildOnWindows (xml, logger);
+ return BuildOnDotNet (xml, logger);
} else {
- return BuildOnLinux (projectXml, logger);
+ return BuildOnMono (projectXml, logger);
}
}
- bool BuildOnWindows (XmlReader reader, ILogger logger)
+ bool BuildOnDotNet (XmlReader reader, ILogger logger)
{
var type = Type.GetType ("Microsoft.Build.Evaluation.ProjectCollection, Microsoft.Build, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a");
return ret;
}
- bool BuildOnLinux (string projectXml, ILogger logger)
+ bool BuildOnMono (string projectXml, ILogger logger)
{
var engine = new Engine (Consts.BinPath);
var project = engine.CreateNewProject ();
}
[Test]
+ [SetCulture ("en-us")]
public void AllowedFrameworkMembers ()
{
string documentString = @"
}
[Test]
+ [SetCulture ("en-us")]
public void MSBuildPropertyFunctions ()
{
string documentString = @"
Assert.AreEqual(files.Length, include.Count, id + "2");
for (int i = 0; i < files.Length; i++) {
- Assert.AreEqual (files [i], include [i].FinalItemSpec, id + "3, file #" + i);
+ Assert.AreEqual (files [i], include [i].FinalItemSpec.Replace ("\\", "/"), id + "3, file #" + i);
Assert.IsTrue (include[i].HasMetadata ("TargetPath"), id + "4, file #" + i + ", TargetPath metadata missing");
Assert.AreEqual (assignedFiles [i], include[i].GetMetadata("TargetPath"), id + "5, file #" + i);
Assert.IsTrue (include [i].HasMetadata ("Child"), id + "6, file #" + i + ", Child metadata missing");
- Assert.AreEqual ("C" + files [i], include [i].GetMetadata ("Child"), id + "7, file #" + i + ", Child metadata value incorrect");
+ Assert.AreEqual ("C" + files [i], include [i].GetMetadata ("Child").Replace ("\\", "/"), id + "7, file #" + i + ", Child metadata value incorrect");
}
}
Assert.Fail ("Build failed");
}
Assert.IsTrue (File.Exists (target_file), "A2");
- Assert.AreEqual (FileAttributes.Normal, File.GetAttributes (target_file), "A3");
+ if (Environment.OSVersion.Platform == PlatformID.Unix)
+ Assert.AreEqual (FileAttributes.Normal, File.GetAttributes (target_file), "A3");
+ else
+ // On Windows the Archive attribute will be set, not the Normal attribute.
+ Assert.AreEqual (FileAttributes.Archive, File.GetAttributes (target_file), "A3");
}
[Test]
Assert.Fail ("Build failed " + sb.ToString ());
}
Assert.IsTrue (File.Exists (target_file), "A2");
- Assert.AreEqual (FileAttributes.Normal, File.GetAttributes (target_file), "A3");
+ var target_file_attrs = File.GetAttributes (target_file);
+ if (Environment.OSVersion.Platform == PlatformID.Unix)
+ Assert.AreEqual (FileAttributes.Normal, File.GetAttributes (target_file), "A3");
+ else
+ // On Windows the Archive attribute will be set, not the Normal attribute.
+ Assert.AreEqual (FileAttributes.Archive, File.GetAttributes (target_file), "A3");
}
[Test]
[Test]
public void TestLineWithEscapedQuote ()
{
+ if (Environment.OSVersion.Platform != PlatformID.Unix) {
+ Assert.Ignore ("Throws \"Illegal characters in path\" on Windows since \" is not a legal Windows path character");
+ }
string[] lines = new string[] { "%22abc test%22 123 %22def%22" };
CreateProjectAndCheck (full_filepath, lines, false, true, delegate () {
CheckFileExists (full_filepath, true);
{
string project_xml = @"<Project xmlns='http://schemas.microsoft.com/developer/msbuild/2003'>
<ItemGroup>
- <Foo Include='Test/ProjectItemTestTemporary/parent/dir*/a*.cs;Test/ProjectItemTestTemporary/x.cs' />
+ <Foo Include='" + "Test/ProjectItemTestTemporary/parent/dir*/a*.cs;Test/ProjectItemTestTemporary/x.cs".Replace ('/', Path.DirectorySeparatorChar) + @"' />
</ItemGroup>
</Project>";
try {
{
string project_xml = @"<Project xmlns='http://schemas.microsoft.com/developer/msbuild/2003'>
<ItemGroup>
- <Foo Include='Test/ProjectItemTestTemporary/parent/**/a*.cs;Test/ProjectItemTestTemporary/x.cs' />
+ <Foo Include='" + "Test/ProjectItemTestTemporary/parent/**/a*.cs;Test/ProjectItemTestTemporary/x.cs".Replace ('/', Path.DirectorySeparatorChar) + @"' />
</ItemGroup>
</Project>";
try {
// sort is needed because they are only sorted by ItemType.
var items = proj.Items.OrderBy (p => p.EvaluatedInclude).ToArray ();
Assert.AreEqual (5, items.Length, "#1");
- Assert.AreEqual (string.Format ("Test/ProjectItemTestTemporary/parent/dir1{0}a.cs", Path.DirectorySeparatorChar), items [0].EvaluatedInclude, "#2");
+ Assert.AreEqual ("Test/ProjectItemTestTemporary/parent/dir1/a.cs", items [0].EvaluatedInclude.Replace (Path.DirectorySeparatorChar, '/'), "#2");
Assert.AreEqual ("a", items [0].GetMetadataValue ("Filename"), "#3");
if (hasRecursiveDir)
Assert.AreEqual ("dir1" + sep, items [0].GetMetadataValue ("RecursiveDir"), "#3.2");
- Assert.AreEqual (string.Format ("Test/ProjectItemTestTemporary/parent/dir1{0}a1.cs", Path.DirectorySeparatorChar), items [1].EvaluatedInclude, "#4");
+ Assert.AreEqual ("Test/ProjectItemTestTemporary/parent/dir1/a1.cs", items [1].EvaluatedInclude.Replace (Path.DirectorySeparatorChar, '/'), "#4");
Assert.AreEqual ("a1", items [1].GetMetadataValue ("Filename"), "#5");
if (hasRecursiveDir)
Assert.AreEqual ("dir1" + sep, items [1].GetMetadataValue ("RecursiveDir"), "#5.2");
- Assert.AreEqual (string.Format ("Test/ProjectItemTestTemporary/parent/dir2{0}a.cs", Path.DirectorySeparatorChar), items [2].EvaluatedInclude, "#6");
+ Assert.AreEqual ("Test/ProjectItemTestTemporary/parent/dir2/a.cs", items [2].EvaluatedInclude.Replace (Path.DirectorySeparatorChar, '/'), "#6");
Assert.AreEqual ("a", items [2].GetMetadataValue ("Filename"), "#7");
if (hasRecursiveDir)
Assert.AreEqual ("dir2" + sep, items [2].GetMetadataValue ("RecursiveDir"), "#7.2");
- Assert.AreEqual (string.Format ("Test/ProjectItemTestTemporary/parent/dir2{0}a2.cs", Path.DirectorySeparatorChar), items [3].EvaluatedInclude, "#8");
+ Assert.AreEqual ("Test/ProjectItemTestTemporary/parent/dir2/a2.cs", items [3].EvaluatedInclude.Replace (Path.DirectorySeparatorChar, '/'), "#8");
Assert.AreEqual ("a2", items [3].GetMetadataValue ("Filename"), "#9");
if (hasRecursiveDir)
Assert.AreEqual ("dir2" + sep, items [3].GetMetadataValue ("RecursiveDir"), "#9.2");
- Assert.AreEqual ("Test/ProjectItemTestTemporary/x.cs", items [4].EvaluatedInclude, "#10");
+ Assert.AreEqual ("Test/ProjectItemTestTemporary/x.cs", items [4].EvaluatedInclude.Replace (Path.DirectorySeparatorChar, '/'), "#10");
for (int i = 0; i < items.Length; i++)
Assert.AreEqual (xitem, items [i].Xml, "#11:" + i);
}
Assert.IsTrue (sub.BuildResult.OverallResult == BuildResultCode.Success, "#1");
DateTime endBuildDone = DateTime.Now;
Assert.IsTrue (endBuildDone - beforeExec >= TimeSpan.FromSeconds (1), "#2");
- Assert.IsTrue (endBuildDone > waitDone, "#3");
+ Assert.IsTrue (waitDone >= beforeExec, "#3");
+ Assert.IsTrue (endBuildDone >= waitDone, "#4");
}
[Test]
${TESTCMD} --label=I18N.West --timeout=5m make -w -C mcs/class/I18N/West run-test
${TESTCMD} --label=I18N.MidEast --timeout=5m make -w -C mcs/class/I18N/MidEast run-test
${TESTCMD} --label=System.DirectoryServices --timeout=5m make -w -C mcs/class/System.DirectoryServices run-test
-if [[ -n "${ghprbPullId}" ]] && [[ ${label} == w* ]]; then ${TESTCMD} --label=Microsoft.Build.Engine --skip; else ${TESTCMD} --label=Microsoft.Build.Engine --timeout=5m make -w -C mcs/class/Microsoft.Build.Engine run-test; fi
+${TESTCMD} --label=Microsoft.Build.Engine --timeout=5m make -w -C mcs/class/Microsoft.Build.Engine run-test
${TESTCMD} --label=Microsoft.Build.Framework --timeout=5m make -w -C mcs/class/Microsoft.Build.Framework run-test
-if [[ -n "${ghprbPullId}" ]] && [[ ${label} == w* ]]; then ${TESTCMD} --label=Microsoft.Build.Tasks --skip; else ${TESTCMD} --label=Microsoft.Build.Tasks --timeout=5m make -w -C mcs/class/Microsoft.Build.Tasks run-test; fi
+${TESTCMD} --label=Microsoft.Build.Tasks --timeout=5m make -w -C mcs/class/Microsoft.Build.Tasks run-test
${TESTCMD} --label=Microsoft.Build.Utilities --timeout=5m make -w -C mcs/class/Microsoft.Build.Utilities run-test
${TESTCMD} --label=Mono.C5 --timeout=5m make -w -C mcs/class/Mono.C5 run-test
${TESTCMD} --label=Mono.Tasklets --timeout=5m make -w -C mcs/class/Mono.Tasklets run-test
${TESTCMD} --label=System.Json --timeout=5m make -w -C mcs/class/System.Json run-test
${TESTCMD} --label=System.Threading.Tasks.Dataflow --timeout=5m make -w -C mcs/class/System.Threading.Tasks.Dataflow run-test
${TESTCMD} --label=Mono.Debugger.Soft --timeout=5m make -w -C mcs/class/Mono.Debugger.Soft run-test
-if [[ -n "${ghprbPullId}" ]] && [[ ${label} == w* ]]; then ${TESTCMD} --label=Microsoft.Build --skip; else ${TESTCMD} --label=Microsoft.Build --timeout=5m make -w -C mcs/class/Microsoft.Build run-test; fi
+${TESTCMD} --label=Microsoft.Build --timeout=5m make -w -C mcs/class/Microsoft.Build run-test
${TESTCMD} --label=monodoc --timeout=10m make -w -C mcs/tools/mdoc run-test
-if [[ -n "${ghprbPullId}" ]] && [[ ${label} == w* ]]; then ${TESTCMD} --label=Microsoft.Build-12 --skip; else ${TESTCMD} --label=Microsoft.Build-12 --timeout=10m make -w -C mcs/class/Microsoft.Build run-test PROFILE=xbuild_12; fi
-if [[ -n "${ghprbPullId}" ]] && [[ ${label} == w* ]]; then ${TESTCMD} --label=Microsoft.Build.Engine-12 --skip; else ${TESTCMD} --label=Microsoft.Build.Engine-12 --timeout=60m make -w -C mcs/class/Microsoft.Build.Engine run-test PROFILE=xbuild_12; fi
+${TESTCMD} --label=Microsoft.Build-12 --timeout=10m make -w -C mcs/class/Microsoft.Build run-test PROFILE=xbuild_12
+${TESTCMD} --label=Microsoft.Build.Engine-12 --timeout=60m make -w -C mcs/class/Microsoft.Build.Engine run-test PROFILE=xbuild_12
${TESTCMD} --label=Microsoft.Build.Framework-12 --timeout=60m make -w -C mcs/class/Microsoft.Build.Framework run-test PROFILE=xbuild_12
-if [[ -n "${ghprbPullId}" ]] && [[ ${label} == w* ]]; then ${TESTCMD} --label=Microsoft.Build.Tasks-12 --skip; else ${TESTCMD} --label=Microsoft.Build.Tasks-12 --timeout=60m make -w -C mcs/class/Microsoft.Build.Tasks run-test PROFILE=xbuild_12; fi
+${TESTCMD} --label=Microsoft.Build.Tasks-12 --timeout=60m make -w -C mcs/class/Microsoft.Build.Tasks run-test PROFILE=xbuild_12
${TESTCMD} --label=Microsoft.Build.Utilities-12 --timeout=60m make -w -C mcs/class/Microsoft.Build.Utilities run-test PROFILE=xbuild_12
-if [[ -n "${ghprbPullId}" ]] && [[ ${label} == w* ]]; then ${TESTCMD} --label=Microsoft.Build-14 --skip; else ${TESTCMD} --label=Microsoft.Build-14 --timeout=60m make -w -C mcs/class/Microsoft.Build run-test PROFILE=xbuild_14; fi
-if [[ -n "${ghprbPullId}" ]] && [[ ${label} == w* ]]; then ${TESTCMD} --label=Microsoft.Build.Engine-14 --skip; else ${TESTCMD} --label=Microsoft.Build.Engine-14 --timeout=60m make -w -C mcs/class/Microsoft.Build.Engine run-test PROFILE=xbuild_14; fi
+${TESTCMD} --label=Microsoft.Build-14 --timeout=60m make -w -C mcs/class/Microsoft.Build run-test PROFILE=xbuild_14
+${TESTCMD} --label=Microsoft.Build.Engine-14 --timeout=60m make -w -C mcs/class/Microsoft.Build.Engine run-test PROFILE=xbuild_14
${TESTCMD} --label=Microsoft.Build.Framework-14 --timeout=60m make -w -C mcs/class/Microsoft.Build.Framework run-test PROFILE=xbuild_14
-if [[ -n "${ghprbPullId}" ]] && [[ ${label} == w* ]]; then ${TESTCMD} --label=Microsoft.Build.Tasks-14 --skip; else ${TESTCMD} --label=Microsoft.Build.Tasks-14 --timeout=60m make -w -C mcs/class/Microsoft.Build.Tasks run-test PROFILE=xbuild_14; fi
+${TESTCMD} --label=Microsoft.Build.Tasks-14 --timeout=60m make -w -C mcs/class/Microsoft.Build.Tasks run-test PROFILE=xbuild_14
${TESTCMD} --label=Microsoft.Build.Utilities-14 --timeout=60m make -w -C mcs/class/Microsoft.Build.Utilities run-test PROFILE=xbuild_14
if [[ ${label} == osx-* ]]
then ${TESTCMD} --label=ms-test-suite --timeout=15m make -w -C acceptance-tests check-ms-test-suite