forked from mesonbuild/meson
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Split tests out from 'common' which require a native compiler
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.
- Loading branch information
1 parent
79b2eeb
commit 88e13c5
Showing
56 changed files
with
131 additions
and
34 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,3 @@ | ||
meson.add_install_script('myinstall.py', 'this/does', 'something-different.dat') | ||
|
||
afile = files('a file.txt') | ||
|
||
exe = executable('exe', 'exe.c', install : false, native : true) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
#include<stdio.h> | ||
|
||
int main(void) { | ||
printf("Trivial test is working.\n"); | ||
return 0; | ||
} |
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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; | ||
} |
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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') |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
exe = executable('exe', 'exe.c', install : false, native : true) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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"} | ||
] | ||
} |
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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)) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
#include<iostream> | ||
|
||
int main(int, char**) { | ||
std::cout << "I am C++.\n"; | ||
return 0; | ||
} |
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.