]> git.ipfire.org Git - thirdparty/squid.git/commitdiff
Added a CPPUNIT assertion to test whether a failed CPPUNIT test case properly
authorrousskov <>
Tue, 26 Feb 2008 07:24:00 +0000 (07:24 +0000)
committerrousskov <>
Tue, 26 Feb 2008 07:24:00 +0000 (07:24 +0000)
destructs local objects on exit.

If a previous test case fails for any reason, the new assertion will fail
instead of store_dir.cc aborting.  This may save us from tracking non-existent
StoreController initialization bugs.

src/tests/testUfs.cc

index cd8a98c7f04f351393a4d2e5e32131ba50e2813a..4d9dd0f9517cf8cb702e19281074f4a895688975 100644 (file)
@@ -225,6 +225,11 @@ testUfs::testUfsDefaultEngine()
     if (0 > system ("rm -rf " TESTDIR))
         throw std::runtime_error("Failed to clean test work directory");
 
+    // This assertion may fail if previous test cases fail.
+    // Apparently, CPPUNIT_ASSERT* failure may prevent destructors of local
+    // objects such as "StorePointer aRoot" from being called.
+    CPPUNIT_ASSERT(!store_table); // or StoreHashIndex ctor will abort below
+
     StorePointer aRoot (new StoreController);
     Store::Root(aRoot);
     SwapDirPointer aStore (new UFSSwapDir("ufs", "Blocking"));