lkml.org 
[lkml]   [2021]   [Nov]   [30]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
From
SubjectRE: [PATCH 2/3] selftests/resctrl: Return KSFT_SKIP(4) if resctrl filessystem is not supported or resctrl is not run as root
Date
Hi Reinette

> (subject line and commit message: filessystem -> file system)
Thanks.

> On 11/10/2021 1:33 AM, Shaopeng Tan wrote:
> > From: "Tan, Shaopeng" <tan.shaopeng@jp.fujitsu.com>
> >
> > To unify the return code of resctrl_tests with the return code of
> > selftest set, return KSFT_SKIP (4) if resctrl filessystem is not
> > supported or resctrl is not run as root.
>
> Could you please elaborate how changing ksft_exit_fail_msg() to
> ksft_exit_skip() accomplishes the goal of unifying the return code?
> What is wrong with using ksft_exit_fail_msg()?

In selftest framwork,
if a test need root privileges, but it is run as user privileges,
the test result will counted as a SKIP item, instead of a FAIL item.

For example,
(1)tools/testing/selftests/mqueue/mq_open_tests.c
267 if (getuid() != 0)
268 ksft_exit_skip("Not running as root, but almost all tests "
269 "require root in order to modify\nsystem settings. "
270 "Exiting.\n");

(2)tools/testing/selftests/bpf/test_kmod.sh
5 ksft_skip=4
6
7 msg="skip all tests:"
8 if [ "$(id -u)" != "0" ]; then
9 echo $msg please run this as root >&2
10 exit $ksft_skip
11 fi

Regards,
Shaopeng Tan
\
 
 \ /
  Last update: 2021-12-01 03:37    [W:0.077 / U:0.276 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site