ci: Test arm rust cross compilation

pull/12487/head
Xavier Claessens 1 year ago
parent a05f6a260e
commit 3c4ba3dcc3
  1. 2
      cross/ubuntu-armhf.json
  2. 7
      cross/ubuntu-armhf.txt
  3. 1
      test cases/rust/12 bindgen/meson.build
  4. 2
      test cases/rust/12 bindgen/src/global-project.h
  5. 2
      test cases/rust/12 bindgen/test.json
  6. 8
      test cases/rust/16 internal c dependencies/meson.build
  7. 5
      test cases/rust/4 polyglot/meson.build
  8. 10
      test cases/rust/4 polyglot/test.json

@ -1,5 +1,5 @@
{
"file": "ubuntu-armhf.txt",
"tests": ["common"],
"tests": ["common", "rust"],
"env": {}
}

@ -3,15 +3,16 @@
# when cross compiled binaries can't be run we don't do that
c = ['/usr/bin/arm-linux-gnueabihf-gcc']
cpp = ['/usr/bin/arm-linux-gnueabihf-g++']
rust = ['rustc', '--target', 'arm-unknown-linux-gnueabihf', '-C', 'linker=/usr/bin/arm-linux-gnueabihf-gcc-7']
rust = ['rustc', '--target', 'arm-unknown-linux-gnueabihf']
ar = '/usr/arm-linux-gnueabihf/bin/ar'
strip = '/usr/arm-linux-gnueabihf/bin/strip'
pkg-config = '/usr/bin/arm-linux-gnueabihf-pkg-config'
ld = '/usr/bin/arm-linux/gnueabihf-ld'
[built-in options]
# Used in unit test '140 get define'
c_args = ['-DMESON_TEST_ISSUE_1665=1']
# MESON_TEST_ISSUE_1665: Used in unit test '140 get define'
# RUST_12_CMD_ARG: Used in rust test '12 bindgen'
c_args = ['-DMESON_TEST_ISSUE_1665=1', '-DRUST_12_CMD_ARG']
cpp_args = '-DMESON_TEST_ISSUE_1665=1'
[properties]

@ -133,6 +133,7 @@ subdir('dependencies')
gp = rust.bindgen(
input : 'src/global-project.h',
output : 'global-project.rs',
args : ['--no-rustfmt-bindings'],
)
gp_lib = static_library('gp_lib', 'src/global.c')

@ -4,7 +4,7 @@ char * success(void);
#ifndef PROJECT_ARG
char * success(void);
#endif
#ifndef CMD_ARG
#ifndef RUST_12_CMD_ARG
char * success(void);
#endif
int success(void);

@ -1,6 +1,6 @@
{
"env": {
"CFLAGS": "-DCMD_ARG"
"CFLAGS": "-DRUST_12_CMD_ARG"
},
"stdout": [
{

@ -7,12 +7,16 @@ static = static_library('static', 'lib.c', c_args : '-DMODE="static"')
# compiler when handling the dependency.
static_dep = declare_dependency(link_with : static, compile_args : ['-Idoesnotexist'])
exe = executable('static', 'main.rs', dependencies : static_dep)
test('static linkage', test_prog, args : [exe, 'This is a static C library'])
if meson.can_run_host_binaries()
test('static linkage', test_prog, args : [exe, 'This is a static C library'])
endif
# Shared linkage with rust doesn't work on macOS with meson, yet
if host_machine.system() != 'darwin'
shared = shared_library('shared', 'lib.c', c_args : '-DMODE="shared"')
shared_dep = declare_dependency(link_with : shared, compile_args : ['-Idoesnotexist'])
exe = executable('shared', 'main.rs', dependencies : shared_dep)
test('shared linkage', test_prog, args : [exe, 'This is a shared C library'])
if meson.can_run_host_binaries()
test('shared linkage', test_prog, args : [exe, 'This is a shared C library'])
endif
endif

@ -18,6 +18,7 @@ foreach crate_type : ['lib', 'rlib', 'dylib', 'cdylib', 'staticlib', 'proc-macro
foreach target_type, allowed : allowed_map
name = f'stuff_@crate_type@_@target_type@'.underscorify()
src = crate_type == 'proc-macro' ? 'proc.rs' : 'stuff.rs'
install = crate_type == 'proc-macro' ? false : true
if crate_type not in allowed
# Note: in the both_libraries() case it is possible that the static part
# is still being built because the shared part raised an error but we
@ -26,7 +27,7 @@ foreach crate_type : ['lib', 'rlib', 'dylib', 'cdylib', 'staticlib', 'proc-macro
build_target(name, src,
target_type: target_type,
rust_crate_type: crate_type,
install: true)
install: install)
endtestcase
continue
endif
@ -39,7 +40,7 @@ foreach crate_type : ['lib', 'rlib', 'dylib', 'cdylib', 'staticlib', 'proc-macro
l = build_target(name, src,
target_type: target_type,
kwargs: rust_kwargs,
install: true)
install: install)
if crate_type in ['cdylib', 'staticlib', 'clib']
e = executable(f'prog-@name@', 'prog.c',
link_with: l,

@ -40,11 +40,6 @@
{"type": "file", "platform": "gcc", "file": "usr/lib/libstuff__static_library.rlib"},
{"type": "file", "platform": "msvc", "file": "usr/lib/libstuff__static_library.rlib"},
{"type": "pdb", "file": "usr/bin/stuff_proc_macro_shared_library.pdb"},
{"type": "file", "platform": "gcc", "file": "usr/lib/libstuff_proc_macro_shared_library.so"},
{"type": "file", "platform": "msvc", "file": "usr/bin/stuff_proc_macro_shared_library.dll"},
{"type": "file", "platform": "msvc", "file": "usr/lib/stuff_proc_macro_shared_library.dll.lib"},
{"type": "pdb", "file": "usr/bin/stuff_lib_both_libraries.pdb"},
{"type": "file", "platform": "gcc", "file": "usr/lib/libstuff_lib_both_libraries.rlib"},
{"type": "file", "platform": "gcc", "file": "usr/lib/libstuff_lib_both_libraries.so"},
@ -79,11 +74,6 @@
{"type": "file", "platform": "msvc", "file": "usr/bin/stuff_cdylib_both_libraries.dll"},
{"type": "file", "platform": "msvc", "file": "usr/lib/stuff_cdylib_both_libraries.dll.lib"},
{"type": "pdb", "file": "usr/bin/stuff_proc_macro_both_libraries.pdb"},
{"type": "file", "platform": "gcc", "file": "usr/lib/libstuff_proc_macro_both_libraries.so"},
{"type": "file", "platform": "msvc", "file": "usr/bin/stuff_proc_macro_both_libraries.dll"},
{"type": "file", "platform": "msvc", "file": "usr/lib/stuff_proc_macro_both_libraries.dll.lib"},
{"type": "pdb", "file": "usr/bin/stuff_dylib_both_libraries.pdb"},
{"type": "file", "platform": "gcc", "file": "usr/lib/libstuff_dylib_both_libraries.so"},
{"type": "file", "platform": "msvc", "file": "usr/bin/stuff_dylib_both_libraries.dll"},

Loading…
Cancel
Save