19 #include <ndb_global.h>
21 #include <TransporterDefinitions.hpp>
22 #include <SimpleProperties.hpp>
23 #include <LongSignal.hpp>
28 Buffer(Uint32
size){ m_sz =
size; buffer =
new Uint32[m_sz]; m_len = 0;}
29 ~
Buffer(){
delete [] buffer;}
46 #define relSz(x) ((x == 0)? 1 : ((x + SectionSegment::DataLength - 1) / SectionSegment::DataLength))
50 const Uint32 sz = relSz(ptr.sz);
51 thePool.releaseList(sz,
53 ptr.p->m_lastSegment);
62 for(Uint32
i = 0;
i<buf.m_len;
i++){
64 if(!db.getWord(&tmp)){
65 ndbout_c(
"getWord(...) failed i=%d size=%d",
i, buf.m_len);
69 if(tmp != buf.buffer[
i]){
70 ndbout_c(
"getWord(...)=%d != buf[%d]=%d size=%d", tmp,
i,
71 buf.buffer[
i], buf.m_len);
81 if(!db.getWords(buf2.buffer, buf.m_len))
85 for(Uint32
i = 0;
i<buf.m_len;
i++){
86 if(buf.buffer[
i] != buf2.buffer[
i]){
87 ndbout_c(
"getWords(...) buf[%d] != buf2[%d] size=%d",
i,
i, buf.m_len);
97 test(Uint32 sz, Uint32 loops, Uint32 iter){
99 ndbout_c(
"SimplePropertiesSection sz=%d loops=%d iter=%d", sz, loops, iter);
102 Uint32
size = sz*((10 + (rand() % (10 * sz)) + sz - 1)/sz);
107 for(Uint32
i = 0;
i<iter;
i++){
108 Uint32 c = 0 + (rand() % (2));
110 const Uint32 alloc = 1 + (rand() % (
size - 1));
114 ndbout_c(
"size: %d loops: %d iter: %d c=%d alloc=%d",
115 size, loops,
i, c, alloc);
119 for(Uint32
i = 0;
i<alloc;
i++)
124 for(Uint32
i = 0;
i<alloc;
i++){
125 w.putWord(buf.buffer[
i]);
131 for(Uint32
i = 0;
i<alloc;
i++)
138 Uint32 sz = rand() % (alloc - i + 1);
139 w.putWords(&buf.buffer[i], sz);
151 release(thePool, dst);
152 require(thePool.getSize() == thePool.getNoOfFree());
160 srand(NdbTick_CurrentMillisecond());
163 test(54, 1000, 1000);
164 test(59, 1000, 1000);
165 test(60, 1000, 1000);
166 test(61, 1000, 1000);
171 ErrorReporter::handleAssert(
const char *
msg,
const char *
file,
int line)
173 ndbout <<
"ErrorReporter::handleAssert activated - "
174 <<
" line= " << line << endl;