Skip to content

Commit

Permalink
Merge pull request #1005 from Qwinci/fix-tests-on-cshim
Browse files Browse the repository at this point in the history
tests: Fix include paths when using cshim
  • Loading branch information
mintsuki authored Feb 18, 2024
2 parents ec3acf7 + 5b9e549 commit d9e7e38
Show file tree
Hide file tree
Showing 5 changed files with 17 additions and 10 deletions.
15 changes: 11 additions & 4 deletions tests/meson.build
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,11 @@ test_link_args = []
test_override_options = ['b_sanitize=none']

if library_type == 'static'
libc = libc_static
libc_dep = declare_dependency(
include_directories: libc_include_dirs,
link_with: libc_static,
dependencies: [libc_deps, rtlib_deps]
)
use_pie = false
test_c_args += '-no-pie'
test_link_args += ['-no-pie', '-static']
Expand All @@ -159,7 +163,11 @@ if library_type == 'static'
crt,
]
else
libc = libc_shared
libc_dep = declare_dependency(
include_directories: libc_include_dirs,
link_with: libc_shared,
dependencies: [libc_deps, rtlib_deps]
)
test_link_args += ['-Wl,--dynamic-linker=' + meson.build_root() + '/ld.so']

if host_machine.system() in ['linux', 'managarm']
Expand Down Expand Up @@ -201,8 +209,7 @@ foreach test_name : all_test_cases

should_fail = fail_test_cases.contains(test_name)
exec = executable(test_exec_name, [test_name + '.c', test_sources],
link_with: libc, include_directories: libc_include_dirs,
dependencies: rtdl_deps + rtlib_deps,
dependencies: libc_dep,
build_rpath: meson.build_root(),
override_options: test_override_options,
c_args: test_c_args,
Expand Down
2 changes: 1 addition & 1 deletion tests/rtdl/ld_library_path/meson.build
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ test_env += ['LD_LIBRARY_PATH=' + test_ld_path]
test_native_env += ['LD_LIBRARY_PATH=' + test_ld_path]

libfoo = shared_library('foo', 'libfoo.c',
link_with: libc, include_directories: libc_include_dirs,
dependencies: libc_dep,
link_args: test_additional_link_args,
)

Expand Down
4 changes: 2 additions & 2 deletions tests/rtdl/meson.build
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,8 @@ foreach test_name : rtdl_test_cases
subdir(test_name)

exec = executable('rtdl-' + test_name, [test_name / 'test.c', test_sources],
link_with: test_link_with + libc, include_directories: libc_include_dirs,
dependencies: rtdl_deps + rtlib_deps,
link_with: test_link_with,
dependencies: libc_dep,
build_rpath: test_rpath,
override_options: test_override_options,
c_args: test_c_args,
Expand Down
2 changes: 1 addition & 1 deletion tests/rtdl/preinit/meson.build
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ if host_machine.cpu_family() == 'riscv64'
endif

libfoo = shared_library('foo', 'libfoo.c',
link_with: libc, include_directories: libc_include_dirs,
dependencies: libc_dep,
override_options: 'b_sanitize=none',
link_args: test_additional_link_args,
)
Expand Down
4 changes: 2 additions & 2 deletions tests/rtdl/rtld_next/meson.build
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,11 @@
no_tail_calls = '-fno-optimize-sibling-calls'

libfoo = shared_library('foo', 'libfoo.c',
link_with: libc, include_directories: libc_include_dirs,
dependencies: libc_dep,
c_args: no_tail_calls,
)
libbar = shared_library('bar', 'libbar.c',
link_with: libc, include_directories: libc_include_dirs,
dependencies: libc_dep,
c_args: no_tail_calls,
)
test_link_with = [libfoo, libbar] # foo is linked before bar
Expand Down

0 comments on commit d9e7e38

Please sign in to comment.