summaryrefslogtreecommitdiff
path: root/ndb/test
diff options
context:
space:
mode:
authorjoreland@mysql.com <>2005-06-09 15:44:57 +0200
committerjoreland@mysql.com <>2005-06-09 15:44:57 +0200
commitf6bb7cabbe3fe2b8343cb8763128b048cf4c1d5f (patch)
treef7b4e570c0747bc54f65bc53d3ad52ad88b4763a /ndb/test
parent872c84b38260cab0a783a3368e8a02d6e5c404b7 (diff)
parent14d74e75dbe5c081d77fc2f4e94f8cd4988ebebf (diff)
downloadmariadb-git-f6bb7cabbe3fe2b8343cb8763128b048cf4c1d5f.tar.gz
merge
Diffstat (limited to 'ndb/test')
-rw-r--r--ndb/test/ndbapi/testNdbApi.cpp102
-rw-r--r--ndb/test/run-test/daily-basic-tests.txt4
-rwxr-xr-xndb/test/run-test/ndb-autotest.sh7
3 files changed, 111 insertions, 2 deletions
diff --git a/ndb/test/ndbapi/testNdbApi.cpp b/ndb/test/ndbapi/testNdbApi.cpp
index 65324af6fe6..000fbcdd66a 100644
--- a/ndb/test/ndbapi/testNdbApi.cpp
+++ b/ndb/test/ndbapi/testNdbApi.cpp
@@ -1269,6 +1269,102 @@ int runBug_11133(NDBT_Context* ctx, NDBT_Step* step){
return result;
}
+int runScan_4006(NDBT_Context* ctx, NDBT_Step* step){
+ int result = NDBT_OK;
+ const Uint32 max= 5;
+ const NdbDictionary::Table* pTab = ctx->getTab();
+
+ Ndb* pNdb = new Ndb("TEST_DB");
+ if (pNdb == NULL){
+ ndbout << "pNdb == NULL" << endl;
+ return NDBT_FAILED;
+ }
+ if (pNdb->init(max)){
+ ERR(pNdb->getNdbError());
+ delete pNdb;
+ return NDBT_FAILED;
+ }
+
+ NdbConnection* pCon = pNdb->startTransaction();
+ if (pCon == NULL){
+ pNdb->closeTransaction(pCon);
+ delete pNdb;
+ return NDBT_FAILED;
+ }
+
+ Uint32 i;
+ Vector<NdbResultSet*> scans;
+ for(i = 0; i<10*max; i++)
+ {
+ NdbScanOperation* pOp = pCon->getNdbScanOperation(pTab->getName());
+ if (pOp == NULL){
+ ERR(pCon->getNdbError());
+ pNdb->closeTransaction(pCon);
+ delete pNdb;
+ return NDBT_FAILED;
+ }
+
+ NdbResultSet* rs;
+ if ((rs= pOp->readTuples()) == 0){
+ pNdb->closeTransaction(pCon);
+ ERR(pOp->getNdbError());
+ delete pNdb;
+ return NDBT_FAILED;
+ }
+ scans.push_back(rs);
+ }
+
+ // Dont' call any equal or setValues
+
+ // Execute should not work
+ int check = pCon->execute(NoCommit);
+ if (check == 0){
+ ndbout << "execute worked" << endl;
+ } else {
+ ERR(pCon->getNdbError());
+ }
+
+ for(i= 0; i<scans.size(); i++)
+ {
+ NdbResultSet* pOp= scans[i];
+ while((check= pOp->nextResult()) == 0);
+ if(check != 1)
+ {
+ ERR(pOp->getOperation()->getNdbError());
+ pNdb->closeTransaction(pCon);
+ delete pNdb;
+ return NDBT_FAILED;
+ }
+ }
+
+ pNdb->closeTransaction(pCon);
+
+ Vector<NdbConnection*> cons;
+ for(i= 0; i<10*max; i++)
+ {
+ pCon= pNdb->startTransaction();
+ if(pCon)
+ cons.push_back(pCon);
+ else
+ break;
+ }
+
+ for(i= 0; i<cons.size(); i++)
+ {
+ cons[i]->close();
+ }
+
+ if(cons.size() != max)
+ {
+ result= NDBT_FAILED;
+ }
+
+ delete pNdb;
+
+ return result;
+}
+
+template class Vector<NdbResultSet*>;
NDBT_TESTSUITE(testNdbApi);
@@ -1351,6 +1447,12 @@ TESTCASE("Bug_11133",
INITIALIZER(runBug_11133);
FINALIZER(runClearTable);
}
+TESTCASE("Scan_4006",
+ "Check that getNdbScanOperation does not get 4006\n"){
+ INITIALIZER(runLoadTable);
+ INITIALIZER(runScan_4006);
+ FINALIZER(runClearTable);
+}
NDBT_TESTSUITE_END(testNdbApi);
int main(int argc, const char** argv){
diff --git a/ndb/test/run-test/daily-basic-tests.txt b/ndb/test/run-test/daily-basic-tests.txt
index ce9f97a9cb2..5d7d7f58f89 100644
--- a/ndb/test/run-test/daily-basic-tests.txt
+++ b/ndb/test/run-test/daily-basic-tests.txt
@@ -520,6 +520,10 @@ max-time: 500
cmd: testNdbApi
args: -n Bug_11133 T1
+max-time: 500
+cmd: testNdbApi
+args: -n Scan_4006 T1
+
#max-time: 500
#cmd: testInterpreter
#args: T1
diff --git a/ndb/test/run-test/ndb-autotest.sh b/ndb/test/run-test/ndb-autotest.sh
index 3ba4d1928d5..09087a8a8c7 100755
--- a/ndb/test/run-test/ndb-autotest.sh
+++ b/ndb/test/run-test/ndb-autotest.sh
@@ -13,7 +13,7 @@ save_args=$*
VERSION="ndb-autotest.sh version 1.04"
DATE=`date '+%Y-%m-%d'`
-HOST=`hostname -s`
+HOST=`hostname`
export DATE HOST
set -e
@@ -330,7 +330,10 @@ start(){
tar cfz /tmp/res.$2.$$.tgz `basename $p2`/$DATE
scp /tmp/res.$2.$$.tgz \
$result_host:$result_path/res.$DATE.$HOST.$2.$$.tgz
- rm -f /tmp/res.$2.$$.tgz
+ if [ $? -eq 0 ]
+ then
+ rm -f /tmp/res.$2.$$.tgz
+ fi
fi
}