List:Commits« Previous MessageNext Message »
From:Magnus Svensson Date:September 12 2008 11:47am
Subject:bzr push into mysql-5.1 branch (msvensson:2665 to 2666)
View as plain text  
 2666 Magnus Svensson	2008-09-11
      Fix valgrind warning in NDBT_Test, use BaaseString instead of strdup
modified:
  storage/ndb/test/include/NDBT_Test.hpp
  storage/ndb/test/src/NDBT_Test.cpp

 2665 Jonas Oreland	2008-09-11
      ndb - autotest
        upload results with temp name, and then rename them,
        to prevent possibility of report producer grabbing them before upload is
        ready
modified:
  storage/ndb/test/run-test/autotest-run.sh

=== modified file 'storage/ndb/test/include/NDBT_Test.hpp'
--- a/storage/ndb/test/include/NDBT_Test.hpp	2007-03-01 09:43:14 +0000
+++ b/storage/ndb/test/include/NDBT_Test.hpp	2008-09-11 10:08:57 +0000
@@ -208,7 +208,7 @@ public:
   virtual void print() = 0;
   virtual void printHTML() = 0;
 
-  const char* getName(){return name;};
+  const char* getName() const { return _name.c_str(); };
   virtual bool tableExists(NdbDictionary::Table* aTable) = 0;
   virtual bool isVerify(const NdbDictionary::Table* aTable) = 0;
 
@@ -238,8 +238,6 @@ protected:
 
   BaseString _name;
   BaseString _comment;
-  const char* name;
-  const char* comment;
   NDBT_TestSuite* suite;
   Properties props;
   NdbTimer timer;

=== modified file 'storage/ndb/test/src/NDBT_Test.cpp'
--- a/storage/ndb/test/src/NDBT_Test.cpp	2007-08-01 07:24:01 +0000
+++ b/storage/ndb/test/src/NDBT_Test.cpp	2008-09-11 10:08:57 +0000
@@ -371,14 +371,10 @@ NDBT_Finalizer::NDBT_Finalizer(NDBT_Test
 NDBT_TestCase::NDBT_TestCase(NDBT_TestSuite* psuite, 
 			     const char* pname, 
 			     const char* pcomment) : 
-  name(strdup(pname)) ,
-  comment(strdup(pcomment)),
+  _name(pname) ,
+  _comment(pcomment),
   suite(psuite)
 {
-  _name.assign(pname);
-  _comment.assign(pcomment);
-  name= _name.c_str();
-  comment= _comment.c_str();
   assert(suite != NULL);
 
   m_all_tables = false;
@@ -602,7 +598,7 @@ void NDBT_TestCaseImpl1::reportStepResul
 int NDBT_TestCase::execute(NDBT_Context* ctx){
   int res;
 
-  ndbout << "- " << name << " started [" << ctx->suite->getDate()
+  ndbout << "- " << _name << " started [" << ctx->suite->getDate()
 	 << "]" << endl;
 
   ctx->setCase(this);
@@ -654,11 +650,11 @@ int NDBT_TestCase::execute(NDBT_Context*
   runFinal(ctx); 
 
   if (res == NDBT_OK) {
-    ndbout << "- " << name << " PASSED [" << ctx->suite->getDate() << "]" 
+    ndbout << "- " << _name << " PASSED [" << ctx->suite->getDate() << "]"
 	   << endl;
   }
   else {
-    ndbout << "- " << name << " FAILED [" << ctx->suite->getDate() << "]" 
+    ndbout << "- " << _name << " FAILED [" << ctx->suite->getDate() << "]"
 	   << endl;
   }
   return res;
@@ -741,7 +737,7 @@ void NDBT_TestCaseImpl1::saveTestResult(
 void NDBT_TestCaseImpl1::printTestResult(){
 
   char buf[255];
-  ndbout << name<<endl;
+  ndbout << _name<<endl;
 
   for (unsigned i = 0; i < testResults.size(); i++){
     NDBT_TestCaseResult* tcr = testResults[i];
@@ -754,8 +750,9 @@ void NDBT_TestCaseImpl1::printTestResult
       res = "FAILED TO CREATE TABLE";
     else if (tcr->getResult() == FAILED_TO_DISCOVER)
       res = "FAILED TO DISCOVER TABLE";
-    BaseString::snprintf(buf, 255," %-10s %-5s %-20s", tcr->getName(), res, tcr->getTimeStr());
-    ndbout << buf<<endl;    
+    BaseString::snprintf(buf, 255," %-10s %-5s %-20s",
+                         tcr->getName(), res, tcr->getTimeStr());
+    ndbout << buf<<endl;
   }
 }
 
@@ -1444,13 +1441,13 @@ const char* NDBT_TestSuite::getDate(){
 void NDBT_TestCaseImpl1::printHTML(){
 
   ndbout << "<tr><td>&nbsp;</td>" << endl;
-  ndbout << "<td name=tc>" << endl << name << "</td><td width=70%>" 
-	 << comment << "</td></tr>" << endl;  
+  ndbout << "<td name=tc>" << endl << _name << "</td><td width=70%>" 
+	 << _comment << "</td></tr>" << endl;  
 }
 
 void NDBT_TestCaseImpl1::print(){
-  ndbout << "Test case: " << name << endl;
-  ndbout << "Description: "<< comment << endl;
+  ndbout << "Test case: " << _name << endl;
+  ndbout << "Description: "<< _comment << endl;
 
   ndbout << "Parameters: " << endl;
 

Thread
bzr push into mysql-5.1 branch (msvensson:2665 to 2666) Magnus Svensson12 Sep