Fixed non-regression test of config_utils in canfestival plugin
authoretisserant
Fri, 23 May 2008 18:48:03 +0200
changeset 150 204d515df3dd
parent 149 fc7fe0de9143
child 151 43614ea83d2a
Fixed non-regression test of config_utils in canfestival plugin
plugins/canfestival/config_utils.py
plugins/canfestival/test_config/master.od
plugins/canfestival/test_config/result.txt
--- a/plugins/canfestival/config_utils.py	Fri May 23 18:47:32 2008 +0200
+++ b/plugins/canfestival/config_utils.py	Fri May 23 18:48:03 2008 +0200
@@ -642,7 +642,7 @@
     
     # Generate MasterNode configuration
     try:
-        masternode = GenerateConciseDCF(locations, (0, 1), nodelist, True)
+        masternode = GenerateConciseDCF(locations, (0, 1), nodelist, True, "TestNode")
     except ValueError, message:
         print "%s\nTest Failed!"%message
         sys.exit()
@@ -659,26 +659,11 @@
         
         print "Reset Successful!"
     else:
-        # Test each line of the result with the reference result
-        test = [line.rstrip() for line in result.splitlines()]
-        
-        file = open("test_config/result.txt", "r")
-        model = [line.rstrip() for line in file.readlines() if line.rstrip()]
+        import os
+        
+        file = open("test_config/result_tmp.txt", "w")
+        file.write(result)
         file.close()
         
-        errors = 0
-        for i, line in enumerate(model):
-            if i >= len(test):
-                errors += 1
-                print "Line %d disappear :\n%s\n"%(i + 1, line)
-            elif line != test[i]:
-                errors += 1
-                print "Error on line %d :\n%s\nInstead of :\n%s\n"%(i + 1, test[i], line)
-        for i in xrange(len(model), len(test)):
-            errors += 1
-            print "Line %d appear :\n%s\n"%(i + 1, test[i])
-        
-        if errors > 0:
-            print "%d errors found.\nTest Failed!"%errors
-        else:
-            print "Test Successful!"
+        os.system("diff test_config/result.txt test_config/result_tmp.txt")
+        os.remove("test_config/result_tmp.txt")
--- a/plugins/canfestival/test_config/master.od	Fri May 23 18:47:32 2008 +0200
+++ b/plugins/canfestival/test_config/master.od	Fri May 23 18:48:03 2008 +0200
@@ -1,10 +1,10 @@
 <?xml version="1.0"?>
 <!DOCTYPE PyObject SYSTEM "PyObjects.dtd">
-<PyObject module="node" class="Node" id="33192272">
-<attr name="Profile" type="dict" id="31097664" >
+<PyObject module="node" class="Node" id="148584620">
+<attr name="Profile" type="dict" id="148589396" >
 </attr>
 <attr name="Description" type="string" value="" />
-<attr name="Dictionary" type="dict" id="30566656" >
+<attr name="Dictionary" type="dict" id="148592132" >
   <entry>
     <key type="numeric" value="4096" />
     <val type="numeric" value="302" />
@@ -15,8 +15,8 @@
   </entry>
   <entry>
     <key type="numeric" value="6144" />
-    <val type="list" id="33494080" >
-      <item type="string" value="{True:self.ID+(base+1)*0x100+0x80,False:0}[base&lt;4]" />
+    <val type="list" id="148585004" >
+      <item type="string" value="{True:&quot;$NODEID+0x%X80&quot;%(base+1),False:0x80000000}[base&lt;4]" />
       <item type="numeric" value="0" />
       <item type="numeric" value="0" />
       <item type="numeric" value="0" />
@@ -25,7 +25,7 @@
   </entry>
   <entry>
     <key type="numeric" value="5120" />
-    <val type="list" id="33103600" >
+    <val type="list" id="148586060" >
       <item type="numeric" value="448" />
       <item type="numeric" value="1" />
       <item type="numeric" value="0" />
@@ -47,19 +47,19 @@
   </entry>
   <entry>
     <key type="numeric" value="6656" />
