tdbtorture: print details when run with -n 1
authorDavid Disseldorp <ddiss@samba.org>
Fri, 15 Aug 2014 12:47:49 +0000 (14:47 +0200)
committerDavid Disseldorp <ddiss@samba.org>
Mon, 18 Aug 2014 11:26:32 +0000 (13:26 +0200)
Currently tdbtorture prints the test details (processes, loops, etc.)
from the first forked child process.
When run with -n 1 (one process), the test is run from within the
parent and no details are printed. This change ensures that they are.

Signed-off-by: David Disseldorp <ddiss@samba.org>
Reviewed-by: Volker Lendecke <vl@samba.org>
Autobuild-User(master): David Disseldorp <ddiss@samba.org>
Autobuild-Date(master): Mon Aug 18 13:26:32 CEST 2014 on sn-devel-104

lib/tdb/tools/tdbtorture.c

index 3e26f65242b5da5970ba23f5aca63f6407ebd860..927868810410915a09f82996be1b914c06d1724c 100644 (file)
@@ -350,6 +350,10 @@ int main(int argc, char * const *argv)
                seed = (getpid() + time(NULL)) & 0x7FFFFFFF;
        }
 
+       printf("Testing with %d processes, %d loops, %d hash_size, seed=%d%s\n",
+              num_procs, num_loops, hash_size, seed,
+              (always_transaction ? " (all within transactions)" : ""));
+
        if (num_procs == 1 && !kill_random) {
                /* Don't fork for this case, makes debugging easier. */
                error_count = run_child(test_tdb, 0, seed, num_loops, 0);
@@ -376,10 +380,6 @@ int main(int argc, char * const *argv)
        for (i=0;i<num_procs;i++) {
                if ((pids[i]=fork()) == 0) {
                        close(pfds[0]);
-                       if (i == 0) {
-                               printf("Testing with %d processes, %d loops, %d hash_size, seed=%d%s\n",
-                                      num_procs, num_loops, hash_size, seed, always_transaction ? " (all within transactions)" : "");
-                       }
                        exit(run_child(test_tdb, i, seed, num_loops, 0));
                }
        }