Skip to content

Commit

Permalink
check if test 33 running under MinGW
Browse files Browse the repository at this point in the history
  • Loading branch information
MihailJP committed Nov 11, 2024
1 parent 481c375 commit 63b7f8e
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 3 deletions.
10 changes: 10 additions & 0 deletions test cases/common/33 run program/check-mingw.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
#!/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('[\\\\/](mingw32|mingw64|clang32|clang64|clangarm64|ucrt64)[\\\\/]', sys.executable, flags=re.IGNORECASE)
if match:
print(match.group(1).upper())
7 changes: 5 additions & 2 deletions test cases/common/33 run program/meson.build
Original file line number Diff line number Diff line change
@@ -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)
Expand Down Expand Up @@ -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)
Expand Down
2 changes: 1 addition & 1 deletion unittests/windowstests.py
Original file line number Diff line number Diff line change
Expand Up @@ -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')
Expand Down

0 comments on commit 63b7f8e

Please sign in to comment.