From 1f3a105712ecf8b2f07ef7fe226cfa618460afdb Mon Sep 17 00:00:00 2001 From: Paul Park Date: Fri, 18 Aug 1995 21:32:28 +0000 Subject: [PATCH] Add multiprocess testing git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@6551 dc483132-0cff-0310-8789-dd5450dbe970 --- src/lib/kdb/t_kdb.c | 135 +++++++++++++++++++++++++++++++++++++++++--- 1 file changed, 128 insertions(+), 7 deletions(-) diff --git a/src/lib/kdb/t_kdb.c b/src/lib/kdb/t_kdb.c index f067f58dc..c53a15913 100644 --- a/src/lib/kdb/t_kdb.c +++ b/src/lib/kdb/t_kdb.c @@ -310,7 +310,7 @@ add_principal(kcontext, principal, eblock, key, rseed) kret = krb5_db_put_principal(kcontext, &dbent, &nentries); if ((!kret) && (nentries != 1)) - kret = KRB5KRB_ERR_GENERIC; + kret = KRB5_KDB_UK_SERROR; out: krb5_dbe_free_contents(kcontext, &dbent); return(kret); @@ -389,7 +389,7 @@ find_principal(kcontext, principal, docompare) &how_many, &more)) return(kret); if (how_many == 0) - return(KRB5KRB_ERR_GENERIC); + return(KRB5_KDB_NOENTRY); if (kret = krb5_dbe_decode_mod_princ_data(kcontext, &dbent, &mod_princ)) { krb5_db_free_principal(kcontext, &dbent, how_many); @@ -438,7 +438,7 @@ delete_principal(kcontext, principal) int do_testing(db, passes, verbose, timing, rcases, check, save_db, dontclean, - db_type) + db_type, ptest) char *db; int passes; int verbose; @@ -448,6 +448,7 @@ do_testing(db, passes, verbose, timing, rcases, check, save_db, dontclean, int save_db; int dontclean; enum dbtype db_type; + int ptest; { krb5_error_code kret; krb5_context kcontext; @@ -883,6 +884,120 @@ do_testing(db, passes, verbose, timing, rcases, check, save_db, dontclean, if (kret) fprintf(stderr, "%s: error while %s %s%s(%s)\n", programname, op, linkage, oparg, error_message(kret)); + + if (!kret && ptest) { + int nper; + pid_t children[32], child; + int nprocs, existat, i, j, fd; + + nprocs = ptest + 1; + if (nprocs > 32) + nprocs = 32; + + nper = passes / nprocs; + unlink("./test.lock"); + for (i=0; i 4) + fprintf(stderr, "*A[%d](%s)\n", getpid(), + playback_name(base+j)); + } + for (j=0; (j 4) + fprintf(stderr, "-S[%d](%s)\n", getpid(), + playback_name(base+j)); + } + for (j=0; (j 4) + fprintf(stderr, "XD[%d](%s)\n", getpid(), + playback_name(base+j)); + } + krb5_db_fini(ccontext); + krb5_free_context(ccontext); + exit((kret) ? 1 : 0); + } + else + children[i] = child; + } + fd = open("./test.lock", O_CREAT|O_RDWR|O_EXCL, 0666); + close(fd); + sleep(1); + unlink("./test.lock"); + for (i=0; i] [-n ]\n", + fprintf(stderr, "%s: usage is %s [-cprstv] [-d ] [-n ]\n", programname, programname); else error = do_testing(db_name, @@ -1017,7 +1136,9 @@ main(argc, argv) check_cont, save_db, dont_clean, - db_type); + db_type, + do_ptest); return(error); } + -- 2.26.2