diff options
author | Michael Hirsch, Ph.D <10931741+scivision@users.noreply.github.com> | 2019-11-02 17:34:58 -0400 |
---|---|---|
committer | Jussi Pakkanen <jpakkane@gmail.com> | 2019-11-02 23:34:58 +0200 |
commit | bbe6db08e39179191f60e397b8837b5a685760d1 (patch) | |
tree | c08d488c46f16bb026c6570a3b957bee14aa94a5 /run_unittests.py | |
parent | b3fe4a0a18edbd85c3a9e119912c968960f99574 (diff) | |
download | meson-bbe6db08e39179191f60e397b8837b5a685760d1.zip meson-bbe6db08e39179191f60e397b8837b5a685760d1.tar.gz meson-bbe6db08e39179191f60e397b8837b5a685760d1.tar.bz2 |
Minit templates modularization
Diffstat (limited to 'run_unittests.py')
-rwxr-xr-x | run_unittests.py | 37 |
1 files changed, 32 insertions, 5 deletions
diff --git a/run_unittests.py b/run_unittests.py index abb4134..72bcf2f 100755 --- a/run_unittests.py +++ b/run_unittests.py @@ -3009,8 +3009,33 @@ int main(int argc, char **argv) { ninja = detect_ninja() if ninja is None: raise unittest.SkipTest('This test currently requires ninja. Fix this once "meson build" works.') - for lang in ('c', 'cpp'): + langs = ['c'] + env = get_fake_env() + try: + env.detect_cpp_compiler(MachineChoice.HOST) + langs.append('cpp') + except EnvironmentException: + pass + try: + env.detect_d_compiler(MachineChoice.HOST) + langs.append('d') + except EnvironmentException: + pass + try: + env.detect_fortran_compiler(MachineChoice.HOST) + langs.append('fortran') + except EnvironmentException: + pass + try: + env.detect_objc_compiler(MachineChoice.HOST) + langs.append('objc') + except EnvironmentException: + pass + # FIXME: omitting rust as Windows AppVeyor CI finds Rust but doesn't link correctly + + for lang in langs: for target_type in ('executable', 'library'): + # test empty directory with tempfile.TemporaryDirectory() as tmpdir: self._run(self.meson_command + ['init', '--language', lang, '--type', target_type], workdir=tmpdir) @@ -3018,10 +3043,12 @@ int main(int argc, char **argv) { workdir=tmpdir) self._run(ninja, workdir=os.path.join(tmpdir, 'builddir')) - with tempfile.TemporaryDirectory() as tmpdir: - with open(os.path.join(tmpdir, 'foo.' + lang), 'w') as f: - f.write('int main() {}') - self._run(self.meson_command + ['init', '-b'], workdir=tmpdir) + # test directory with existing code file + if lang in ('c', 'cpp'): + with tempfile.TemporaryDirectory() as tmpdir: + with open(os.path.join(tmpdir, 'foo.' + lang), 'w') as f: + f.write('int main() {}') + self._run(self.meson_command + ['init', '-b'], workdir=tmpdir) # The test uses mocking and thus requires that # the current process is the one to run the Meson steps. |