[PATCH] checkSkipTest for Skipping unit_test failures

O.R.Senthil Kumaran Senthil_OR at Dell.com
Sat Sep 3 07:33:30 CDT 2005


Patch for Skipping the make unit_test failures.

With the libsmbios-0.10.0_beta5, the following unit test failures are
observed when done make unit_test

opti    void testSmbiosXml::testCmosWriting()... [FAIL]
lattitude_D500          void testSmbiosXml::testCmosWriting()... [FAIL]
lattitude_D500          void testSmbiosXml::testServiceTagWriting()...
[FAIL]
PAweb110        void testSmbiosXml::testServiceTagWriting()... [FAIL]
PE0400          void testSmbiosXml::testCmosWriting()... [FAIL]
PE0500          void testSmbiosXml::testCmosWriting()... [FAIL]
PE0600          void testSmbiosXml::testCmosWriting()... [FAIL]
PE0650          void testSmbiosXml::testCmosWriting()... [FAIL]
PE1300          void testSmbiosXml::testCmosWriting()... [FAIL]
PE1655_blade1   void testSmbiosXml::testServiceTagWriting()... [FAIL]
PE1655_blade2   void testSmbiosXml::testServiceTagWriting()... [FAIL]
PE8450          void testSmbiosXml::testServiceTagWriting()... [FAIL]

Some are due to BIOS Bugs, the workarounds for which is not yet
available. In that case, it was decided that it would be okay to SKIP
those tests.
The following patches will implement a mechanism to SKIP the unit_test
failures for platforms.

* Platform File Specific Changes. To Skip the testCmosWriting and
testServiceTagWriting for lattitude_D500; modify the testInput.xml of
lattitude_D500. Similar changes need to be made for tests for other
platforms.
* checkSkipTest function implemented in testSmbiosXml.cpp.
testSmbiosXml.h modified to include the declaration.
* outputclt.h modified to call checkSkipTest
* testSmbiosXmlPrivate.cpp and testSmbiosXmlPrivate.h modified for
compilation. 


testInput.xml.patch

--- /home/ors/libsmbios-0.10.0_beta5/cppunit/platform/lattitude_D500/testInput.xml      2005-05-20 00:55:44.000000000 +0530
+++ /home/ors/libsmbios-0.10.0_beta5-modified/cppunit/platform/lattitude_D500/testInput.xml     2005-09-03 15:48:57.000000000 +0530
@@ -9,4 +9,12 @@
         <isDellSystem>1</isDellSystem>
     </systemInfo>
     <smbios offset="0x000f8ce0"/>
+    <testsToSkip>
+       <test name="testCmosWriting">
+               <reason>BIOS Bug in this version of BIOS that we have
not yet worked around.</reason>
+       </test>
+       <test name="testServiceTagWriting">
+               <reason>BIOS Bug in this version of BIOS that we have
not yet worked around.</reason>
+       </test>
+    </testToSkip>
 </TESTINPUT>



outputctl.h.patch
--- /home/ors/libsmbios-0.10.0_beta5/cppunit/outputctl.h
2005-08-22 20:22:28.000000000 +0530
+++ /home/ors/libsmbios-0.10.0_beta5-modified/cppunit/outputctl.h
2005-09-03 16:36:21.000000000 +0530
@@ -46,7 +46,7 @@
 // standard stuff

 // Standard test start/end header
-#define STD_TEST_START(arg1, arg2) startTest(arg1, arg2);  bool
skip=false; cout << flush; try {
+#define STD_TEST_START(arg1, arg2) startTest(arg1, arg2);  bool
skip=false; cout << flush; try { checkSkipTest(__FUNCTION__) #define
STD_TEST_END()                              \
         } catch (const skip_test &) {               \
                 skip = true;                        \


testSmbiosXml.cpp.patch

--- /home/ors/libsmbios-0.10.0_beta5/cppunit/interface/testSmbiosXml.cpp
2005-08-30 03:31:35.000000000 +0530
+++ /home/ors/libsmbios-0.10.0_beta5-modified/cppunit/interface/testSmbiosXml.cpp       2005-09-03 16:48:02.000000000 +0530
@@ -1065,6 +1065,35 @@
 }


+// testInput.xml tests
+
+
+// checkSkipTest for Skipping known BIOS Bugs.
+
+void
+testSmbiosXml::checkSkipTest(string testName)
+{
+    if(!doc)
+        throw skip_test();
+
+    try
+    {
+        XERCES_CPP_NAMESPACE_QUALIFIER DOMElement *testsToSkip =
xmlutils::findElement(doc->getDocumentElement(),"testsToSkip","","");
+        XERCES_CPP_NAMESPACE_QUALIFIER DOMElement *test =
xmlutils::findElement(testsToSkip,"test","name",testName);
+
+        if(test)
+            throw "Skip this";
+    }
+    catch (const char *)
+    {
+        throw skip_test();
+    }
+    catch (const exception &)
+    {
+        //Do Nothing
+    }
+}
+
 void
 testSmbiosXml::testIdByte()
 {




testSmbiosXml.h.patch

--- /home/ors/libsmbios-0.10.0_beta5/cppunit/interface/testSmbiosXml.h
2005-08-20 01:03:33.000000000 +0530
+++ /home/ors/libsmbios-0.10.0_beta5-modified/cppunit/interface/testSmbiosXml.h 2005-09-03 16:22:39.000000000 +0530
@@ -52,6 +52,8 @@

     std::string getTestInputString( std::string toFind );

+    void checkSkipTest( std::string testName);
+
     // parser owns all XML entities. When it is deleted, everything
     // goes with it.
     XERCES_CPP_NAMESPACE_QUALIFIER DOMBuilder *parser;



testSmbiosXmlPrivate.cpp.patch
--- /home/ors/libsmbios-0.10.0_beta5/cppunit/private/testSmbiosXmlPrivate.cpp   2005-08-22 11:30:25.000000000 +0530
+++ /home/ors/libsmbios-0.10.0_beta5-modified/cppunit/private/testSmbiosXmlPrivate.cpp  2005-09-03 16:51:02.000000000 +0530
@@ -70,4 +70,8 @@
     STD_TEST_END();
 }

+void
+testSmbiosXmlPrivate::checkSkipTest(string)
+{}
+


testSmbiosXmlPrivate.h.patch
--- /home/ors/libsmbios-0.10.0_beta5/cppunit/private/testSmbiosXmlPrivate.h     2005-06-16 03:08:54.000000000 +0530
+++ /home/ors/libsmbios-0.10.0_beta5-modified/cppunit/private/testSmbiosXmlPrivate.h    2005-09-03 16:51:49.000000000 +0530
@@ -45,6 +45,8 @@
         return STD_SMBIOS_XML_FILE;
     };

+    void checkSkipTest(std::string);
+
 public:
     virtual void setUp();
     virtual void tearDown();



Please let me know your comments on changes which need/can be done.

Thanks Michael and Sandeep for the guidance and support.


Regards,
Senthil





More information about the libsmbios-devel mailing list