tests: now we run in tmp dir, always create temporary files in this dir.
authorRusty Russell <rusty@rustcorp.com.au>
Mon, 30 Aug 2010 03:06:23 +0000 (12:36 +0930)
committerRusty Russell <rusty@rustcorp.com.au>
Mon, 30 Aug 2010 03:06:23 +0000 (12:36 +0930)
19 files changed:
ccan/tdb/test/run-3G-file.c
ccan/tdb/test/run-bad-tdb-header.c
ccan/tdb/test/run-check.c
ccan/tdb/test/run-corrupt.c
ccan/tdb/test/run-die-during-transaction.c
ccan/tdb/test/run-endian.c
ccan/tdb/test/run-nested-transactions.c
ccan/tdb/test/run-nested-traverse.c
ccan/tdb/test/run-no-lock-during-traverse.c
ccan/tdb/test/run-open-during-transaction.c
ccan/tdb/test/run-traverse-in-transaction.c
ccan/tdb/test/run.c
ccan/tdb2/test/run-enlarge_hash.c
ccan/tdb2/test/run-expand.c
ccan/tdb2/test/run-new_database.c
ccan/tdb2/test/run-record-expand.c
ccan/tdb2/test/run-simple-delete.c
ccan/tdb2/test/run-simple-fetch.c
ccan/tdb2/test/run-simple-store.c

index 94639113656d9b6967b46c0949f3006db1fab47a..ea395a9c35bdbdef76ae5abf06f72b689ff1737c 100644 (file)
@@ -73,7 +73,7 @@ int main(int argc, char *argv[])
        struct tdb_record rec;
 
        plan_tests(24);
-       tdb = tdb_open("/tmp/test.tdb", 1024, TDB_CLEAR_IF_FIRST,
+       tdb = tdb_open("run-36-file.tdb", 1024, TDB_CLEAR_IF_FIRST,
                       O_CREAT|O_TRUNC|O_RDWR, 0600);
 
        ok1(tdb);
index 3f9b66913870308796de478b36482784f4d4cff1..0303ec26f7d0988a04d6feee40c008f2e7eee73d 100644 (file)
@@ -21,18 +21,18 @@ int main(int argc, char *argv[])
 
        plan_tests(11);
        /* Can open fine if complete crap, as long as O_CREAT. */
-       fd = open("/tmp/test.tdb", O_RDWR|O_CREAT|O_TRUNC, 0600);
+       fd = open("run-bad-tdb-header.tdb", O_RDWR|O_CREAT|O_TRUNC, 0600);
        ok1(fd >= 0);
        ok1(write(fd, "hello world", 11) == 11);
        close(fd);
-       tdb = tdb_open("/tmp/test.tdb", 1024, 0, O_RDWR, 0);
+       tdb = tdb_open("run-bad-tdb-header.tdb", 1024, 0, O_RDWR, 0);
        ok1(!tdb);
-       tdb = tdb_open("/tmp/test.tdb", 1024, 0, O_CREAT|O_RDWR, 0600);
+       tdb = tdb_open("run-bad-tdb-header.tdb", 1024, 0, O_CREAT|O_RDWR, 0600);
        ok1(tdb);
        tdb_close(tdb);
 
        /* Now, with wrong version it should *not* overwrite. */
-       fd = open("/tmp/test.tdb", O_RDWR);
+       fd = open("run-bad-tdb-header.tdb", O_RDWR);
        ok1(fd >= 0);
        ok1(read(fd, &hdr, sizeof(hdr)) == sizeof(hdr));
        ok1(hdr.version == TDB_VERSION);
@@ -41,15 +41,14 @@ int main(int argc, char *argv[])
        ok1(write(fd, &hdr, sizeof(hdr)) == sizeof(hdr));
        close(fd);
 
-       tdb = tdb_open("/tmp/test.tdb", 1024, 0, O_RDWR|O_CREAT, 0600);
+       tdb = tdb_open("run-bad-tdb-header.tdb", 1024, 0, O_RDWR|O_CREAT, 0600);
        ok1(errno == EIO);
        ok1(!tdb);
 
        /* With truncate, will be fine. */
-       tdb = tdb_open("/tmp/test.tdb", 1024, 0, O_RDWR|O_CREAT|O_TRUNC, 0600);
+       tdb = tdb_open("run-bad-tdb-header.tdb", 1024, 0, O_RDWR|O_CREAT|O_TRUNC, 0600);
        ok1(tdb);
        tdb_close(tdb);
-       unlink("/tmp/test.tdb");
 
        return exit_status();
 }
