Skip to content

Commit

Permalink
visibility declarations; make all targets public. Set role. Adding ad…
Browse files Browse the repository at this point in the history
…ditional BERT tests.
  • Loading branch information
smolkaj authored and bibhuprasad committed Nov 1, 2024
1 parent a7754ae commit 2175df5
Show file tree
Hide file tree
Showing 5 changed files with 347 additions and 5 deletions.
1 change: 0 additions & 1 deletion tests/forwarding/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,6 @@ cc_library(
testonly = True,
srcs = ["smoke_test.cc"],
hdrs = ["smoke_test.h"],
visibility = ["//visibility:public"],
deps = [
":p4_blackbox_fixture",
":test_data",
Expand Down
11 changes: 9 additions & 2 deletions tests/forwarding/p4_blackbox_fixture.h
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ class P4BlackboxFixture : public thinkit::MirrorTestbedFixture {
}

void TearDown() override {
if (SutP4RuntimeSession() != nullptr) {
if (SutP4RuntimeSession() != nullptr && clear_table_entries_on_teardown_) {
// Clear all table entries to leave the switch in a clean state.
EXPECT_OK(pdpi::ClearTableEntries(SutP4RuntimeSession()));
}
Expand All @@ -82,9 +82,16 @@ class P4BlackboxFixture : public thinkit::MirrorTestbedFixture {

const pdpi::IrP4Info& IrP4Info() const { return ir_p4info_; }

protected:
void DisableClearingTableEntriesOnTearDown() {
clear_table_entries_on_teardown_ = false;
}

private:
bool clear_table_entries_on_teardown_ = true;
std::unique_ptr<pdpi::P4RuntimeSession> sut_p4rt_session_;
pdpi::IrP4Info ir_p4info_ = sai::GetIrP4Info(sai::Instantiation::kMiddleblock);
pdpi::IrP4Info ir_p4info_ =
sai::GetIrP4Info(sai::Instantiation::kMiddleblock);
};

} // namespace gpins
Expand Down
5 changes: 3 additions & 2 deletions tests/forwarding/smoke_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -129,8 +129,9 @@ TEST_P(SmokeTestFixture, InsertAndReadTableEntries) {

p4::v1::ReadRequest read_request;
read_request.add_entities()->mutable_table_entry();
ASSERT_OK_AND_ASSIGN(p4::v1::ReadResponse read_response,
pdpi::SetMetadataAndSendPiReadRequest(session, read_request));
ASSERT_OK_AND_ASSIGN(
p4::v1::ReadResponse read_response,
pdpi::SetMetadataAndSendPiReadRequest(session, read_request));

for (const auto& entity : read_response.entities()) {
ASSERT_OK(test_environment.AppendToTestArtifact(
Expand Down
2 changes: 2 additions & 0 deletions tests/gnoi/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,8 @@ cc_library(
"//thinkit:mirror_testbed_fixture",
"@com_github_gnoi//diag:diag_cc_proto",
"@com_github_google_glog//:glog",
"@com_google_absl//absl/container:flat_hash_set",
"@com_google_absl//absl/flags:flag",
"@com_github_grpc_grpc//:grpc++",
"@com_google_absl//absl/strings",
"@com_google_absl//absl/time",
Expand Down
Loading

0 comments on commit 2175df5

Please sign in to comment.