-    <val type="list" id="33494296" >
+    <val type="list" id="148585228" >
       <item type="numeric" value="268501000" />
     </val>
   </entry>
   <entry>
     <key type="numeric" value="5632" />
-    <val type="list" id="33156560" >
+    <val type="list" id="148585036" >
       <item type="numeric" value="536870920" />
     </val>
   </entry>
   <entry>
     <key type="numeric" value="4120" />
-    <val type="list" id="33154256" >
+    <val type="list" id="148585292" >
       <item type="numeric" value="0" />
       <item type="numeric" value="0" />
       <item type="numeric" value="0" />
@@ -68,27 +68,27 @@
   </entry>
   <entry>
     <key type="numeric" value="4118" />
-    <val type="list" id="33153104" >
+    <val type="list" id="148585100" >
       <item type="numeric" value="4195804" />
     </val>
   </entry>
 </attr>
-<attr name="SpecificMenu" type="list" id="33103168" >
-</attr>
-<attr name="ParamsDictionary" type="dict" id="20375584" >
-</attr>
-<attr name="UserMapping" type="dict" id="31086928" >
+<attr name="SpecificMenu" type="list" id="148584044" >
+</attr>
+<attr name="ParamsDictionary" type="dict" id="148592268" >
+</attr>
+<attr name="UserMapping" type="dict" id="148592404" >
   <entry>
     <key type="numeric" value="8192" />
-    <val type="dict" id="31097952" >
+    <val type="dict" id="148592540" >
       <entry>
         <key type="string" value="need" />
         <val type="False" value="" />
       </entry>
       <entry>
         <key type="string" value="values" />
-        <val type="list" id="33156128" >
-          <item type="dict" id="24847184" >
+        <val type="list" id="148585868" >
+          <item type="dict" id="148592676" >
             <entry>
               <key type="string" value="access" />
               <val type="string" value="rw" />
@@ -119,18 +119,18 @@
     </val>
   </entry>
 </attr>
-<attr name="DS302" type="dict" id="30561584" >
+<attr name="DS302" type="dict" id="148592812" >
   <entry>
     <key type="numeric" value="7968" />
-    <val type="dict" id="32624112" >
+    <val type="dict" id="148592948" >
       <entry>
         <key type="string" value="need" />
         <val type="False" value="" />
       </entry>
       <entry>
         <key type="string" value="values" />
-        <val type="list" id="33473888" >
-          <item type="dict" id="31092992" >
+        <val type="list" id="148584684" >
+          <item type="dict" id="148593084" >
             <entry>
               <key type="string" value="access" />
               <val type="string" value="ro" />
@@ -148,7 +148,7 @@
               <val type="string" value="Number of Entries" />
             </entry>
           </item>
-          <item type="dict" id="24983440" >
+          <item type="dict" id="148593220" >
             <entry>
               <key type="string" value="access" />
               <val type="string" value="rw" />
@@ -184,15 +184,15 @@
   </entry>
   <entry>
     <key type="numeric" value="7969" />
-    <val type="dict" id="31087504" >
+    <val type="dict" id="148593356" >
       <entry>
         <key type="string" value="need" />
         <val type="False" value="" />
       </entry>
       <entry>
         <key type="string" value="values" />
-        <val type="list" id="33475040" >
-          <item type="dict" id="21632432" >
+        <val type="list" id="148585516" >
+          <item type="dict" id="148593492" >
             <entry>
               <key type="string" value="access" />
               <val type="string" value="ro" />
@@ -210,7 +210,7 @@
               <val type="string" value="Number of Entries" />
             </entry>
           </item>
-          <item type="dict" id="32618160" >
+          <item type="dict" id="148593628" >
             <entry>
               <key type="string" value="access" />
               <val type="string" value="rw" />
@@ -246,15 +246,15 @@
   </entry>
   <entry>
     <key type="numeric" value="7970" />
