From 5ec43055103f8890e957a163f094431fcdbcbd74 Mon Sep 17 00:00:00 2001 From: Rusty Russell Date: Wed, 20 Jun 2012 21:31:21 +0930 Subject: ntdb: fix occasional abort in testing. Occasionally, the capability test inserts multiple used records and they clash, but our primitive test layout engine doesn't handle hash clashes and aborts. Force a seed value which we know doesn't clash. Reported-by: Andrew Bartlett Signed-off-by: Rusty Russell Autobuild-User(master): Rusty Russell Autobuild-Date(master): Wed Jun 20 16:50:20 CEST 2012 on sn-devel-104 --- lib/ntdb/test/run-capabilities.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) (limited to 'lib/ntdb') diff --git a/lib/ntdb/test/run-capabilities.c b/lib/ntdb/test/run-capabilities.c index cb03746862..6503214c06 100644 --- a/lib/ntdb/test/run-capabilities.c +++ b/lib/ntdb/test/run-capabilities.c @@ -30,6 +30,12 @@ static void create_ntdb(const char *name, struct ntdb_layout *layout; struct ntdb_context *ntdb; int fd, clen; + union ntdb_attribute seed_attr; + + /* Force a seed which doesn't allow records to clash! */ + seed_attr.base.attr = NTDB_ATTRIBUTE_SEED; + seed_attr.base.next = &tap_log_attr; + seed_attr.seed.seed = 0; key = ntdb_mkdata("Hello", 5); data = ntdb_mkdata("world", 5); @@ -61,7 +67,7 @@ static void create_ntdb(const char *name, va_end(ap); /* We open-code this, because we need to use the failtest write. */ - ntdb = ntdb_layout_get(layout, failtest_free, &tap_log_attr); + ntdb = ntdb_layout_get(layout, failtest_free, &seed_attr); fd = open(name, O_RDWR|O_TRUNC|O_CREAT, 0600); if (fd < 0) -- cgit