From a1d98eb457c8eb5c1e8d158b4e03ce397e5ac101 Mon Sep 17 00:00:00 2001 From: Ichthyostega Date: Thu, 27 Dec 2012 03:31:09 +0100 Subject: [PATCH] restore and fix some broken tests ..more to come, especially several of the QueryResolver based tests are still broken --- src/lib/element-tracker.hpp | 4 ++++ src/proc/mobject/session/sess-manager-impl.cpp | 9 ++++++--- tests/40components.tests | 2 +- .../proc/mobject/session/defs-manager-test.cpp | 6 +++--- .../mobject/session/session-element-tracker-test.cpp | 4 ++-- tests/lib/query/query-utils-test.cpp | 6 +++--- 6 files changed, 19 insertions(+), 12 deletions(-) diff --git a/src/lib/element-tracker.hpp b/src/lib/element-tracker.hpp index 160c6b5a2..5e7bdfd44 100644 --- a/src/lib/element-tracker.hpp +++ b/src/lib/element-tracker.hpp @@ -45,6 +45,10 @@ ** AutoRegistered::is_attached_to and AutoRegistered::deactivateRegistryLink ** can be used for detaching an Registry explicitly before destruction. ** Ignoring this might lead to segfault on application shutdown. /////////////////TICKET #574 + ** @warning be sure to understand the implications of object identity, + ** especially when it comes to closing and opening the Session. Especially + ** note that Assets use a systematic identity, not an instance identity, + ** which might lead to removing an old instance from the new session. ** ** @see session-element-tracker-test.cpp ** @see session-interface-modules.hpp diff --git a/src/proc/mobject/session/sess-manager-impl.cpp b/src/proc/mobject/session/sess-manager-impl.cpp index 533e5e567..4bdd00317 100644 --- a/src/proc/mobject/session/sess-manager-impl.cpp +++ b/src/proc/mobject/session/sess-manager-impl.cpp @@ -245,7 +245,8 @@ namespace session { SessManagerImpl::close () { Lock sync(this); - lifecycle_->shutDown(); + if (isUp()) + lifecycle_->shutDown(); pSess_.reset(); } @@ -258,7 +259,8 @@ namespace session { SessManagerImpl::reset () { Lock sync(this); - lifecycle_->shutDown(); + if (isUp()) + lifecycle_->shutDown(); lifecycle_->pullUp(); } @@ -268,7 +270,8 @@ namespace session { { UNIMPLEMENTED ("load serialised session"); Lock sync(this); - lifecycle_->shutDown(); + if (isUp()) + lifecycle_->shutDown(); lifecycle_->pullUp(); } diff --git a/tests/40components.tests b/tests/40components.tests index 1eab26448..8099d8662 100644 --- a/tests/40components.tests +++ b/tests/40components.tests @@ -530,7 +530,7 @@ END TEST "Query support utilities" QueryUtils_test <defaults(Query ()); + pipe2 = Session::current->defaults(Query ("")); CHECK (pipe2 == pipe1); - pipe2 = asset::Struct::retrieve (Query ()); + pipe2 = asset::Struct::retrieve (Query ("")); CHECK (pipe2 == pipe1); pipe2 = asset::Struct::retrieve (Query ("default(P)")); CHECK (pipe2 == pipe1); @@ -143,7 +143,7 @@ namespace test { void failureCreatesNewDefault() { - PPipe pipe1 = Session::current->defaults(Query ()); // "the default pipe" + PPipe pipe1 = Session::current->defaults(Query ("")); // "the default pipe" string new_pID (str (format ("dummy_%s_%i") % pipe1->getPipeID() diff --git a/tests/components/proc/mobject/session/session-element-tracker-test.cpp b/tests/components/proc/mobject/session/session-element-tracker-test.cpp index d907a4418..d9f417593 100644 --- a/tests/components/proc/mobject/session/session-element-tracker-test.cpp +++ b/tests/components/proc/mobject/session/session-element-tracker-test.cpp @@ -211,11 +211,11 @@ namespace test { /** @test ensure the asset cleanup doesn't interfere with session shutdown */ void - verify_cleanup (PTimeline aTimeline_in_session) + verify_cleanup (PTimeline const& aTimeline_in_session) { CHECK (1 < aTimeline_in_session.use_count(), "test object should still be attached to session"); Session::current.reset(); - aTimeline_in_session->detach(); // should be a no-op and not cause any invalid access + CHECK (1 == aTimeline_in_session.use_count(), "session reset should have de-registered the test object"); } }; diff --git a/tests/lib/query/query-utils-test.cpp b/tests/lib/query/query-utils-test.cpp index 0ab2f20a9..63fcc1851 100644 --- a/tests/lib/query/query-utils-test.cpp +++ b/tests/lib/query/query-utils-test.cpp @@ -66,7 +66,7 @@ namespace test{ virtual void run (Arg arg) { - if (isnil(arg)) arg = Cmdline ("Query normaliseID extractID removeTerm countPred"); + if (isnil(arg)) arg = Cmdline ("normaliseID extractID removeTerm countPred"); if (contains (arg, "normaliseID")) check_normaliseID(); if (contains (arg, "extractID" )) check_extractID (); @@ -85,11 +85,11 @@ namespace test{ tokens.push_back (" White \t space "); tokens.push_back ("§&Ω%€GΩ%€ar ☠☠☠ baäääääge!!!!! "); - cout << "..original : " << tokens << " :"<