Skip to content

Commit 7ae4d8a

Browse files
committed
check if test 33 running under MinGW
1 parent 481c375 commit 7ae4d8a

File tree

3 files changed

+16
-3
lines changed

3 files changed

+16
-3
lines changed
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
#!/usr/bin/env python3
2+
3+
import os, sys, re
4+
5+
if 'MSYSTEM' in os.environ and os.environ['MSYSTEM'] != '':
6+
print(os.environ['MSYSTEM'])
7+
else:
8+
match = re.search('[\\\\/](mingw32|mingw64|clang64|clangarm64|ucrt64)[\\\\/]', sys.executable, flags=re.IGNORECASE)
9+
if match:
10+
print(match.group(1).upper())

test cases/common/33 run program/meson.build

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,9 @@
11
project('run command', version : run_command('get-version.py', check : true).stdout().strip(), meson_version: '>=0.1.0')
22

3-
if build_machine.system() == 'windows'
3+
check_mingw = run_command('check-mingw.py', check : true).stdout().strip()
4+
is_mingw = not (check_mingw == '' or check_mingw == 'MSYS')
5+
6+
if build_machine.system() == 'windows' and not is_mingw
47
c = run_command('cmd', '/c', 'echo', 'hello', check: false)
58
else
69
c = run_command('echo', 'hello', check: false)
@@ -45,7 +48,7 @@ endif
4548
# We should be able to have files() in argument
4649
f = files('meson.build')
4750

48-
if build_machine.system() == 'windows'
51+
if build_machine.system() == 'windows' and not is_mingw
4952
c = run_command('cmd', '/c', 'echo', f, check: false)
5053
else
5154
c = run_command('echo', f, check: false)

unittests/windowstests.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ def test_find_program(self):
5959
self.assertTrue(prog1.found(), msg='xcopy not found')
6060
prog2 = ExternalProgram('xcopy.exe')
6161
self.assertTrue(prog2.found(), msg='xcopy.exe not found')
62-
self.assertPathEqual(prog1.get_path(), prog2.get_path()) # fails on recent MinGW
62+
self.assertPathEqual(prog1.get_path(), prog2.get_path())
6363
# Find xcopy.exe with args without searching
6464
prog = ExternalProgram('xcopy', command=['xcopy', '/?'])
6565
self.assertTrue(prog.found(), msg='xcopy not found with args')

0 commit comments

Comments
 (0)