Skip to content

Commit

Permalink
Merge pull request #366 from orecham/iox2-98-cleanup-iox-entrypoint-cli
Browse files Browse the repository at this point in the history
[#98] Clean up entrypoint CLI
  • Loading branch information
orecham committed Sep 12, 2024
2 parents 61e78de + e83a259 commit 2d1f01d
Show file tree
Hide file tree
Showing 10 changed files with 491 additions and 203 deletions.
3 changes: 3 additions & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -72,8 +72,10 @@ iceoryx2-ffi-macros = { version = "0.3.0", path = "iceoryx2-ffi/ffi-macros" }

iceoryx2 = { version = "0.3.0", path = "iceoryx2/" }

anyhow = { version = "1.0.86" }
bindgen = { version = "0.69.4" }
bitflags = { version = "2.5.0" }
cargo_metadata = { version = "0.18.1" }
cbindgen = { version = "0.26.0" }
cc = { version = "1.0.98" }
cdr = { version = "0.2.4" }
Expand All @@ -93,6 +95,7 @@ serde = { version = "1.0.203", features = ["derive"] }
serde_test = { version = "1.0.176" }
sha1_smol = { version = "1.0.0" }
syn = { version = "2.0.66", features = ["full"] }
tempfile = { version = "3.12.0" }
termsize = { version = "0.1.6" }
thiserror = { version = "1.0.56" }
tiny-fn = { version = "0.1.6" }
Expand Down
37 changes: 37 additions & 0 deletions iceoryx2-bb/testing/src/assert.rs
Original file line number Diff line number Diff line change
Expand Up @@ -173,6 +173,34 @@ macro_rules! assert_that {
}
}
};
($lhs:expr, contains_match |$element:ident| $predicate:expr) => {
{
let mut does_contain = false;
for $element in &$lhs {
if $predicate {
does_contain = true;
break;
}
}
if !does_contain {
assert_that!(message_contains_match $lhs, core::stringify!($predicate));
}
}
};
($lhs:expr, not_contains_match |$element:ident| $predicate:expr) => {
{
let mut does_contain = false;
for $element in &$lhs {
if $predicate {
does_contain = true;
break;
}
}
if does_contain {
assert_that!(message_contains_match $lhs, core::stringify!($predicate));
}
}
};
($lhs:expr, time_at_least $rhs:expr) => {
{
let lval = $lhs.as_secs_f32();
Expand Down Expand Up @@ -237,6 +265,15 @@ macro_rules! assert_that {
assert_that![color_end]
);
};
[message_contains_match $lhs:expr, $predicate:expr] => {
core::panic!(
"assertion failed: {}expr: {} contains no element matching predicate: {}{}",
assert_that![color_start],
core::stringify!($lhs),
$predicate,
assert_that![color_end]
);
};
[message_property $lhs:expr, $lval:expr, $property:expr, $rhs:expr] => {
core::panic!(
"assertion failed: {}expr: {}.{} == {}; value: {} == {}{}",
Expand Down
11 changes: 8 additions & 3 deletions iceoryx2-cli/iox2/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,13 @@ rust-version = { workspace = true }
version = { workspace = true }

[dependencies]
human-panic = { workspace = true }
anyhow = { workspace = true }
better-panic = { workspace = true }
clap = { workspace = true }
colored = { workspace = true }
thiserror = { workspace = true }
clap = { workspace = true }
human-panic = { workspace = true }
cargo_metadata = { workspace = true }

[dev-dependencies]
iceoryx2-bb-testing = { workspace = true }
tempfile = { workspace = true }
7 changes: 6 additions & 1 deletion iceoryx2-cli/iox2/src/cli.rs
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,12 @@ pub struct Cli {
)]
pub dev: bool,

#[arg(hide = true, required = false)]
#[arg(
hide = true,
required = false,
trailing_var_arg = true,
allow_hyphen_values = true
)]
pub external_command: Vec<String>,
}

Expand Down
Loading

0 comments on commit 2d1f01d

Please sign in to comment.