Skip to content

Commit

Permalink
fix(test): fixed modern bpf tests build.
Browse files Browse the repository at this point in the history
Signed-off-by: Federico Di Pierro <[email protected]>
  • Loading branch information
FedeDP authored and poiana committed Jan 17, 2023
1 parent 5076613 commit f4b199f
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 7 deletions.
8 changes: 4 additions & 4 deletions test/modern_bpf/event_class/event_class.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -196,7 +196,7 @@ void event_test::disable_capture()

void event_test::clear_ring_buffers()
{
int16_t cpu_id = 0;
uint16_t cpu_id = 0;
while(get_event_from_ringbuffer(&cpu_id) != NULL)
{
};
Expand All @@ -207,15 +207,15 @@ bool event_test::are_all_ringbuffers_full(unsigned long threshold)
return pman_are_all_ringbuffers_full(threshold);
}

struct ppm_evt_hdr* event_test::get_event_from_ringbuffer(int16_t* cpu_id)
struct ppm_evt_hdr* event_test::get_event_from_ringbuffer(uint16_t* cpu_id)
{
m_event_header = NULL;
uint16_t attempts = 0;

/* Try 2 times just to be sure that all the buffers are empty. */
while(attempts <= 1)
{
pman_consume_first_from_buffers((void**)&m_event_header, cpu_id);
pman_consume_one_from_buffers((void**)&m_event_header, cpu_id);
if(m_event_header != NULL)
{
return m_event_header;
Expand Down Expand Up @@ -819,7 +819,7 @@ void event_test::assert_unix_path(const char* desired_path, int starting_index)

void event_test::assert_event_in_buffers(pid_t pid_to_search, int event_to_search, bool presence)
{
int16_t cpu_id = 0;
uint16_t cpu_id = 0;
pid_t pid = 0;
uint16_t evt_type = 0;

Expand Down
2 changes: 1 addition & 1 deletion test/modern_bpf/event_class/event_class.h
Original file line number Diff line number Diff line change
Expand Up @@ -169,7 +169,7 @@ class event_test
*
* @param cpu_id CPU from which we extracted the event.
*/
struct ppm_evt_hdr* get_event_from_ringbuffer(int16_t* cpu_id);
struct ppm_evt_hdr* get_event_from_ringbuffer(uint16_t* cpu_id);

/**
* @brief Parse information from the event that we have extracted from the buffer:
Expand Down
2 changes: 1 addition & 1 deletion test/modern_bpf/start_tests.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ int main(int argc, char** argv)
::testing::InitGoogleTest(&argc, argv);

/* Configure and load BPF probe. */
ret = pman_init_state(libbpf_verbosity, buffer_dim);
ret = pman_init_state(libbpf_verbosity, buffer_dim, DEFAULT_CPU_FOR_EACH_BUFFER, true);
ret = ret ?: pman_open_probe();
ret = ret ?: pman_prepare_ringbuf_array_before_loading();
ret = ret ?: pman_prepare_maps_before_loading();
Expand Down
2 changes: 1 addition & 1 deletion test/modern_bpf/test_suites/local_suite/ring_buffer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ TEST(Local, ring_buffer_overwrite)
* and keep the pointer to an event to see if this is overwritten
*/
struct ppm_evt_hdr* evt = NULL;
int16_t cpu_id = 0;
uint16_t cpu_id = 0;

for(int i=0; i<10; i++)
{
Expand Down

0 comments on commit f4b199f

Please sign in to comment.