#! /usr/bin/env python # loading an environment import Params import Runner pexec = Runner.exec_command Params.set_trace(0, 0, 0) # constants sconstruct_x = """ bld.set_srcdir('.') bld.set_bdir('_build_') bld.scandirs('src ') from Common import dummy add_subdir('src') """ sconscript_0=""" obj=dummy() obj.source='dummy.h' obj.target='dummy.i' """ sconscript_1=""" i=0 while i<1000: i+=1 obj=dummy() obj.source='dummy.h' obj.target='dummy.i' """ sconscript_2=""" i=0 while i<10000: i+=1 obj=dummy() obj.source='dummy.h' obj.target='dummy.i' """ def runscript(scriptname): # clean before building pexec('rm -rf runtest/ && mkdir -p runtest/src/') # write our files dest = open('./runtest/sconstruct', 'w') dest.write(sconstruct_x) dest.close() dest = open('./runtest/src/sconscript', 'w') dest.write(scriptname) dest.close() dest = open('./runtest/src/dummy.h', 'w') dest.write('content') dest.close() # now that the files are there, run the app Params.set_trace(0,0,0) os.chdir('runtest') sys.path.append('..') import Scripting import time t1=time.clock() Scripting.Main() t2=time.clock() os.chdir('..') Params.set_trace(1,1,1) return (t2-t1) #t=runscript(sconscript_1) #print "* posting 1000 objects ",t," seconds (1000 times the same)" #t=runscript(sconscript_2) #print "* posting 10000 objects ",t," seconds (10000 times the same)" def runscript2(scriptname, howmany): # clean before building pexec('rm -rf runtest/ && mkdir -p runtest/src/') sc = open('./runtest/sconstruct', 'w') sc.write(""" bld.set_srcdir('.') bld.set_bdir('_build_') bld.scandirs('""") i=0 while i