/[escript]/trunk/site_scons/site_init.py
ViewVC logotype

Diff of /trunk/site_scons/site_init.py

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

trunk/scons/scons_extensions.py revision 1233 by phornby, Mon Aug 13 00:20:22 2007 UTC temp_trunk_copy/scons/scons_extensions.py revision 1384 by phornby, Fri Jan 11 02:29:38 2008 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_path'] + ' "' + 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 = sys.executable + " " + app
199      if env.Execute(app)  != 0:     print "Executing test: " + app
200          os.chdir(olddir)     if env.Execute(app) == 0:
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.1233  
changed lines
  Added in v.1384

  ViewVC Help
Powered by ViewVC 1.1.26