aboutsummaryrefslogtreecommitdiff
path: root/run_unittests.py
diff options
context:
space:
mode:
authorJussi Pakkanen <jpakkane@gmail.com>2020-11-14 13:47:39 +0200
committerGitHub <noreply@github.com>2020-11-14 13:47:39 +0200
commit299a67781e8330e110bd2aee76464ac6b755322c (patch)
tree8772aa52e79947a60a22b2a034a46f9b0da37f8a /run_unittests.py
parent8dcc7d3ef3cb95029c41a0d4accef86415f29cb8 (diff)
parent6ce3812762405393d912ca8f222fa86cb2d6bed3 (diff)
downloadmeson-299a67781e8330e110bd2aee76464ac6b755322c.zip
meson-299a67781e8330e110bd2aee76464ac6b755322c.tar.gz
meson-299a67781e8330e110bd2aee76464ac6b755322c.tar.bz2
Merge pull request #7843 from dcbaker/submit/rustc-fixes
A few fixups for rust
Diffstat (limited to 'run_unittests.py')
-rwxr-xr-xrun_unittests.py54
1 files changed, 30 insertions, 24 deletions
diff --git a/run_unittests.py b/run_unittests.py
index 97110bc..7f7df36 100755
--- a/run_unittests.py
+++ b/run_unittests.py
@@ -2943,20 +2943,22 @@ class AllPlatformTests(BasePlatformTests):
# the source tree leads to all kinds of trouble.
with tempfile.TemporaryDirectory() as project_dir:
with open(os.path.join(project_dir, 'meson.build'), 'w') as ofile:
- ofile.write('''project('disttest', 'c', version : '1.4.3')
-e = executable('distexe', 'distexe.c')
-test('dist test', e)
-subproject('vcssub', required : false)
-subproject('tarballsub', required : false)
-''')
+ ofile.write(textwrap.dedent('''\
+ project('disttest', 'c', version : '1.4.3')
+ e = executable('distexe', 'distexe.c')
+ test('dist test', e)
+ subproject('vcssub', required : false)
+ subproject('tarballsub', required : false)
+ '''))
with open(os.path.join(project_dir, 'distexe.c'), 'w') as ofile:
- ofile.write('''#include<stdio.h>
+ ofile.write(textwrap.dedent('''\
+ #include<stdio.h>
-int main(int argc, char **argv) {
- printf("I am a distribution test.\\n");
- return 0;
-}
-''')
+ int main(int argc, char **argv) {
+ printf("I am a distribution test.\\n");
+ return 0;
+ }
+ '''))
xz_distfile = os.path.join(self.distdir, 'disttest-1.4.3.tar.xz')
xz_checksumfile = xz_distfile + '.sha256sum'
zip_distfile = os.path.join(self.distdir, 'disttest-1.4.3.zip')
@@ -3615,8 +3617,8 @@ int main(int argc, char **argv) {
"""
tdir = os.path.join(self.unit_test_dir, '30 shared_mod linking')
out = self.init(tdir)
- msg = ('''WARNING: target links against shared modules. This is not
-recommended as it is not supported on some platforms''')
+ msg = ('WARNING: target links against shared modules. This is not '
+ 'recommended as it is not supported on some platforms')
self.assertIn(msg, out)
def test_ndebug_if_release_disabled(self):
@@ -7265,16 +7267,18 @@ class LinuxlikeTests(BasePlatformTests):
testdir = os.path.join(self.unit_test_dir, '61 identity cross')
nativefile = tempfile.NamedTemporaryFile(mode='w')
- nativefile.write('''[binaries]
-c = ['{0}']
-'''.format(os.path.join(testdir, 'build_wrapper.py')))
+ nativefile.write(textwrap.dedent('''\
+ [binaries]
+ c = ['{0}']
+ '''.format(os.path.join(testdir, 'build_wrapper.py'))))
nativefile.flush()
self.meson_native_file = nativefile.name
crossfile = tempfile.NamedTemporaryFile(mode='w')
- crossfile.write('''[binaries]
-c = ['{0}']
-'''.format(os.path.join(testdir, 'host_wrapper.py')))
+ crossfile.write(textwrap.dedent('''\
+ [binaries]
+ c = ['{0}']
+ '''.format(os.path.join(testdir, 'host_wrapper.py'))))
crossfile.flush()
self.meson_cross_file = crossfile.name
@@ -7287,9 +7291,10 @@ c = ['{0}']
'CC_FOR_BUILD': '"' + os.path.join(testdir, 'build_wrapper.py') + '"',
}
crossfile = tempfile.NamedTemporaryFile(mode='w')
- crossfile.write('''[binaries]
-c = ['{0}']
-'''.format(os.path.join(testdir, 'host_wrapper.py')))
+ crossfile.write(textwrap.dedent('''\
+ [binaries]
+ c = ['{0}']
+ '''.format(os.path.join(testdir, 'host_wrapper.py'))))
crossfile.flush()
self.meson_cross_file = crossfile.name
# TODO should someday be explicit about build platform only here
@@ -7355,8 +7360,9 @@ c = ['{0}']
self._check_ld('ld.lld', 'lld', 'c', 'ld.lld')
@skip_if_not_language('rust')
+ @skipIfNoExecutable('ld.gold') # need an additional check here because _check_ld checks for gcc
def test_ld_environment_variable_rust(self):
- self._check_ld('ld.gold', 'gold', 'rust', 'ld.gold')
+ self._check_ld('gcc', 'gcc -fuse-ld=gold', 'rust', 'ld.gold')
def test_ld_environment_variable_cpp(self):
self._check_ld('ld.gold', 'gold', 'cpp', 'ld.gold')