diff options
author | Brenda J. Butler <bjb@mojatatu.com> | 2018-02-14 14:09:22 -0500 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2018-02-15 15:38:33 -0500 |
commit | f6926e85eee9be08d05170af3a2266b8d7f9cdef (patch) | |
tree | 3672adb98e4c15c2fa692e664cfdee7a7fab114d /tools/testing/selftests/tc-testing/plugin-lib/rootPlugin.py | |
parent | 93707cbabcc8baf2b2b5f4a99c1f08ee83eb7abd (diff) |
tools: tc-testing: rootPlugin
Move the functionality that checks for root permissions into a plugin.
Signed-off-by: Brenda J. Butler <bjb@mojatatu.com>
Acked-by: Lucas Bates <lucasb@mojatatu.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'tools/testing/selftests/tc-testing/plugin-lib/rootPlugin.py')
-rw-r--r-- | tools/testing/selftests/tc-testing/plugin-lib/rootPlugin.py | 19 |
1 files changed, 19 insertions, 0 deletions
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 @@ | |||
1 | import os | ||
2 | import sys | ||
3 | from TdcPlugin import TdcPlugin | ||
4 | |||
5 | from tdc_config import * | ||
6 | |||
7 | |||
8 | class SubPlugin(TdcPlugin): | ||
9 | def __init__(self): | ||
10 | self.sub_class = 'root/SubPlugin' | ||
11 | super().__init__() | ||
12 | |||
13 | def pre_suite(self, testcount, testidlist): | ||
14 | # run commands before test_runner goes into a test loop | ||
15 | super().pre_suite(testcount, testidlist) | ||
16 | |||
17 | if os.geteuid(): | ||
18 | print('This script must be run with root privileges', file=sys.stderr) | ||
19 | exit(1) | ||