]> git.saurik.com Git - apple/security.git/blobdiff - SecurityTests/clxutils/threadTest/dbOpenClose.cpp
Security-57740.51.3.tar.gz
[apple/security.git] / SecurityTests / clxutils / threadTest / dbOpenClose.cpp
diff --git a/SecurityTests/clxutils/threadTest/dbOpenClose.cpp b/SecurityTests/clxutils/threadTest/dbOpenClose.cpp
deleted file mode 100644 (file)
index e6825d9..0000000
+++ /dev/null
@@ -1,76 +0,0 @@
-/* 
- * dbOpenClose.cpp - multi-threaded DB open/close test
- */
-#include "testParams.h"
-#include <Security/cssm.h>
-#include <stdlib.h>
-#include <stdio.h>
-#include <time.h>
-#include <security_cdsa_utils/cuCdsaUtils.h>
-#include <strings.h>
-#include <utilLib/common.h>
-
-/* 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; loop<testParams->numLoops; 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;
-}
-