Fix test-debug: make sure debugger is unloaded before running next test
authoryurys@chromium.org <yurys@chromium.org@ce2b1a6d-e550-0410-aec6-3dcde31c8c00>
Wed, 28 Apr 2010 09:18:53 +0000 (09:18 +0000)
committeryurys@chromium.org <yurys@chromium.org@ce2b1a6d-e550-0410-aec6-3dcde31c8c00>
Wed, 28 Apr 2010 09:18:53 +0000 (09:18 +0000)
Review URL: http://codereview.chromium.org/1704015

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@4527 ce2b1a6d-e550-0410-aec6-3dcde31c8c00

src/debug.h
test/cctest/test-debug.cc

index 19a694a..e7ac94e 100644 (file)
@@ -670,6 +670,7 @@ class Debugger {
   // Unload the debugger if possible. Only called when no debugger is currently
   // active.
   static void UnloadDebugger();
+  friend void ForceUnloadDebugger();  // In test-debug.cc
 
   inline static bool EventActive(v8::DebugEvent event) {
     ScopedLock with(debugger_access_);
index a7ab0dc..e2ed157 100644 (file)
@@ -436,6 +436,12 @@ void CheckDebuggerUnloaded(bool check_functions) {
 }
 
 
+void ForceUnloadDebugger() {
+  Debugger::never_unload_debugger_ = false;
+  Debugger::UnloadDebugger();
+}
+
+
 } }  // namespace v8::internal
 
 
@@ -6146,5 +6152,8 @@ TEST(DebugContextIsPreservedBetweenAccesses) {
   v8::Local<v8::Context> context1 = v8::Debug::GetDebugContext();
   v8::Local<v8::Context> context2 = v8::Debug::GetDebugContext();
   CHECK_EQ(*context1, *context2);
+  // Make sure debugger is unloaded before running other tests.
+  v8::internal::ForceUnloadDebugger();
+  CheckDebuggerUnloaded();
 }