Skip to content

Commit a8d3ed1

Browse files
avasylevfacebook-github-bot
authored andcommitted
Make decap tc tests fail on missmatch
Summary: For tc tests we don't check result of comparison in unit tests, only print them. Fixing to fail unit test run when miss match. Reviewed By: nikhildl12 Differential Revision: D71416328 fbshipit-source-id: 4952e22c947e4655ffd197496c3c2f5d4f8d005c
1 parent c6a5f2e commit a8d3ed1

File tree

2 files changed

+4
-3
lines changed

2 files changed

+4
-3
lines changed

katran/lib/testing/BpfTester.cpp

+3-2
Original file line numberDiff line numberDiff line change
@@ -129,14 +129,15 @@ bool BpfTester::testFromFixture() {
129129
return runBpfTesterFromFixtures(config_.bpfProgFd, kXdpCodes, {});
130130
}
131131

132-
void BpfTester::testClsFromFixture(
132+
bool BpfTester::testClsFromFixture(
133133
int progFd,
134134
std::vector<struct __sk_buff> ctxs_in) {
135135
std::vector<void*> ctxs;
136136
for (auto& ctx : ctxs_in) {
137137
ctxs.push_back(&ctx);
138138
}
139-
runBpfTesterFromFixtures(progFd, kTcCodes, ctxs, sizeof(struct __sk_buff));
139+
return runBpfTesterFromFixtures(
140+
progFd, kTcCodes, ctxs, sizeof(struct __sk_buff));
140141
}
141142

142143
bool BpfTester::runBpfTesterFromFixtures(

katran/lib/testing/BpfTester.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,7 @@ class BpfTester {
110110
* helper function to run tests on data from test fixtures
111111
* for clsact(tc) based bpf program. optional ctxs could be specified
112112
*/
113-
void testClsFromFixture(int progFd, std::vector<struct __sk_buff> ctxs_in);
113+
bool testClsFromFixture(int progFd, std::vector<struct __sk_buff> ctxs_in);
114114

115115
/**
116116
* @param vector<string, string> new input fixtures

0 commit comments

Comments
 (0)