mirror of
https://github.com/SELinuxProject/selinux
synced 2024-12-24 15:02:44 +00:00
mcstrans: fix Python linter warnings on test scripts
Signed-off-by: Nicolas Iooss <nicolas.iooss@m4x.org>
This commit is contained in:
parent
0ec2ed57c3
commit
b7227aaec1
@ -1,7 +1,8 @@
|
||||
#!/usr/bin/python -E
|
||||
import sys
|
||||
import re
|
||||
from selinux import *
|
||||
import selinux
|
||||
|
||||
|
||||
verbose = 0
|
||||
errors = 0
|
||||
|
||||
@ -18,12 +19,12 @@ for arg in sys.argv[1:]:
|
||||
line = line.rstrip('\n')
|
||||
# print line
|
||||
context, expected = line.split("=")
|
||||
rc, raw = selinux_trans_to_raw_context(context)
|
||||
rc, raw = selinux.selinux_trans_to_raw_context(context)
|
||||
if rc < 0:
|
||||
print("Unable to get raw context of '%s'" % (context))
|
||||
errors += 1
|
||||
continue
|
||||
rc, colors = selinux_raw_context_to_color(raw)
|
||||
rc, colors = selinux.selinux_raw_context_to_color(raw)
|
||||
if rc < 0:
|
||||
print("Unable to get colors for '%s'" % (context))
|
||||
errors += 1
|
||||
|
@ -1,14 +1,15 @@
|
||||
#!/usr/bin/python -E
|
||||
import sys
|
||||
import re
|
||||
from selinux import *
|
||||
import selinux
|
||||
|
||||
|
||||
verbose = 0
|
||||
errors = 0
|
||||
|
||||
|
||||
def untrans(trans, val):
|
||||
global errors, verbose
|
||||
(rc, raw) = selinux_trans_to_raw_context(trans)
|
||||
(rc, raw) = selinux.selinux_trans_to_raw_context(trans)
|
||||
if raw != val:
|
||||
print("untrans: '%s' -> '%s' != '%s' FAILED" % (trans, raw, val))
|
||||
errors += 1
|
||||
@ -19,7 +20,7 @@ def untrans(trans, val):
|
||||
|
||||
def trans(raw, val):
|
||||
global errors, verbose
|
||||
(rc, trans) = selinux_raw_to_trans_context(raw)
|
||||
(rc, trans) = selinux.selinux_raw_to_trans_context(raw)
|
||||
if trans != val:
|
||||
print("trans: '%s' -> '%s' != '%s' FAILED" % (raw, trans, val))
|
||||
errors += 1
|
||||
@ -27,6 +28,7 @@ def trans(raw, val):
|
||||
if verbose:
|
||||
print("trans: %s -> %s != %s SUCCESS" % (raw, trans, val))
|
||||
|
||||
|
||||
if len(sys.argv) > 1 and sys.argv[1] == "-v":
|
||||
verbose = 1
|
||||
|
||||
@ -38,7 +40,7 @@ for arg in sys.argv[1:]:
|
||||
if not line.strip():
|
||||
continue
|
||||
line = line.rstrip('\n')
|
||||
if (line.find("==") != -1):
|
||||
if line.find("==") != -1:
|
||||
t, r = line.split("==")
|
||||
untrans("a:b:c:" + t, "a:b:c:" + r)
|
||||
trans("a:b:c:" + r, "a:b:c:" + t)
|
||||
|
Loading…
Reference in New Issue
Block a user