From 0cddb06425f98ff78b352500cfbc15129e79b09f Mon Sep 17 00:00:00 2001 From: Jim Warner Date: Mon, 17 Aug 2020 12:12:12 -0500 Subject: [PATCH] build-sys: proper fix for the 'test_Itemtables' module Me thinks Craig had the right idea but perhaps not the most correct solution. As currently structured, all of the tests now go way too far by checking every 'unref' and 'new' call when what we're trying for is survival. In the final analysis, it doesn't matter who issues an EXIT_FAILURE - that run_tests guy or an early Exit out of a procps_new() function. They both will produce the same end result of the desired "FAIL" test diagnostic. [ and this patch once again allows the slabinfo test ] Reference(s): commit 4eeed6dcff8b3bf3930eb1998738b5c6d458f0c1 Signed-off-by: Jim Warner --- proc/test_Itemtables.c | 34 ++++++++++++++++++++-------------- 1 file changed, 20 insertions(+), 14 deletions(-) diff --git a/proc/test_Itemtables.c b/proc/test_Itemtables.c index 81e6aa40..4bbf5b59 100644 --- a/proc/test_Itemtables.c +++ b/proc/test_Itemtables.c @@ -31,50 +31,56 @@ static int check_diskstats (void *data) { struct diskstats_info *ctx = NULL; testname = "Itemtable check, diskstats"; - if (procps_diskstats_new(&ctx) < 0) return 0; - return (procps_diskstats_unref(&ctx) == 0); + if (0 == procps_diskstats_new(&ctx)) + procps_diskstats_unref(&ctx); + return 1; } static int check_meminfo (void *data) { struct meminfo_info *ctx = NULL; testname = "Itemtable check, meminfo"; - if (procps_meminfo_new(&ctx) < 0) return 0; - return (procps_meminfo_unref(&ctx) == 0); + if (0 == procps_meminfo_new(&ctx)) + procps_meminfo_unref(&ctx); + return 1; } static int check_pids (void *data) { - struct pids_info *ctx = NULL;; + struct pids_info *ctx = NULL; testname = "Itemtable check, pids"; - if (procps_pids_new(&ctx, NULL, 0) < 0) return 0; - return (procps_pids_unref(&ctx) == 0); + if (0 == procps_pids_new(&ctx, NULL, 0)) + procps_pids_unref(&ctx); + return 1; } static int check_slabinfo (void *data) { struct slabinfo_info *ctx = NULL; testname = "Itemtable check, slabinfo"; - if (procps_slabinfo_new(&ctx) < 0) return 0; - return (procps_slabinfo_unref(&ctx) == 0); + if (0 == procps_slabinfo_new(&ctx)) + procps_slabinfo_unref(&ctx); + return 1; } static int check_stat (void *data) { struct stat_info *ctx = NULL; testname = "Itemtable check, stat"; - if (procps_stat_new(&ctx) < 0) return 0; - return (procps_stat_unref(&ctx) == 0); + if (0 == procps_stat_new(&ctx)) + procps_stat_unref(&ctx); + return 1; } static int check_vmstat (void *data) { struct vmstat_info *ctx = NULL; testname = "Itemtable check, vmstat"; - if (procps_vmstat_new(&ctx) < 0) return 0; - return (procps_vmstat_unref(&ctx) == 0); + if (0 == procps_vmstat_new(&ctx)) + procps_vmstat_unref(&ctx); + return 1; } static TestFunction test_funcs[] = { check_diskstats, check_meminfo, check_pids, - // check_slabinfo, EPERM errors + check_slabinfo, check_stat, check_vmstat, NULL