From: Howard Chu Date: Tue, 23 Sep 2003 11:55:59 +0000 (+0000) Subject: Change slapd-tester to read search base from file instead of using X-Git-Tag: OPENLDAP_REL_ENG_2_1_MP~667 X-Git-Url: https://git.sur5r.net/?a=commitdiff_plain;h=feb03bfde57de8cef47fa988d99fafa678cf8efb;p=openldap Change slapd-tester to read search base from file instead of using the commandline --- diff --git a/tests/data/do_search.0 b/tests/data/do_search.0 index 6e9cd1f3fa..ea0e29b643 100644 --- a/tests/data/do_search.0 +++ b/tests/data/do_search.0 @@ -1,5 +1,10 @@ +o=university of michigan,c=us cn=Barbara Jensen +ou=people,o=university of michigan,c=us cn=Bjorn Jensen +ou=people,o=university of michigan,c=us cn=James A Jones 1 +o=university of michigan,c=us cn=Bjorn Jensen +o=university of michigan,c=us cn=Alumni Assoc Staff diff --git a/tests/progs/slapd-tester.c b/tests/progs/slapd-tester.c index a2a96f415a..4c5c9e2374 100644 --- a/tests/progs/slapd-tester.c +++ b/tests/progs/slapd-tester.c @@ -35,7 +35,7 @@ #define TMODRDNFILE "do_modrdn.0" static char *get_file_name( char *dirname, char *filename ); -static int get_search_filters( char *filename, char *filters[] ); +static int get_search_filters( char *filename, char *filters[], char *bases[] ); static int get_read_entries( char *filename, char *entries[] ); static void fork_child( char *prog, char **args ); static void wait4kids( int nkidval ); @@ -54,7 +54,7 @@ static char argbuf[BUFSIZ]; static void usage( char *name ) { - fprintf( stderr, "usage: %s [-h ] -p -D -w -d -b [-j ] [-l ] -P \n", name ); + fprintf( stderr, "usage: %s -H | ([-h ] -p ) -D -w -d [-j ] [-l ] -P \n", name ); exit( EXIT_FAILURE ); } @@ -68,13 +68,13 @@ main( int argc, char **argv ) char *manager = NULL; char *passwd = NULL; char *dirname = NULL; - char *sbase = NULL; char *progdir = NULL; char *loops = LOOPS; DIR *datadir; struct dirent *file; char *sfile = NULL; char *sreqs[MAXREQS]; + char *sbase[MAXREQS]; int snum = 0; char *rfile = NULL; char *rreqs[MAXREQS]; @@ -119,10 +119,6 @@ main( int argc, char **argv ) passwd = ArgDup( optarg ); break; - case 'b': /* the base DN */ - sbase = ArgDup( optarg ); - break; - case 'd': /* data directory */ dirname = strdup( optarg ); break; @@ -145,7 +141,7 @@ main( int argc, char **argv ) } } - if (( dirname == NULL ) || ( sbase == NULL ) || ( port == NULL && uri == NULL ) || + if (( dirname == NULL ) || ( port == NULL && uri == NULL ) || ( manager == NULL ) || ( passwd == NULL ) || ( progdir == NULL )) usage( argv[0] ); @@ -184,7 +180,7 @@ main( int argc, char **argv ) /* look for search requests */ if ( sfile ) { - snum = get_search_filters( sfile, sreqs ); + snum = get_search_filters( sfile, sreqs, sbase ); } /* look for read requests */ @@ -214,10 +210,10 @@ main( int argc, char **argv ) sargs[sanum++] = "-p"; sargs[sanum++] = port; } - sargs[sanum++] = "-b"; - sargs[sanum++] = sbase; sargs[sanum++] = "-l"; sargs[sanum++] = loops; + sargs[sanum++] = "-b"; + sargs[sanum++] = NULL; /* will hold the search base */ sargs[sanum++] = "-f"; sargs[sanum++] = NULL; /* will hold the search request */ sargs[sanum++] = NULL; @@ -304,6 +300,7 @@ main( int argc, char **argv ) if ( j < snum ) { sargs[sanum - 2] = sreqs[j]; + sargs[sanum - 4] = sbase[j]; fork_child( scmd, sargs ); } @@ -348,7 +345,7 @@ get_file_name( char *dirname, char *filename ) static int -get_search_filters( char *filename, char *filters[] ) +get_search_filters( char *filename, char *filters[], char *bases[] ) { FILE *fp; int filter = 0; @@ -361,6 +358,11 @@ get_search_filters( char *filename, char *filters[] ) if (( nl = strchr( line, '\r' )) || ( nl = strchr( line, '\n' ))) *nl = '\0'; + bases[filter] = ArgDup( line ); + fgets( line, BUFSIZ, fp ); + if (( nl = strchr( line, '\r' )) || ( nl = strchr( line, '\n' ))) + *nl = '\0'; + filters[filter++] = ArgDup( line ); } diff --git a/tests/scripts/test008-concurrency b/tests/scripts/test008-concurrency index 4e0c7af7d2..23f67993a3 100755 --- a/tests/scripts/test008-concurrency +++ b/tests/scripts/test008-concurrency @@ -50,7 +50,7 @@ for i in 0 1 2 3 4 5; do done echo "Using tester for concurrent server access..." -$SLAPDTESTER -b "$BASEDN" -P "$PROGDIR" -d "$DATADIR" -h $LOCALHOST -p $PORT -D "$MANAGERDN" -w $PASSWD -l 50 +$SLAPDTESTER -P "$PROGDIR" -d "$DATADIR" -h $LOCALHOST -p $PORT -D "$MANAGERDN" -w $PASSWD -l 50 RC=$? if test $RC != 0 ; then