aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--cross/ubuntu-mingw.txt10
-rw-r--r--interpreter.py8
-rwxr-xr-xmeson_test.py5
-rw-r--r--mparser.py2
-rwxr-xr-xrun_cross_test.py6
-rw-r--r--test cases/common/59 object generator/meson.build5
-rwxr-xr-xtest cases/common/59 object generator/obj_generator.py15
7 files changed, 31 insertions, 20 deletions
diff --git a/cross/ubuntu-mingw.txt b/cross/ubuntu-mingw.txt
index 66b279f..7e848ac 100644
--- a/cross/ubuntu-mingw.txt
+++ b/cross/ubuntu-mingw.txt
@@ -1,8 +1,8 @@
name = 'windows'
exe_wrapper = 'wine' # A command used to run generated executables.
-c = '/usr/bin/i586-mingw32msvc-gcc'
-cpp = '/usr/bin/i586-mingw32msvc-g++'
-ar = '/usr/i586-mingw32msvc/bin/ar'
-strip = '/usr/i586-mingw32msvc/bin/strip'
+c = '/usr/bin/i686-w64-mingw32-gcc'
+cpp = '/usr/bin/i686-w64-mingw32-gcc'
+ar = '/usr/bin/i686-w64-mingw32-ar'
+strip = '/usr/bin/i686-w64-mingw32-strip'
-root = '/usr/i586-mingw32msvc'
+root = '/usr/i686-w64-mingw32'
diff --git a/interpreter.py b/interpreter.py
index 4297633..8c16518 100644
--- a/interpreter.py
+++ b/interpreter.py
@@ -503,12 +503,16 @@ class CompilerHolder(InterpreterObject):
'has_function' : self.has_function_method,
'has_member' : self.has_member_method,
'alignment' : self.alignment_method,
- 'version' : self.version_method
+ 'version' : self.version_method,
+ 'cmd_array' : self.cmd_array_method,
})
def version_method(self, args, kwargs):
return self.compiler.version
+ def cmd_array_method(self, args, kwargs):
+ return self.compiler.exelist
+
def alignment_method(self, args, kwargs):
if len(args) != 1:
raise InterpreterException('Alignment method takes exactly one positional argument.')
@@ -1682,7 +1686,7 @@ class Interpreter():
index = args[0]
if not isinstance(index, int):
raise InvalidArguments('Array index must be a number.')
- if index < 0 or index >= len(obj):
+ if index < -len(obj) or index >= len(obj):
raise InvalidArguments('Array index %s is out of bounds for array of size %d.' % (index, len(obj)))
return obj[index]
raise InterpreterException('Arrays do not have a method called "%s".' % method_name)
diff --git a/meson_test.py b/meson_test.py
index d4a5b62..2807dde 100755
--- a/meson_test.py
+++ b/meson_test.py
@@ -41,7 +41,10 @@ class TestRun():
def write_log(logfile, test_name, result_str, result):
logfile.write(result_str + '\n\n')
logfile.write('--- command ---\n')
- logfile.write(' '.join(result.cmd))
+ if result.cmd is None:
+ logfile.write('NONE')
+ else:
+ logfile.write(' '.join(result.cmd))
logfile.write('\n--- "%s" stdout ---\n' % test_name)
logfile.write(result.stdo)
logfile.write('\n--- "%s" stderr ---\n' % test_name)
diff --git a/mparser.py b/mparser.py
index b7fb519..e8f20a5 100644
--- a/mparser.py
+++ b/mparser.py
@@ -41,7 +41,7 @@ class Lexer:
# Need to be sorted longest to shortest.
('ignore', re.compile(r'[ \t]')),
('id', re.compile('[_a-zA-Z][_0-9a-zA-Z]*')),
- ('number', re.compile(r'\d+')),
+ ('number', re.compile(r'-?\d+')),
('eol_cont', re.compile(r'\\\n')),
('eol', re.compile(r'\n')),
('multiline_string', re.compile(r"'''(.|\n)*?'''", re.M)),
diff --git a/run_cross_test.py b/run_cross_test.py
index 6026336..7355c28 100755
--- a/run_cross_test.py
+++ b/run_cross_test.py
@@ -45,7 +45,7 @@ def run_test(testdir, should_succeed=True):
os.mkdir(test_build_dir)
os.mkdir(install_dir)
print('Running test: ' + testdir)
- gen_command = [sys.executable, meson_command, '--prefix', install_dir, '--libdir', 'lib', testdir, test_build_dir] + extra_flags
+ gen_command = [sys.executable, meson_command, '--prefix', '/usr', '--libdir', 'lib', testdir, test_build_dir] + extra_flags
p = subprocess.Popen(gen_command)
p.wait()
if not should_succeed:
@@ -62,7 +62,9 @@ def run_test(testdir, should_succeed=True):
pt.wait()
if pt.returncode != 0:
raise RuntimeError('Running unit tests failed.')
- pi = subprocess.Popen(install_commands, cwd=test_build_dir)
+ install_env = os.environ.copy()
+ install_env['DESTDIR'] = install_dir
+ pi = subprocess.Popen(install_commands, cwd=test_build_dir, env=install_env)
pi.wait()
if pi.returncode != 0:
raise RuntimeError('Running install failed.')
diff --git a/test cases/common/59 object generator/meson.build b/test cases/common/59 object generator/meson.build
index 04d7d8b..d2c8afb 100644
--- a/test cases/common/59 object generator/meson.build
+++ b/test cases/common/59 object generator/meson.build
@@ -12,10 +12,11 @@ else
outputname = '@BASENAME@.o'
endif
-# Generate a header file that needs to be included.
+cc = meson.get_compiler('c').cmd_array().get(0-1)
+# Generate an object file manually.
gen = generator(python,
output : outputname,
- arguments : [comp, '@INPUT@', '@OUTPUT@'])
+ arguments : [comp, cc, '@INPUT@', '@OUTPUT@'])
generated = gen.process('source.c')
diff --git a/test cases/common/59 object generator/obj_generator.py b/test cases/common/59 object generator/obj_generator.py
index f644843..6f98f39 100755
--- a/test cases/common/59 object generator/obj_generator.py
+++ b/test cases/common/59 object generator/obj_generator.py
@@ -5,14 +5,15 @@
import sys, shutil, subprocess
if __name__ == '__main__':
- if len(sys.argv) != 3:
- print(sys.argv[0], 'input_file output_file')
+ if len(sys.argv) != 4:
+ print(sys.argv[0], 'compiler input_file output_file')
sys.exit(1)
- ifile = sys.argv[1]
- ofile = sys.argv[2]
- if shutil.which('cl'):
- cmd = ['cl', '/nologo', '/Fo'+ofile, '/c', ifile]
+ compiler = sys.argv[1]
+ ifile = sys.argv[2]
+ ofile = sys.argv[3]
+ if compiler.endswith('cl'):
+ cmd = [compiler, '/nologo', '/Fo'+ofile, '/c', ifile]
else:
- cmd = ['cc', '-c', ifile, '-o', ofile]
+ cmd = [compiler, '-c', ifile, '-o', ofile]
sys.exit(subprocess.call(cmd))