Tests can now be easily run with both shell and Ninja.
This commit is contained in:
parent
aad3a7a76e
commit
a2845b491b
|
@ -596,6 +596,8 @@ echo Run compile.sh before this or bad things will happen.
|
|||
linker = self.build.compilers[0] # Fixme.
|
||||
commands = []
|
||||
commands += linker.get_exelist()
|
||||
if isinstance(target, interpreter.StaticLibrary):
|
||||
commands += linker.get_std_link_flags()
|
||||
commands += linker.get_output_flags()
|
||||
commands.append(outname)
|
||||
commands += obj_list
|
||||
|
@ -605,7 +607,7 @@ echo Run compile.sh before this or bad things will happen.
|
|||
commands += linker.get_std_shared_lib_link_flags()
|
||||
commands += linker.get_pic_flags()
|
||||
elif isinstance(target, interpreter.StaticLibrary):
|
||||
commands += linker.get_std_link_flags()
|
||||
pass
|
||||
else:
|
||||
raise RuntimeError('Unknown build target type.')
|
||||
for dep in target.get_external_deps():
|
||||
|
|
17
run_tests.py
17
run_tests.py
|
@ -19,10 +19,18 @@ import os, subprocess, shutil
|
|||
|
||||
test_build_dir = 'work area'
|
||||
install_dir = os.path.join(os.path.split(os.path.abspath(__file__))[0], 'install dir')
|
||||
use_shell = True
|
||||
builder_command = './builder.py'
|
||||
compile_commands = ['compile.sh']
|
||||
test_commands = ['run_tests.sh']
|
||||
install_commands = ['install.sh']
|
||||
if use_shell:
|
||||
generator_flags = []
|
||||
compile_commands = ['compile.sh']
|
||||
test_commands = ['run_tests.sh']
|
||||
install_commands = ['install.sh']
|
||||
else:
|
||||
generator_flags = ['--generator', 'ninja']
|
||||
compile_commands = ['ninja']
|
||||
test_commands = ['ninja', 'test']
|
||||
install_commands = ['ninja', 'install']
|
||||
|
||||
def run_test(testdir):
|
||||
shutil.rmtree(test_build_dir)
|
||||
|
@ -30,7 +38,8 @@ def run_test(testdir):
|
|||
os.mkdir(test_build_dir)
|
||||
os.mkdir(install_dir)
|
||||
print('Running test: ' + testdir)
|
||||
p = subprocess.Popen([builder_command, '--prefix', install_dir, testdir, test_build_dir])
|
||||
p = subprocess.Popen([builder_command, '--prefix', install_dir, testdir, test_build_dir] +\
|
||||
generator_flags)
|
||||
p.wait()
|
||||
if p.returncode != 0:
|
||||
raise RuntimeError('Generating the build system failed.')
|
||||
|
|
Loading…
Reference in New Issue