summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTrond Norbye <trond.norbye@gmail.com>2011-07-14 15:31:11 +0200
committerTrond Norbye <trond.norbye@gmail.com>2011-07-14 15:31:45 +0200
commit1d251a2495040dbd74e170008115aad19143982b (patch)
tree7693ccdea4f22329b794bbdfb0132981d5861815
parent8a38629379830218553d3912e303c92120d01155 (diff)
downloadmemcached-1d251a2495040dbd74e170008115aad19143982b.tar.gz
Make the current testcase available through the test harness
-rw-r--r--include/memcached/engine_testapp.h5
-rw-r--r--programs/engine_testapp.c12
2 files changed, 14 insertions, 3 deletions
diff --git a/include/memcached/engine_testapp.h b/include/memcached/engine_testapp.h
index caa4785..afbf272 100644
--- a/include/memcached/engine_testapp.h
+++ b/include/memcached/engine_testapp.h
@@ -18,6 +18,8 @@ enum test_result {
TIMEOUT = 23
};
+typedef struct test engine_test_t;
+
struct test_harness {
const char *engine_path;
const char *default_engine_cfg;
@@ -31,10 +33,9 @@ struct test_harness {
void (*unlock_cookie)(const void *cookie);
void (*waitfor_cookie)(const void *cookie);
void (*time_travel)(int offset);
+ const engine_test_t* (*get_current_testcase)(void);
};
-typedef struct test engine_test_t;
-
struct test {
const char *name;
enum test_result(*tfun)(ENGINE_HANDLE *, ENGINE_HANDLE_V1 *);
diff --git a/programs/engine_testapp.c b/programs/engine_testapp.c
index dded5ae..195a59c 100644
--- a/programs/engine_testapp.c
+++ b/programs/engine_testapp.c
@@ -640,6 +640,14 @@ static void reload_engine(ENGINE_HANDLE **h, ENGINE_HANDLE_V1 **h1,
*h = handle;
}
+static engine_test_t* current_testcase;
+
+static const engine_test_t* get_current_testcase(void)
+{
+ return current_testcase;
+}
+
+
static enum test_result run_test(engine_test_t test, const char *engine, const char *default_cfg) {
enum test_result ret = PENDING;
if (test.tfun != NULL) {
@@ -647,6 +655,7 @@ static enum test_result run_test(engine_test_t test, const char *engine, const c
pid_t pid = fork();
if (pid == 0) {
#endif
+ current_testcase = &test;
if (test.prepare != NULL) {
if ((ret = test.prepare(&test)) == SUCCESS) {
ret = PENDING;
@@ -849,7 +858,8 @@ int main(int argc, char **argv) {
.lock_cookie = lock_mock_cookie,
.unlock_cookie = unlock_mock_cookie,
.waitfor_cookie = waitfor_mock_cookie,
- .time_travel = mock_time_travel };
+ .time_travel = mock_time_travel,
+ .get_current_testcase = get_current_testcase };
symbol = dlsym(handle, "setup_suite");
if (symbol != NULL) {
my_setup_suite.voidptr = symbol;