#print env.Dump()
+# Add a check target for running tests
+check = env.Alias('check')
+env.AlwaysBuild(check)
+
+
#######################################################################
# Invoke host SConscripts
#
return targets
-def createInstallMethods(env):
- env.AddMethod(install_program, 'InstallProgram')
- env.AddMethod(install_shared_library, 'InstallSharedLibrary')
-
-
def msvc2013_compat(env):
if env['gcc']:
env.Append(CCFLAGS = [
'-Werror=pointer-arith',
])
-def createMSVCCompatMethods(env):
- env.AddMethod(msvc2013_compat, 'MSVC2013Compat')
+
+def unit_test(env, test_name, program_target, args=None):
+ env.InstallProgram(program_target)
+
+ cmd = [program_target[0].abspath]
+ if args is not None:
+ cmd += args
+ cmd = ' '.join(cmd)
+
+ # http://www.scons.org/wiki/UnitTests
+ action = SCons.Action.Action(cmd, " Running %s ..." % test_name)
+ alias = env.Alias(test_name, program_target, action)
+ env.AlwaysBuild(alias)
+ env.Depends('check', alias)
def num_jobs():
# Custom builders and methods
env.Tool('custom')
- createInstallMethods(env)
- createMSVCCompatMethods(env)
+ env.AddMethod(install_program, 'InstallProgram')
+ env.AddMethod(install_shared_library, 'InstallSharedLibrary')
+ env.AddMethod(msvc2013_compat, 'MSVC2013Compat')
+ env.AddMethod(unit_test, 'UnitTest')
env.PkgCheckModules('X11', ['x11', 'xext', 'xdamage', 'xfixes', 'glproto >= 1.4.13'])
env.PkgCheckModules('XCB', ['x11-xcb', 'xcb-glx >= 1.8.1', 'xcb-dri2 >= 1.8'])
target = testname,
source = [testname + '.c', 'lp_test_main.c'],
)
- env.InstallProgram(target)
-
- # http://www.scons.org/wiki/UnitTests
- alias = env.Alias(testname, [target], target[0].abspath)
- AlwaysBuild(alias)
+ env.UnitTest(testname, target)
Export('llvmpipe')
target = progname,
source = progname + '.c',
)
-
- env.Alias(progname, env.InstallProgram(prog))
-
- # http://www.scons.org/wiki/UnitTests
- test_alias = env.Alias('unit', [prog], prog[0].abspath)
- AlwaysBuild(test_alias)
-
+ if progname not in [
+ 'u_cache_test', # too long
+ 'translate_test', # unreliable
+ ]:
+ env.UnitTest(progname, prog)
Export('mesautil')
-# http://www.scons.org/wiki/UnitTests
u_atomic_test = env.Program(
target = 'u_atomic_test',
source = ['u_atomic_test.c'],
)
-alias = env.Alias("u_atomic_test", u_atomic_test, u_atomic_test[0].abspath)
-AlwaysBuild(alias)
+env.UnitTest("u_atomic_test", u_atomic_test)
roundeven_test = env.Program(
target = 'roundeven_test',
source = ['roundeven_test.c'],
)
-alias = env.Alias("roundeven_test", roundeven_test, roundeven_test[0].abspath)
-AlwaysBuild(alias)
+env.UnitTest("roundeven_test", roundeven_test)