/[escript]/branches/stage3.0/scons/scons_extensions.py
ViewVC logotype

Diff of /branches/stage3.0/scons/scons_extensions.py

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1311 by phornby, Mon Aug 13 06:39:29 2007 UTC revision 1312 by ksteube, Mon Sep 24 06:18:44 2007 UTC
# Line 5  Line 5 
5  import py_compile  import py_compile
6  import sys  import sys
7  import os  import os
8    import time
9  import glob  import glob
10  import fnmatch  import fnmatch
11  import types  import types
# Line 177  def doSubstitution(target,source,env) : Line 178  def doSubstitution(target,source,env) :
178    
179  # Code to run unit_test executables  # Code to run unit_test executables
180  def runUnitTest(target, source, env):  def runUnitTest(target, source, env):
181      app = str(source[0].abspath)    time_start = time.time()
182      app = str(source[0].abspath)
183      olddir = os.getcwd()    if env['useMPI']: app = env['mpi_run'] + ' ' + app
184      newdir = os.path.dirname(str(source[0]))    print "Executing test: " + app
185      os.chdir(newdir)    if not env.Execute(app):
   
     if env.Execute(app) != 0:  
         os.chdir(olddir)  
         return 1  
   
     os.chdir(olddir)  
186      open(str(target[0]),'w').write("PASSED\n")      open(str(target[0]),'w').write("PASSED\n")
187      return 0    else:
188        return 1
189      print "Test execution time: ", round(time.time() - time_start, 1), " seconds wall time for " + str(source[0].abspath)
190      return None
191    
192  def runPyUnitTest(target, source, env):  def runPyUnitTest(target, source, env):
193      app = env['python_cmd'] + ' "' + str(source[0].abspath) + '"'     time_start = time.time()
194       app = str(source[0].abspath)
195      olddir = os.getcwd()     if env['useMPI']:
196      newdir = os.path.dirname(str(source[0]))       app = env['mpi_run'] +' lib/pythonMPI ' + app
197      os.chdir(newdir)     else:
198         app = 'python ' + app
199      if env.Execute(app)  != 0:     print "Executing test: " + app
200          os.chdir(olddir)     if not env.Execute(app):
201          return 1        open(str(target[0]),'w').write("PASSED\n")
202       else:
203      os.chdir(olddir)       return 1
204      open(str(target[0]),'w').write("PASSED\n")     print "Test execution time: ", round(time.time() - time_start, 1), " seconds wall time for " + str(source[0].abspath)
205      return 0     return None
     
206    
207  def addBuilders(env) :  def addBuilders(env) :
208      py_builder = env.Builder(action = build_py,      py_builder = env.Builder(action = build_py,

Legend:
Removed from v.1311  
changed lines
  Added in v.1312

  ViewVC Help
Powered by ViewVC 1.1.26