BUG#:8669
authorr.kieninger <r.kieninger>
Fri, 18 Dec 2009 23:22:00 +0000 (23:22 +0000)
committerr.kieninger <r.kieninger>
Fri, 18 Dec 2009 23:22:00 +0000 (23:22 +0000)
TITLE: TestSCMO fails on 64-bit platforms

DESCRIPTION: Remove volatile data from SCMO data dump and comparison

src/Pegasus/Common/SCMO.cpp
src/Pegasus/Common/SCMO.h
src/Pegasus/Common/SCMODump.h
src/Pegasus/Common/tests/SCMO/TestSCMO.cpp
src/Pegasus/Common/tests/SCMO/masterClass

index bb8dfa046084dee524b7983d45b883e04799b15e..f0b4fe5bdb4343f0bd6d41a66695ff4690136806 100644 (file)
@@ -5371,7 +5371,7 @@ Boolean SCMOInstance::_isPropertyInFilter(Uint32 i) const
  *****************************************************************************/
 SCMODump::SCMODump()
 {
-    _out = stdout;
+    _out = stderr;
     _fileOpen = false;
 
 #ifdef PEGASUS_OS_ZOS
@@ -5470,16 +5470,18 @@ Boolean SCMODump::compareFile(String master)
     return true;
 }
 
