]> git.sur5r.net Git - openldap/commitdiff
split operations in inner/outer loops
authorPierangelo Masarati <ando@openldap.org>
Fri, 3 Mar 2006 16:02:34 +0000 (16:02 +0000)
committerPierangelo Masarati <ando@openldap.org>
Fri, 3 Mar 2006 16:02:34 +0000 (16:02 +0000)
tests/progs/slapd-addel.c
tests/progs/slapd-bind.c
tests/progs/slapd-modify.c
tests/progs/slapd-modrdn.c
tests/progs/slapd-read.c
tests/progs/slapd-search.c
tests/progs/slapd-tester.c

index dc94d83a05b0aeaeb5967231a78405bce4f6dc91..5c437634fff20128f029995d3878b538bf29effb 100644 (file)
@@ -56,6 +56,7 @@ usage( char *name )
                "-w <passwd> "
                "-f <addfile> "
                "[-l <loops>] "
+               "[-L <outerloops>] "
                "[-r <maxretries>] "
                "[-t <delay>] "
                "[-F]\n",
@@ -75,6 +76,7 @@ main( int argc, char **argv )
        char            *filename = NULL;
        char            *entry = NULL;
        int             loops = LOOPS;
+       int             outerloops = 1;
        int             retries = RETRIES;
        int             delay = 0;
        int             friendly = 0;
@@ -82,7 +84,7 @@ main( int argc, char **argv )
 
        tester_init( "slapd-modify" );
 
