[Avida-SVN] r1632 - trunk/tests/_testrunner

brysonda at myxo.css.msu.edu brysonda at myxo.css.msu.edu
Fri Jun 1 12:06:00 PDT 2007


Author: brysonda
Date: 2007-06-01 15:06:00 -0400 (Fri, 01 Jun 2007)
New Revision: 1632

Modified:
   trunk/tests/_testrunner/testrunner.py
Log:
Update trunk to TestRunner 1.4

Modified: trunk/tests/_testrunner/testrunner.py
===================================================================
--- trunk/tests/_testrunner/testrunner.py	2007-06-01 19:03:40 UTC (rev 1631)
+++ trunk/tests/_testrunner/testrunner.py	2007-06-01 19:06:00 UTC (rev 1632)
@@ -52,7 +52,7 @@
 
 # Global Constants
 # ---------------------------------------------------------------------------------------------------------------------------
-TESTRUNNER_VERSION = "1.2"
+TESTRUNNER_VERSION = "1.4"
 TESTRUNNER_COPYRIGHT = "2007"
 
 TRUE_STRINGS = ("y","Y","yes","Yes","true","True","1")
@@ -521,31 +521,8 @@
       except (IOError, OSError): pass
     
     
-    # Run warm up
-    p = popen2.Popen4("cd %s; %s %s" % (rundir, self.app, self.args))
-    
-    # Process output from app
-    # Note: must at least swallow app output so that the process output buffer does not fill and block execution
-    if settings.has_key("_verbose"): print
-    for line in p.fromchild:
-      if settings.has_key("_verbose"):
-        sys.stdout.write("%s output: %s" % (self.name, line))
-        sys.stdout.flush()
-    
-    exitcode = p.wait()
-
-    # Check exit code
-    nz = self.getConfig("main", "nonzeroexit", "disallow")
-    if (nz == "disallow" and exitcode != 0) or (nz == "require" and exitcode == 0):
-      try:
-        shutil.rmtree(rundir, True) # Clean up test directory
-      except (IOError, OSError): pass
-      self.psuccess = False
-      self.presult = "test app returned non-zero exit code"
-      return
-    
-    
     # Run test X times, take min value
+    nz = self.getConfig("main", "nonzeroexit", "disallow")
     r_times = []
     t_times = []
     for i in range(settings["perf_repeat"]):
@@ -633,16 +610,17 @@
     r_margin = settings["perf_user_margin"] * r_base
     r_umargin = r_base + r_margin
     r_lmargin = r_base - r_margin
+    r_ratio = r_min / r_base
+
     t_margin = settings["perf_wall_margin"] * t_base
     t_umargin = t_base + t_margin
     t_lmargin = t_base - t_margin
+    t_ratio = t_min / t_base
     
     
     if r_min > r_umargin or t_min > t_umargin:
       self.psuccess = False
       self.presult = "failed"
-      if t_min > t_umargin: self.presult += " - wall = b: %3.4f t: %3.4f" % (t_base, t_min)
-      if r_min > r_umargin: self.presult += " - user = b: %3.4f t: %3.4f" % (r_base, r_min)
     elif r_min < r_lmargin or t_min < t_lmargin:
       # new baseline, move old baseline and write out new results
       try:
@@ -662,15 +640,12 @@
         fp.flush()
         fp.close()
       except (IOError, OSError, shutil.Error):
-        try:
-          shutil.rmtree(rundir, True) # Clean up test directory
-        except (IOError, OSError): pass
         print "Warning: error updating '%s' performance baseline" % self.name
-        return
-        
       self.presult = "exceeded"
-      if t_min < t_lmargin: self.presult += " - wall = b: %3.4f t: %3.4f" % (t_base, t_min)
-      if r_min < r_lmargin: self.presult += " - user = b: %3.4f t: %3.4f" % (r_base, r_min)
+
+    # Print output on all tests
+    self.presult += "\n - wall: %2.2f  base = %3.4f  test = %3.4f" % (t_ratio, t_base, t_min)
+    self.presult += "\n - user: %2.2f  base = %3.4f  test = %3.4f" % (r_ratio, r_base, r_min)
     
     # Clean up test directory
     try:
@@ -757,7 +732,8 @@
     else:
       print "failed\n"
       if self.exitcode != 0:
-        print "exit code: %d" % self.exitcode
+        print "exit code: %d" % os.WEXITSTATUS(self.exitcode)
+        print "term signal: %d" % os.WTERMSIG(self.exitcode)
       else:
         print "output variance(s):"
         for err in self.errors: print err




More information about the Avida-cvs mailing list