import os
Import('env', 'build_type', 'prefix', 'version_info', 'test_xml')

test_env = env.Clone()
test_env.Append(LIBPATH = ['#build/src']);
test_env.Append(CPPPATH = ['#src'])
test_env.Append(LIBS = ['ucore_' + build_type, 'check'])

tests = test_env.Glob('test_*.c')

test_executable = 'test_runner'
#run test_runner --xml to produce an xml result file
if test_xml:
    test_executable += ' --xml'

prog = test_env.Program('test_runner', tests)
cmd  = test_env.Command(target='test_phony' , 
                            source = None, 
                            action= test_env.Dir('.').abspath + '/' + test_executable)
test_env.Depends(cmd, prog)
test_env.AlwaysBuild(cmd)

