Revision: 21081
          
http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=21081
Author:   jaguarandi
Date:     2009-06-22 19:20:35 +0200 (Mon, 22 Jun 2009)

Log Message:
-----------
*added readme
*changed the way current machine is configured
*add sample css file to repository
*added sample scene with a sample config(.xml)
(xml config is not mandatory.. it uses config.default_case if no .xml with same 
basename is found)

Modified Paths:
--------------
    branches/soc-2009-jaguarandi/test/Test.py
    branches/soc-2009-jaguarandi/test/blendertest.py
    branches/soc-2009-jaguarandi/test/config.py

Added Paths:
-----------
    branches/soc-2009-jaguarandi/test/README
    branches/soc-2009-jaguarandi/test/case/
    branches/soc-2009-jaguarandi/test/case/sample/
    branches/soc-2009-jaguarandi/test/case/sample/simple.blend
    branches/soc-2009-jaguarandi/test/case/sample/simple.xml
    branches/soc-2009-jaguarandi/test/default_machine.xml
    branches/soc-2009-jaguarandi/test/html/
    branches/soc-2009-jaguarandi/test/html/style.css

Property Changed:
----------------
    branches/soc-2009-jaguarandi/test/Test.py
    branches/soc-2009-jaguarandi/test/blendertest.py
    branches/soc-2009-jaguarandi/test/config.py
    branches/soc-2009-jaguarandi/test/html.py
    branches/soc-2009-jaguarandi/test/persistent.py
    branches/soc-2009-jaguarandi/test/util.py

Added: branches/soc-2009-jaguarandi/test/README
===================================================================
--- branches/soc-2009-jaguarandi/test/README                            (rev 0)
+++ branches/soc-2009-jaguarandi/test/README    2009-06-22 17:20:35 UTC (rev 
21081)
@@ -0,0 +1,48 @@
+An updated documentation on this can be found on: 
+  
http://wiki.blender.org/index.php/User:Jaguarandi/SummerOfCode2009/BlenderTest
+
+==Blender Test==
+With the purpose to easy the test of the SoC project and help finding 
optimizaton directions, a python script has been developped.
+
+A sample html output can be seen at: 
http://andresp.no-ip.org/soc2009/btest/html/render.html
+Source code: 
https://svn.blender.org/svnroot/bf-blender/branches/soc-2009-jaguarandi/test
+
+
+===Concepts===
+This test script uses 4 concepts:
+
+====machine====
+current machine (configured on config.py)
+
+====build====
+a blender binary (*.bin) (given as argument)     
+
+====case====
+A .blend scene (*.blend) (given as argument)
+
+====test-run====
+A test-run is the result of running a build against a scene on a given machine
+test-run results are saved on:
+ <config.run_path>/<machine_hash>/<build_hash>/<case_hash>/result.xml
+ <config.run_path>/<machine_hash>/<build_hash>/<case_hash>/1.png
+and save information like: time, stderr, stdout, exit_code, image result
+
+
+===Usage===
+blendertest.py <action> <paths>
+
+*all .blend found while walking the paths are considered as a test case
+*all .bin found while walking the paths are considered builds
+
+action can be one of:
+ --update (run tests cases on the given builds/cases)
+ --html   (outputs a comparison table between the given builds/cases)
+
+as so running builds against test case can be as simple as:
+ blendertest.py --update <paths_with_cases> <paths_with_builds>
+ blendertest.py --update case/test249/render build/rev12345.bin
+
+to generate an html comparison use:
+ blendertest.py --html <path_with_cases> <paths_with_builds>
+ bendertest.py --html build/ case/ > html/all.html
+


Property changes on: branches/soc-2009-jaguarandi/test/README
___________________________________________________________________
Name: svn:eol-style
   + native

Modified: branches/soc-2009-jaguarandi/test/Test.py
===================================================================
--- branches/soc-2009-jaguarandi/test/Test.py   2009-06-22 16:34:37 UTC (rev 
21080)
+++ branches/soc-2009-jaguarandi/test/Test.py   2009-06-22 17:20:35 UTC (rev 
21081)
@@ -37,7 +37,7 @@
        def run(self, test):
                #prepare cmdline
                filename = os.path.join(test.path, self["filename"])
-               cmd = [ test["build"]["path"], "-b", self["path"], "-o", 
filename, "-F", "PNG", "-x", "0", "-f", "%d"%self["frame"]]
+               cmd = [ test["build"]["path"], "-b", self["scene"], "-o", 
filename, "-F", "PNG", "-x", "0", "-f", "%d"%self["frame"]]
 
                if self.run_cmd(cmd, test) == 0:
                        test["result"] = TestRun.RESULT_OK


