diff options
author | Michael Hirsch, Ph.D <scivision@users.noreply.github.com> | 2019-10-23 00:39:24 -0400 |
---|---|---|
committer | Jussi Pakkanen <jpakkane@gmail.com> | 2019-10-23 18:44:19 +0300 |
commit | 248a75ff4871cf8887280438a1fdf7b8f32084a2 (patch) | |
tree | 807b923038233351624ea1e824f52dc7cb6ddf68 | |
parent | f96a8cbdf5ff3c8905d0d12442d0f9d378aeec13 (diff) | |
download | meson-248a75ff4871cf8887280438a1fdf7b8f32084a2.zip meson-248a75ff4871cf8887280438a1fdf7b8f32084a2.tar.gz meson-248a75ff4871cf8887280438a1fdf7b8f32084a2.tar.bz2 |
tests: add fortran-specific compiler checks
-rw-r--r-- | test cases/fortran/17 add_languages/meson.build | 5 | ||||
-rw-r--r-- | test cases/fortran/18 first_arg/meson.build | 26 |
2 files changed, 31 insertions, 0 deletions
diff --git a/test cases/fortran/17 add_languages/meson.build b/test cases/fortran/17 add_languages/meson.build new file mode 100644 index 0000000..e7de180 --- /dev/null +++ b/test cases/fortran/17 add_languages/meson.build @@ -0,0 +1,5 @@ +project('add_lang_fortran') + +# catch bug where Fortran compiler is found with project('foo', 'fortran') but +# not by add_languages('fortran') +assert(add_languages('fortran'), 'these tests assume Fortran compiler can be found')
\ No newline at end of file diff --git a/test cases/fortran/18 first_arg/meson.build b/test cases/fortran/18 first_arg/meson.build new file mode 100644 index 0000000..874f4db --- /dev/null +++ b/test cases/fortran/18 first_arg/meson.build @@ -0,0 +1,26 @@ +project('fortran_args', 'fortran') + +fc = meson.get_compiler('fortran') + +if fc.get_id() == 'intel-cl' + is_arg = '/O2' + useless = '/DFOO' +else + is_arg = '-O2' + useless = '-DFOO' +endif + +isnt_arg = '-fiambroken' + +assert(fc.has_argument(is_arg), 'Arg that should have worked does not work.') +assert(not fc.has_argument(isnt_arg), 'Arg that should be broken is not.') + +assert(fc.get_supported_arguments([is_arg, isnt_arg, useless]) == [is_arg, useless], 'Arg filtering returned different result.') + +# Have useless at the end to ensure that the search goes from front to back. +l1 = fc.first_supported_argument([isnt_arg, is_arg, isnt_arg, useless]) +l2 = fc.first_supported_argument(isnt_arg, isnt_arg, isnt_arg) + +assert(l1.length() == 1, 'First supported returned wrong result.') +assert(l1.get(0) == is_arg, 'First supported returned wrong argument.') +assert(l2.length() == 0, 'First supported did not return empty array.') |