Skip to content

Commit

Permalink
allow runtime config in int-test of bytecode images
Browse files Browse the repository at this point in the history
Allow us to change the bytecode image paths at
runtime, this will allow us to make sure that
we can get coverage after local bytecode image
changes prior to merging.

Signed-off-by: Andrew Stoycos <[email protected]>
  • Loading branch information
astoycos committed Jul 3, 2024
1 parent 78d2f93 commit 793549e
Show file tree
Hide file tree
Showing 6 changed files with 115 additions and 96 deletions.
1 change: 1 addition & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions tests/integration-test/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ bpfman = { workspace = true }
env_logger = { workspace = true }
integration-test-macros = { workspace = true }
inventory = { workspace = true }
lazy_static = { workspace = true }
log = { workspace = true }
predicates = { workspace = true }
rand = { workspace = true, features = ["std", "std_rng"] }
Expand Down
28 changes: 14 additions & 14 deletions tests/integration-test/src/tests/basic.rs
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ fn test_load_unload_xdp() {
Some(globals.clone()),
Some(proceed_on.clone()),
lt,
XDP_PASS_IMAGE_LOC,
&XDP_PASS_IMAGE_LOC,
XDP_PASS_FILE_LOC,
Some(XDP_PASS_NAME),
None, // metadata
Expand Down Expand Up @@ -93,7 +93,7 @@ fn test_map_sharing_load_unload_xdp() {
None, // globals
None, // proceed_on
&load_type,
XDP_COUNTER_IMAGE_LOC,
&XDP_COUNTER_IMAGE_LOC,
"", // file_path
None,
None, // metadata
Expand Down Expand Up @@ -129,7 +129,7 @@ fn test_map_sharing_load_unload_xdp() {
None, // globals
None, // proceed_on
&load_type,
XDP_COUNTER_IMAGE_LOC,
&XDP_COUNTER_IMAGE_LOC,
"", // file_path
None,
None, // metadata
Expand Down Expand Up @@ -225,7 +225,7 @@ fn test_load_unload_tc() {
Some(globals.clone()),
Some(proceed_on.clone()),
lt,
TC_PASS_IMAGE_LOC,
&TC_PASS_IMAGE_LOC,
TC_PASS_FILE_LOC,
);
loaded_ids.push(prog_id.unwrap());
Expand Down Expand Up @@ -260,7 +260,7 @@ fn test_load_unload_tracepoint() {
let (prog_id, _) = add_tracepoint(
Some(globals.clone()),
lt,
TRACEPOINT_IMAGE_LOC,
&TRACEPOINT_IMAGE_LOC,
TRACEPOINT_FILE_LOC,
TRACEPOINT_TRACEPOINT_NAME,
);
Expand All @@ -282,7 +282,7 @@ fn test_load_unload_uprobe() {
let prog_id = add_uprobe(
Some(globals.clone()),
lt,
UPROBE_IMAGE_LOC,
&UPROBE_IMAGE_LOC,
UPROBE_FILE_LOC,
UPROBE_KERNEL_FUNCTION_NAME,
UPROBE_TARGET,
Expand All @@ -307,7 +307,7 @@ fn test_load_unload_uretprobe() {
let prog_id = add_uretprobe(
Some(globals.clone()),
lt,
URETPROBE_IMAGE_LOC,
&URETPROBE_IMAGE_LOC,
URETPROBE_FILE_LOC,
URETPROBE_FUNCTION_NAME,
None, // target
Expand All @@ -331,7 +331,7 @@ fn test_load_unload_kprobe() {
let prog_id = add_kprobe(
Some(globals.clone()),
lt,
KPROBE_IMAGE_LOC,
&KPROBE_IMAGE_LOC,
KPROBE_FILE_LOC,
KPROBE_KERNEL_FUNCTION_NAME,
None, // container_pid
Expand All @@ -356,7 +356,7 @@ fn test_load_unload_kretprobe() {
let prog_id = add_kretprobe(
Some(globals.clone()),
lt,
KRETPROBE_IMAGE_LOC,
&KRETPROBE_IMAGE_LOC,
KRETPROBE_FILE_LOC,
KRETPROBE_KERNEL_FUNCTION_NAME,
)
Expand All @@ -372,7 +372,7 @@ fn test_pull_bytecode() {
debug!("Pull bytecode image");

// Just ensure this doesn't panic
assert!(bpfman_pull_bytecode(TRACEPOINT_IMAGE_LOC, Some(PULL_POLICY_ALWAYS), None).is_ok());
assert!(bpfman_pull_bytecode(&TRACEPOINT_IMAGE_LOC, Some(PULL_POLICY_ALWAYS), None).is_ok());
}

#[integration_test]
Expand Down Expand Up @@ -407,7 +407,7 @@ fn test_list_with_metadata() {
Some(globals.clone()),
Some(proceed_on.clone()),
lt,
XDP_PASS_IMAGE_LOC,
&XDP_PASS_IMAGE_LOC,
XDP_PASS_FILE_LOC,
Some(XDP_PASS_NAME),
None, // metadata
Expand All @@ -425,7 +425,7 @@ fn test_list_with_metadata() {
Some(globals.clone()),
Some(proceed_on.clone()),
&LoadType::Image,
XDP_PASS_IMAGE_LOC,
&XDP_PASS_IMAGE_LOC,
XDP_PASS_FILE_LOC,
Some(XDP_PASS_NAME),
Some(vec![key]),
Expand Down Expand Up @@ -459,7 +459,7 @@ fn test_load_unload_fentry() {
for lt in LOAD_TYPES {
let prog_id = add_fentry_or_fexit(
lt,
FENTRY_IMAGE_LOC,
&FENTRY_IMAGE_LOC,
FENTRY_FILE_LOC,
true,
FENTRY_FEXIT_KERNEL_FUNCTION_NAME,
Expand All @@ -480,7 +480,7 @@ fn test_load_unload_fexit() {
for lt in LOAD_TYPES {
let prog_id = add_fentry_or_fexit(
lt,
FEXIT_IMAGE_LOC,
&FEXIT_IMAGE_LOC,
FEXIT_FILE_LOC,
false,
FENTRY_FEXIT_KERNEL_FUNCTION_NAME,
Expand Down
Loading

0 comments on commit 793549e

Please sign in to comment.