Merge working tree with build tree.
[m6w6/libmemcached] / libtest / main.cc
index ef10028c5800160dabb687448ec433b0bc0ba321..697cce1c4782610db3e0eeee3cbeb5735839f4bd 100644 (file)
@@ -308,41 +308,39 @@ int main(int argc, char *argv[])
           try {
             if (test_success(return_code= world.item.startup(creators_ptr)))
             {
-              if (test_success(return_code= world.item.flush(creators_ptr, run)))
+              if (run->requires_flush)
               {
-                // @note pre will fail is SKIPPED is returned
-                if (test_success(return_code= world.item.pre(creators_ptr)))
-                {
-                  { // Runner Code
-                    gettimeofday(&start_time, NULL);
-                    assert(world.runner());
-                    assert(run->test_fn);
-                    try 
+                return_code= world.runner()->flush(creators_ptr);
+              }
+
+              if (test_success(return_code))
+              {
+                { // Runner Code
+                  gettimeofday(&start_time, NULL);
+                  assert(world.runner());
+                  assert(run->test_fn);
+                  try 
+                  {
+                    return_code= world.runner()->run(run->test_fn, creators_ptr);
+                  }
+                  // Special case where check for the testing of the exception
+                  // system.
+                  catch (libtest::fatal &e)
+                  {
+                    if (fatal::is_disabled())
                     {
-                      return_code= world.runner()->run(run->test_fn, creators_ptr);
+                      fatal::increment_disabled_counter();
+                      return_code= TEST_SUCCESS;
                     }
-                    // Special case where check for the testing of the exception
-                    // system.
-                    catch (libtest::fatal &e)
+                    else
                     {
-                      if (fatal::is_disabled())
-                      {
-                        fatal::increment_disabled_counter();
-                        return_code= TEST_SUCCESS;
-                      }
-                      else
-                      {
-                        throw;
-                      }
+                      throw;
                     }
-
-                    gettimeofday(&end_time, NULL);
-                    load_time= timedif(end_time, start_time);
                   }
-                }
 
-                // @todo do something if post fails
-                (void)world.item.post(creators_ptr);
+                  gettimeofday(&end_time, NULL);
+                  load_time= timedif(end_time, start_time);
+                }
               }
               else if (return_code == TEST_SKIPPED)
               { }
@@ -466,6 +464,10 @@ cleanup:
   {
     std::cerr << e.what() << std::endl;
   }
+  catch (libtest::disconnected& e)
+  {
+    std::cerr << "Unhandled disconnection occurred:" << e.what() << std::endl;
+  }
   catch (std::exception& e)
   {
     std::cerr << e.what() << std::endl;