index dfba583fc8a20f9e06a547f389f27b4749e3eb9f..3a4a39f1f32fad5ba55ba689c0b1c9ffec4d9653 100644 (file)
@@ -19,7 +19,7 @@ int main(int argc, char *argv[])
        TDB_DATA key, data;
 
        plan_tests(9);
-       tdb = tdb_open("/tmp/test5.tdb", 1, TDB_CLEAR_IF_FIRST,
+       tdb = tdb_open("run-check.tdb", 1, TDB_CLEAR_IF_FIRST,
                       O_CREAT|O_TRUNC|O_RDWR, 0600);
 
        ok1(tdb);
@@ -34,7 +34,7 @@ int main(int argc, char *argv[])
        ok1(tdb_check(tdb, NULL, NULL) == 0);
        tdb_close(tdb);
 
-       tdb = tdb_open("/tmp/test5.tdb", 1024, 0, O_RDWR, 0);
+       tdb = tdb_open("run-check.tdb", 1024, 0, O_RDWR, 0);
        ok1(tdb);
        ok1(tdb_check(tdb, NULL, NULL) == 0);
        tdb_close(tdb);
index eaa326bdd0e70274ce14fec0804feb5ae133100e..a5c4aa4417e8d5f7b0565a3c6ec5781df6630b68 100644 (file)
@@ -103,7 +103,7 @@ int main(int argc, char *argv[])
 
        plan_tests(4);
        /* This should use mmap. */
-       tdb = tdb_open("/tmp/test6.tdb", 2, TDB_CLEAR_IF_FIRST,
+       tdb = tdb_open("run-corrupt.tdb", 2, TDB_CLEAR_IF_FIRST,
                       O_CREAT|O_TRUNC|O_RDWR, 0600);
 
        if (!tdb)
@@ -112,7 +112,7 @@ int main(int argc, char *argv[])
        tdb_close(tdb);
 
        /* This should not. */
-       tdb = tdb_open("/tmp/test6.tdb", 2, TDB_CLEAR_IF_FIRST|TDB_NOMMAP,
+       tdb = tdb_open("run-corrupt.tdb", 2, TDB_CLEAR_IF_FIRST|TDB_NOMMAP,
                       O_CREAT|O_TRUNC|O_RDWR, 0600);
 
        if (!tdb)
index f8000b553e2ed029ed93785ceec7c24312c02d17..ffb9fe4fbc8d8c942341f32fbbc4c79a6db3dde2 100644 (file)
@@ -37,7 +37,7 @@ static bool in_transaction;
 static bool suppress_logging;
 static int target, current;
 static jmp_buf jmpbuf;
-#define TEST_DBNAME "/tmp/test7.tdb"
+#define TEST_DBNAME "run-die-during-transaction.tdb"
 
 static void taplog(struct tdb_context *tdb,
                   enum tdb_debug_level level,
index 25335a7f5710c71482bf1107fde4242e8e610cfc..9ee877dde5090a1bf3a1e550f75fb5cf0f9bacf8 100644 (file)
@@ -19,7 +19,7 @@ int main(int argc, char *argv[])
        TDB_DATA key, data;
 
        plan_tests(13);
-       tdb = tdb_open("/tmp/test.tdb", 1024, TDB_CLEAR_IF_FIRST|TDB_CONVERT,
+       tdb = tdb_open("run-endian.tdb", 1024, TDB_CLEAR_IF_FIRST|TDB_CONVERT,
                       O_CREAT|O_TRUNC|O_RDWR, 0600);
 
        ok1(tdb);
@@ -46,7 +46,7 @@ int main(int argc, char *argv[])
        tdb_close(tdb);
 
        /* Reopen: should read it */
-       tdb = tdb_open("/tmp/test.tdb", 1024, 0, O_RDWR, 0);
+       tdb = tdb_open("run-endian.tdb", 1024, 0, O_RDWR, 0);
        ok1(tdb);
        
        key.dsize = strlen("hi");
index fd28895527d6e9d5e159b4f826d4fc3b4413603e..b39833638b416e1d4bedde3f29f4ae30d6b8e726 100644 (file)
@@ -22,7 +22,7 @@ int main(int argc, char *argv[])
        key.dsize = strlen("hi");
        key.dptr = (void *)"hi";
 
-       tdb = tdb_open("/tmp/test4.tdb", 1024, TDB_CLEAR_IF_FIRST,
+       tdb = tdb_open("run-nested-transactions.tdb", 1024, TDB_CLEAR_IF_FIRST,
                       O_CREAT|O_TRUNC|O_RDWR, 0600);
        ok1(tdb);
 
@@ -49,7 +49,7 @@ int main(int argc, char *argv[])
        free(data.dptr);
        tdb_close(tdb);
 
-       tdb = tdb_open("/tmp/test4.tdb", 1024, TDB_ALLOW_NESTING, O_RDWR, 0);
+       tdb = tdb_open("run-nested-transactions.tdb", 1024, TDB_ALLOW_NESTING, O_RDWR, 0);
        ok1(tdb);
 
        ok1(tdb_transaction_start(tdb) == 0);
index 054af0d21bc3c5fb62c8b4d34a4632f294d9f97c..156946af1fb82ce61a0856afbeee23554459125f 100644 (file)
@@ -60,7 +60,7 @@ int main(int argc, char *argv[])
        if (!agent)
                err(1, "preparing agent");
 
-       tdb = tdb_open("/tmp/test3.tdb", 1024, TDB_CLEAR_IF_FIRST,
+       tdb = tdb_open("run-nested-traverse.tdb", 1024, TDB_CLEAR_IF_FIRST,
                       O_CREAT|O_TRUNC|O_RDWR, 0600);
        ok1(tdb);
 
index 1eec04b519b9acf73186d58703979d188e7a1c7d..a4f7668ee49ca24ae3073aea92402e66190f11d7 100644 (file)
@@ -78,8 +78,8 @@ int main(int argc, char *argv[])
        int errors = 0;
 
        plan_tests(41);
-       tdb = tdb_open("/tmp/test8.tdb", 1024, TDB_CLEAR_IF_FIRST,
-                      O_CREAT|O_TRUNC|O_RDWR, 0600);
+       tdb = tdb_open("run-no-lock-during-traverse.tdb",
+                      1024, TDB_CLEAR_IF_FIRST, O_CREAT|O_TRUNC|O_RDWR, 0600);
 
        ok1(tdb);
        ok1(prepare_entries(tdb));
index 908dc7da6c44309560793b4abecccff1113af316..0c4934c5939e73f17ad2585e4b6a497550598fbe 100644 (file)
@@ -36,7 +36,7 @@ static bool snapshot_uptodate;
 static char *snapshot;
 static off_t snapshot_len;
 static bool clear_if_first;
-#define TEST_DBNAME "/tmp/test7.tdb"
+#define TEST_DBNAME "run-open-during-transaction.tdb"
 
 #undef write
 #undef pwrite
index 0a74055b6b0b778f35f0d81d327e31acd1723d64..58ff750bb89ab493b4a6476352e0f285350b57f2 100644 (file)
@@ -47,8 +47,8 @@ int main(int argc, char *argv[])
        if (!agent)
                err(1, "preparing agent");
 
-       tdb = tdb_open("/tmp/test2.tdb", 1024, TDB_CLEAR_IF_FIRST,
-                      O_CREAT|O_TRUNC|O_RDWR, 0600);
+       tdb = tdb_open("run-traverse-in-transaction.tdb",
+                      1024, TDB_CLEAR_IF_FIRST, O_CREAT|O_TRUNC|O_RDWR, 0600);
        ok1(tdb);
 
        key.dsize = strlen("hi");
index f7fc2a0a08d8edb7d2ace398691858d0cce759d6..b6202fe70860037db737a268d0fdc018c1762e56 100644 (file)
@@ -19,7 +19,7 @@ int main(int argc, char *argv[])
        TDB_DATA key, data;
 
        plan_tests(10);
-       tdb = tdb_open("/tmp/test.tdb", 1024, TDB_CLEAR_IF_FIRST,
+       tdb = tdb_open("run.tdb", 1024, TDB_CLEAR_IF_FIRST,
                       O_CREAT|O_TRUNC|O_RDWR, 0600);
 
        ok1(tdb);
index 10ded59b205f0fdc2678799cb4dda250da454b6e..539ff51075e4e962b63c882c0b1b7726733fa5ec 100644 (file)
@@ -15,7 +15,7 @@ int main(int argc, char *argv[])
 
        plan_tests(sizeof(flags) / sizeof(flags[0]) * 2 + 1);
        for (i = 0; i < sizeof(flags) / sizeof(flags[0]); i++) {
-               tdb = tdb_open("/tmp/run-new_database.tdb", flags[i],
+               tdb = tdb_open("run-enlarge-hash.tdb", flags[i],
                               O_RDWR|O_CREAT|O_TRUNC, 0600, NULL);
                tdb->log = tap_log_fn;
                ok1(tdb);
index 7785969c921d3aec002dbb76cf9f866d95429131..2319e91bb5ef8579cf0c0f517c36b349e8abf4e5 100644 (file)
@@ -27,7 +27,7 @@ int main(int argc, char *argv[])
 
        /* First, lower level expansion tests. */
        for (i = 0; i < sizeof(flags) / sizeof(flags[0]); i++) {
-               tdb = tdb_open("/tmp/run-new_database.tdb", flags[i],
+               tdb = tdb_open("run-expand.tdb", flags[i],
                               O_RDWR|O_CREAT|O_TRUNC, 0600, NULL);
                tdb->log = tap_log_fn;
                ok1(tdb);
@@ -101,7 +101,7 @@ int main(int argc, char *argv[])
 
        /* Now using tdb_expand. */
        for (i = 0; i < sizeof(flags) / sizeof(flags[0]); i++) {
-               tdb = tdb_open("/tmp/run-new_database.tdb", flags[i],
+               tdb = tdb_open("run-expand.tdb", flags[i],
                               O_RDWR|O_CREAT|O_TRUNC, 0600, NULL);
                tdb->log = tap_log_fn;
                ok1(tdb);
index 28bae2a8dc4b93d0aedf94517dcf14ff3bbecf7a..45675e2e86b4a5ee8b4b87c1a72998369a40bf0b 100644 (file)
@@ -15,7 +15,7 @@ int main(int argc, char *argv[])
 
        plan_tests(sizeof(flags) / sizeof(flags[0]) * 2 + 1);
        for (i = 0; i < sizeof(flags) / sizeof(flags[0]); i++) {
-               tdb = tdb_open("/tmp/run-new_database.tdb", flags[i],
+               tdb = tdb_open("run-new_database", flags[i],
                               O_RDWR|O_CREAT|O_TRUNC, 0600, NULL);
                tdb->log = tap_log_fn;
                ok1(tdb);
index 53befc1d06fb4628dab04a5892cb43f589c1b5aa..918833d9037f239a70f2b9c85fe3c072d87a55f6 100644 (file)
@@ -24,7 +24,7 @@ int main(int argc, char *argv[])
        plan_tests(sizeof(flags) / sizeof(flags[0])
                   * (3 + (1 + (MAX_SIZE/SIZE_STEP)) * 2) + 1);
        for (i = 0; i < sizeof(flags) / sizeof(flags[0]); i++) {
-               tdb = tdb_open("/tmp/run-new_database.tdb", flags[i],
+               tdb = tdb_open("run-record-expand.tdb", flags[i],
                               O_RDWR|O_CREAT|O_TRUNC, 0600, NULL);
                tdb->log = tap_log_fn;
                ok1(tdb);
index 37e9a462cb1b431ceeefa9b00a8dc447e0e3eff3..eb70011124f7b53c501746880842c3e0b5c04453 100644 (file)
@@ -17,7 +17,7 @@ int main(int argc, char *argv[])
 
        plan_tests(sizeof(flags) / sizeof(flags[0]) * 8 + 1);
        for (i = 0; i < sizeof(flags) / sizeof(flags[0]); i++) {
-               tdb = tdb_open("/tmp/run-new_database.tdb", flags[i],
+               tdb = tdb_open("run-simple-delete.tdb", flags[i],
                               O_RDWR|O_CREAT|O_TRUNC, 0600, NULL);
                tdb->log = tap_log_fn;
                ok1(tdb);
index 1802844270f8f0e6e3e31ebb45c5c445b3a8147b..dd4f7d40eda615d315505502eed80a8683ade180 100644 (file)
@@ -17,7 +17,7 @@ int main(int argc, char *argv[])
 
        plan_tests(sizeof(flags) / sizeof(flags[0]) * 8 + 1);
        for (i = 0; i < sizeof(flags) / sizeof(flags[0]); i++) {
-               tdb = tdb_open("/tmp/run-new_database.tdb", flags[i],
+               tdb = tdb_open("run-simple-fetch.tdb", flags[i],
                               O_RDWR|O_CREAT|O_TRUNC, 0600, NULL);
                tdb->log = tap_log_fn;
                ok1(tdb);
index 44ac9071c1fa273929372ceb92db1d8373e90386..4e340da1b22c92d30c4a3f2237e20f43baf1f6e5 100644 (file)
@@ -17,7 +17,7 @@ int main(int argc, char *argv[])
 
        plan_tests(sizeof(flags) / sizeof(flags[0]) * 9 + 1);
        for (i = 0; i < sizeof(flags) / sizeof(flags[0]); i++) {
-               tdb = tdb_open("/tmp/run-new_database.tdb", flags[i],
+               tdb = tdb_open("run-simple-store.tdb", flags[i],
                               O_RDWR|O_CREAT|O_TRUNC, 0600, NULL);
                tdb->log = tap_log_fn;
                ok1(tdb);