Skip to content

Commit

Permalink
test(userspace/libsinsp): test proc.ppid and proc.apid[1] when parent…
Browse files Browse the repository at this point in the history
… is thread

Signed-off-by: Lorenzo Susini <[email protected]>
  • Loading branch information
loresuso authored and poiana committed Jan 13, 2025
1 parent 1f14fe0 commit 431ba43
Showing 1 changed file with 17 additions and 0 deletions.
17 changes: 17 additions & 0 deletions userspace/libsinsp/test/events_proc.ut.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1352,3 +1352,20 @@ TEST_F(sinsp_with_test_input, last_exec_ts) {
// Check we execed after the last clone
ASSERT_GT(evt->get_thread_info()->m_lastexec_ts, evt->get_thread_info()->m_clone_ts);
}

TEST_F(sinsp_with_test_input, proc_ppid_apid) {
/* Instantiate the default tree */
DEFAULT_TREE

/* Create a child for `p2_t3` */
int64_t p7_t1_tid = 100;
[[maybe_unused]] int64_t p7_t1_pid = 100;
[[maybe_unused]] int64_t p7_t1_ptid = p2_t3_tid;

auto evt = generate_clone_x_event(p7_t1_tid, p2_t3_tid, p2_t3_pid, p2_t3_ptid);
ASSERT_THREAD_CHILDREN(p2_t3_tid, 1, 1, p7_t1_tid);

/* Check that proc.ppid and proc.apid[1] are the same and that this holds even in the case
a thread performed a clone */
ASSERT_EQ(get_field_as_string(evt, "proc.ppid"), get_field_as_string(evt, "proc.apid[1]"));
}

0 comments on commit 431ba43

Please sign in to comment.