Skip to content

Commit

Permalink
test(meson): simplify tests config
Browse files Browse the repository at this point in the history
  • Loading branch information
SeaDve committed Jul 24, 2023
1 parent 7942e1c commit a9d8ac6
Showing 1 changed file with 10 additions and 15 deletions.
25 changes: 10 additions & 15 deletions src/meson.build
Original file line number Diff line number Diff line change
Expand Up @@ -18,12 +18,8 @@ run_command(
check: true
)

manifest_path = meson.project_source_root() / 'Cargo.toml'
cargo_home = meson.project_build_root() / 'cargo-home'
cargo_target_dir = meson.project_build_root() / 'src'

cargo_options = [ '--manifest-path', manifest_path ]
cargo_options += [ '--target-dir', cargo_target_dir ]
cargo_options = [ '--manifest-path', meson.project_source_root() / 'Cargo.toml' ]
cargo_options += [ '--target-dir', meson.project_build_root() / 'src' ]

if get_option('profile') == 'default'
cargo_options += [ '--release' ]
Expand All @@ -34,7 +30,7 @@ else
message('Building in debug mode')
endif

cargo_env = [ 'CARGO_HOME=' + cargo_home ]
cargo_env = [ 'CARGO_HOME=' + meson.project_build_root() / 'cargo-home' ]

cargo_build = custom_target(
'cargo-build',
Expand All @@ -60,15 +56,13 @@ test(
cargo,
args: [
'test',
'--manifest-path=@0@'.format(manifest_path),
'--target-dir=@0@'.format(cargo_target_dir),
cargo_options,
'--',
'--nocapture',
],
env: [
'RUST_BACKTRACE=1',
'CARGO_HOME=@0@'.format(cargo_home),
'PATH=/app/bin:/usr/bin:/usr/lib/sdk/llvm16/bin:/usr/lib/sdk/rust-stable/bin', # TODO Remove llvm16 once removed in manifest
cargo_env
],
timeout: 300, # give cargo more time
)
Expand All @@ -78,12 +72,13 @@ test(
cargo,
args: [
'clippy',
'--manifest-path=@0@'.format(manifest_path),
'--target-dir=@0@'.format(cargo_target_dir),
cargo_options,
'--',
'-D',
'warnings'
],
env: [
'CARGO_HOME=@0@'.format(cargo_home),
'PATH=/app/bin:/usr/bin:/usr/lib/sdk/llvm16/bin:/usr/lib/sdk/rust-stable/bin', # TODO Remove llvm16 once removed in manifest
cargo_env
],
timeout: 300, # give cargo more time
)

0 comments on commit a9d8ac6

Please sign in to comment.