diff options
author | Jussi Pakkanen <jpakkane@gmail.com> | 2014-03-19 20:53:35 +0200 |
---|---|---|
committer | Jussi Pakkanen <jpakkane@gmail.com> | 2014-03-19 20:53:35 +0200 |
commit | f692555a275cd56546f5f47f4341f996c5b0cba1 (patch) | |
tree | 465ddbb0a81467229a69db99f6f8311ae8433e51 /run_tests.py | |
parent | f221a682523b983704fed6504ae7044dcbef7fa2 (diff) | |
download | meson-f692555a275cd56546f5f47f4341f996c5b0cba1.zip meson-f692555a275cd56546f5f47f4341f996c5b0cba1.tar.gz meson-f692555a275cd56546f5f47f4341f996c5b0cba1.tar.bz2 |
Now can use run_tests.py with MSBuild.
Diffstat (limited to 'run_tests.py')
-rwxr-xr-x | run_tests.py | 36 |
1 files changed, 27 insertions, 9 deletions
diff --git a/run_tests.py b/run_tests.py index 2d15707..1cd5413 100755 --- a/run_tests.py +++ b/run_tests.py @@ -24,7 +24,15 @@ failing_tests = 0 test_build_dir = 'work area' install_dir = os.path.join(os.path.split(os.path.abspath(__file__))[0], 'install dir') meson_command = './meson.py' -if True: # Currently we have only one backend. + +msbuild_exe = shutil.which('msbuild') + +if msbuild_exe is not None: + backend_flags = ['--backend=vs2010'] + compile_commands = ['msbuild'] + test_commands = ['msbuild', 'RUN_TESTS.vcxproj'] + install_commands = [] +else: backend_flags = [] ninja_command = environment.detect_ninja() if ninja_command is None: @@ -88,6 +96,7 @@ def run_and_log(logfile, testdir, should_succeed=True): logfile.write('\n\n---\n\n') def run_test(testdir, should_succeed): + global compile_commands shutil.rmtree(test_build_dir) shutil.rmtree(install_dir) os.mkdir(test_build_dir) @@ -104,7 +113,12 @@ def run_test(testdir, should_succeed): return ('Test that should have failed succeeded', stdo, stde) if p.returncode != 0: return ('Generating the build system failed.', stdo, stde) - pc = subprocess.Popen(compile_commands, cwd=test_build_dir, + if 'msbuild' in compile_commands[0]: + sln_name = glob(os.path.join(test_build_dir, '*.sln'))[0] + comp = compile_commands + [os.path.split(sln_name)[-1]] + else: + comp = compile_commands + pc = subprocess.Popen(comp, cwd=test_build_dir, stdout=subprocess.PIPE, stderr=subprocess.PIPE) (o, e) = pc.communicate() stdo += o.decode('utf-8') @@ -118,14 +132,18 @@ def run_test(testdir, should_succeed): stde += e.decode('utf-8') if pt.returncode != 0: return ('Running unit tests failed.', stdo, stde) - pi = subprocess.Popen(install_commands, cwd=test_build_dir, + if len(install_commands) == 0: + print("Skipping install test") + return ('', '', '') + else: + pi = subprocess.Popen(install_commands, cwd=test_build_dir, stdout=subprocess.PIPE, stderr=subprocess.PIPE) - (o, e) = pi.communicate() - stdo += o.decode('utf-8') - stde += e.decode('utf-8') - if pi.returncode != 0: - return ('Running install failed.', stdo, stde) - return (validate_install(testdir, install_dir), stdo, stde) + (o, e) = pi.communicate() + stdo += o.decode('utf-8') + stde += e.decode('utf-8') + if pi.returncode != 0: + return ('Running install failed.', stdo, stde) + return (validate_install(testdir, install_dir), stdo, stde) def gather_tests(testdir): tests = [t.replace('\\', '/').split('/', 2)[2] for t in glob(os.path.join(testdir, '*'))] |