Skip to content

Commit

Permalink
fix(libsinsp_e2e): improve multiarch compatibility
Browse files Browse the repository at this point in the history
Signed-off-by: Roberto Scolaro <roberto.scolaro21@gmail.com>
  • Loading branch information
therealbobo committed Apr 2, 2024
1 parent f665cf6 commit b2b6cfc
Showing 1 changed file with 10 additions and 5 deletions.
15 changes: 10 additions & 5 deletions test/libsinsp_e2e/sys_call_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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<sinsp> inspector)
Expand All @@ -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
Expand All @@ -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"));

Expand Down Expand Up @@ -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);

Expand Down

0 comments on commit b2b6cfc

Please sign in to comment.