Running resctrl selftest requires the test to write to resctrl file system and only root user has permission to do so. Hence, abort the test suite if the user is not running the test with root user privileges. Fixes: ecdbb911f22d ("selftests/resctrl: Add MBM test") Signed-off-by: Sai Praneeth Prakhya <sai.praneeth.prakhya@xxxxxxxxx> --- tools/testing/selftests/resctrl/resctrl_tests.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/tools/testing/selftests/resctrl/resctrl_tests.c b/tools/testing/selftests/resctrl/resctrl_tests.c index cab69ed8c67d..f005ba2b41ec 100644 --- a/tools/testing/selftests/resctrl/resctrl_tests.c +++ b/tools/testing/selftests/resctrl/resctrl_tests.c @@ -125,8 +125,10 @@ int main(int argc, char **argv) * 1. We write to resctrl FS * 2. We execute perf commands */ - if (geteuid() != 0) - printf("# WARNING: not running as root, tests may fail.\n"); + if (geteuid() != 0) { + printf("Bail out! not running as root, abort testing\n"); + return -1; + } /* Detect AMD vendor */ detect_amd(); -- 2.19.1