-void SCMODump::dumpSCMOInstance(SCMOInstance& testInstconst
+void SCMODump::dumpSCMOInstance(SCMOInstance& testInst, Boolean inclMemHdr)const
 {
     SCMBInstance_Main* insthdr = testInst.inst.hdr;
     char* instbase = testInst.inst.base;
 
     fprintf(_out,"\n\nDump of SCMOInstance\n");
-    // The magic number for SCMO class
-    fprintf(_out,"\nheader.magic=%08X",insthdr->header.magic);
-    // Total size of the instance memory block( # bytes )
-    fprintf(_out,"\nheader.totalSize=%llu",insthdr->header.totalSize);
+
+    if (inclMemHdr)
+    {
+        _dumpSCMBMgmt_Header(insthdr->header,instbase);
+    }
+
     // The reference counter for this c++ class
     fprintf(_out,"\nrefCount=%i",insthdr->refCount.get());
     fprintf(_out,"\ntheClass: %p",insthdr->theClass.ptr);
@@ -5750,16 +5752,57 @@ void SCMODump::dumpSCMOInstanceKeyBindings(
 
 }
 
-void SCMODump::dumpSCMOClass(SCMOClass& testCls) const
+void SCMODump::_dumpSCMBMgmt_Header(SCMBMgmt_Header& header,char* base) const
+{
+    fprintf(_out,"\nThe Management Header:");
+    // The magic number
+    fprintf(_out,"\n   magic=%08X",header.magic);
+    // Total size of the memory block( # bytes )
+    fprintf(_out,"\n   totalSize=%llu",header.totalSize);
+    // Free bytes in the block
+    fprintf(_out,"\n   freeBytes=%llu",header.freeBytes);
+    // Index to the start of the free space in this SCMB memory block.
+    fprintf(_out,"\n   startOfFreeSpace=%llu",header.startOfFreeSpace);
+    // Number of external references in this instance.
+    fprintf(_out,"\n   numberExtRef=%u",header.numberExtRef);
+    // Size of external reference index array;
+    fprintf(_out,"\n   sizeExtRefIndexArray=%u",header.sizeExtRefIndexArray);
+
+    if (header.numberExtRef > 0)
+    {
+        fprintf(_out,"\n   extRefIndexArray=[");
+        Uint64* extRefIndexArray =
+            (Uint64*)&(base[header.extRefIndexArray.start]);
+
+        for (Uint32 i = 0; i < header.numberExtRef;)
+        {
+            fprintf(_out,"%llu",extRefIndexArray[i]);
+            i++;
+            if (i != header.numberExtRef)
+            {
+                fprintf(_out,", ");
+            }
+        }
+        fprintf(_out,"\n");
+    }
+    else
+    {
+           fprintf(_out,"\n   extRefIndexArray=[NO INDEX]\n");
+    }
+}
+
+void SCMODump::dumpSCMOClass(SCMOClass& testCls, Boolean inclMemHdr) const
 {
     SCMBClass_Main* clshdr = testCls.cls.hdr;
     char* clsbase = testCls.cls.base;
 
     fprintf(_out,"\n\nDump of SCMOClass\n");
-    // The magic number for SCMO class
-    fprintf(_out,"\nheader.magic=%08X",clshdr->header.magic);
-    // Total size of the instance memory block( # bytes )
-    fprintf(_out,"\nheader.totalSize=%llu",clshdr->header.totalSize);
+
+    if (inclMemHdr)
+    {
+        _dumpSCMBMgmt_Header(clshdr->header,clsbase);
+    }
+
     // The reference counter for this c++ class
     fprintf(_out,"\nrefCount=%i",clshdr->refCount.get());
     fprintf(_out,"\n\nThe Flags:");
index 33d205a470bfa4038510863b5f8243e478937a05..644805c7db4525f5b7ce29af73c9c3bb3527de75 100644 (file)
@@ -510,17 +510,6 @@ typedef Uint64        SCMBKeyPropertyMask[];
 // can iterate streight  from 0 to filterProperties.
 typedef Uint32      SCMBPropertyFilterIndexMap[];
 
-// This is the definition of a detached instance property.
-struct SCMBProperty_Main
-{
-    // The SCMB management header
-    SCMBMgmt_Header     header;
-    // The property name
-    SCMBDataPtr     name;
-    // The value of this property
-    SCMBValue       value;
-};
-
 // The static definition of the common SCMO memory functions
 inline const void* _resolveDataPtr(
     const SCMBDataPtr& ptr,
index 0f2e755d45e5ca9fb663375f7714cb0ba18b0fb1..e4f0631a3cfd590890bc99ff27a3ccc6562dc895 100644 (file)
@@ -54,7 +54,7 @@ public:
     SCMODump(const char *filename);
     // Methods for SCMOClass only
     void hexDumpSCMOClass(SCMOClass& testCls) const;
-    void dumpSCMOClass(SCMOClass& testCls) const;
+    void dumpSCMOClass(SCMOClass& testCls,Boolean inclMemHdr = true) const;
     void dumpSCMOClassQualifiers(SCMOClass& testCls) const;
     void dumpKeyPropertyMask(SCMOClass& testCls) const;
     void dumpClassProperties(SCMOClass& testCls) const;
@@ -64,7 +64,9 @@ public:
     void dumpClassKeyBindingNodeArray(SCMOClass& testCls) const;
 
     // Methods for SCMOInstance only
-    void dumpSCMOInstance(SCMOInstance& testInst) const;
+    void dumpSCMOInstance(
+        SCMOInstance& testInst,
+        Boolean inclMemHdr = true) const;
     void dumpSCMOInstanceKeyBindings(
         SCMOInstance& testInst,
         Boolean verbose = false) const ;
@@ -124,11 +126,13 @@ private:
         const SCMBClassProperty& prop,
         char* clsbase) const;
 
-   void _hexDump(char* buffer,Uint64 length) const;
+    void _dumpSCMBMgmt_Header(SCMBMgmt_Header& header,char* base) const;
+
+    void _hexDump(char* buffer,Uint64 length) const;
 
-   Boolean _fileOpen;
-   FILE *_out;
-   String _filename;
+    Boolean _fileOpen;
+    FILE *_out;
+    String _filename;
 };
 
 PEGASUS_NAMESPACE_END
index 7bc0f917396e88b8263e9104fa609d6f515a69a7..895a8b12a643cdcc07579dcbae97639eafd4a928 100644 (file)
@@ -85,6 +85,29 @@ SCMOClass _scmoClassCache_GetClass(
         (const char*)nameSpace.getString().getCString());
 }
 
+void structureSizes()
+{
+    cout << endl << "Sizes of structures:" << endl;
+    cout << "=====================" << endl << endl;
+    cout << "SCMBUnion           : " << sizeof(SCMBUnion) << endl;
+    cout << "SCMBDataPtr         : " << sizeof(SCMBDataPtr) << endl;
+    cout << "SCMBValue           : " << sizeof(SCMBValue) << endl;
+    cout << "SCMBKeyBindingValue : " << sizeof(SCMBKeyBindingValue) << endl;
+    cout << "SCMBUserKeyBindingElement : "
+         << sizeof(SCMBUserKeyBindingElement) << endl;
+    cout << "SCMBQualifier       : " << sizeof(SCMBQualifier) << endl;
+    cout << "SCMBMgmt_Header     : " << sizeof(SCMBMgmt_Header) << endl;
+    cout << "SCMBClassProperty   : " << sizeof(SCMBClassProperty) << endl;
+    cout << "SCMBClassPropertySet_Header : "
+         << sizeof(SCMBClassPropertySet_Header) << endl;
+    cout << "SCMBClassPropertyNode : " << sizeof(SCMBClassPropertyNode) << endl;
+    cout << "SCMBKeyBindingNode  : " << sizeof(SCMBKeyBindingNode) << endl;
+    cout << "SCMBKeyBindingSet_Header : "
+         << sizeof(SCMBKeyBindingSet_Header) << endl;
+    cout << "SCMBClass_Main      : " << sizeof(SCMBClass_Main) << endl;
+    cout << "SCMBInstance_Main   : " << sizeof(SCMBInstance_Main) << endl;
+}
+
 void CIMClassToSCMOClass()
 {
     CIMClass theCIMClass;
@@ -108,7 +131,8 @@ void CIMClassToSCMOClass()
     const char TestCSMOClassLog[]="TestSCMOClass.log";
     SCMODump dump(&(TestCSMOClassLog[0]));
 
-    dump.dumpSCMOClass(theSCMOClass);
+    // Do not dump the volatile data.
+    dump.dumpSCMOClass(theSCMOClass,false);
 
     String masterFile (getenv("PEGASUS_ROOT"));
     masterFile.append(MASTERCLASS);
@@ -1790,8 +1814,6 @@ void SCMOInstancePropertyFilterTest()
     PEGASUS_TEST_ASSERT(SCMO_TESTClass2_Inst.getPropertyCount()==3);
 
     VCOUT << endl << "Done." << endl;
-    // dump.dumpSCMOInstance(SCMO_TESTClass2_Inst);
-
 
 }
 
@@ -1856,6 +1878,11 @@ int main (int argc, char *argv[])
     try
     {
 
+        if (verbose)
+        {
+            structureSizes();
+        }
+
         CIMClassToSCMOClass();
 
         // init the cache.
index 6557ce4e3eee2ff64a96b992b626cc3f29d4f9c5..f3e392a0a7394260614af7d7f8b77d4aa2abbff3 100644 (file)
@@ -2,8 +2,6 @@
 
 Dump of SCMOClass
 
-header.magic=F00FABCD
-header.totalSize=32768
 refCount=1
 
 The Flags: