diff --git a/tests/progs/slapd-addel.c b/tests/progs/slapd-addel.c index 95b4185b90..456bb78475 100644 --- a/tests/progs/slapd-addel.c +++ b/tests/progs/slapd-addel.c @@ -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: diff --git a/tests/progs/slapd-modify.c b/tests/progs/slapd-modify.c index ad5ad6f3b1..03ac37549d 100644 --- a/tests/progs/slapd-modify.c +++ b/tests/progs/slapd-modify.c @@ -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: diff --git a/tests/progs/slapd-modrdn.c b/tests/progs/slapd-modrdn.c index 67f6462cbc..1522b864f3 100644 --- a/tests/progs/slapd-modrdn.c +++ b/tests/progs/slapd-modrdn.c @@ -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: diff --git a/tests/progs/slapd-tester.c b/tests/progs/slapd-tester.c index c8d4d57f25..e49947198b 100644 --- a/tests/progs/slapd-tester.c +++ b/tests/progs/slapd-tester.c @@ -80,8 +80,9 @@ usage( char *name ) "[-j ] " "[-l ] " "-P " - "[-r ]" - "[-t ]\n", + "[-r ] " + "[-t ] " + "[-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;