Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(9)

Unified Diff: runtime/vm/unit_test.h

Issue 2640573003: Resolution for issue #5092: Unit test handle checks consider dangling handles to be valid. (Closed)
Patch Set: Created 3 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« runtime/vm/thread_registry.cc ('K') | « runtime/vm/thread_registry.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/vm/unit_test.h
diff --git a/runtime/vm/unit_test.h b/runtime/vm/unit_test.h
index c08f36efae6178098554acd010ee419041b60d5f..59f742f57905e981a4ef969b8af6f1b6570361d8 100644
--- a/runtime/vm/unit_test.h
+++ b/runtime/vm/unit_test.h
@@ -547,6 +547,13 @@ class CompilerTest : public AllStatic {
" '%s'\n", \
#handle, Dart_GetError(tmp_handle)); \
} \
+ if (!Dart_IsValid(tmp_handle)) { \
bkonyi 2017/01/18 00:47:01 I'm not sure if we'd rather create a new macro or
siva 2017/01/18 23:27:06 The check for the handle being valid should happen
bkonyi 2017/01/19 01:05:13 Done.
+ dart::Expect(__FILE__, __LINE__) \
+ .Fail( \
+ "expected '%s' to be a valid handle but '%s' has already been " \
+ "freed\n", \
+ #handle, #handle); \
+ } \
} while (0)
#define EXPECT_ERROR(handle, substring) \
@@ -564,6 +571,18 @@ class CompilerTest : public AllStatic {
} \
} while (0)
+#define EXPECT_INVALID(handle) \
+ do { \
bkonyi 2017/01/18 00:44:47 Should this check for error handles as well, shoul
siva 2017/01/18 23:27:06 Why do we need this macro, couldn't the unit tests
bkonyi 2017/01/19 01:05:13 You're right. Removed.
+ Dart_Handle tmp_handle = (handle); \
+ if (Dart_IsValid(tmp_handle)) { \
+ dart::Expect(__FILE__, __LINE__) \
+ .Fail( \
+ "expected '%s' to be an invalid handle but '%s' has not been " \
+ "freed\n", \
+ #handle, #handle); \
+ } \
+ } while (0)
+
#define EXPECT_TRUE(handle) \
do { \
Dart_Handle tmp_handle = (handle); \
« runtime/vm/thread_registry.cc ('K') | « runtime/vm/thread_registry.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698