-    <val type="dict" id="26876272" >
+    <val type="dict" id="148593764" >
       <entry>
         <key type="string" value="need" />
         <val type="False" value="" />
       </entry>
       <entry>
         <key type="string" value="values" />
-        <val type="list" id="33474968" >
-          <item type="dict" id="24997376" >
+        <val type="list" id="148594956" >
+          <item type="dict" id="148593900" >
             <entry>
               <key type="string" value="access" />
               <val type="string" value="ro" />
@@ -272,7 +272,7 @@
               <val type="string" value="Number of Entries" />
             </entry>
           </item>
-          <item type="dict" id="24995872" >
+          <item type="dict" id="148594036" >
             <entry>
               <key type="string" value="access" />
               <val type="string" value="rw" />
@@ -309,6 +309,6 @@
 </attr>
 <attr name="ProfileName" type="string" value="None" />
 <attr name="Type" type="string">master</attr>
-<attr name="ID" type="numeric" value="1" />
+<attr name="ID" type="numeric" value="0" />
 <attr name="Name" type="string">TestMaster</attr>
 </PyObject>
--- a/plugins/canfestival/test_config/result.txt	Fri May 23 18:47:32 2008 +0200
+++ b/plugins/canfestival/test_config/result.txt	Fri May 23 18:48:03 2008 +0200
@@ -38,18 +38,19 @@
 1403 04 (Compatibility Entry): 0
 1403 05 (Event Timer): 0
 1404 (Receive PDO 5 Parameter):
-1404 01 (COB ID used by PDO): 180
+1404 01 (COB ID used by PDO): 181
 1404 02 (Transmission Type): 1
 1404 03 (Inhibit Time): 0
 1404 04 (Compatibility Entry): 0
 1404 05 (Event Timer): 0
 1600 (Receive PDO 1 Mapping):
 1600 01 (PDO 1 Mapping for an application object 1): 22400108
+1600 02 (PDO 1 Mapping for an application object 2): 0
 1601 (Receive PDO 2 Mapping):
-1601 01 (PDO 2 Mapping for an application object 1): 20010310
+1601 01 (PDO 2 Mapping for an application object 1): 20000310
 1601 02 (PDO 2 Mapping for an application object 2): 23400110
 1601 03 (PDO 2 Mapping for an application object 3): 23400210
-1601 04 (PDO 2 Mapping for an application object 4): 20010310
+1601 04 (PDO 2 Mapping for an application object 4): 20000310
 1602 (Receive PDO 3 Mapping):
 1602 01 (PDO 3 Mapping for an application object 1): 24400120
 1602 02 (PDO 3 Mapping for an application object 2): 24400220
@@ -59,7 +60,7 @@
 1604 01 (PDO 5 Mapping for an application object 1): 22400208
 1604 02 (PDO 5 Mapping for an application object 2): 24400420
 1800 (Transmit PDO 1 Parameter):
-1800 01 (COB ID used by PDO): {True:self.ID+(base+1)*0x100+0x80,False:0}[base<4]
+1800 01 (COB ID used by PDO): {True:"$NODEID+0x%X80"%(base+1),False:0x80000000}[base<4]
 1800 02 (Transmission Type): 0
 1800 03 (Inhibit Time): 0
 1800 04 (Compatibility Entry): 0
@@ -74,9 +75,9 @@
 1A00 01 (PDO 1 Mapping for a process data variable 1): 10010008
 1A01 (Transmit PDO 2 Mapping):
 1A01 01 (PDO 2 Mapping for a process data variable 1): 43400110
-1A01 02 (PDO 2 Mapping for a process data variable 2): 20010310
-1A01 03 (PDO 2 Mapping for a process data variable 3): 20010310
-1A01 04 (PDO 2 Mapping for a process data variable 4): 20010310
+1A01 02 (PDO 2 Mapping for a process data variable 2): 20000310
+1A01 03 (PDO 2 Mapping for a process data variable 3): 20000310
+1A01 04 (PDO 2 Mapping for a process data variable 4): 20000310
 1F22 (Concise DCF):
 1F22 01 (Concise DCF for Node 1): 
 1F22 02 (Concise DCF for Node 2): 
