r7178: If we're using one process in NETBENCH simultion only open one
authorJeremy Allison <jra@samba.org>
Wed, 1 Jun 2005 23:10:11 +0000 (23:10 +0000)
committerGerald (Jerry) Carter <jerry@samba.org>
Wed, 10 Oct 2007 18:17:23 +0000 (13:17 -0500)
connection to the server. Makes valgrind/cachegrind on the server
easier.
Jeremy.
(This used to be commit fba9462591864a4efcfae653e1cef81f08299f92)

source4/torture/nbench/nbench.c

index 748ff90467462255c82fc59f1b042d179ae528ac..7d293494413fe0f2423279d91a788426d1c8ad7b 100644 (file)
@@ -32,6 +32,7 @@ static const char *loadfile;
 /* run a test that simulates an approximate netbench client load */
 static BOOL run_netbench(struct smbcli_state *cli, int client)
 {
+       extern int torture_nprocs;
        int i;
        pstring line;
        char *cname;
@@ -40,6 +41,12 @@ static BOOL run_netbench(struct smbcli_state *cli, int client)
        const char *p;
        BOOL correct = True;
 
+       if (torture_nprocs == 1) {
+               if (!torture_setup_dir(cli, "\\clients")) {
+                       return False;
+               }
+       }
+
        nb_setup(cli, client);
 
        asprintf(&cname, "client%d", client+1);
@@ -173,12 +180,14 @@ BOOL torture_nbench(void)
                loadfile = "client.txt";
        }
 
-       if (!torture_open_connection(&cli)) {
-               return False;
-       }
+       if (torture_nprocs > 1) {
+               if (!torture_open_connection(&cli)) {
+                       return False;
+               }
 
-       if (!torture_setup_dir(cli, "\\clients")) {
-               return False;
+               if (!torture_setup_dir(cli, "\\clients")) {
+                       return False;
+               }
        }
 
        nbio_shmem(torture_nprocs, timelimit, warmup);