summaryrefslogtreecommitdiff
path: root/src/journal/test-journal.c
diff options
context:
space:
mode:
authorLennart Poettering <lennart@poettering.net>2011-11-08 18:20:03 +0100
committerLennart Poettering <lennart@poettering.net>2011-11-08 18:20:03 +0100
commitde190aef08bb267b645205a747762df573b36834 (patch)
tree517b703941012766056f46442d36d93406b55ce9 /src/journal/test-journal.c
parent9b3c575ed90bb1165a192dfae2fb2330baab583c (diff)
journal: implement multiple field matches
Diffstat (limited to 'src/journal/test-journal.c')
-rw-r--r--src/journal/test-journal.c41
1 files changed, 28 insertions, 13 deletions
diff --git a/src/journal/test-journal.c b/src/journal/test-journal.c
index 93e2b4dab..45ced12b4 100644
--- a/src/journal/test-journal.c
+++ b/src/journal/test-journal.c
@@ -31,6 +31,7 @@ int main(int argc, char *argv[]) {
struct iovec iovec;
static const char test[] = "test", test2[] = "test2";
Object *o;
+ uint64_t p;
log_set_max_level(LOG_DEBUG);
@@ -54,41 +55,55 @@ int main(int argc, char *argv[]) {
journal_file_dump(f);
- assert(journal_file_next_entry(f, NULL, DIRECTION_DOWN, &o, NULL) == 1);
+ assert(journal_file_next_entry(f, NULL, 0, DIRECTION_DOWN, &o, &p) == 1);
assert(le64toh(o->entry.seqnum) == 1);
- assert(journal_file_next_entry(f, o, DIRECTION_DOWN, &o, NULL) == 1);
+ assert(journal_file_next_entry(f, o, p, DIRECTION_DOWN, &o, &p) == 1);
assert(le64toh(o->entry.seqnum) == 2);
- assert(journal_file_next_entry(f, o, DIRECTION_DOWN, &o, NULL) == 1);
+ assert(journal_file_next_entry(f, o, p, DIRECTION_DOWN, &o, &p) == 1);
assert(le64toh(o->entry.seqnum) == 3);
- assert(journal_file_next_entry(f, o, DIRECTION_DOWN, &o, NULL) == 0);
+ assert(journal_file_next_entry(f, o, p, DIRECTION_DOWN, &o, &p) == 0);
- assert(journal_file_find_first_entry(f, test, strlen(test), DIRECTION_DOWN, &o, NULL) == 1);
+ assert(journal_file_next_entry(f, NULL, 0, DIRECTION_DOWN, &o, &p) == 1);
assert(le64toh(o->entry.seqnum) == 1);
- assert(journal_file_find_first_entry(f, test, strlen(test), DIRECTION_UP, &o, NULL) == 1);
+ assert(journal_file_skip_entry(f, o, p, 2, &o, &p) == 1);
assert(le64toh(o->entry.seqnum) == 3);
- assert(journal_file_find_first_entry(f, test2, strlen(test2), DIRECTION_UP, &o, NULL) == 1);
+ assert(journal_file_skip_entry(f, o, p, -2, &o, &p) == 1);
+ assert(le64toh(o->entry.seqnum) == 1);
+
+ assert(journal_file_skip_entry(f, o, p, -2, &o, &p) == 1);
+ assert(le64toh(o->entry.seqnum) == 1);
+
+ assert(journal_file_find_data_object(f, test, strlen(test), NULL, &p) == 1);
+ assert(journal_file_next_entry_for_data(f, NULL, 0, p, DIRECTION_DOWN, &o, NULL) == 1);
+ assert(le64toh(o->entry.seqnum) == 1);
+
+ assert(journal_file_next_entry_for_data(f, NULL, 0, p, DIRECTION_UP, &o, NULL) == 1);
+ assert(le64toh(o->entry.seqnum) == 3);
+
+ assert(journal_file_find_data_object(f, test2, strlen(test2), NULL, &p) == 1);
+ assert(journal_file_next_entry_for_data(f, NULL, 0, p, DIRECTION_UP, &o, NULL) == 1);
assert(le64toh(o->entry.seqnum) == 2);
- assert(journal_file_find_first_entry(f, test2, strlen(test2), DIRECTION_DOWN, &o, NULL) == 1);
+ assert(journal_file_next_entry_for_data(f, NULL, 0, p, DIRECTION_DOWN, &o, NULL) == 1);
assert(le64toh(o->entry.seqnum) == 2);
- assert(journal_file_find_first_entry(f, "quux", 4, DIRECTION_DOWN, &o, NULL) == 0);
+ assert(journal_file_find_data_object(f, "quux", 4, NULL, &p) == 0);
- assert(journal_file_move_to_entry(f, 1, &o, NULL) == 1);
+ assert(journal_file_move_to_entry_by_seqnum(f, 1, DIRECTION_DOWN, &o, NULL) == 1);
assert(le64toh(o->entry.seqnum) == 1);
- assert(journal_file_move_to_entry(f, 3, &o, NULL) == 1);
+ assert(journal_file_move_to_entry_by_seqnum(f, 3, DIRECTION_DOWN, &o, NULL) == 1);
assert(le64toh(o->entry.seqnum) == 3);
- assert(journal_file_move_to_entry(f, 2, &o, NULL) == 1);
+ assert(journal_file_move_to_entry_by_seqnum(f, 2, DIRECTION_DOWN, &o, NULL) == 1);
assert(le64toh(o->entry.seqnum) == 2);
- assert(journal_file_move_to_entry(f, 10, &o, NULL) == 0);
+ assert(journal_file_move_to_entry_by_seqnum(f, 10, DIRECTION_DOWN, &o, NULL) == 0);
journal_file_rotate(&f);
journal_file_rotate(&f);