summaryrefslogtreecommitdiff
path: root/lib/ntdb/test/api-83-openhook.c
diff options
context:
space:
mode:
authorRusty Russell <rusty@rustcorp.com.au>2012-06-18 22:30:29 +0930
committerRusty Russell <rusty@rustcorp.com.au>2012-06-19 05:38:06 +0200
commit40cf08823dadb7f2f9cb3b32c2e64b6242522ef4 (patch)
tree92ae2284e9c3c7277b9b724a7cd828d76f982716 /lib/ntdb/test/api-83-openhook.c
parent3bccb610c166df1ce2ea5c8a80daa451bd6edf67 (diff)
downloadsamba-40cf08823dadb7f2f9cb3b32c2e64b6242522ef4.tar.gz
samba-40cf08823dadb7f2f9cb3b32c2e64b6242522ef4.tar.bz2
samba-40cf08823dadb7f2f9cb3b32c2e64b6242522ef4.zip
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 <rusty@rustcorp.com.au>
Diffstat (limited to 'lib/ntdb/test/api-83-openhook.c')
-rw-r--r--lib/ntdb/test/api-83-openhook.c10
1 files changed, 7 insertions, 3 deletions
diff --git a/lib/ntdb/test/api-83-openhook.c b/lib/ntdb/test/api-83-openhook.c
index 9f474c9ab8..666b4b8d8f 100644
--- a/lib/ntdb/test/api-83-openhook.c
+++ b/lib/ntdb/test/api-83-openhook.c
@@ -11,6 +11,8 @@
#include "external-agent.h"
#include "logging.h"
+#define KEY_STR "key"
+
static enum NTDB_ERROR clear_if_first(int fd, void *arg)
{
/* We hold a lock offset 4 always, so we can tell if anyone is holding it.
@@ -45,7 +47,7 @@ int main(int argc, char *argv[])
struct ntdb_context *ntdb;
struct agent *agent;
union ntdb_attribute cif;
- NTDB_DATA key = ntdb_mkdata("key", 3);
+ NTDB_DATA key = ntdb_mkdata(KEY_STR, strlen(KEY_STR));
int flags[] = { NTDB_DEFAULT, NTDB_NOMMAP,
NTDB_CONVERT, NTDB_NOMMAP|NTDB_CONVERT };
@@ -74,7 +76,8 @@ int main(int argc, char *argv[])
/* Agent should not clear it, since it's still open. */
ok1(external_agent_operation(agent, OPEN_WITH_HOOK,
"run-83-openhook.ntdb") == SUCCESS);
- ok1(external_agent_operation(agent, FETCH, "key") == SUCCESS);
+ ok1(external_agent_operation(agent, FETCH, KEY_STR "=" KEY_STR)
+ == SUCCESS);
ok1(external_agent_operation(agent, CLOSE, "") == SUCCESS);
/* Still exists for us too. */
@@ -85,7 +88,8 @@ int main(int argc, char *argv[])
ok1(external_agent_operation(agent, OPEN_WITH_HOOK,
"run-83-openhook.ntdb") == SUCCESS);
- ok1(external_agent_operation(agent, FETCH, "key") == FAILED);
+ ok1(external_agent_operation(agent, FETCH, KEY_STR "=" KEY_STR)
+ == FAILED);
ok1(external_agent_operation(agent, CLOSE, "") == SUCCESS);
ok1(tap_log_messages == 0);