From a2845b491ba9bd0c2159140271d28dd055fe3f3e Mon Sep 17 00:00:00 2001 From: Jussi Pakkanen Date: Sun, 10 Feb 2013 14:08:53 +0200 Subject: [PATCH] Tests can now be easily run with both shell and Ninja. --- generators.py | 4 +++- run_tests.py | 17 +++++++++++++---- 2 files changed, 16 insertions(+), 5 deletions(-) diff --git a/generators.py b/generators.py index edc31764b..ea45352bf 100755 --- a/generators.py +++ b/generators.py @@ -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(): diff --git a/run_tests.py b/run_tests.py index a8c733bd1..6b9cb4c3c 100755 --- a/run_tests.py +++ b/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.')