Property changes on: branches/soc-2009-jaguarandi/test/Test.py
___________________________________________________________________
Name: svn:eol-style
   + native

Modified: branches/soc-2009-jaguarandi/test/blendertest.py
===================================================================
--- branches/soc-2009-jaguarandi/test/blendertest.py    2009-06-22 16:34:37 UTC 
(rev 21080)
+++ branches/soc-2009-jaguarandi/test/blendertest.py    2009-06-22 17:20:35 UTC 
(rev 21081)
@@ -24,7 +24,7 @@
 ENDC = "\033[0m"
 
 ### Build ###
-_valid_build = re.compile(r'.*\.bin$')
+_valid_build = re.compile(r'.*(\.bin|blender)$')
 def is_valid_build(arg):
        return _valid_build.match( arg )
        
@@ -36,6 +36,7 @@
        conf["name"] = os.path.splitext(os.path.basename(path))[0]
        conf["hash"] = util.get_hash(open(path, 'rb'))
                
+#      print "Build:",conf
        return conf
 
 ### Test Case ###      
@@ -44,13 +45,21 @@
        return _valid_scene.match( arg )
 
 def load_case(path):
-       #TODO test the existence of a .xml file with diferent configuration for 
this test case
-       conf = dict(config.default_case_config)
-       
+       conf = dict()
+               
        conf["path"] = path
+       conf["scene"] = path
        conf["name"] = os.path.splitext(os.path.basename(path))[0]
        conf["hash"] = util.get_hash(open(path, 'rb'))
                
+       xml_conf = util.change_extension(path, ".xml")
+       if os.path.isfile(xml_conf):
+               conf["path"] = xml_conf
+               conf.update( persistent.load( open(xml_conf, "r" ) ) )
+       else:
+               conf.update( config.default_case_config )
+       
+#      print "Testcase:",conf
        return conf
 
 


Property changes on: branches/soc-2009-jaguarandi/test/blendertest.py
___________________________________________________________________
Name: svn:eol-style
   + native

Added: branches/soc-2009-jaguarandi/test/case/sample/simple.blend
===================================================================
(Binary files differ)


Property changes on: branches/soc-2009-jaguarandi/test/case/sample/simple.blend
___________________________________________________________________
Name: svn:mime-type
   + application/octet-stream

Added: branches/soc-2009-jaguarandi/test/case/sample/simple.xml
===================================================================
--- branches/soc-2009-jaguarandi/test/case/sample/simple.xml                    
        (rev 0)
+++ branches/soc-2009-jaguarandi/test/case/sample/simple.xml    2009-06-22 
17:20:35 UTC (rev 21081)
@@ -0,0 +1,43 @@
+<?xml version='1.0' encoding='UTF-8'?>
+<marshal>
+  <dictionary id='testcase'>
+
+<!--
+If not defined the a hash based on a md5sum of the .blend content will be used
+
+    <string>hash</string>
+    <string>1B2M2Y8AsgTp</string>
+ -->
+
+<!--
+If not defined name will be the basename of the used scene
+    <string>name</string>
+    <string>default</string>
+ -->
+ 
+       <!-- type of test case -->
+    <string>type</string>
+    <string>Render</string>
+
+    <string>filename</string>
+    <string>#.png</string>
+
+    <string>frame</string>
+    <int>1</int>
+    
+    <string>description</string>
+    <string>This is the default scene in blender.</string>
+
+<!--
+You can define any other information.
+
+    <string>author</string>
+    <string>...</string>
+
+    <string>url</string>
+    <string>...</string>
+
+ -->
+
+  </dictionary>
+</marshal>

Modified: branches/soc-2009-jaguarandi/test/config.py
===================================================================
--- branches/soc-2009-jaguarandi/test/config.py 2009-06-22 16:34:37 UTC (rev 
21080)
+++ branches/soc-2009-jaguarandi/test/config.py 2009-06-22 17:20:35 UTC (rev 
21081)
@@ -1,7 +1,10 @@
 import os
+import sys
+import persistent
 
 run_path = "run"
 html_path = "html"
