From b140f1368af04bd1d6a96bbeed47dc2f5e362ad9 Mon Sep 17 00:00:00 2001 From: Roberto Scolaro Date: Mon, 6 Jan 2025 15:18:03 +0000 Subject: [PATCH] chore(test/libsinsp_e2e): rename before_close to after_capture Signed-off-by: Roberto Scolaro --- test/libsinsp_e2e/event_capture.cpp | 4 ++-- test/libsinsp_e2e/event_capture.h | 14 +++++++------- test/libsinsp_e2e/suppress_events.cpp | 8 ++++---- test/libsinsp_e2e/sys_call_test.cpp | 8 ++++---- 4 files changed, 17 insertions(+), 17 deletions(-) diff --git a/test/libsinsp_e2e/event_capture.cpp b/test/libsinsp_e2e/event_capture.cpp index 83f35be67c..a84e57c701 100644 --- a/test/libsinsp_e2e/event_capture.cpp +++ b/test/libsinsp_e2e/event_capture.cpp @@ -33,7 +33,7 @@ unsigned long event_capture::s_buffer_dim = DEFAULT_DRIVER_BUFFER_BYTES_DIM * 4; event_capture::event_capture(captured_event_callback_t captured_event_callback, before_open_t before_open, before_capture_t before_capture, - after_capture_t before_close, + after_capture_t after_capture, event_filter_t filter, uint32_t max_thread_table_size, uint64_t thread_timeout_ns, @@ -41,7 +41,7 @@ event_capture::event_capture(captured_event_callback_t captured_event_callback, m_captured_event_callback = std::move(captured_event_callback); m_before_open = std::move(before_open); m_before_capture = std::move(before_capture); - m_after_capture = std::move(before_close); + m_after_capture = std::move(after_capture); m_filter = std::move(filter); m_eventfd = -1; diff --git a/test/libsinsp_e2e/event_capture.h b/test/libsinsp_e2e/event_capture.h index d5acd3c2c2..03a767ffea 100644 --- a/test/libsinsp_e2e/event_capture.h +++ b/test/libsinsp_e2e/event_capture.h @@ -66,7 +66,7 @@ class event_capture { event_capture(captured_event_callback_t captured_event_callback, before_open_t before_open, before_capture_t before_capture, - after_capture_t before_close, + after_capture_t after_capture, event_filter_t filter, uint32_t max_thread_table_size, uint64_t thread_timeout_ns, @@ -84,7 +84,7 @@ class event_capture { and, for any event that matches the filter, calls captured_event_callback. Before starting the capture, before_open is called. - After closing the capture, before_close is called. + After closing the capture, after_capture is called. The default ppm_sc_set is the whole set minus `read` and `readv`. */ static void run(const run_callback_t& run_function, @@ -92,7 +92,7 @@ class event_capture { event_filter_t filter, before_open_t before_open = event_capture::do_nothing, before_capture_t before_capture = event_capture::do_nothing, - after_capture_t before_close = event_capture::do_nothing, + after_capture_t after_capture = event_capture::do_nothing, libsinsp::events::set sc_set = {}, uint32_t max_thread_table_size = 131072, uint64_t thread_timeout_ns = (uint64_t)60 * 1000 * 1000 * 1000, @@ -101,7 +101,7 @@ class event_capture { event_capture capturing(std::move(captured_event_callback), std::move(before_open), std::move(before_capture), - std::move(before_close), + std::move(after_capture), std::move(filter), max_thread_table_size, thread_timeout_ns, @@ -124,7 +124,7 @@ class event_capture { and, for any event that matches the filter, calls captured_event_callback. Before starting the capture, before_open is called. - After closing the capture, before_close is called. + After closing the capture, after_capture is called. The default ppm_sc_set is the whole set minus `read` and `readv`. */ static void run(const run_callback_async_t& run_function, @@ -132,7 +132,7 @@ class event_capture { event_filter_t filter, before_open_t before_open = event_capture::do_nothing, before_capture_t before_capture = event_capture::do_nothing, - after_capture_t before_close = event_capture::do_nothing, + after_capture_t after_capture = event_capture::do_nothing, libsinsp::events::set sc_set = {}, uint32_t max_thread_table_size = 131072, uint64_t thread_timeout_ns = (uint64_t)60 * 1000 * 1000 * 1000, @@ -141,7 +141,7 @@ class event_capture { event_capture capturing(std::move(captured_event_callback), std::move(before_open), std::move(before_capture), - std::move(before_close), + std::move(after_capture), std::move(filter), max_thread_table_size, thread_timeout_ns, diff --git a/test/libsinsp_e2e/suppress_events.cpp b/test/libsinsp_e2e/suppress_events.cpp index a0f7d8b4af..9334debbb2 100644 --- a/test/libsinsp_e2e/suppress_events.cpp +++ b/test/libsinsp_e2e/suppress_events.cpp @@ -103,7 +103,7 @@ static void test_helper_quotactl(test_helper_args& hargs) { } }; - after_capture_t before_close = [](sinsp* inspector) { + after_capture_t after_capture = [](sinsp* inspector) { scap_stats st; inspector->get_capture_stats(&st); @@ -121,7 +121,7 @@ static void test_helper_quotactl(test_helper_args& hargs) { filter, event_capture::do_nothing, before_open, - before_close, + after_capture, {}, 131072, 6000, @@ -259,7 +259,7 @@ void suppress_types::run_test(std::vector supp_syscalls) { } }; - after_capture_t before_close = [&](sinsp* inspector) { + after_capture_t after_capture = [&](sinsp* inspector) { for(auto sc : m_suppressed_syscalls) { bool expect_exception = (sc >= PPM_SC_MAX); bool caught_exception = false; @@ -296,7 +296,7 @@ void suppress_types::run_test(std::vector supp_syscalls) { m_tid_filter, event_capture::do_nothing, before_open, - before_close); + after_capture); }); EXPECT_EQ(m_expected_calls, callnum); } diff --git a/test/libsinsp_e2e/sys_call_test.cpp b/test/libsinsp_e2e/sys_call_test.cpp index a260a16e4c..050a393c19 100644 --- a/test/libsinsp_e2e/sys_call_test.cpp +++ b/test/libsinsp_e2e/sys_call_test.cpp @@ -1464,7 +1464,7 @@ TEST_F(sys_call_test, getsetresuid_and_gid) { } }; - after_capture_t before_close = [&](sinsp* inspector) { + after_capture_t after_capture = [&](sinsp* inspector) { int result = 0; result += setresuid(orig_uids[0], orig_uids[1], orig_uids[2]); @@ -1485,7 +1485,7 @@ TEST_F(sys_call_test, getsetresuid_and_gid) { filter, event_capture::do_nothing, event_capture::do_nothing, - before_close); + after_capture); }); EXPECT_EQ(8, callnum); } @@ -2166,7 +2166,7 @@ TEST_F(sys_call_test, thread_lookup_live) { } }; - after_capture_t before_close = [&](sinsp* inspector) { + after_capture_t after_capture = [&](sinsp* inspector) { // close scap to maintain the num_consumers at exit == 0 assertion // close_capture(scap, platform); auto platform = (scap_linux_platform*)inspector->get_scap_platform(); @@ -2187,7 +2187,7 @@ TEST_F(sys_call_test, thread_lookup_live) { }; ASSERT_NO_FATAL_FAILURE({ - event_capture::run(test, callback, filter, event_capture::do_nothing, before_close); + event_capture::run(test, callback, filter, event_capture::do_nothing, after_capture); }); }