diff options
author | Rusty Russell <rusty@rustcorp.com.au> | 2012-02-14 04:05:43 +1030 |
---|---|---|
committer | Rusty Russell <rusty@rustcorp.com.au> | 2012-02-14 04:05:43 +1030 |
commit | 0802791081ba39298aa93f0e6860c3b62800df73 (patch) | |
tree | 9de98d155090cdb4c6b498e37938890be8514d8b /lib/tdb/test/external-agent.h | |
parent | 390b9a2dd8447ecd16e3957c02fa886781797733 (diff) | |
download | samba-0802791081ba39298aa93f0e6860c3b62800df73.tar.gz samba-0802791081ba39298aa93f0e6860c3b62800df73.tar.bz2 samba-0802791081ba39298aa93f0e6860c3b62800df73.zip |
tdb: import unit tests from CCAN into tdb/test/
I pulled tdb into CCAN as an experiment a while ago; it doesn't belong
there, but it has accumulated some important unit tests.
These are copied from CCAN version init-1486-gc438ec1 with #include "../"
changed to #include "../common/".
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
Diffstat (limited to 'lib/tdb/test/external-agent.h')
-rw-r--r-- | lib/tdb/test/external-agent.h | 41 |
1 files changed, 41 insertions, 0 deletions
diff --git a/lib/tdb/test/external-agent.h b/lib/tdb/test/external-agent.h new file mode 100644 index 0000000000..dffdca962f --- /dev/null +++ b/lib/tdb/test/external-agent.h @@ -0,0 +1,41 @@ +#ifndef TDB_TEST_EXTERNAL_AGENT_H +#define TDB_TEST_EXTERNAL_AGENT_H + +/* For locking tests, we need a different process to try things at + * various times. */ +enum operation { + OPEN, + OPEN_WITH_CLEAR_IF_FIRST, + TRANSACTION_START, + FETCH, + STORE, + TRANSACTION_COMMIT, + CHECK, + NEEDS_RECOVERY, + CLOSE, +}; + +/* Do this before doing any tdb stuff. Return handle, or -1. */ +struct agent *prepare_external_agent(void); + +enum agent_return { + SUCCESS, + WOULD_HAVE_BLOCKED, + AGENT_DIED, + FAILED, /* For fetch, or NEEDS_RECOVERY */ + OTHER_FAILURE, +}; + +/* Ask the external agent to try to do an operation. + * name == tdb name for OPEN/OPEN_WITH_CLEAR_IF_FIRST, + * record name for FETCH/STORE (store stores name as data too) + */ +enum agent_return external_agent_operation(struct agent *handle, + enum operation op, + const char *name); + +/* Mapping enum -> string. */ +const char *agent_return_name(enum agent_return ret); +const char *operation_name(enum operation op); + +#endif /* TDB_TEST_EXTERNAL_AGENT_H */ |