Re: [PATCH v4 05/17] selftests/resctrl: Add a few dependencies

From: Shuah Khan
Date: Tue Jan 26 2021 - 05:49:22 EST


On 11/30/20 1:19 PM, Fenghua Yu wrote:
Add a couple of sanity checks and the config file for test dependencies.

Running any resctrl unit test involves writing to resctrl file system
and only a root user has permission to write to resctrl FS. Resctrl
test suite before running any test checks for the privilege of the
user and if it's not a root user, the test suite prints a warning
and continues attempting to run tests.

Attempting to run any test without root privileges will fail as below

TAP version 13
ok kernel supports resctrl filesystem
.................
not ok mounting resctrl to "/sys/fs/resctrl"
not ok MBA: schemata change

Hence, don't attempt to run any test if the user is not a root user and
change the warning message to a bail out message to comply with TAP 13
standards.

Regarding the second check, check_resctrlfs_support() checks if the
platform supports resctrl file system or not by looking for resctrl
in /proc/filesystems and returns a boolean value. The main function
of resctrl test suite calls check_resctrlfs_support() but forgets to
check for it's return value. This means that resctrl test suite will
attempt to run resctrl tests (like CMT, CAT, MBM and MBA) even if the
platform doesn't support resctrl file system.

Fix this by checking for the return value of check_resctrlfs_support() in
the main function. If resctrl file system isn't supported on the platform
then exit the test suite gracefully without attempting to run any of
resctrl unit tests.


Please use kselftest.h instead of adding TAP stuff. This way if updates
to newer TAP will not require changes.

thanks,
-- Shuah