diff --git a/test cases/common/33 run program/check-mingw.py b/test cases/common/33 run program/check-mingw.py deleted file mode 100755 index f10c28ba1a5c..000000000000 --- a/test cases/common/33 run program/check-mingw.py +++ /dev/null @@ -1,10 +0,0 @@ -#!/usr/bin/env python3 - -import os, sys, re - -if 'MSYSTEM' in os.environ and os.environ['MSYSTEM'] != '': - print(os.environ['MSYSTEM']) -else: - match = re.search(r'[\\/](mingw32|mingw64|clang32|clang64|clangarm64|ucrt64)[\\/]', sys.executable, flags=re.IGNORECASE) - if match: - print(match.group(1).upper()) diff --git a/test cases/common/33 run program/meson.build b/test cases/common/33 run program/meson.build index 1cd530523357..2257d93c7fc1 100644 --- a/test cases/common/33 run program/meson.build +++ b/test cases/common/33 run program/meson.build @@ -1,9 +1,6 @@ project('run command', version : run_command('get-version.py', check : true).stdout().strip(), meson_version: '>=0.1.0') -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 +if build_machine.system() == 'windows' c = run_command('cmd', '/c', 'echo', 'hello', check: false) else c = run_command('echo', 'hello', check: false) @@ -48,7 +45,7 @@ endif # We should be able to have files() in argument f = files('meson.build') -if build_machine.system() == 'windows' and not is_mingw +if build_machine.system() == 'windows' 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 c5b0ba08d306..8448ab1649cc 100644 --- a/unittests/windowstests.py +++ b/unittests/windowstests.py @@ -54,20 +54,20 @@ def test_find_program(self): PATH to point to a directory with Python scripts. ''' testdir = os.path.join(self.platform_test_dir, '8 find program') - # Find `xcopy` and `xcopy.exe` - prog1 = ExternalProgram('xcopy') - self.assertTrue(prog1.found(), msg='xcopy not found') - prog2 = ExternalProgram('xcopy.exe') - self.assertTrue(prog2.found(), msg='xcopy.exe not found') + # Find `cmd` and `cmd.exe` + prog1 = ExternalProgram('cmd') + self.assertTrue(prog1.found(), msg='cmd not found') + prog2 = ExternalProgram('cmd.exe') + self.assertTrue(prog2.found(), msg='cmd.exe not found') 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') - self.assertPathEqual(prog.get_command()[0], 'xcopy') - # Find xcopy with an absolute path that's missing the extension - xcopy_path = prog2.get_path()[:-4] - prog = ExternalProgram(xcopy_path) - self.assertTrue(prog.found(), msg=f'{xcopy_path!r} not found') + # Find cmd.exe with args without searching + prog = ExternalProgram('cmd', command=['cmd', '/C']) + self.assertTrue(prog.found(), msg='cmd not found with args') + self.assertPathEqual(prog.get_command()[0], 'cmd') + # Find cmd with an absolute path that's missing the extension + cmd_path = prog2.get_path()[:-4] + prog = ExternalProgram(cmd_path) + self.assertTrue(prog.found(), msg=f'{cmd_path!r} not found') # Finding a script with no extension inside a directory works prog = ExternalProgram(os.path.join(testdir, 'test-script')) self.assertTrue(prog.found(), msg='test-script not found')