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 4eeed6dcff

Signed-off-by: Jim Warner <james.warner@comcast.net>
This commit is contained in:
Jim Warner 2020-08-17 12:12:12 -05:00 committed by Craig Small
parent 4eeed6dcff
commit 0cddb06425

View File

@ -31,50 +31,56 @@
static int check_diskstats (void *data) { static int check_diskstats (void *data) {
struct diskstats_info *ctx = NULL; struct diskstats_info *ctx = NULL;
testname = "Itemtable check, diskstats"; testname = "Itemtable check, diskstats";
if (procps_diskstats_new(&ctx) < 0) return 0; if (0 == procps_diskstats_new(&ctx))
return (procps_diskstats_unref(&ctx) == 0); procps_diskstats_unref(&ctx);
return 1;
} }
static int check_meminfo (void *data) { static int check_meminfo (void *data) {
struct meminfo_info *ctx = NULL; struct meminfo_info *ctx = NULL;
testname = "Itemtable check, meminfo"; testname = "Itemtable check, meminfo";
if (procps_meminfo_new(&ctx) < 0) return 0; if (0 == procps_meminfo_new(&ctx))
return (procps_meminfo_unref(&ctx) == 0); procps_meminfo_unref(&ctx);
return 1;
} }
static int check_pids (void *data) { static int check_pids (void *data) {
struct pids_info *ctx = NULL;; struct pids_info *ctx = NULL;
testname = "Itemtable check, pids"; testname = "Itemtable check, pids";
if (procps_pids_new(&ctx, NULL, 0) < 0) return 0; if (0 == procps_pids_new(&ctx, NULL, 0))
return (procps_pids_unref(&ctx) == 0); procps_pids_unref(&ctx);
return 1;
} }
static int check_slabinfo (void *data) { static int check_slabinfo (void *data) {
struct slabinfo_info *ctx = NULL; struct slabinfo_info *ctx = NULL;
testname = "Itemtable check, slabinfo"; testname = "Itemtable check, slabinfo";
if (procps_slabinfo_new(&ctx) < 0) return 0; if (0 == procps_slabinfo_new(&ctx))
return (procps_slabinfo_unref(&ctx) == 0); procps_slabinfo_unref(&ctx);
return 1;
} }
static int check_stat (void *data) { static int check_stat (void *data) {
struct stat_info *ctx = NULL; struct stat_info *ctx = NULL;
testname = "Itemtable check, stat"; testname = "Itemtable check, stat";
if (procps_stat_new(&ctx) < 0) return 0; if (0 == procps_stat_new(&ctx))
return (procps_stat_unref(&ctx) == 0); procps_stat_unref(&ctx);
return 1;
} }
static int check_vmstat (void *data) { static int check_vmstat (void *data) {
struct vmstat_info *ctx = NULL; struct vmstat_info *ctx = NULL;
testname = "Itemtable check, vmstat"; testname = "Itemtable check, vmstat";
if (procps_vmstat_new(&ctx) < 0) return 0; if (0 == procps_vmstat_new(&ctx))
return (procps_vmstat_unref(&ctx) == 0); procps_vmstat_unref(&ctx);
return 1;
} }
static TestFunction test_funcs[] = { static TestFunction test_funcs[] = {
check_diskstats, check_diskstats,
check_meminfo, check_meminfo,
check_pids, check_pids,
// check_slabinfo, EPERM errors check_slabinfo,
check_stat, check_stat,
check_vmstat, check_vmstat,
NULL NULL