diff options
| author | Paolo Bonzini <pbonzini@redhat.com> | 2025-07-12 11:23:50 +0200 |
|---|---|---|
| committer | Dylan Baker <dylan@pnwbakers.com> | 2025-07-14 10:26:46 -0700 |
| commit | 1537a13d468aa7b49e7e0917be258e2e1a8b515f (patch) | |
| tree | 2cacf1f1e9928d4222d2ff1e31b05128378efe06 /test cases | |
| parent | bdabc2e5de8764521ded7e2e919a13e9e214757d (diff) | |
| download | meson-1537a13d468aa7b49e7e0917be258e2e1a8b515f.tar.gz | |
unittests: add test case for setting and retrieving build options
Check that build options fall back to host options, and that they
can be retrieved with get_option.
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Diffstat (limited to 'test cases')
| -rw-r--r-- | test cases/unit/69 cross/crossfile.in | 3 | ||||
| -rw-r--r-- | test cases/unit/69 cross/meson.build | 11 | ||||
| -rw-r--r-- | test cases/unit/69 cross/nativefile.in | 2 |
3 files changed, 15 insertions, 1 deletions
diff --git a/test cases/unit/69 cross/crossfile.in b/test cases/unit/69 cross/crossfile.in index 678e8d3a3..beab9bc45 100644 --- a/test cases/unit/69 cross/crossfile.in +++ b/test cases/unit/69 cross/crossfile.in @@ -3,3 +3,6 @@ system = '@system@' cpu_family = '@cpu_family@' cpu = '@cpu@' endian = '@endian@' + +[built-in options] +c_args = ['-funroll-loops'] diff --git a/test cases/unit/69 cross/meson.build b/test cases/unit/69 cross/meson.build index acf4f0f17..645d453c5 100644 --- a/test cases/unit/69 cross/meson.build +++ b/test cases/unit/69 cross/meson.build @@ -1,16 +1,25 @@ project('crosstest') +add_languages('c', native: true) if get_option('generate') conf_data = configuration_data() conf_data.set('system', build_machine.system()) conf_data.set('cpu', build_machine.cpu()) conf_data.set('cpu_family', build_machine.cpu_family()) conf_data.set('endian', build_machine.endian()) + conf_data.set('c_args', '-pedantic') configure_file(input: 'crossfile.in', output: 'crossfile', configuration: conf_data) - message('Written cross file') + configure_file(input: 'nativefile.in', + output: 'nativefile', + configuration: conf_data) + message('Written native and cross file') + + add_languages('c', native: false) + assert(get_option('build.c_args') == get_option('c_args')) else assert(meson.is_cross_build(), 'not setup as cross build') + assert(get_option('build.c_args') == ['-pedantic']) endif diff --git a/test cases/unit/69 cross/nativefile.in b/test cases/unit/69 cross/nativefile.in new file mode 100644 index 000000000..054cf108d --- /dev/null +++ b/test cases/unit/69 cross/nativefile.in @@ -0,0 +1,2 @@ +[built-in options] +c_args = ['@c_args@'] |
