summaryrefslogtreecommitdiff
path: root/tests/src/GC
diff options
context:
space:
mode:
authorBruce Forstall <brucefo@microsoft.com>2018-06-13 15:04:23 -0700
committerGitHub <noreply@github.com>2018-06-13 15:04:23 -0700
commitf762f8b0e4a2870162badb58e77b9edceef58d97 (patch)
treeca4719a1f987353b8b77fbec57b59b47cfaba50e /tests/src/GC
parent82134a002fed96739694b6f085baaeea6c7c41f5 (diff)
parent75623f73d1fd635ddace9d36ee28eeabe6030531 (diff)
downloadcoreclr-f762f8b0e4a2870162badb58e77b9edceef58d97.tar.gz
coreclr-f762f8b0e4a2870162badb58e77b9edceef58d97.tar.bz2
coreclr-f762f8b0e4a2870162badb58e77b9edceef58d97.zip
Merge pull request #18438 from BruceForstall/FixKeepAlive
Fix GC KeepAlive test
Diffstat (limited to 'tests/src/GC')
-rw-r--r--tests/src/GC/API/GC/KeepAlive.cs14
1 files changed, 9 insertions, 5 deletions
diff --git a/tests/src/GC/API/GC/KeepAlive.cs b/tests/src/GC/API/GC/KeepAlive.cs
index c5dd55d10c..badc54a04a 100644
--- a/tests/src/GC/API/GC/KeepAlive.cs
+++ b/tests/src/GC/API/GC/KeepAlive.cs
@@ -56,8 +56,10 @@ public class Test
}
- public static void RunTest()
+ public static bool RunTest()
{
+ bool success = false;
+
Dummy obj = new Dummy();
RunTest2();
@@ -71,14 +73,18 @@ public class Test
GC.Collect();
//}
+ success = (visited1 == false) && (visited2 == true);
+
GC.KeepAlive(obj); // will keep obj alive until this point
+
+ return success;
}
public static int Main()
{
- RunTest();
+ bool success = RunTest();
- if ((visited1 == false) && (visited2 == true))
+ if (success)
{
Console.WriteLine("Test for KeepAlive() passed!");
return 100;
@@ -86,8 +92,6 @@ public class Test
else
{
Console.WriteLine("Test for KeepAlive() failed!");
-
-
return 1;
}
}