summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJose Fonseca <jfonseca@vmware.com>2016-04-13 13:31:04 +0100
committerJose Fonseca <jfonseca@vmware.com>2016-04-14 07:19:04 +0100
commit50ddf03ada3cc167f7dcb6b26f82adb20162f983 (patch)
tree4a81fcbb92eeb5cb1531fee7cb346d87d276189b
parent9ae0e8ee3cf5e422804dcecd248dc28bb5dc63dc (diff)
scons: Add a "check" target to run all unit tests.
Except: - u_cache_test -- too long - translate_test -- unreliable (it's probably testing corner cases that translate module doesn't care about.) Reviewed-by: Roland Scheidegger <sroland@vmware.com>
-rw-r--r--SConstruct5
-rwxr-xr-xscons/gallium.py27
-rw-r--r--src/gallium/drivers/llvmpipe/SConscript6
-rw-r--r--src/gallium/tests/unit/SConscript12
-rw-r--r--src/util/SConscript7
5 files changed, 31 insertions, 26 deletions
diff --git a/SConstruct b/SConstruct
index ef71ab69c3..e2e49fcc6c 100644
--- a/SConstruct
+++ b/SConstruct
@@ -84,6 +84,11 @@ env.Append(CPPPATH = [
#print env.Dump()
+# Add a check target for running tests
+check = env.Alias('check')
+env.AlwaysBuild(check)
+
+
#######################################################################
# Invoke host SConscripts
#
diff --git a/scons/gallium.py b/scons/gallium.py
index f37042d9af..94321b2e84 100755
--- a/scons/gallium.py
+++ b/scons/gallium.py
@@ -82,11 +82,6 @@ def install_shared_library(env, sources, version = ()):
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 = [
@@ -94,8 +89,20 @@ def msvc2013_compat(env):
'-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():
@@ -667,8 +674,10 @@ def generate(env):
# 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'])
diff --git a/src/gallium/drivers/llvmpipe/SConscript b/src/gallium/drivers/llvmpipe/SConscript
index 8188156afc..fbbd22a529 100644
--- a/src/gallium/drivers/llvmpipe/SConscript
+++ b/src/gallium/drivers/llvmpipe/SConscript
@@ -38,10 +38,6 @@ if not env['embedded']:
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')
diff --git a/src/gallium/tests/unit/SConscript b/src/gallium/tests/unit/SConscript
index a816e2fea4..0650804018 100644
--- a/src/gallium/tests/unit/SConscript
+++ b/src/gallium/tests/unit/SConscript
@@ -24,10 +24,8 @@ for progname in progs:
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)
diff --git a/src/util/SConscript b/src/util/SConscript
index 5f3ecc1cdf..73f3430397 100644
--- a/src/util/SConscript
+++ b/src/util/SConscript
@@ -47,17 +47,14 @@ env.Alias('mesautil', mesautil)
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)