Though when doing `make check-python` the dump is intermixed into testing output :(
Cc: [email protected] Signed-off-by: Kirill Smelkov <[email protected]> --- lib/tdb/pytdb.c | 15 +++++++++++++++ lib/tdb/python/tests/simple.py | 7 +++++++ 2 files changed, 22 insertions(+), 0 deletions(-) diff --git a/lib/tdb/pytdb.c b/lib/tdb/pytdb.c index 55a193b..706e868 100644 --- a/lib/tdb/pytdb.c +++ b/lib/tdb/pytdb.c @@ -414,6 +414,18 @@ static PyObject *obj_clear(PyTdbObject *self) Py_RETURN_NONE; } +static PyObject *obj_dump_all(PyTdbObject *self) +{ + tdb_dump_all(self->ctx); + Py_RETURN_NONE; +} + +static PyObject *obj_printfreelist(PyTdbObject *self) +{ + tdb_printfreelist(self->ctx); + Py_RETURN_NONE; +} + static PyMethodDef tdb_object_methods[] = { { "transaction_cancel", (PyCFunction)obj_transaction_cancel, METH_NOARGS, "S.transaction_cancel() -> None\n" @@ -465,6 +477,9 @@ static PyMethodDef tdb_object_methods[] = { { "iterkeys", (PyCFunction)tdb_object_iter, METH_NOARGS, "S.iterkeys() -> iterator" }, { "clear", (PyCFunction)obj_clear, METH_NOARGS, "S.clear() -> None\n" "Wipe the entire database." }, + { "dump_all", (PyCFunction)obj_dump_all, METH_NOARGS, "S.dump_all() -> None" }, + { "printfreelist", (PyCFunction)obj_printfreelist, METH_NOARGS, + "S.print_freelist -> None" }, { NULL } }; diff --git a/lib/tdb/python/tests/simple.py b/lib/tdb/python/tests/simple.py index 6f14340..0dfa9d0 100644 --- a/lib/tdb/python/tests/simple.py +++ b/lib/tdb/python/tests/simple.py @@ -163,6 +163,13 @@ class SimpleTdbTests(TestCase): self.tdb.clear() self.assertEquals(0, len(list(self.tdb))) + def test_dump(self): + self.tdb["foo"] = "1" + self.tdb["bar"] = "2" + # XXX temp. redirect stdout to /dev/null ? + self.tdb.dump_all() + self.tdb.printfreelist() + def test_len(self): self.assertEquals(0, len(list(self.tdb))) self.tdb["entry"] = "value" -- 1.7.3.rc2 -- To UNSUBSCRIBE, email to [email protected] with a subject of "unsubscribe". Trouble? Contact [email protected]

