diff options
author | Alexander Köplinger <alex.koeplinger@outlook.com> | 2017-07-14 15:47:14 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-07-14 15:47:14 +0300 |
commit | 5dd17f89421f7911c6da5f8bc057ace775e0cd20 (patch) | |
tree | c7d651ec837f9e417ab2f89bdecb86db120d16b1 /mcs/class/test-helpers | |
parent | 2c59986b441cbcabc139feea58cb80aa3b09371a (diff) |
[Microsoft.Build] Make BuildSubmissionTest.EndBuildWaitsForCompletion more reliable (#5209)
We've seen this test failure a few times:
```
MESSAGE:
#2
Expected: greater than or equal to 00:00:01
But was: 00:00:00.9544900
+++++++++++++++++++
STACK TRACE:
at MonoTests.Microsoft.Build.Execution.BuildSubmissionTest.EndBuildWaitsForSubmissionCompletion () [0x000d8] in /mnt/jenkins/workspace/test-mono-mainline-linux/label/ubuntu-1404-amd64/mcs/class/Microsoft.Build/Test/Microsoft.Build.Execution/BuildSubmissionTest.cs:110
at (wrapper managed-to-native) System.Reflection.MonoMethod:InternalInvoke (System.Reflection.MonoMethod,object,object[],System.Exception&)
at System.Reflection.MonoMethod.Invoke (System.Object obj, System.Reflection.BindingFlags invokeAttr, System.Reflection.Binder binder, System.Object[] parameters, System.Globalization.CultureInfo culture) [0x00032] in /mnt/jenkins/workspace/test-mono-mainline-linux/label/ubuntu-1404-amd64/mcs/class/corlib/System.Reflection/MonoMethod.cs:305
```
Rewriting the test to use Stopwatch instead of DateTime
for measuring elapsed time should make it more reliable.
Diffstat (limited to 'mcs/class/test-helpers')
-rw-r--r-- | mcs/class/test-helpers/NunitHelpers.cs | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/mcs/class/test-helpers/NunitHelpers.cs b/mcs/class/test-helpers/NunitHelpers.cs index 20ea722a155..93f29727f99 100644 --- a/mcs/class/test-helpers/NunitHelpers.cs +++ b/mcs/class/test-helpers/NunitHelpers.cs @@ -124,6 +124,21 @@ namespace NUnit.Framework Assert.That(arg1, Is.LessThanOrEqualTo(arg2), message, args); } + public static void LessOrEqual(long arg1, long arg2, string message = null, params object[] args) + { + Assert.That(arg1, Is.LessThanOrEqualTo(arg2), message, args); + } + + public static void LessOrEqual(System.DateTime arg1, System.DateTime arg2, string message = null, params object[] args) + { + Assert.That(arg1, Is.LessThanOrEqualTo(arg2), message, args); + } + + public static void LessOrEqual(System.TimeSpan arg1, System.TimeSpan arg2, string message = null, params object[] args) + { + Assert.That(arg1, Is.LessThanOrEqualTo(arg2), message, args); + } + public static void IsNotInstanceOfType(System.Type expected, object actual, string message, params object[] args ) { Assert.IsFalse (actual.GetType ().IsInstanceOfType (expected), message, args); |