+machine_path = "machine.xml"
 
 default_case_config    = {
                "type":                 "Render",
@@ -13,9 +16,21 @@
 
 machine = {
                "hostname":             os.uname()[1],
-#              "cpu":                  "Intel(R) Pentium(R) 4 CPU 2.80GHz",
                "hash":                 os.uname()[1]
        }
 
-print "config.py: please configure your machine description and comment this 
line!"
+if os.path.isfile(machine_path):
+       machine = persistent.load( open(machine_path, "r") )
 
+       if "hash" not in machine:
+               machine["hash"] = os.uname()[1]
+       if "hostname" not in machine:
+               machine["hostname"] = os.uname()[1]
+       
+else:
+       print >>sys.stderr,"""
+       You can configure your machine description on the path 
("""+machine_path+""").
+       Use the file (default_machine.xml) as template.
+       """
+#      os._exit(-1)
+


Property changes on: branches/soc-2009-jaguarandi/test/config.py
___________________________________________________________________
Name: svn:eol-style
   + native

Added: branches/soc-2009-jaguarandi/test/default_machine.xml
===================================================================
--- branches/soc-2009-jaguarandi/test/default_machine.xml                       
        (rev 0)
+++ branches/soc-2009-jaguarandi/test/default_machine.xml       2009-06-22 
17:20:35 UTC (rev 21081)
@@ -0,0 +1,30 @@
+<?xml version='1.0' encoding='UTF-8'?>
+<marshal>
+  <dictionary id='i0'>
+<!--
+       If you dont define this, it will use your hostname as hash
+    <string>hash</string>
+    <string>unconfigured_hash</string>
+ -->    
+
+    <string>model</string>
+    <string>eeepc 1000</string>
+        
+    <string>cpu model</string>
+    <string>Intel(R) Atom(TM) CPU N270   @ 1.60GHz</string>
+
+<!--    
+       You can add any additional information, it will be included on run 
reports
+
+    <string>hostname</string>
+    <string>...</string>
+
+    <string>os</string>
+    <string>Debian GNU/Linux</string>
+    
+    <string>webpage</string>
+    <string>...</string>
+  -->
+    
+  </dictionary>
+</marshal>

Added: branches/soc-2009-jaguarandi/test/html/style.css
===================================================================
--- branches/soc-2009-jaguarandi/test/html/style.css                            
(rev 0)
+++ branches/soc-2009-jaguarandi/test/html/style.css    2009-06-22 17:20:35 UTC 
(rev 21081)
@@ -0,0 +1,98 @@
+body
+{
+       background: #000;
+       color: #eee;
+}
+
+img
+{
+       border: none;
+}
+table.comparison_scene tr td img
+{
+       width: 100px;
+       display:block;
+       margin: auto;
+}
+table.comparison_scene tr td
+{
+       text-align: center;
+}
+table.comparison_scene tr td.fail
+{
+       color: #000;
+       background: #eaa;
+}
+table.comparison_scene tr td.error
+{
+       color: #000;
+       background: #eaa;
+}
+table.comparison_scene tr td.ok
+{
+       color: #000;
+       background: #aea;
+}
+table.comparison_scene tr td.warning
+{
+       color: #000;
+       background: #eea;
+}
+table.comparison_scene tr td.not_available
+{
+       color: #000;
+       background: #bbb;
+}
+
+.cmp_equal
+{
+       font-weight: bolder;
+       color: #000;
+}
+.cmp_greater
+{
+       font-weight: bolder;
+       color: #0a0;
+}
+.cmp_less
+{
+       font-weight: bolder;
+       color: #a00;
+}
+
+.block
+{
+       display: block;
+}
+
+/* CSS for test_results */
+.test_run_result > pre
+{
+       border: solid 1px rgb(200,200,200);
+       background: rgb(70,70,70);
+       margin: 1em;
+       padding: 1px;
+       min-height: 1em;
+}
+
+.test_run_result > img
+{
+       display: block;
+       margin: auto;
+}
+
+.test_run_result h1
+{
+       text-align: center;
+}
+
+.test_run_result > dl dt
+{
+       margin-left: 1em;
+       font-weight: bolder;    
+}
+
+.test_run_result > dl dd
+{
+       margin-left: 2em;
+}


Property changes on: branches/soc-2009-jaguarandi/test/html.py
___________________________________________________________________
Name: svn:eol-style
   + native


Property changes on: branches/soc-2009-jaguarandi/test/persistent.py
___________________________________________________________________
Name: svn:eol-style
   + native


Property changes on: branches/soc-2009-jaguarandi/test/util.py
___________________________________________________________________
Name: svn:eol-style
   + native


_______________________________________________
Bf-blender-cvs mailing list
[email protected]
http://lists.blender.org/mailman/listinfo/bf-blender-cvs

Reply via email to