From b2b6cfc46a66608d07aeeaf448f291f01fe1e9a4 Mon Sep 17 00:00:00 2001 From: Roberto Scolaro Date: Tue, 2 Apr 2024 18:02:09 +0000 Subject: [PATCH] fix(libsinsp_e2e): improve multiarch compatibility Signed-off-by: Roberto Scolaro --- test/libsinsp_e2e/sys_call_test.cpp | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/test/libsinsp_e2e/sys_call_test.cpp b/test/libsinsp_e2e/sys_call_test.cpp index b621487847..2c2a9fafe1 100644 --- a/test/libsinsp_e2e/sys_call_test.cpp +++ b/test/libsinsp_e2e/sys_call_test.cpp @@ -1403,7 +1403,8 @@ TEST_F(sys_call_test, poll_timeout) int callnum = 0; event_filter_t filter = [&](sinsp_evt* evt) { - return !strcmp(evt->get_name(), "poll") && m_tid_filter(evt); + std::string name(evt->get_name()); + return name.find("poll") != std::string::npos && m_tid_filter(evt); }; run_callback_t test = [](concurrent_object_handle inspector) @@ -1413,14 +1414,18 @@ TEST_F(sys_call_test, poll_timeout) ufds[0].events = POLLIN; ufds[1].fd = 1; ufds[1].events = POLLOUT; +#if defined(__x86_64__) syscall(SYS_poll, ufds, 2, 20); +#else + poll(ufds, 2, 20); +#endif }; captured_event_callback_t callback = [&](const callback_param& param) { sinsp_evt* e = param.m_evt; uint16_t type = e->get_type(); - if (type == PPME_SYSCALL_POLL_E) + if (type == PPME_SYSCALL_POLL_E || type == PPME_SYSCALL_PPOLL_E) { // // stdin and stdout can be a file or a fifo depending @@ -1433,7 +1438,7 @@ TEST_F(sys_call_test, poll_timeout) EXPECT_EQ("20", e->get_param_value_str("timeout")); callnum++; } - else if (type == PPME_SYSCALL_POLL_X) + else if (type == PPME_SYSCALL_POLL_X || type == PPME_SYSCALL_PPOLL_X) { int64_t res = stoi(e->get_param_value_str("res")); @@ -1555,8 +1560,8 @@ TEST_F(sys_call_test, getsetresuid_and_gid) { char command[] = "useradd -u 5454 testsetresuid && " "groupadd -g 6565 testsetresgid && " - "sudo -u testsetresuid echo -n && " - "sudo -g testsetresgid echo -n"; + "sudo -u testsetresuid echo && " + "sudo -g testsetresgid echo"; ret = system(command); ASSERT_EQ(0, ret);