]> git.sur5r.net Git - openldap/commitdiff
allow a friendly behavior of write stress testers...
authorPierangelo Masarati <ando@openldap.org>
Fri, 4 Nov 2005 16:17:32 +0000 (16:17 +0000)
committerPierangelo Masarati <ando@openldap.org>
Fri, 4 Nov 2005 16:17:32 +0000 (16:17 +0000)
tests/progs/slapd-addel.c
tests/progs/slapd-modify.c
tests/progs/slapd-modrdn.c
tests/progs/slapd-tester.c

index 95b4185b9063f74ca3b9f187b872756acaa56692..456bb78475e2e9401a6a872a13ed7547269c5536 100644 (file)
@@ -41,7 +41,8 @@ get_add_entry( char *filename, LDAPMod ***mods );
 
 static void
 do_addel( char *uri, char *host, int port, char *manager, char *passwd,
-       char *dn, LDAPMod **attrs, int maxloop, int maxretries, int delay );
+       char *dn, LDAPMod **attrs, int maxloop, int maxretries, int delay,
+       int friendly );
 
 static void
 usage( char *name )
@@ -73,10 +74,15 @@ main( int argc, char **argv )
        int             loops = LOOPS;
        int             retries = RETRIES;
        int             delay = 0;
+       int             friendly = 0;
        LDAPMod         **attrs = NULL;
 
-       while ( (i = getopt( argc, argv, "H:h:p:D:w:f:l:r:t:" )) != EOF ) {
+       while ( (i = getopt( argc, argv, "FH:h:p:D:w:f:l:r:t:" )) != EOF ) {
                switch( i ) {
+               case 'F':
+                       friendly++;
+                       break;
+                       
                case 'H':               /* the server's URI */
                        uri = strdup( optarg );
                        break;
@@ -141,7 +147,7 @@ main( int argc, char **argv )
        }
 
        do_addel( uri, host, port, manager, passwd, entry, attrs,
-                       loops, retries, delay );
+                       loops, retries, delay, friendly );
 
        exit( EXIT_SUCCESS );
 }
@@ -272,7 +278,8 @@ do_addel(
        LDAPMod **attrs,
        int maxloop,
        int maxretries,
-       int delay
+       int delay,
+       int friendly
 )
 {
        LDAP    *ld = NULL;
@@ -333,6 +340,9 @@ retry:;
                                /* NOTE: this likely means
                                 * the delete failed
                                 * during the previous round... */
+                               if ( !friendly ) {
+                                       goto done;
+                               }
                                break;
 
                        case LDAP_BUSY:
@@ -363,6 +373,9 @@ retry:;
                                /* NOTE: this likely means
                                 * the add failed
                                 * during the previous round... */
+                               if ( !friendly ) {
+                                       goto done;
+                               }
                                break;
 
                        case LDAP_BUSY:
index ad5ad6f3b1edcfe91b023ecb1f0a597a4ae98e4c..03ac37549d2832d27cf00f126f59a86639888d1a 100644 (file)
@@ -35,7 +35,7 @@
 static void
 do_modify( char *uri, char *host, int port, char *manager, char *passwd,
                char *entry, char *attr, char *value, int maxloop,
-               int maxretries, int delay );
+               int maxretries, int delay, int friendly );
 
 
 static void
@@ -69,9 +69,14 @@ main( int argc, char **argv )
        int             loops = LOOPS;
        int             retries = RETRIES;
        int             delay = 0;
+       int             friendly = 0;
 
-       while ( (i = getopt( argc, argv, "H:h:p:D:w:e:a:l:r:t:" )) != EOF ) {
+       while ( (i = getopt( argc, argv, "FH:h:p:D:w:e:a:l:r:t:" )) != EOF ) {
                switch( i ) {
+               case 'F':
+                       friendly++;
+                       break;
+
                case 'H':               /* the server uri */
                        uri = strdup( optarg );
                        break;
@@ -144,7 +149,7 @@ main( int argc, char **argv )
                value++;
 
        do_modify( uri, host, port, manager, passwd, entry, ava, value,
-                       loops, retries, delay );
+                       loops, retries, delay, friendly );
        exit( EXIT_SUCCESS );
 }
 
@@ -152,7 +157,7 @@ main( int argc, char **argv )
 static void
 do_modify( char *uri, char *host, int port, char *manager,
        char *passwd, char *entry, char* attr, char* value,
-       int maxloop, int maxretries, int delay )
+       int maxloop, int maxretries, int delay, int friendly )
 {
        LDAP    *ld = NULL;
        int     i = 0, do_retry = maxretries;
@@ -225,6 +230,9 @@ retry:;
                                /* NOTE: this likely means
                                 * the second modify failed
                                 * during the previous round... */
+                               if ( !friendly ) {
+                                       goto done;
+                               }
                                break;
 
                        case LDAP_BUSY:
@@ -249,6 +257,9 @@ retry:;
                                /* NOTE: this likely means
                                 * the first modify failed
                                 * during the previous round... */
+                               if ( !friendly ) {
+                                       goto done;
+                               }
                                break;
 
                        case LDAP_BUSY:
index 67f6462cbce903483825c62f564b06fbfef60eee..1522b864f330c13271ae9c1dcc422a9e1e63bd94 100644 (file)
@@ -38,7 +38,8 @@
 
 static void
 do_modrdn( char *uri, char *host, int port, char *manager, char *passwd,
-               char *entry, int maxloop, int maxretries, int delay );
+               char *entry, int maxloop, int maxretries, int delay,
+               int friendly );
 
 static void
 usage( char *name )
