Bundle libseccomp 2.3.1
[linux-seccomp.git] / libseccomp / tests / 13-basic-attrs.py
CommitLineData
8befd5cc
MG
1#!/usr/bin/env python
2
3#
4# Seccomp Library test program
5#
6# Copyright (c) 2012 Red Hat <pmoore@redhat.com>
7# Author: Paul Moore <paul@paul-moore.com>
8#
9
10#
11# This library is free software; you can redistribute it and/or modify it
12# under the terms of version 2.1 of the GNU Lesser General Public License as
13# published by the Free Software Foundation.
14#
15# This library is distributed in the hope that it will be useful, but WITHOUT
16# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
17# FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
18# for more details.
19#
20# You should have received a copy of the GNU Lesser General Public License
21# along with this library; if not, see <http://www.gnu.org/licenses>.
22#
23
24import argparse
25import sys
26
27import util
28
29from seccomp import *
30
31def test():
32 f = SyscallFilter(ALLOW)
33 if f.get_attr(Attr.ACT_DEFAULT) != ALLOW:
34 raise RuntimeError("Failed getting Attr.ACT_DEFAULT")
35 try:
36 f.set_attr(Attr.ACT_DEFAULT, ALLOW)
37 except RuntimeError:
38 pass
39 f.set_attr(Attr.ACT_BADARCH, ALLOW)
40 if f.get_attr(Attr.ACT_BADARCH) != ALLOW:
41 raise RuntimeError("Failed getting Attr.ACT_BADARCH")
42 f.set_attr(Attr.CTL_NNP, 0)
43 if f.get_attr(Attr.CTL_NNP) != 0:
44 raise RuntimeError("Failed getting Attr.CTL_NNP")
45
46test()
47
48# kate: syntax python;
49# kate: indent-mode python; space-indent on; indent-width 4; mixedindent off;
This page took 0.011492 seconds and 4 git commands to generate.