From 40cf08823dadb7f2f9cb3b32c2e64b6242522ef4 Mon Sep 17 00:00:00 2001 From: Rusty Russell Date: Mon, 18 Jun 2012 22:30:29 +0930 Subject: ntdb: enhance external-helper test code. Our external test helper is a bit primitive when it comes to doing STORE or FETCH commands: let us specify the data we expect, instead of assuming it's the same as the key. Signed-off-by: Rusty Russell --- lib/ntdb/test/run-lockall.c | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) (limited to 'lib/ntdb/test/run-lockall.c') diff --git a/lib/ntdb/test/run-lockall.c b/lib/ntdb/test/run-lockall.c index 964164e20b..c4bfb0e5cd 100644 --- a/lib/ntdb/test/run-lockall.c +++ b/lib/ntdb/test/run-lockall.c @@ -13,6 +13,7 @@ #include "logging.h" #define TEST_DBNAME "run-lockall.ntdb" +#define KEY_STR "key" #undef fcntl @@ -40,26 +41,29 @@ int main(int argc, char *argv[]) ok1(ret == SUCCESS); ok1(ntdb_lockall(ntdb) == NTDB_SUCCESS); - ok1(external_agent_operation(agent, STORE, "key") + ok1(external_agent_operation(agent, STORE, KEY_STR "=" KEY_STR) == WOULD_HAVE_BLOCKED); - ok1(external_agent_operation(agent, FETCH, "key") + ok1(external_agent_operation(agent, FETCH, KEY_STR "=" KEY_STR) == WOULD_HAVE_BLOCKED); /* Test nesting. */ ok1(ntdb_lockall(ntdb) == NTDB_SUCCESS); ntdb_unlockall(ntdb); ntdb_unlockall(ntdb); - ok1(external_agent_operation(agent, STORE, "key") == SUCCESS); + ok1(external_agent_operation(agent, STORE, KEY_STR "=" KEY_STR) + == SUCCESS); ok1(ntdb_lockall_read(ntdb) == NTDB_SUCCESS); - ok1(external_agent_operation(agent, STORE, "key") + ok1(external_agent_operation(agent, STORE, KEY_STR "=" KEY_STR) == WOULD_HAVE_BLOCKED); - ok1(external_agent_operation(agent, FETCH, "key") == SUCCESS); + ok1(external_agent_operation(agent, FETCH, KEY_STR "=" KEY_STR) + == SUCCESS); ok1(ntdb_lockall_read(ntdb) == NTDB_SUCCESS); ntdb_unlockall_read(ntdb); ntdb_unlockall_read(ntdb); - ok1(external_agent_operation(agent, STORE, "key") == SUCCESS); + ok1(external_agent_operation(agent, STORE, KEY_STR "=" KEY_STR) + == SUCCESS); ok1(external_agent_operation(agent, CLOSE, NULL) == SUCCESS); ntdb_close(ntdb); } -- cgit