-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
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>
- Loading branch information
Brenda J. Butler
authored and
David S. Miller
committed
Feb 15, 2018
1 parent
93707cb
commit f6926e8
Showing
2 changed files
with
19 additions
and
4 deletions.
There are no files selected for viewing
19 changes: 19 additions & 0 deletions
19
tools/testing/selftests/tc-testing/plugin-lib/rootPlugin.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters