From 86c7eeb70d154f96f16d3a7e4913e90f9eef2542 Mon Sep 17 00:00:00 2001 From: Craig Small Date: Mon, 1 Aug 2022 22:23:38 +1000 Subject: [PATCH] testsuite: Add test for fatal_proc_unmounted Adding a check to ensure that fatal_proc_unmounted returns values for things that do not just sit in /proc/self/stat References: commit 52bd019d8ca09ecfec34b5020eb7b8d612c315f8 --- proc/test_pids.c | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/proc/test_pids.c b/proc/test_pids.c index 633c7298..6435b955 100644 --- a/proc/test_pids.c +++ b/proc/test_pids.c @@ -24,6 +24,7 @@ #include "tests.h" enum pids_item items[] = { PIDS_ID_PID, PIDS_ID_PID }; +enum pids_item items2[] = { PIDS_ID_PID, PIDS_VM_RSS }; int check_pids_new_nullinfo(void *data) { @@ -47,10 +48,23 @@ int check_pids_new_and_unref(void *data) info == NULL); } +int check_fatal_proc_unmounted(void *data) +{ + struct pids_info *info = NULL; + struct pids_stack *stack; + testname = "check_fatal_proc_unmounted"; + + return ( (procps_pids_new(&info, items2, 2) == 0) && + ( (stack = fatal_proc_unmounted(info, 1)) != NULL) && + ( PIDS_VAL(0, s_int, stack, info) > 0) && + ( PIDS_VAL(1, u_int, stack, info) > 0)); +} + TestFunction test_funcs[] = { check_pids_new_nullinfo, // skipped, ask Jim check_pids_new_toomany, check_pids_new_and_unref, + check_fatal_proc_unmounted, NULL }; int main(int argc, char *argv[])