21 #include <ndb_global.h>
22 #include <kernel/ndb_limits.h>
24 #include "NDBT_ReturnCodes.h"
25 #include <Properties.hpp>
26 #include <NdbThread.h>
28 #include <NdbCondition.h>
29 #include <NdbTimer.hpp>
32 #include <NdbDictionary.hpp>
48 int getNumTables()
const;
49 const char * getTableName(
int)
const;
54 int getNumRecords()
const;
55 int getNumLoops()
const;
60 Uint32 getProperty(
const char*, Uint32 = 0 );
61 const char* getProperty(
const char*,
const char* );
62 void setProperty(
const char*, Uint32);
63 void setProperty(
const char*,
const char*);
70 void wait_timeout(
int msec);
73 bool getPropertyWait(
const char*, Uint32);
74 const char* getPropertyWait(
const char*,
const char* );
76 void decProperty(
const char *);
77 void incProperty(
const char *);
78 Uint32 casProperty(
const char *, Uint32 oldValue, Uint32 newValue);
86 Uint32 getDbProperty(
const char*);
87 bool setDbProperty(
const char*, Uint32);
96 int getNoOfCompletedSteps()
const ;
102 void sync_up_and_wait(
const char * key, Uint32 count = 0);
111 void setNumRecords(
int);
112 void setNumLoops(
int);
121 NdbMutex* propertyMutexPtr;
131 NDBT_TESTFUNC* pfunc);
137 const char* getName() {
return name; }
138 int getStepNo() {
return step_no; }
139 void setStepNo(
int n) { step_no =
n; }
161 NDBT_TESTFUNC* pfunc);
169 NDBT_TESTFUNC* func);
177 NDBT_TESTFUNC* func);
185 NDBT_TESTFUNC* func);
190 enum NDBT_DriverType {
200 const char* comment);
203 static const char* getStepThreadStackSizePropName()
204 {
return "StepThreadStackSize"; };
211 void setProperty(
const char*, Uint32);
212 void setProperty(
const char*,
const char*);
213 virtual void print() = 0;
214 virtual void printHTML() = 0;
216 const char* getName()
const {
return _name.
c_str(); };
220 virtual void saveTestResult(
const char*,
int result) = 0;
221 virtual void printTestResult() = 0;
222 void initBeforeTest(){ timer.doReset();};
224 void setDriverType(NDBT_DriverType
type) { m_driverType=
type; }
225 NDBT_DriverType getDriverType()
const {
return m_driverType; }
231 virtual int getNoOfCompletedSteps()
const = 0;
241 virtual void addTable(
const char* aTableName,
bool isVerify=
true) = 0;
253 NDBT_DriverType m_driverType;
256 static const int FAILED_TO_CREATE = 1000;
257 static const int FAILED_TO_DISCOVER = 1001;
268 const char* getName(){
return m_name.
c_str(); };
269 int getResult(){
return m_result; };
270 const char* getTimeStr(){
272 Uint32 lapTime = (Uint32)m_ticks;
273 Uint32 secTime = lapTime/1000;
288 const char* comment);
294 void addTable(
const char*,
bool);
297 void reportStepResult(
const NDBT_Step*,
int result);
307 virtual int getNoOfCompletedSteps()
const;
309 static const int NORESULT = 999;
311 void saveTestResult(
const char*,
int result);
312 void printTestResult();
324 unsigned numStepsFail;
326 unsigned numStepsCompleted;
327 NdbMutex* waitThreadsMutexPtr;
341 int execute(
int,
const char**);
352 void setCreateTable(
bool);
353 void setCreateAllTables(
bool);
354 void setRunAllTables(
bool);
355 void setConnectCluster(
bool);
358 void printExecutionTree();
359 void printExecutionTreeHTML();
365 void printTestCaseSummary(
const char* tcname = NULL);
381 void setTemporaryTables(
bool val);
382 bool getTemporaryTables()
const;
384 void setLogging(
bool val);
385 bool getLogging()
const;
387 bool getForceShort()
const;
392 void setDriverType(NDBT_DriverType
type) { m_driverType=
type; }
393 NDBT_DriverType getDriverType()
const {
return m_driverType; }
397 const char* _tabname,
const char* testname = NULL);
399 const char* testname = NULL);
403 int report(
const char* _tcname = NULL);
404 int reportAllTables(
const char* );
409 int numTestsExecuted;
418 bool m_connect_cluster;
422 bool temporaryTables;
424 NDBT_DriverType m_driverType;
431 #define NDBT_TESTSUITE(suitname) \
432 class C##suitname : public NDBT_TestSuite { \
434 C##suitname():NDBT_TestSuite(#suitname){ \
435 NDBT_TestCaseImpl1* pt; pt = NULL; \
436 NDBT_Step* pts; pts = NULL; \
437 NDBT_Verifier* ptv; ptv = NULL; \
438 NDBT_Initializer* pti; pti = NULL; \
439 NDBT_Finalizer* ptf; ptf = NULL;
442 #define DRIVER(type) \
445 #define TESTCASE(testname, comment) \
446 pt = new NDBT_TestCaseImpl1(this, testname, comment); \
450 #define TESTCASE_DRIVER(type) \
451 pt->setDriverType(type);
453 #define TC_PROPERTY(propname, propval) \
454 pt->setProperty(propname, propval);
456 #define STEP(stepfunc) \
457 pts = new NDBT_ParallelStep(pt, #stepfunc, stepfunc); \
461 #define STEPS(stepfunc, num) \
462 { int i; for (i = 0; i < num; i++){ \
463 pts = new NDBT_ParallelStep(pt, #stepfunc, stepfunc); \
467 #define VERIFIER(stepfunc) \
468 ptv = new NDBT_Verifier(pt, #stepfunc, stepfunc); \
469 pt->addVerifier(ptv);
471 #define INITIALIZER(stepfunc) \
472 pti = new NDBT_Initializer(pt, #stepfunc, stepfunc); \
473 pt->addInitializer(pti);
475 #define FINALIZER(stepfunc) \
476 ptf = new NDBT_Finalizer(pt, #stepfunc, stepfunc); \
477 pt->addFinalizer(ptf);
483 #define TABLE(tableName) \
484 pt->addTable(tableName, true);
489 #define NOT_TABLE(tableName) \
490 pt->addTable(tableName, false);
493 #define ALL_TABLES() \
494 pt->m_all_tables= true;
496 #define NDBT_TESTSUITE_END(suitname) \
499 #define NDBT_TESTSUITE_INSTANCE(suitname) \
503 #define GETNDB(ps) ((NDBT_Step*)ps)->getNdb()
505 #define POSTUPGRADE(testname) \
506 TESTCASE(testname "--post-upgrade", \
507 "checks being run after upgrade has completed")