summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPaul Moore <pmoore@redhat.com>2013-01-15 14:29:22 -0500
committerPaul Moore <pmoore@redhat.com>2013-01-15 14:29:22 -0500
commitaeac2736f600f887b42e4aca83ae6b466725aec2 (patch)
tree14a58851efc5b1a5d134d46467cb08c503a306bf
parentd69be167cde617fee9a0d81098c707b60be4cdf8 (diff)
downloadlibseccomp-aeac2736f600f887b42e4aca83ae6b466725aec2.tar.gz
tests: fix 16-arch-basic.py
Fix the following problem: Traceback (most recent call last): File "./16-arch-basic.py", line 47, in <module> ctx = test(args) File "./16-arch-basic.py", line 33, in test if not Arch.system() == Arch.X86: TypeError: descriptor 'system' of 'seccomp.Arch' object needs an argument Signed-off-by: Paul Moore <pmoore@redhat.com>
-rw-r--r--src/python/seccomp.pyx17
-rwxr-xr-xtests/16-arch-basic.py4
2 files changed, 11 insertions, 10 deletions
diff --git a/src/python/seccomp.pyx b/src/python/seccomp.pyx
index 45a6f53..1b6f368 100644
--- a/src/python/seccomp.pyx
+++ b/src/python/seccomp.pyx
@@ -91,6 +91,14 @@ GE = libseccomp.SCMP_CMP_GE
GT = libseccomp.SCMP_CMP_GT
MASKED_EQ = libseccomp.SCMP_CMP_MASKED_EQ
+def system_arch():
+ """ Return the system architecture value.
+
+ Description:
+ Returns the native system architecture value.
+ """
+ return libseccomp.seccomp_arch_native()
+
cdef class Arch:
""" Python object representing the SyscallFilter architecture values.
@@ -99,18 +107,11 @@ cdef class Arch:
X86 - 32-bit x86
X86_64 - 64-bit x86
"""
+
NATIVE = libseccomp.SCMP_ARCH_NATIVE
X86 = libseccomp.SCMP_ARCH_X86
X86_64 = libseccomp.SCMP_ARCH_X86_64
- def system(self):
- """ Return the system's architecture
-
- Description:
- Return an integer value matching the native architecture.
- """
- return libseccomp.seccomp_arch_native()
-
cdef class Attr:
""" Python object representing the SyscallFilter attributes.
diff --git a/tests/16-arch-basic.py b/tests/16-arch-basic.py
index 6103f67..e23d18b 100755
--- a/tests/16-arch-basic.py
+++ b/tests/16-arch-basic.py
@@ -30,9 +30,9 @@ from seccomp import *
def test(args):
f = SyscallFilter(KILL)
- if not Arch.system() == Arch.X86:
+ if not system_arch() == Arch.X86:
f.add_arch(Arch.X86)
- if not Arch.system() == Arch.X86_64:
+ if not system_arch() == Arch.X86_64:
f.add_arch(Arch.X86_64)
f.add_rule(ALLOW, "read", Arg(0, EQ, sys.stdin))
f.add_rule(ALLOW, "write", Arg(0, EQ, sys.stdout))