[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAMDBHYK-xm5Tp5pEA9_W=xFyCdMmhrzp4K9MTgafp0FeXKyFtw@mail.gmail.com>
Date: Wed, 14 Feb 2018 17:44:57 -0500
From: Lucas Bates <lucasb@...atatu.com>
To: "Brenda J. Butler" <bjb@...atatu.com>
Cc: davem@...emloft.net, kernel@...atatu.com,
Cong Wang <xiyou.wangcong@...il.com>,
Jiri Pirko <jiri@...nulli.us>, Chris Mi <chrism@...lanox.com>,
Linux Kernel Network Developers <netdev@...r.kernel.org>
Subject: Re: [PATCH net-next 4/7] tools: tc-testing: rootPlugin
On Wed, Feb 14, 2018 at 2:09 PM, Brenda J. Butler <bjb@...atatu.com> wrote:
> Move the functionality that checks for root permissions into a plugin.
>
> Signed-off-by: Brenda J. Butler <bjb@...atatu.com>
Acked-by: Lucas Bates <lucasb@...atatu.com>
> ---
> .../selftests/tc-testing/plugin-lib/rootPlugin.py | 19 +++++++++++++++++++
> tools/testing/selftests/tc-testing/tdc.py | 4 ----
> 2 files changed, 19 insertions(+), 4 deletions(-)
> create mode 100644 tools/testing/selftests/tc-testing/plugin-lib/rootPlugin.py
>
> diff --git a/tools/testing/selftests/tc-testing/plugin-lib/rootPlugin.py b/tools/testing/selftests/tc-testing/plugin-lib/rootPlugin.py
> new file mode 100644
> index 000000000000..e36775bd4d12
> --- /dev/null
> +++ b/tools/testing/selftests/tc-testing/plugin-lib/rootPlugin.py
> @@ -0,0 +1,19 @@
> +import os
> +import sys
> +from TdcPlugin import TdcPlugin
> +
> +from tdc_config import *
> +
> +
> +class SubPlugin(TdcPlugin):
> + def __init__(self):
> + self.sub_class = 'root/SubPlugin'
> + super().__init__()
> +
> + def pre_suite(self, testcount, testidlist):
> + # run commands before test_runner goes into a test loop
> + super().pre_suite(testcount, testidlist)
> +
> + if os.geteuid():
> + print('This script must be run with root privileges', file=sys.stderr)
> + exit(1)
> diff --git a/tools/testing/selftests/tc-testing/tdc.py b/tools/testing/selftests/tc-testing/tdc.py
> index 3e6f9f2e1691..a718d2b57739 100755
> --- a/tools/testing/selftests/tc-testing/tdc.py
> +++ b/tools/testing/selftests/tc-testing/tdc.py
> @@ -579,10 +579,6 @@ def set_operation_mode(pm, args):
> list_test_cases(alltests)
> exit(0)
>
> - if (os.geteuid() != 0):
> - print("This script must be run with root privileges.\n")
> - exit(1)
> -
> ns_create(args, pm)
>
> if len(alltests):
> --
> 2.15.1
>
Powered by blists - more mailing lists