@@ -141,33 +142,30 @@
 1F22 3D (Concise DCF for Node 61): 
 1F22 3E (Concise DCF for Node 62): 
 1F22 3F (Concise DCF for Node 63): 
-1F22 40 (Concise DCF for Node 64): 26 arg defined
+1F22 40 (Concise DCF for Node 64): 23 arg defined
 1F22 40, arg 1: 1800 01 00000004 800001C0
 1F22 40, arg 2: 1800 02 00000001 01
 1F22 40, arg 3: 1800 01 00000004 000001C0
 1F22 40, arg 4: 1801 01 00000004 800002C0
 1F22 40, arg 5: 1801 02 00000001 01
 1F22 40, arg 6: 1801 01 00000004 000002C0
-1F22 40, arg 7: 1801 01 00000004 800002C0
-1F22 40, arg 8: 1801 02 00000001 01
-1F22 40, arg 9: 1801 01 00000004 000002C0
-1F22 40, arg 10: 1401 01 00000004 80000340
-1F22 40, arg 11: 1401 02 00000001 01
-1F22 40, arg 12: 1401 01 00000004 00000340
-1F22 40, arg 13: 1804 01 00000004 80000180
-1F22 40, arg 14: 1804 02 00000001 01
-1F22 40, arg 15: 1804 01 00000004 00000180
-1F22 40, arg 16: 1A04 01 00000004 60020108
-1F22 40, arg 17: 1A04 02 00000004 64260120
-1F22 40, arg 18: 1805 01 00000004 80000182
-1F22 40, arg 19: 1805 02 00000001 01
-1F22 40, arg 20: 1805 01 00000004 00000182
-1F22 40, arg 21: 1A05 01 00000004 64260220
-1F22 40, arg 22: 1A05 02 00000004 64260320
-1F22 40, arg 23: 1806 01 00000004 80000183
-1F22 40, arg 24: 1806 02 00000001 01
-1F22 40, arg 25: 1806 01 00000004 00000183
-1F22 40, arg 26: 1A06 01 00000004 64260420
+1F22 40, arg 7: 1401 01 00000004 80000340
+1F22 40, arg 8: 1401 02 00000001 01
+1F22 40, arg 9: 1401 01 00000004 00000340
+1F22 40, arg 10: 1804 01 00000004 80000181
+1F22 40, arg 11: 1804 02 00000001 01
+1F22 40, arg 12: 1804 01 00000004 00000181
+1F22 40, arg 13: 1A04 01 00000004 60020108
+1F22 40, arg 14: 1A04 02 00000004 64260120
+1F22 40, arg 15: 1805 01 00000004 80000182
+1F22 40, arg 16: 1805 02 00000001 01
+1F22 40, arg 17: 1805 01 00000004 00000182
+1F22 40, arg 18: 1A05 01 00000004 64260220
+1F22 40, arg 19: 1A05 02 00000004 64260320
+1F22 40, arg 20: 1806 01 00000004 80000183
+1F22 40, arg 21: 1806 02 00000001 01
+1F22 40, arg 22: 1806 01 00000004 00000183
+1F22 40, arg 23: 1A06 01 00000004 64260420
 1F22 41 (Concise DCF for Node 65): 
 1F22 42 (Concise DCF for Node 66): 
 1F22 43 (Concise DCF for Node 67): 
@@ -232,12 +230,6 @@
 1F22 7E (Concise DCF for Node 126): 
 1F22 7F (Concise DCF for Node 127): 
 2000 (Read Inputs): 0
-2001 (trashvariables):
-2001 01 (TRASH1): 0
-2001 02 (TRASH8): 0
-2001 03 (TRASH16): 0
-2001 04 (TRASH32): 0
-2001 05 (TRASH64): 0
 2240 (__IB0_1_64):
 2240 01 (24576_1): 0
 2240 02 (24578_1): 0