-       while ( (i = getopt( argc, argv, "FH:h:p:D:w:f:l:r:t:" )) != EOF ) {
+       while ( (i = getopt( argc, argv, "FH:h:p:D:w:f:l:L:r:t:" )) != EOF ) {
                switch( i ) {
                case 'F':
                        friendly++;
@@ -121,6 +123,12 @@ main( int argc, char **argv )
                        }
                        break;
 
+               case 'L':               /* the number of outerloops */
+                       if ( lutil_atoi( &outerloops, optarg ) != 0 ) {
+                               usage( argv[0] );
+                       }
+                       break;
+
                case 'r':               /* number of retries */
                        if ( lutil_atoi( &retries, optarg ) != 0 ) {
                                usage( argv[0] );
@@ -162,8 +170,10 @@ main( int argc, char **argv )
 
        uri = tester_uri( uri, host, port );
 
-       do_addel( uri, manager, &passwd, entry, attrs,
-                       loops, retries, delay, friendly );
+       for ( i = 0; i < outerloops; i++ ) {
+               do_addel( uri, manager, &passwd, entry, attrs,
+                               loops, retries, delay, friendly );
+       }
 
        exit( EXIT_SUCCESS );
 }
index 45ebd51dda21f284a7479f92a92764f0ace0b20a..c538e4ff7aa9423a9162653dad546e6aad30e064 100644 (file)
@@ -55,8 +55,17 @@ do_base( char *uri, struct berval *base, struct berval *pass, int maxloop, int f
 static void
 usage( char *name )
 {
-       fprintf( stderr, "usage: %s [-h <host>] -p port (-D <dn>|-b <baseDN> [-f <searchfilter>]) -w <passwd> [-l <loops>] [-F] [-I] [-t delay]\n",
-                       name );
+       fprintf( stderr, "usage: %s "
+               "[-h <host>] "
+               "-p port "
+               "(-D <dn>|-b <baseDN> [-f <searchfilter>]) "
+               "-w <passwd> "
+               "[-l <loops>] "
+               "[-L <outerloops>] "
+               "[-F] "
+               "[-I] "
+               "[-t delay]\n",
+               name );
        exit( EXIT_FAILURE );
 }
 
@@ -73,13 +82,14 @@ main( int argc, char **argv )
        struct berval   pass = { 0, NULL };
        int             port = -1;
        int             loops = LOOPS;
+       int             outerloops = 1;
        int             force = 0;
        int             noinit = 0;
        int             delay = 0;
 
        tester_init( "slapd-bind" );
 
-       while ( (i = getopt( argc, argv, "b:H:h:p:D:w:l:f:FIt:" )) != EOF ) {
+       while ( (i = getopt( argc, argv, "b:H:h:p:D:w:l:L:f:FIt:" )) != EOF ) {
                switch( i ) {
                        case 'b':               /* base DN of a tree of user DNs */
                                ber_str2bv( optarg, 0, 0, &base );
@@ -114,6 +124,12 @@ main( int argc, char **argv )
                                }
                                break;
 
+                       case 'L':               /* the number of outerloops */
+                               if ( lutil_atoi( &outerloops, optarg ) != 0 ) {
+                                       usage( argv[0] );
+                               }
+                               break;
+
                        case 'f':
                                filter = optarg;
                                break;
@@ -146,11 +162,14 @@ main( int argc, char **argv )
 
        uri = tester_uri( uri, host, port );
 
-       if ( base.bv_val != NULL ) {
-               do_base( uri, &base, &pass, ( 20 * loops ), force, noinit, delay );
-       } else {
-               do_bind( uri, dn, &pass, ( 20 * loops ), force, noinit, NULL );
+       for ( i = 0; i < outerloops; i++ ) {
+               if ( base.bv_val != NULL ) {
+                       do_base( uri, &base, &pass, loops, force, noinit, delay );
+               } else {
+                       do_bind( uri, dn, &pass, loops, force, noinit, NULL );
+               }
        }
+
        exit( EXIT_SUCCESS );
 }
 
index 510571c91494bfa2224bc37cae44960a1af0bfed..4be8a5d97d40848880d5b9c1b6e91e5ae33c2314 100644 (file)
@@ -50,6 +50,7 @@ usage( char *name )
                "-w <passwd> "
                "-e <entry> "
                "[-l <loops>] "
+               "[-L <outerloops>] "
                "[-r <maxretries>] "
                "[-t <delay>] "
                "[-F]\n",
@@ -70,13 +71,14 @@ main( int argc, char **argv )
        char            *ava = NULL;
        char            *value = NULL;
        int             loops = LOOPS;
+       int             outerloops = 1;
        int             retries = RETRIES;
        int             delay = 0;
        int             friendly = 0;
 
        tester_init( "slapd-modify" );
 
-       while ( (i = getopt( argc, argv, "FH:h:p:D:w:e:a:l:r:t:" )) != EOF ) {
+       while ( (i = getopt( argc, argv, "FH:h:p:D:w:e:a:l:L:r:t:" )) != EOF ) {
                switch( i ) {
                case 'F':
                        friendly++;
@@ -119,6 +121,12 @@ main( int argc, char **argv )
                        }
                        break;
 
+               case 'L':               /* the number of outerloops */
+                       if ( lutil_atoi( &outerloops, optarg ) != 0 ) {
+                               usage( argv[0] );
+                       }
+                       break;
+
                case 'r':               /* number of retries */
                        if ( lutil_atoi( &retries, optarg ) != 0 ) {
                                usage( argv[0] );
@@ -164,8 +172,11 @@ main( int argc, char **argv )
 
        uri = tester_uri( uri, host, port );
 
-       do_modify( uri, manager, &passwd, entry, ava, value,
-                       loops, retries, delay, friendly );
+       for ( i = 0; i < outerloops; i++ ) {
+               do_modify( uri, manager, &passwd, entry, ava, value,
+                               loops, retries, delay, friendly );
+       }
+
        exit( EXIT_SUCCESS );
 }
 
index 8695e172a482328875ffe33289a4b8012b586328..b28ae2848439f48b6def20a6936ca5f53c37cf92 100644 (file)
@@ -53,6 +53,7 @@ usage( char *name )
                "-w <passwd> "
                "-e <entry> "
                "[-l <loops>] "
+               "[-L <outerloops>] "
                "[-r <maxretries>] "
                "[-t <delay>] "
                "[-F]\n",
@@ -71,13 +72,14 @@ main( int argc, char **argv )
        struct berval   passwd = { 0, NULL };
        char            *entry = NULL;
        int             loops = LOOPS;
+       int             outerloops = 1;
        int             retries = RETRIES;
        int             delay = 0;
        int             friendly = 0;
 
        tester_init( "slapd-modrdn" );
 
-       while ( (i = getopt( argc, argv, "FH:h:p:D:w:e:l:r:t:" )) != EOF ) {
+       while ( (i = getopt( argc, argv, "FH:h:p:D:w:e:l:L:r:t:" )) != EOF ) {
                switch( i ) {
                case 'F':
                        friendly++;
@@ -116,6 +118,12 @@ main( int argc, char **argv )
                        }
                        break;
 
+               case 'L':               /* the number of outerloops */
+                       if ( lutil_atoi( &outerloops, optarg ) != 0 ) {
+                               usage( argv[0] );
+                       }
+                       break;
+
                case 'r':               /* the number of retries */
                        if ( lutil_atoi( &retries, optarg ) != 0 ) {
                                usage( argv[0] );
@@ -147,8 +155,11 @@ main( int argc, char **argv )
 
        uri = tester_uri( uri, host, port );
 
-       do_modrdn( uri, manager, &passwd, entry,
-                       loops, retries, delay, friendly );
+       for ( i = 0; i < outerloops; i++ ) {
+               do_modrdn( uri, manager, &passwd, entry,
+                               loops, retries, delay, friendly );
+       }
+
        exit( EXIT_SUCCESS );
 }
 
index 6d5858d4e58872edf5b990db14a7e9fc704bd118..493b4b74b2da343fc2ee15e784488cfb44af976e 100644 (file)
@@ -50,9 +50,10 @@ usage( char *name )
                "-H <uri> | ([-h <host>] -p <port>) "
                "-e <entry> "
                "[-l <loops>] "
+               "[-L <outerloops>] "
                "[-r <maxretries>] "
                "[-t <delay>]\n",
-                       name );
+               name );
        exit( EXIT_FAILURE );
 }
 
@@ -65,12 +66,13 @@ main( int argc, char **argv )
        int             port = -1;
        char            *entry = NULL;
        int             loops = LOOPS;
+       int             outerloops = 1;
        int             retries = RETRIES;
        int             delay = 0;
 
        tester_init( "slapd-read" );
 
-       while ( (i = getopt( argc, argv, "H:h:p:e:l:r:t:" )) != EOF ) {
+       while ( (i = getopt( argc, argv, "H:h:p:e:l:L:r:t:" )) != EOF ) {
                switch( i ) {
                case 'H':               /* the server uri */
                        uri = strdup( optarg );
@@ -96,6 +98,12 @@ main( int argc, char **argv )
                        }
                        break;
 
+               case 'L':               /* the number of outerloops */
+                       if ( lutil_atoi( &outerloops, optarg ) != 0 ) {
+                               usage( argv[0] );
+                       }
+                       break;
+
                case 'r':               /* the number of retries */
                        if ( lutil_atoi( &retries, optarg ) != 0 ) {
                                usage( argv[0] );
@@ -125,7 +133,10 @@ main( int argc, char **argv )
 
        uri = tester_uri( uri, host, port );
 
-       do_read( uri, entry, ( 20 * loops ), retries, delay );
+       for ( i = 0; i < outerloops; i++ ) {
+               do_read( uri, entry, loops, retries, delay );
+       }
+
        exit( EXIT_SUCCESS );
 }
 
index 9d66783ef4fc0e02ce006a6bed8bf247f3778afb..80a6c3f1d2168041a1390e31efb2c4622d05bcbb 100644 (file)
@@ -40,7 +40,8 @@
 
 static void
 do_search( char *uri, char *manager, struct berval *passwd,
-               char *sbase, char *filter, int maxloop, int maxretries, int delay );
+       char *sbase, char *filter, int innerloop,
+       int maxretries, int delay );
 
 static void
 usage( char *name )
@@ -53,6 +54,7 @@ usage( char *name )
                "-b <searchbase> "
                "-f <searchfilter> "
                "[-l <loops>] "
+               "[-L <outerloops>] "
                "[-r <maxretries>] "
                "[-t <delay>]\n",
                        name );
@@ -71,12 +73,13 @@ main( int argc, char **argv )
        char            *sbase = NULL;
        char            *filter  = NULL;
        int             loops = LOOPS;
+       int             outerloops = 1;
        int             retries = RETRIES;
        int             delay = 0;
 
        tester_init( "slapd-search" );
 
-       while ( (i = getopt( argc, argv, "b:D:f:H:h:l:p:w:r:t:" )) != EOF ) {
+       while ( (i = getopt( argc, argv, "b:D:f:H:h:l:L:p:w:r:t:" )) != EOF ) {
                switch( i ) {
                case 'H':               /* the server uri */
                        uri = strdup( optarg );
@@ -115,6 +118,12 @@ main( int argc, char **argv )
                        }
                        break;
 
+               case 'L':               /* number of loops */
+                       if ( lutil_atoi( &outerloops, optarg ) != 0 ) {
+                               usage( argv[0] );
+                       }
+                       break;
+
                case 'r':               /* number of retries */
                        if ( lutil_atoi( &retries, optarg ) != 0 ) {
                                usage( argv[0] );
@@ -146,15 +155,18 @@ main( int argc, char **argv )
 
        uri = tester_uri( uri, host, port );
 
-       do_search( uri, manager, &passwd, sbase, filter,
-                       ( 10 * loops ), retries, delay );
+       for ( i = 0; i < outerloops; i++ ) {
+               do_search( uri, manager, &passwd, sbase, filter,
+                               loops, retries, delay );
+       }
+
        exit( EXIT_SUCCESS );
 }
 
 
 static void
 do_search( char *uri, char *manager, struct berval *passwd,
-               char *sbase, char *filter, int maxloop, int maxretries, int delay )
+               char *sbase, char *filter, int innerloop, int maxretries, int delay )
 {
        LDAP    *ld = NULL;
        int     i = 0, do_retry = maxretries;
@@ -174,7 +186,7 @@ retry:;
 
        if ( do_retry == maxretries ) {
                fprintf( stderr, "PID=%ld - Search(%d): base=\"%s\", filter=\"%s\".\n",
-                               (long) pid, maxloop, sbase, filter );
+                               (long) pid, innerloop, sbase, filter );
        }
 
        rc = ldap_sasl_bind_s( ld, manager, LDAP_SASL_SIMPLE, passwd, NULL, NULL, NULL );
@@ -198,7 +210,7 @@ retry:;
                exit( EXIT_FAILURE );
        }
 
-       for ( ; i < maxloop; i++ ) {
+       for ( ; i < innerloop; i++ ) {
                LDAPMessage *res;
 
                rc = ldap_search_ext_s( ld, sbase, LDAP_SCOPE_SUBTREE,
index 19c18bf0b35516c5896d2d2ec665b622b7c54f1e..8b818da5551fd092b8f2d1841a1052e61de7874d 100644 (file)
@@ -46,7 +46,8 @@
 #define BINDCMD                        "slapd-bind"
 #define MAXARGS                100
 #define MAXREQS                        5000
-#define LOOPS                  "100"
+#define LOOPS                  100
+#define OUTERLOOPS             "1"
 #define RETRIES                        "0"
 
 #define TSEARCHFILE            "do_search.0"
@@ -84,6 +85,7 @@ usage( char *name )
                "-d <datadir> "
                "[-j <maxchild>] "
                "[-l <loops>] "
+               "[-L <outerloops>] "
                "-P <progdir> "
                "[-r <maxretries>] "
                "[-t <delay>] "
@@ -103,7 +105,8 @@ main( int argc, char **argv )
        char            *passwd = NULL;
        char            *dirname = NULL;
        char            *progdir = NULL;
-       char            *loops = LOOPS;
+       int             loops = LOOPS;
+       char            *outerloops = OUTERLOOPS;
        char            *retries = RETRIES;
        char            *delay = "0";
        DIR             *datadir;
@@ -117,6 +120,7 @@ main( int argc, char **argv )
        char            *sargs[MAXARGS];
        int             sanum;
        char            scmd[MAXPATHLEN];
+       char            sloops[] = "18446744073709551615UL";
        /* read */
        char            *rfile = NULL;
        char            *rreqs[MAXREQS];
@@ -124,12 +128,14 @@ main( int argc, char **argv )
        char            *rargs[MAXARGS];
        int             ranum;
        char            rcmd[MAXPATHLEN];
+       char            rloops[] = "18446744073709551615UL";
        /* addel */
        char            *afiles[MAXREQS];
        int             anum = 0;
        char            *aargs[MAXARGS];
        int             aanum;
        char            acmd[MAXPATHLEN];
+       char            aloops[] = "18446744073709551615UL";
        /* modrdn */
        char            *mfile = NULL;
        char            *mreqs[MAXREQS];
@@ -137,6 +143,7 @@ main( int argc, char **argv )
        char            *margs[MAXARGS];
        int             manum;
        char            mcmd[MAXPATHLEN];
+       char            mloops[] = "18446744073709551615UL";
        /* modify */
        char            *modfile = NULL;
        char            *modreqs[MAXREQS];
@@ -145,6 +152,7 @@ main( int argc, char **argv )
        char            *modargs[MAXARGS];
        int             modanum;
        char            modcmd[MAXPATHLEN];
+       char            modloops[] = "18446744073709551615UL";
        /* bind */
        char            *bfile = NULL;
        char            *breqs[MAXREQS];
@@ -153,12 +161,13 @@ main( int argc, char **argv )
        char            *bargs[MAXARGS];
        int             banum;
        char            bcmd[MAXPATHLEN];
+       char            bloops[] = "18446744073709551615UL";
 
        char            *friendlyOpt = NULL;
 
        tester_init( "slapd-tester" );
 
-       while ( (i = getopt( argc, argv, "D:d:FH:h:j:l:P:p:r:t:w:" )) != EOF ) {
+       while ( (i = getopt( argc, argv, "D:d:FH:h:j:l:L:P:p:r:t:w:" )) != EOF ) {
                switch( i ) {
                case 'D':               /* slapd manager */
                        manager = ArgDup( optarg );
@@ -187,7 +196,13 @@ main( int argc, char **argv )
                        break;
 
                case 'l':               /* the number of loops per client */
-                       loops = strdup( optarg );
+                       if ( lutil_atoi( &loops, optarg ) != 0 ) {
+                               usage( argv[0] );
+                       }
+                       break;
+
+               case 'L':               /* the number of outerloops per client */
+                       outerloops = strdup( optarg );
                        break;
 
                case 'P':               /* prog directory */
@@ -301,6 +316,13 @@ main( int argc, char **argv )
                break;
        }
 
+       snprintf( sloops, sizeof( sloops ), "%d", 10 * loops );
+       snprintf( rloops, sizeof( rloops ), "%d", 20 * loops );
+       snprintf( aloops, sizeof( aloops ), "%d", loops );
+       snprintf( mloops, sizeof( mloops ), "%d", loops );
+       snprintf( modloops, sizeof( modloops ), "%d", loops );
+       snprintf( bloops, sizeof( bloops ), "%d", 20 * loops );
+
        /*
         * generate the search clients
         */
@@ -323,7 +345,9 @@ main( int argc, char **argv )
        sargs[sanum++] = "-w";
        sargs[sanum++] = passwd;
        sargs[sanum++] = "-l";
-       sargs[sanum++] = loops;
+       sargs[sanum++] = sloops;
+       sargs[sanum++] = "-L";
+       sargs[sanum++] = outerloops;
        sargs[sanum++] = "-r";
        sargs[sanum++] = retries;
        sargs[sanum++] = "-t";
@@ -352,7 +376,9 @@ main( int argc, char **argv )
                rargs[ranum++] = port;
        }
        rargs[ranum++] = "-l";
-       rargs[ranum++] = loops;
+       rargs[ranum++] = rloops;
+       rargs[ranum++] = "-L";
+       rargs[ranum++] = outerloops;
        rargs[ranum++] = "-r";
        rargs[ranum++] = retries;
        rargs[ranum++] = "-t";
@@ -383,7 +409,9 @@ main( int argc, char **argv )
        margs[manum++] = "-w";
        margs[manum++] = passwd;
        margs[manum++] = "-l";
-       margs[manum++] = loops;
+       margs[manum++] = mloops;
+       margs[manum++] = "-L";
+       margs[manum++] = outerloops;
        margs[manum++] = "-r";
        margs[manum++] = retries;
        margs[manum++] = "-t";
@@ -417,7 +445,9 @@ main( int argc, char **argv )
        modargs[modanum++] = "-w";
        modargs[modanum++] = passwd;
        modargs[modanum++] = "-l";
-       modargs[modanum++] = loops;
+       modargs[modanum++] = modloops;
+       modargs[modanum++] = "-L";
+       modargs[modanum++] = outerloops;
        modargs[modanum++] = "-r";
        modargs[modanum++] = retries;
        modargs[modanum++] = "-t";
@@ -453,7 +483,9 @@ main( int argc, char **argv )
        aargs[aanum++] = "-w";
        aargs[aanum++] = passwd;
        aargs[aanum++] = "-l";
-       aargs[aanum++] = loops;
+       aargs[aanum++] = aloops;
+       aargs[aanum++] = "-L";
+       aargs[aanum++] = outerloops;
        aargs[aanum++] = "-r";
        aargs[aanum++] = retries;
        aargs[aanum++] = "-t";
@@ -483,7 +515,9 @@ main( int argc, char **argv )
                bargs[banum++] = port;
        }
        bargs[banum++] = "-l";
-       bargs[banum++] = loops;
+       bargs[banum++] = bloops;
+       bargs[banum++] = "-L";
+       bargs[banum++] = outerloops;
 #if 0
        bargs[banum++] = "-r";
        bargs[banum++] = retries;