From fd50cee25e6c28cefa41584c87e4fea2119df953 Mon Sep 17 00:00:00 2001 From: MihailJP Date: Sun, 10 Nov 2024 19:21:36 +0900 Subject: [PATCH] Check if test 33 is running under MinGW --- test cases/common/33 run program/check-mingw.py | 8 ++++++++ test cases/common/33 run program/meson.build | 7 +++++-- unittests/windowstests.py | 2 +- 3 files changed, 14 insertions(+), 3 deletions(-) create mode 100644 test cases/common/33 run program/check-mingw.py diff --git a/test cases/common/33 run program/check-mingw.py b/test cases/common/33 run program/check-mingw.py new file mode 100644 index 000000000000..05a12957afba --- /dev/null +++ b/test cases/common/33 run program/check-mingw.py @@ -0,0 +1,8 @@ +#!/usr/bin/env python3 + +import os + +if 'MSYSTEM' not in os.environ: + pass +else: + os.environ['MSYSTEM'] diff --git a/test cases/common/33 run program/meson.build b/test cases/common/33 run program/meson.build index 2257d93c7fc1..d3fbe04a29b5 100644 --- a/test cases/common/33 run program/meson.build +++ b/test cases/common/33 run program/meson.build @@ -1,6 +1,9 @@ project('run command', version : run_command('get-version.py', check : true).stdout().strip(), meson_version: '>=0.1.0') -if build_machine.system() == 'windows' +check_mingw = run_command('check-mingw.py', check : true).stdout().strip() +is_mingw = not (check_mingw == '' or check_mingw == 'MSYS') + +if build_machine.system() == 'windows' and (not is_mingw) c = run_command('cmd', '/c', 'echo', 'hello', check: false) else c = run_command('echo', 'hello', check: false) @@ -45,7 +48,7 @@ endif # We should be able to have files() in argument f = files('meson.build') -if build_machine.system() == 'windows' +if build_machine.system() == 'windows' and (not is_mingw) c = run_command('cmd', '/c', 'echo', f, check: false) else c = run_command('echo', f, check: false) diff --git a/unittests/windowstests.py b/unittests/windowstests.py index 1667ee7a5a13..c5b0ba08d306 100644 --- a/unittests/windowstests.py +++ b/unittests/windowstests.py @@ -59,7 +59,7 @@ def test_find_program(self): self.assertTrue(prog1.found(), msg='xcopy not found') prog2 = ExternalProgram('xcopy.exe') self.assertTrue(prog2.found(), msg='xcopy.exe not found') - self.assertPathEqual(prog1.get_path(), prog2.get_path()) # fails on recent MinGW + self.assertPathEqual(prog1.get_path(), prog2.get_path()) # Find xcopy.exe with args without searching prog = ExternalProgram('xcopy', command=['xcopy', '/?']) self.assertTrue(prog.found(), msg='xcopy not found with args')