Skip to content

Commit

Permalink
fix(test/libsinsp_e2e): only enable generic syscalls in timestamp t…
Browse files Browse the repository at this point in the history
…est to avoid drops.

Signed-off-by: Federico Di Pierro <[email protected]>
  • Loading branch information
FedeDP committed Sep 27, 2024
1 parent 9053f57 commit 58fadd4
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion test/libsinsp_e2e/sys_call_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -507,6 +507,17 @@ TEST_F(sys_call_test, timestamp) {
uint64_t timestampv[20];
int callnum = 0;

before_capture_t setup = [&](sinsp* inspector) {
// Drop all but generic syscalls (since PPM_SC_GETTIMEOFDAY is generic)
// to avoid drops.
const auto state_sc_set = libsinsp::events::sinsp_state_sc_set();
for(int i = 0; i < PPM_SC_MAX; i++) {
if((ppm_sc_code)i != PPM_SC_GETTIMEOFDAY) {
inspector->mark_ppm_sc_of_interest((ppm_sc_code)i, false);
}
}
};

event_filter_t filter = [&](sinsp_evt* evt) { return m_tid_filter(evt); };

run_callback_t test = [&](sinsp* inspector) {
Expand All @@ -529,7 +540,7 @@ TEST_F(sys_call_test, timestamp) {
}
};

ASSERT_NO_FATAL_FAILURE({ event_capture::run(test, callback, filter); });
ASSERT_NO_FATAL_FAILURE({ event_capture::run(test, callback, filter, setup); });
EXPECT_EQ((int)(sizeof(timestampv) / sizeof(timestampv[0])), callnum);
}

Expand Down

0 comments on commit 58fadd4

Please sign in to comment.