Split out tests (and parts of tests) which require a native compiler from the 'common' suite to a new suite called 'native', so we can selectively avoid running those tests when only a cross-compiler is available. Also move test '211 cmake module' to 'cmake' suite, since it appears that the way we use cmake requires a native compiler.pull/7021/head
parent
79b2eeb1ba
commit
88e13c5f7c
56 changed files with 131 additions and 34 deletions
@ -1,23 +1,16 @@ |
||||
project('global arg test', 'cpp', 'c') |
||||
|
||||
add_global_arguments('-DMYTHING', language : 'c', native : true) |
||||
add_global_arguments('-DMYTHING', language : 'c', native : false) |
||||
add_global_arguments('-DMYCPPTHING', language : 'cpp', native : true) |
||||
add_global_arguments('-DMYCPPTHING', language : 'cpp', native : false) |
||||
|
||||
add_global_arguments('-DGLOBAL_BUILD', language : 'c', native : true) |
||||
add_global_arguments('-DGLOBAL_HOST', language : 'c', native : false) |
||||
add_global_arguments('-DMYTHING', language : 'c') |
||||
add_global_arguments('-DMYCPPTHING', language : 'cpp') |
||||
add_global_arguments('-DGLOBAL_HOST', language : 'c') |
||||
|
||||
build_c_args = ['-DARG_BUILD'] |
||||
c_args = ['-DARG_HOST'] |
||||
|
||||
add_global_arguments('-DMYCANDCPPTHING', language: ['c', 'cpp'], native: true) |
||||
add_global_arguments('-DMYCANDCPPTHING', language: ['c', 'cpp'], native: false) |
||||
add_global_arguments('-DMYCANDCPPTHING', language: ['c', 'cpp']) |
||||
|
||||
exe1 = executable('prog1', 'prog.c', c_args : build_c_args, native : true) |
||||
exe2 = executable('prog2', 'prog.c', c_args : c_args, native : false) |
||||
exe2 = executable('prog2', 'prog.c', c_args : c_args) |
||||
exe3 = executable('prog3', 'prog.cc') |
||||
|
||||
test('prog1', exe1) |
||||
test('prog2', exe2) |
||||
test('prog3', exe3) |
||||
|
@ -0,0 +1,9 @@ |
||||
project('trivial native test', 'c') |
||||
|
||||
sources = 'trivial.c' |
||||
cc = meson.get_compiler('c', native: true) |
||||
|
||||
if meson.is_cross_build() |
||||
native_exe = executable('native-trivialprog', sources : sources, native : true) |
||||
test('native exe in cross build', native_exe) |
||||
endif |
@ -0,0 +1,6 @@ |
||||
#include<stdio.h> |
||||
|
||||
int main(void) { |
||||
printf("Trivial test is working.\n"); |
||||
return 0; |
||||
} |
@ -0,0 +1,14 @@ |
||||
project('global arg test', 'cpp', 'c') |
||||
|
||||
add_global_arguments('-DMYTHING', language : 'c', native : true) |
||||
add_global_arguments('-DMYCPPTHING', language : 'cpp', native : true) |
||||
add_global_arguments('-DGLOBAL_BUILD', language : 'c', native : true) |
||||
|
||||
build_c_args = ['-DARG_BUILD'] |
||||
c_args = ['-DARG_HOST'] |
||||
|
||||
add_global_arguments('-DMYCANDCPPTHING', language: ['c', 'cpp'], native: true) |
||||
|
||||
exe1 = executable('prog1', 'prog.c', c_args : build_c_args, native : true) |
||||
|
||||
test('prog1', exe1) |
@ -0,0 +1,43 @@ |
||||
#ifndef MYTHING |
||||
#error "Global argument not set" |
||||
#endif |
||||
|
||||
#ifdef MYCPPTHING |
||||
#error "Wrong global argument set" |
||||
#endif |
||||
|
||||
#ifndef MYCANDCPPTHING |
||||
#error "Global argument not set" |
||||
#endif |
||||
|
||||
#if !defined(GLOBAL_HOST) && !defined(GLOBAL_BUILD) |
||||
#error "Neither global_host nor glogal_build is set." |
||||
#endif |
||||
|
||||
#if defined(GLOBAL_HOST) && defined(GLOBAL_BUILD) |
||||
#error "Both global build and global host set." |
||||
#endif |
||||
|
||||
#ifdef GLOBAL_BUILD |
||||
#ifndef ARG_BUILD |
||||
#error "Global is build but arg_build is not set." |
||||
#endif |
||||
|
||||
#ifdef ARG_HOST |
||||
#error "Global is build but arg host is set." |
||||
#endif |
||||
#endif |
||||
|
||||
#ifdef GLOBAL_HOST |
||||
#ifndef ARG_HOST |
||||
#error "Global is host but arg_host is not set." |
||||
#endif |
||||
|
||||
#ifdef ARG_BUILD |
||||
#error "Global is host but arg_build is set." |
||||
#endif |
||||
#endif |
||||
|
||||
int main(void) { |
||||
return 0; |
||||
} |
@ -0,0 +1,15 @@ |
||||
#ifdef MYTHING |
||||
#error "Wrong global argument set" |
||||
#endif |
||||
|
||||
#ifndef MYCPPTHING |
||||
#error "Global argument not set" |
||||
#endif |
||||
|
||||
#ifndef MYCANDCPPTHING |
||||
#error "Global argument not set" |
||||
#endif |
||||
|
||||
int main(void) { |
||||
return 0; |
||||
} |
@ -0,0 +1,12 @@ |
||||
project('custom install script', 'c') |
||||
|
||||
# this is just to ensure that the install directory exists before exe is run |
||||
install_data('file.txt', install_dir: '.') |
||||
|
||||
subdir('src') |
||||
|
||||
meson.add_install_script(exe, 'generated.txt') |
||||
wrap = find_program('wrap.py') |
||||
# Yes, these are getting silly |
||||
meson.add_install_script(wrap, exe, 'wrapped.txt') |
||||
meson.add_install_script(wrap, wrap, exe, 'wrapped2.txt') |
@ -0,0 +1 @@ |
||||
exe = executable('exe', 'exe.c', install : false, native : true) |
@ -0,0 +1,8 @@ |
||||
{ |
||||
"installed": [ |
||||
{"type": "file", "file": "usr/file.txt"}, |
||||
{"type": "file", "file": "usr/generated.txt"}, |
||||
{"type": "file", "file": "usr/wrapped.txt"}, |
||||
{"type": "file", "file": "usr/wrapped2.txt"} |
||||
] |
||||
} |
@ -0,0 +1,3 @@ |
||||
project('add language', 'c') |
||||
assert(add_languages('cpp', native: true), 'Add_languages returned false on success') |
||||
test('C++', executable('cppprog', 'prog.cc', native: true)) |
@ -0,0 +1,6 @@ |
||||
#include<iostream> |
||||
|
||||
int main(int, char**) { |
||||
std::cout << "I am C++.\n"; |
||||
return 0; |
||||
} |
Loading…
Reference in new issue