summaryrefslogtreecommitdiff
path: root/storage/ndb/test/src/NDBT_Test.cpp
diff options
context:
space:
mode:
authorunknown <jonas@perch.ndb.mysql.com>2005-11-07 12:19:28 +0100
committerunknown <jonas@perch.ndb.mysql.com>2005-11-07 12:19:28 +0100
commitee740746aff3c5163adfff481bc4cf70c37728f5 (patch)
tree2cb53178c95e7d8d6578018e169c2d71bb1fdbcb /storage/ndb/test/src/NDBT_Test.cpp
parent8a224ed85a8794743472f3611830349dc490aabc (diff)
downloadmariadb-git-ee740746aff3c5163adfff481bc4cf70c37728f5.tar.gz
Import ndb varsize
BitKeeper/deleted/.del-MetaData.cpp~146ae9865dd35829: Delete: storage/ndb/src/kernel/vm/MetaData.cpp BitKeeper/deleted/.del-MetaData.hpp~538342afcd8ac53c: Delete: storage/ndb/src/kernel/vm/MetaData.hpp BitKeeper/deleted/.del-DbtupLCP.cpp~855b1ed3fbc86a42: Delete: storage/ndb/src/kernel/blocks/dbtup/DbtupLCP.cpp BitKeeper/deleted/.del-DbtupSystemRestart.cpp~15b54d7e4e75d2d: Delete: storage/ndb/src/kernel/blocks/dbtup/DbtupSystemRestart.cpp BitKeeper/deleted/.del-DbtupUndoLog.cpp~5a2ef6e86b1404e9: Delete: storage/ndb/src/kernel/blocks/dbtup/DbtupUndoLog.cpp storage/ndb/include/kernel/signaldata/CreateFilegroup.hpp: New BitKeeper file ``storage/ndb/include/kernel/signaldata/CreateFilegroup.hpp'' storage/ndb/include/kernel/signaldata/CreateFilegroupImpl.hpp: New BitKeeper file ``storage/ndb/include/kernel/signaldata/CreateFilegroupImpl.hpp'' storage/ndb/include/kernel/signaldata/CreateObj.hpp: New BitKeeper file ``storage/ndb/include/kernel/signaldata/CreateObj.hpp'' storage/ndb/include/kernel/signaldata/DictObjOp.hpp: New BitKeeper file ``storage/ndb/include/kernel/signaldata/DictObjOp.hpp'' storage/ndb/include/kernel/signaldata/DropFilegroup.hpp: New BitKeeper file ``storage/ndb/include/kernel/signaldata/DropFilegroup.hpp'' storage/ndb/include/kernel/signaldata/DropFilegroupImpl.hpp: New BitKeeper file ``storage/ndb/include/kernel/signaldata/DropFilegroupImpl.hpp'' storage/ndb/include/kernel/signaldata/DropObj.hpp: New BitKeeper file ``storage/ndb/include/kernel/signaldata/DropObj.hpp'' storage/ndb/include/kernel/signaldata/Extent.hpp: New BitKeeper file ``storage/ndb/include/kernel/signaldata/Extent.hpp'' storage/ndb/include/kernel/signaldata/LgmanContinueB.hpp: New BitKeeper file ``storage/ndb/include/kernel/signaldata/LgmanContinueB.hpp'' storage/ndb/include/kernel/signaldata/PgmanContinueB.hpp: New BitKeeper file ``storage/ndb/include/kernel/signaldata/PgmanContinueB.hpp'' storage/ndb/include/kernel/signaldata/RestoreContinueB.hpp: New BitKeeper file ``storage/ndb/include/kernel/signaldata/RestoreContinueB.hpp'' storage/ndb/include/kernel/signaldata/RestoreImpl.hpp: New BitKeeper file ``storage/ndb/include/kernel/signaldata/RestoreImpl.hpp'' storage/ndb/include/kernel/signaldata/TsmanContinueB.hpp: New BitKeeper file ``storage/ndb/include/kernel/signaldata/TsmanContinueB.hpp'' storage/ndb/src/kernel/blocks/dbdih/printSysfile.cpp: New BitKeeper file ``storage/ndb/src/kernel/blocks/dbdih/printSysfile.cpp'' storage/ndb/src/kernel/blocks/dbtup/DbtupDiskAlloc.cpp: New BitKeeper file ``storage/ndb/src/kernel/blocks/dbtup/DbtupDiskAlloc.cpp'' storage/ndb/src/kernel/blocks/dbtup/DbtupVarAlloc.cpp: New BitKeeper file ``storage/ndb/src/kernel/blocks/dbtup/DbtupVarAlloc.cpp'' storage/ndb/src/kernel/blocks/dbtup/Undo_buffer.cpp: New BitKeeper file ``storage/ndb/src/kernel/blocks/dbtup/Undo_buffer.cpp'' storage/ndb/src/kernel/blocks/dbtup/Undo_buffer.hpp: New BitKeeper file ``storage/ndb/src/kernel/blocks/dbtup/Undo_buffer.hpp'' storage/ndb/src/kernel/blocks/dbtup/test_varpage.cpp: New BitKeeper file ``storage/ndb/src/kernel/blocks/dbtup/test_varpage.cpp'' storage/ndb/src/kernel/blocks/dbtup/tuppage.cpp: New BitKeeper file ``storage/ndb/src/kernel/blocks/dbtup/tuppage.cpp'' storage/ndb/src/kernel/blocks/dbtup/tuppage.hpp: New BitKeeper file ``storage/ndb/src/kernel/blocks/dbtup/tuppage.hpp'' storage/ndb/src/kernel/blocks/diskpage.cpp: New BitKeeper file ``storage/ndb/src/kernel/blocks/diskpage.cpp'' storage/ndb/src/kernel/blocks/diskpage.hpp: New BitKeeper file ``storage/ndb/src/kernel/blocks/diskpage.hpp'' storage/ndb/src/kernel/blocks/lgman.cpp: New BitKeeper file ``storage/ndb/src/kernel/blocks/lgman.cpp'' storage/ndb/src/kernel/blocks/lgman.hpp: New BitKeeper file ``storage/ndb/src/kernel/blocks/lgman.hpp'' storage/ndb/src/kernel/blocks/pgman.cpp: New BitKeeper file ``storage/ndb/src/kernel/blocks/pgman.cpp'' storage/ndb/src/kernel/blocks/pgman.hpp: New BitKeeper file ``storage/ndb/src/kernel/blocks/pgman.hpp'' storage/ndb/src/kernel/blocks/print_file.cpp: New BitKeeper file ``storage/ndb/src/kernel/blocks/print_file.cpp'' storage/ndb/src/kernel/blocks/restore.cpp: New BitKeeper file ``storage/ndb/src/kernel/blocks/restore.cpp'' storage/ndb/src/kernel/blocks/restore.hpp: New BitKeeper file ``storage/ndb/src/kernel/blocks/restore.hpp'' storage/ndb/src/kernel/blocks/tsman.cpp: New BitKeeper file ``storage/ndb/src/kernel/blocks/tsman.cpp'' storage/ndb/src/kernel/blocks/tsman.hpp: New BitKeeper file ``storage/ndb/src/kernel/blocks/tsman.hpp'' storage/ndb/src/kernel/vm/DLCFifoList.hpp: New BitKeeper file ``storage/ndb/src/kernel/vm/DLCFifoList.hpp'' storage/ndb/src/kernel/vm/DLCHashTable.hpp: New BitKeeper file ``storage/ndb/src/kernel/vm/DLCHashTable.hpp'' storage/ndb/src/kernel/vm/KeyTable2Ref.hpp: New BitKeeper file ``storage/ndb/src/kernel/vm/KeyTable2Ref.hpp'' storage/ndb/src/kernel/vm/Rope.cpp: New BitKeeper file ``storage/ndb/src/kernel/vm/Rope.cpp'' storage/ndb/src/kernel/vm/Rope.hpp: New BitKeeper file ``storage/ndb/src/kernel/vm/Rope.hpp''
Diffstat (limited to 'storage/ndb/test/src/NDBT_Test.cpp')
-rw-r--r--storage/ndb/test/src/NDBT_Test.cpp143
1 files changed, 131 insertions, 12 deletions
diff --git a/storage/ndb/test/src/NDBT_Test.cpp b/storage/ndb/test/src/NDBT_Test.cpp
index 4cd9df8e538..701c9912373 100644
--- a/storage/ndb/test/src/NDBT_Test.cpp
+++ b/storage/ndb/test/src/NDBT_Test.cpp
@@ -31,7 +31,6 @@
NDBT_Context::NDBT_Context(Ndb_cluster_connection& con)
: m_cluster_connection(con)
{
- tab = NULL;
suite = NULL;
testcase = NULL;
ndb = NULL;
@@ -58,8 +57,8 @@ NDBT_Context::~NDBT_Context(){
}
const NdbDictionary::Table* NDBT_Context::getTab(){
- assert(tab != NULL);
- return tab;
+ assert(tables.size());
+ return tables[0];
}
NDBT_TestSuite* NDBT_Context::getSuite(){
@@ -225,8 +224,25 @@ bool NDBT_Context::setDbProperty(const char*, Uint32){
}
void NDBT_Context::setTab(const NdbDictionary::Table* ptab){
- assert(ptab != NULL);
- tab = ptab;
+ tables.clear();
+ tables.push_back(ptab);
+ tables.push_back(0);
+}
+
+void NDBT_Context::addTab(const NdbDictionary::Table* ptab){
+ if(tables.size())
+ tables.back() = ptab;
+ else
+ tables.push_back(ptab);
+
+ tables.push_back(0);
+}
+
+
+const NdbDictionary::Table**
+NDBT_Context::getTables()
+{
+ return tables.getBase();
}
void NDBT_Context::setSuite(NDBT_TestSuite* psuite){
@@ -751,6 +767,8 @@ NDBT_TestSuite::NDBT_TestSuite(const char* pname):name(pname){
records = 0;
loops = 0;
createTable = true;
+ diskbased = false;
+ tsname = NULL;
createAllTables = false;
}
@@ -766,6 +784,9 @@ void NDBT_TestSuite::setCreateTable(bool _flag){
createTable = _flag;
}
+void NDBT_TestSuite::setRunAllTables(bool _flag){
+ runonce = _flag;
+}
void NDBT_TestSuite::setCreateAllTables(bool _flag){
createAllTables = _flag;
}
@@ -780,6 +801,14 @@ int NDBT_TestSuite::addTest(NDBT_TestCase* pTest){
return 0;
}
+static int
+g_create_hook(Ndb* ndb, NdbDictionary::Table& tab, int when, void* arg)
+{
+ NDBT_TestSuite* ts = (NDBT_TestSuite*)arg;
+ return ts->createHook(ndb, tab, when);
+}
+
+
int NDBT_TestSuite::executeAll(Ndb_cluster_connection& con,
const char* _testname){
@@ -796,14 +825,84 @@ int NDBT_TestSuite::executeAll(Ndb_cluster_connection& con,
ndbout << name << " started [" << getDate() << "]" << endl;
- testSuiteTimer.doStart();
- for (int t=0; t < NDBT_Tables::getNumTables(); t++){
- const NdbDictionary::Table* ptab = NDBT_Tables::getTable(t);
- ndbout << "|- " << ptab->getName() << endl;
- execute(con, &ndb, ptab, _testname);
+ if(!runonce)
+ {
+ testSuiteTimer.doStart();
+ for (int t=0; t < NDBT_Tables::getNumTables(); t++){
+ const NdbDictionary::Table* ptab = NDBT_Tables::getTable(t);
+ ndbout << "|- " << ptab->getName() << endl;
+ execute(con, &ndb, ptab, _testname);
+ }
+ testSuiteTimer.doStop();
+ }
+ else
+ {
+ NdbDictionary::Dictionary* pDict= ndb.getDictionary();
+ for (unsigned i = 0; i < tests.size(); i++){
+ if (_testname != NULL && strcasecmp(tests[i]->getName(), _testname) != 0)
+ continue;
+
+
+ tests[i]->initBeforeTest();
+ ctx = new NDBT_Context(con);
+
+ Uint32 t;
+ for (t=0; t < (Uint32)NDBT_Tables::getNumTables(); t++)
+ {
+ const NdbDictionary::Table* pTab = NDBT_Tables::getTable(t);
+ const NdbDictionary::Table* pTab2 = pDict->getTable(pTab->getName());
+
+ if(pTab2 != 0 && pDict->dropTable(pTab->getName()) != 0)
+ {
+ numTestsFail++;
+ numTestsExecuted++;
+ g_err << "ERROR0: Failed to drop table " << pTab->getName() << endl;
+ tests[i]->saveTestResult(pTab, FAILED_TO_CREATE);
+ continue;
+ }
+
+ if (NDBT_Tables::createTable(&ndb, pTab->getName(), false, false,
+ g_create_hook, this) != 0) {
+ numTestsFail++;
+ numTestsExecuted++;
+ g_err << "ERROR1: Failed to create table " << pTab->getName()
+ << pDict->getNdbError() << endl;
+ tests[i]->saveTestResult(pTab, FAILED_TO_CREATE);
+ continue;
+ }
+ pTab2 = pDict->getTable(pTab->getName());
+
+ ctx->addTab(pTab2);
+ }
+
+ ctx->setNumRecords(records);
+ ctx->setNumLoops(loops);
+ if(remote_mgm != NULL)
+ ctx->setRemoteMgm(remote_mgm);
+ ctx->setSuite(this);
+
+ const NdbDictionary::Table** tables= ctx->getTables();
+
+ result = tests[i]->execute(ctx);
+ tests[i]->saveTestResult(tables[0], result);
+ if (result != NDBT_OK)
+ numTestsFail++;
+ else
+ numTestsOk++;
+ numTestsExecuted++;
+
+ if(result == NDBT_OK)
+ {
+ for(t = 0; tables[t] != 0; t++)
+ {
+ pDict->dropTable(tables[t]->getName());
+ }
+ }
+
+ delete ctx;
+ }
}
- testSuiteTimer.doStop();
return reportAllTables(_testname);
}
@@ -839,6 +938,25 @@ NDBT_TestSuite::executeOne(Ndb_cluster_connection& con,
}
}
+int
+NDBT_TestSuite::createHook(Ndb* ndb, NdbDictionary::Table& tab, int when)
+{
+ if (when == 0) {
+ if (diskbased) {
+ for (int i = 0; i < tab.getNoOfColumns(); i++) {
+ NdbDictionary::Column* col = tab.getColumn(i);
+ if (! col->getPrimaryKey()) {
+ col->setStorageType(NdbDictionary::Column::StorageTypeDisk);
+ }
+ }
+ }
+ if (tsname != NULL) {
+ tab.setTablespace(tsname);
+ }
+ }
+ return 0;
+}
+
void NDBT_TestSuite::execute(Ndb_cluster_connection& con,
Ndb* ndb, const NdbDictionary::Table* pTab,
const char* _testname){
@@ -873,7 +991,8 @@ void NDBT_TestSuite::execute(Ndb_cluster_connection& con,
continue;
}
- if(NDBT_Tables::createTable(ndb, pTab->getName()) != 0){
+ if (NDBT_Tables::createTable(ndb, pTab->getName(), false, false,
+ g_create_hook, this) != 0) {
numTestsFail++;
numTestsExecuted++;
g_err << "ERROR1: Failed to create table " << pTab->getName()