@@ -69,9 +70,14 @@ main( int argc, char **argv )
        int             loops = LOOPS;
        int             retries = RETRIES;
        int             delay = 0;
+       int             friendly = 0;
 
-       while ( (i = getopt( argc, argv, "H:h:p:D:w:e:l:r:t:" )) != EOF ) {
+       while ( (i = getopt( argc, argv, "FH:h:p:D:w:e:l:r:t:" )) != EOF ) {
                switch( i ) {
+               case 'F':
+                       friendly++;
+                       break;
+
                case 'H':               /* the server uri */
                        uri = strdup( optarg );
                        break;
@@ -125,14 +131,16 @@ main( int argc, char **argv )
 
        }
 
-       do_modrdn( uri, host, port, manager, passwd, entry, loops, retries, delay );
+       do_modrdn( uri, host, port, manager, passwd, entry,
+                       loops, retries, delay, friendly );
        exit( EXIT_SUCCESS );
 }
 
 
 static void
 do_modrdn( char *uri, char *host, int port, char *manager,
-       char *passwd, char *entry, int maxloop, int maxretries, int delay )
+       char *passwd, char *entry, int maxloop, int maxretries, int delay,
+       int friendly )
 {
        LDAP    *ld = NULL;
        int     i = 0, do_retry = maxretries;
@@ -216,6 +224,9 @@ retry:;
                                /* NOTE: this likely means
                                 * the second modrdn failed
                                 * during the previous round... */
+                               if ( !friendly ) {
+                                       goto done;
+                               }
                                break;
 
                        case LDAP_BUSY:
@@ -238,6 +249,9 @@ retry:;
                                /* NOTE: this likely means
                                 * the first modrdn failed
                                 * during the previous round... */
+                               if ( !friendly ) {
+                                       goto done;
+                               }
                                break;
 
                        case LDAP_BUSY:
index c8d4d57f25cd0efc1568c1f0fa523d5f15f4f268..e49947198b51ad57de3bee0af1b31a5ee680cc95 100644 (file)
@@ -80,8 +80,9 @@ usage( char *name )
                "[-j <maxchild>] "
                "[-l <loops>] "
                "-P <progdir> "
-               "[-r <maxretries>]"
-               "[-t <delay>]\n",
+               "[-r <maxretries>] "
+               "[-t <delay>] "
+               "[-F]\n",
                name );
        exit( EXIT_FAILURE );
 }
@@ -133,8 +134,9 @@ main( int argc, char **argv )
        char            *modreqs[MAXREQS];
        char            *moddn[MAXREQS];
        int             modnum = 0;
+       int             friendly = 0;
 
-       while ( (i = getopt( argc, argv, "D:d:H:h:j:l:P:p:r:t:w:" )) != EOF ) {
+       while ( (i = getopt( argc, argv, "D:d:FH:h:j:l:P:p:r:t:w:" )) != EOF ) {
                switch( i ) {
                case 'D':               /* slapd manager */
                        manager = ArgDup( optarg );
@@ -144,6 +146,10 @@ main( int argc, char **argv )
                        dirname = strdup( optarg );
                        break;
 
+               case 'F':
+                       friendly++;
+                       break;
+
                case 'H':               /* slapd uri */
                        uri = strdup( optarg );
                        break;
@@ -332,6 +338,9 @@ main( int argc, char **argv )
        margs[manum++] = retries;
        margs[manum++] = "-t";
        margs[manum++] = delay;
+       if ( friendly ) {
+               margs[manum++] = "-F";
+       }
        margs[manum++] = "-e";
        margs[manum++] = NULL;          /* will hold the modrdn entry */
        margs[manum++] = NULL;
@@ -363,6 +372,9 @@ main( int argc, char **argv )
        modargs[modanum++] = retries;
        modargs[modanum++] = "-t";
        modargs[modanum++] = delay;
+       if ( friendly ) {
+               modargs[modanum++] = "-F";
+       }
        modargs[modanum++] = "-e";
        modargs[modanum++] = NULL;              /* will hold the modify entry */
        modargs[modanum++] = "-a";;
@@ -396,6 +408,9 @@ main( int argc, char **argv )
        aargs[aanum++] = retries;
        aargs[aanum++] = "-t";
        aargs[aanum++] = delay;
+       if ( friendly ) {
+               aargs[aanum++] = "-F";
+       }
        aargs[aanum++] = "-f";
        aargs[aanum++] = NULL;          /* will hold the add data file */
        aargs[aanum++] = NULL;