Brian Aker 13 лет назад
Родитель
Сommit
625517c71f
10 измененных файлов с 45 добавлено и 32 удалено
  1. 0 2
      examples/reverse_worker.cc
  2. 0 2
      libtest/collection.cc
  3. 1 1
      libtest/fatal.cc
  4. 3 2
      libtest/framework.cc
  5. 31 15
      libtest/framework.h
  6. 1 1
      libtest/skiptest.cc
  7. 2 2
      libtest/unittest.cc
  8. 2 2
      tests/blobslap_client.cc
  9. 3 3
      tests/cli.cc
  10. 2 2
      tests/cycle.cc

+ 0 - 2
examples/reverse_worker.cc

@@ -88,8 +88,6 @@ static gearman_return_t reverse_worker(gearman_job_st *job, void *context)
     return GEARMAN_ERROR;
     return GEARMAN_ERROR;
   }
   }
 
 
-  size_t x;
-  size_t y;
   for (size_t y= 0, x= workload_size; x; x--, y++)
   for (size_t y= 0, x= workload_size; x; x--, y++)
   {
   {
     result[y]= ((uint8_t *)workload)[x - 1];
     result[y]= ((uint8_t *)workload)[x - 1];

+ 0 - 2
libtest/collection.cc

@@ -97,8 +97,6 @@ test_return_t Collection::exec()
   {
   {
     for (test_st *run= _tests; run->name; run++)
     for (test_st *run= _tests; run->name; run++)
     {
     {
-      long int load_time= 0;
-
       if (_frame->match(run->name))
       if (_frame->match(run->name))
       {
       {
         continue;
         continue;

+ 1 - 1
libtest/fatal.cc

@@ -42,8 +42,8 @@ namespace libtest {
 
 
 fatal::fatal(const char *file_arg, int line_arg, const char *func_arg, const char *format, ...) :
 fatal::fatal(const char *file_arg, int line_arg, const char *func_arg, const char *format, ...) :
   std::runtime_error(func_arg),
   std::runtime_error(func_arg),
-  _file(file_arg),
   _line(line_arg),
   _line(line_arg),
+  _file(file_arg),
   _func(func_arg)
   _func(func_arg)
   {
   {
     va_list args;
     va_list args;

+ 3 - 2
libtest/framework.cc

@@ -48,13 +48,14 @@ using namespace libtest;
 Framework::Framework(libtest::SignalThread& signal,
 Framework::Framework(libtest::SignalThread& signal,
                      const std::string& only_run_arg,
                      const std::string& only_run_arg,
                      const std::string& wildcard_arg) :
                      const std::string& wildcard_arg) :
-  collections(NULL),
+  _collections(NULL),
   _total(0),
   _total(0),
   _success(0),
   _success(0),
   _skipped(0),
   _skipped(0),
   _failed(0),
   _failed(0),
   _create(NULL),
   _create(NULL),
   _destroy(NULL),
   _destroy(NULL),
+  _on_error(NULL),
   _runner(NULL),
   _runner(NULL),
   _socket(false),
   _socket(false),
   _creators_ptr(NULL),
   _creators_ptr(NULL),
@@ -64,7 +65,7 @@ Framework::Framework(libtest::SignalThread& signal,
 {
 {
   get_world(this);
   get_world(this);
 
 
-  for (collection_st *next= collections; next and next->name; next++)
+  for (collection_st *next= _collections; next and next->name; next++)
   {
   {
     _collection.push_back(new Collection(this, next));
     _collection.push_back(new Collection(this, next));
   }
   }

+ 31 - 15
libtest/framework.h

@@ -48,19 +48,24 @@
 
 
 class Framework {
 class Framework {
 public:
 public:
-  collection_st *collections;
-
-  /* These methods are called outside of any collection call. */
-  test_callback_create_fn *_create;
-  test_callback_destroy_fn *_destroy;
 
 
 public:
 public:
   test_return_t create();
   test_return_t create();
 
 
-  /**
-    If an error occurs during the test, this is called.
-  */
-  test_callback_error_fn *_on_error;
+  void create(test_callback_create_fn* arg)
+  {
+    _create= arg;
+  }
+
+  void destroy(test_callback_destroy_fn* arg)
+  {
+    _destroy= arg;
+  }
+
+  void collections(collection_st* arg)
+  {
+    _collections= arg;
+  }
 
 
   void set_on_error(test_callback_error_fn *arg)
   void set_on_error(test_callback_error_fn *arg)
   {
   {
@@ -83,12 +88,6 @@ public:
   {
   {
     return _servers;
     return _servers;
   }
   }
-  
-  /**
-    Runner represents the callers for the tests. If not implemented we will use
-    a set of default implementations.
-  */
-  libtest::Runner *_runner;
 
 
   void set_runner(libtest::Runner *arg)
   void set_runner(libtest::Runner *arg)
   {
   {
@@ -154,10 +153,27 @@ public:
 private:
 private:
   Framework& operator=(const Framework&);
   Framework& operator=(const Framework&);
 
 
+  collection_st *_collections;
+
   uint32_t _total;
   uint32_t _total;
   uint32_t _success;
   uint32_t _success;
   uint32_t _skipped;
   uint32_t _skipped;
   uint32_t _failed;
   uint32_t _failed;
+  
+  /* These methods are called outside of any collection call. */
+  test_callback_create_fn *_create;
+  test_callback_destroy_fn *_destroy;
+
+  /**
+    If an error occurs during the test, this is called.
+  */
+  test_callback_error_fn *_on_error;
+
+  /**
+    Runner represents the callers for the tests. If not implemented we will use
+    a set of default implementations.
+  */
+  libtest::Runner *_runner;
 
 
   libtest::server_startup_st _servers;
   libtest::server_startup_st _servers;
   bool _socket;
   bool _socket;

+ 1 - 1
libtest/skiptest.cc

@@ -53,5 +53,5 @@ static void *world_create(server_startup_st&, test_return_t& rc)
 
 
 void get_world(Framework *world)
 void get_world(Framework *world)
 {
 {
-  world->_create= world_create;
+  world->create(world_create);
 }
 }

+ 2 - 2
libtest/unittest.cc

@@ -953,6 +953,6 @@ static void *world_create(server_startup_st& servers, test_return_t&)
 
 
 void get_world(Framework *world)
 void get_world(Framework *world)
 {
 {
-  world->collections= collection;
-  world->_create= world_create;
+  world->collections(collection);
+  world->create(world_create);
 }
 }

+ 2 - 2
tests/blobslap_client.cc

@@ -115,7 +115,7 @@ static void *world_create(server_startup_st& servers, test_return_t& error)
 void get_world(Framework *world)
 void get_world(Framework *world)
 {
 {
   executable= "./benchmark/blobslap_client";
   executable= "./benchmark/blobslap_client";
-  world->collections= collection;
-  world->_create= world_create;
+  world->collections(collection);
+  world->create(world_create);
 }
 }
 
 

+ 3 - 3
tests/cli.cc

@@ -328,7 +328,7 @@ static bool world_destroy(void *object)
 
 
 void get_world(Framework *world)
 void get_world(Framework *world)
 {
 {
-  world->collections= collection;
-  world->_create= world_create;
-  world->_destroy= world_destroy;
+  world->collections(collection);
+  world->create(world_create);
+  world->destroy(world_destroy);
 }
 }

+ 2 - 2
tests/cycle.cc

@@ -158,7 +158,7 @@ static void *world_create(server_startup_st& servers, test_return_t& )
 
 
 void get_world(Framework *world)
 void get_world(Framework *world)
 {
 {
-  world->collections= collection;
-  world->_create= world_create;
+  world->collections(collection);
+  world->create(world_create);
 }
 }
 
 

Некоторые файлы не были показаны из-за большого количества измененных файлов