You've already forked linux-packaging-mono
Imported Upstream version 5.8.0.22
Former-commit-id: df344e34b07851d296efb3e6604c8db42b6f7aa3
This commit is contained in:
parent
5f4a27cc8a
commit
7d05485754
@ -81,35 +81,29 @@ namespace MonoTests.Microsoft.Build.Execution
|
||||
[Test]
|
||||
public void EndBuildWaitsForSubmissionCompletion ()
|
||||
{
|
||||
// Windows does not have useful sleep or alternative, so skip it
|
||||
bool is_windows = true;
|
||||
switch (Environment.OSVersion.Platform) {
|
||||
case PlatformID.Unix:
|
||||
case PlatformID.MacOSX:
|
||||
is_windows = false;
|
||||
break;
|
||||
}
|
||||
string project_xml = string.Format (@"<Project DefaultTargets='Wait1Sec' xmlns='http://schemas.microsoft.com/developer/msbuild/2003'>
|
||||
<Target Name='Wait1Sec'>
|
||||
<Exec Command='{0}' />
|
||||
</Target>
|
||||
</Project>", is_windows ? "powershell -command \"Start-Sleep -s 1\"" : "/bin/sleep 1");
|
||||
</Project>", Environment.OSVersion.Platform == PlatformID.Win32NT ? "powershell -command \"Start-Sleep -s 1\"" : "/bin/sleep 1");
|
||||
var xml = XmlReader.Create (new StringReader (project_xml));
|
||||
var root = ProjectRootElement.Create (xml);
|
||||
root.FullPath = "BuildSubmissionTest.EndBuildWaitsForSubmissionCompletion.proj";
|
||||
var proj = new ProjectInstance (root);
|
||||
var bm = new BuildManager ();
|
||||
bm.BeginBuild (new BuildParameters ());
|
||||
DateTime waitDone = DateTime.MinValue;
|
||||
DateTime beforeExec = DateTime.Now;
|
||||
var waitDone = TimeSpan.MinValue;
|
||||
var sw = System.Diagnostics.Stopwatch.StartNew ();
|
||||
var sub = bm.PendBuildRequest (new BuildRequestData (proj, new string [] { "Wait1Sec" }));
|
||||
sub.ExecuteAsync (delegate { waitDone = DateTime.Now; }, null);
|
||||
sub.ExecuteAsync (cb => waitDone = sw.Elapsed, null);
|
||||
bm.EndBuild ();
|
||||
Assert.IsTrue (sub.BuildResult.OverallResult == BuildResultCode.Success, "#1");
|
||||
DateTime endBuildDone = DateTime.Now;
|
||||
Assert.IsTrue (endBuildDone - beforeExec >= TimeSpan.FromSeconds (1), "#2");
|
||||
Assert.IsTrue (waitDone >= beforeExec, "#3");
|
||||
Assert.IsTrue (endBuildDone >= waitDone, "#4");
|
||||
Assert.AreEqual (BuildResultCode.Success, sub.BuildResult.OverallResult, "#1");
|
||||
var endBuildDone = sw.Elapsed;
|
||||
AssertHelper.GreaterOrEqual (endBuildDone, TimeSpan.FromSeconds (1), "#2");
|
||||
AssertHelper.GreaterOrEqual (waitDone, TimeSpan.FromSeconds (1), "#3");
|
||||
AssertHelper.GreaterOrEqual (endBuildDone, waitDone, "#4");
|
||||
AssertHelper.LessOrEqual (endBuildDone, TimeSpan.FromSeconds (2), "#5");
|
||||
AssertHelper.LessOrEqual (waitDone, TimeSpan.FromSeconds (2), "#6");
|
||||
}
|
||||
|
||||
[Test]
|
||||
|
Reference in New Issue
Block a user