#!/usr/bin/python Import("env", "CONFIG_DEBUG") CMD = "tests/%s/%s.test" OUT = "tests/%s/%s.run" GOOD = "tests/%s/%s.good" if CONFIG_DEBUG: GOOD = "tests/%s/%s-debug.good" def run_test(group, name): cmd = CMD % (group, name) out = OUT % (group, name) good = GOOD % (group, name) return Command("%s.run" % name, None, [ "%s > %s" % (cmd, out), "diff -u %s %s" % (out, good), ] ) def Test(group, src, config = []): name, extension = src.rsplit(".", 1) lib = SConscript("../../lib/Sconscript", variant_dir = ".%s" % name) prog = env.Program("%s.test" % name, [ src ] + lib) test = run_test(group, name) Depends(test, prog) AlwaysBuild(test) Alias("tests", [ prog, test ]) Alias("tests/%s" % group, [ prog, test ]) Alias("tests/%s/%s" % (group, name), [ prog, test ]) Export("Test") # Read SConscript files basic = SConscript("basic/Sconscript") file = SConscript("file/Sconscript") Default("tests")