Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Fetching contributors…

Cannot retrieve contributors at this time

64 lines (47 sloc) 1.921 kB
import sys
# enable python to find the module
module_path = Dir('.').srcnode().abspath
sys.path.append(module_path)
from build.perftest import compile_test
import os
Import('env')
my_env = env.Clone()
def cu_build_function(source, target, env):
compile_test(str(source[0]), str(target[0]))
# define a rule to build a .cu from a .test
cu_builder = Builder(action = cu_build_function,
suffix = '.cu',
src_suffix = '.test')
my_env.Append(BUILDERS = {'CUFile' : cu_builder})
# define a rule to build a report from an executable
report_builder = Builder(action = os.path.join('"' + str(my_env.Dir('.')), '$SOURCE" > $TARGET'),
suffix = '.xml',
src_suffix = my_env['PROGSUFFIX'])
my_env.Append(BUILDERS = {'Report' : report_builder})
my_env.Append(CPPPATH = [Dir('.').srcnode(), Dir('#/testing')])
cu_list = []
program_list = []
report_list = []
build_files = [os.path.join('build', f) for f in ['perftest.py', 'test_function_template.cxx']]
# describe dependency graph:
# report -> program -> .cu -> .test
for test in my_env.Glob('*.test'):
cu = my_env.CUFile(test)
my_env.Depends(cu, build_files)
cu_list.append(cu)
prog = my_env.Program(cu)
program_list.append(prog)
report = my_env.Report(prog)
report_list.append(report)
# make aliases for groups of targets
reports = my_env.Alias("reports", report_list)
programs = my_env.Alias("programs", program_list)
# when no build target is specified, by default we build the programs
my_env.Default(programs)
# output a help message
my_env.Help("""
Type: 'scons' to build all performance test programs.
Type: 'scons reports' to run all performance tests and output reports.
Type: 'scons <test name>' to build a single performance test program of interest.
Type: 'scons <test name>.xml' to run a single performance test of interest and output a report.
""")
Jump to Line
Something went wrong with that request. Please try again.