X-Git-Url: https://git.saurik.com/apple/security.git/blobdiff_plain/b04fe171f0375ecd5d8a24747ca1dff85720a0ca..6b200bc335dc93c5516ccb52f14bd896d8c7fad7:/SecurityTests/clxutils/threadTest/dbOpenClose.cpp?ds=inline diff --git a/SecurityTests/clxutils/threadTest/dbOpenClose.cpp b/SecurityTests/clxutils/threadTest/dbOpenClose.cpp deleted file mode 100644 index e6825d90..00000000 --- a/SecurityTests/clxutils/threadTest/dbOpenClose.cpp +++ /dev/null @@ -1,76 +0,0 @@ -/* - * dbOpenClose.cpp - multi-threaded DB open/close test - */ -#include "testParams.h" -#include -#include -#include -#include -#include -#include -#include - -/* One create at init time, multi threads opening and closing this DB */ -#define DB_NAME "/tmp/dbOpenCLose.db" - -static CSSM_DL_HANDLE dlHand = 0; - -int dbOpenCloseInit(TestParams *testParams) -{ - dlHand = cuDlStartup(); - if(dlHand == 0) { - printf("***dbOpenCloseInit: Error connecting to DL\n"); - return -1; - } - - int ourRtn = 0; - - /* Create the DB, deleting existing */ - CSSM_RETURN crtn; - CSSM_DB_HANDLE dbHand = 0; - crtn = dbCreateOpen(dlHand, DB_NAME, - CSSM_TRUE, // doCreate - CSSM_TRUE, // delete exist - "foobar", - &dbHand); - if(crtn) { - printf("***Error creating %s. Aborting.\n", DB_NAME); - ourRtn = -1; - } - return ourRtn; -} - -int dbOpenCloseEval(TestParams *testParams) -{ - int ourRtn = 0; - for(unsigned loop=0; loopnumLoops; loop++) { - if(testParams->verbose) { - printf("dbOpenClose thread %d: loop %d\n", - testParams->threadNum, loop); - } - else if(!testParams->quiet) { - printChar(testParams->progressChar); - } - - /* attach to existing DB - don't create */ - CSSM_DB_HANDLE dbHand = cuDbStartupByName(dlHand, (char *)DB_NAME, - CSSM_FALSE, // don't create - testParams->quiet); - if(dbHand == 0) { - printf("***dbOpenClose: error attaching to db %s\n", DB_NAME); - ourRtn = -1; - break; - } - - CSSM_DL_DB_HANDLE dlDbHand = {dlHand, dbHand}; - CSSM_RETURN crtn = CSSM_DL_DbClose(dlDbHand); - if(crtn) { - cssmPerror("CSSM_DL_DbClose", crtn); - printf("***Error closing %s\n", DB_NAME); - ourRtn = -1; - break; - } - } - return ourRtn; -} -