Skip to content

Commit

Permalink
Merge pull request iovisor#4167 from davemarchevsky/davemarchevsky_fi…
Browse files Browse the repository at this point in the history
…x_bpf_table_test

test_bpf_table: Re-add deletion of 'bpf' module
  • Loading branch information
davemarchevsky committed Aug 12, 2022
2 parents f9aa1e7 + 08a26ed commit fa41a40
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions tests/cc/test_bpf_table.cc
Original file line number Diff line number Diff line change
Expand Up @@ -26,13 +26,13 @@ TEST_CASE("test bpf table", ebpf::bpf_module_rw_engine_enabled() ? "[bpf_table]"
BPF_TABLE("hash", int, int, myhash, 128);
)";

ebpf::BPF bpf;
auto bpf = std::make_unique<ebpf::BPF>();
ebpf::StatusTuple res(0);
std::vector<std::pair<std::string, std::string>> elements;
res = bpf.init(BPF_PROGRAM);
res = bpf->init(BPF_PROGRAM);
REQUIRE(res.ok());

ebpf::BPFTable t = bpf.get_table("myhash");
ebpf::BPFTable t = bpf->get_table("myhash");

// update element
std::string value;
Expand Down Expand Up @@ -78,7 +78,8 @@ TEST_CASE("test bpf table", ebpf::bpf_module_rw_engine_enabled() ? "[bpf_table]"
REQUIRE(res.ok());
REQUIRE(elements.size() == 0);


// delete bpf_module, call to key/leaf printf/scanf must fail
bpf.reset();

res = t.update_value("0x07", "0x42");
REQUIRE(!res.ok());
Expand Down

0 comments on commit fa41a40

Please sign in to comment.