Blame tests/43-sim-a2_order.py

Packit 56e23f
#!/usr/bin/env python
Packit 56e23f
Packit 56e23f
#
Packit 56e23f
# Seccomp Library test program
Packit 56e23f
#
Packit 56e23f
# Copyright (c) 2018 Oracle and/or its affiliates.  All rights reserved.
Packit 56e23f
# Author: Tom Hromatka <tom.hromatka@oracle.com>
Packit 56e23f
#
Packit 56e23f
Packit 56e23f
#
Packit 56e23f
# This library is free software; you can redistribute it and/or modify it
Packit 56e23f
# under the terms of version 2.1 of the GNU Lesser General Public License as
Packit 56e23f
# published by the Free Software Foundation.
Packit 56e23f
#
Packit 56e23f
# This library is distributed in the hope that it will be useful, but WITHOUT
Packit 56e23f
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
Packit 56e23f
# FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public License
Packit 56e23f
# for more details.
Packit 56e23f
#
Packit 56e23f
# You should have received a copy of the GNU Lesser General Public License
Packit 56e23f
# along with this library; if not, see <http://www.gnu.org/licenses>.
Packit 56e23f
#
Packit 56e23f
Packit 56e23f
import argparse
Packit 56e23f
import errno
Packit 56e23f
import sys
Packit 56e23f
Packit 56e23f
import util
Packit 56e23f
Packit 56e23f
from seccomp import *
Packit 56e23f
Packit 56e23f
def test(args):
Packit 56e23f
    set_api(3)
Packit 56e23f
Packit 56e23f
    f = SyscallFilter(KILL)
Packit 56e23f
    f.add_rule(ALLOW, "read", Arg(2, LE, 64))
Packit 56e23f
    f.add_rule(ERRNO(5), "read", Arg(2, GT, 128))
Packit 56e23f
    f.add_rule(ERRNO(6), "read", Arg(2, GT, 256))
Packit 56e23f
    f.add_rule(ERRNO(7), "read", Arg(2, GT, 512))
Packit 56e23f
    f.add_rule(ERRNO(8), "read", Arg(2, GT, 1024))
Packit 56e23f
    f.add_rule(ERRNO(9), "read", Arg(2, GT, 2048))
Packit 56e23f
    f.add_rule(ERRNO(10), "read", Arg(2, GT, 4096))
Packit 56e23f
    f.add_rule(ERRNO(11), "read", Arg(2, GT, 8192))
Packit 56e23f
    f.add_rule(ERRNO(12), "read", Arg(2, GT, 16384))
Packit 56e23f
    f.add_rule(ALLOW, "write", Arg(2, GE, 32768))
Packit 56e23f
    f.add_rule(ERRNO(5), "write", Arg(2, LT, 128))
Packit 56e23f
    f.add_rule(ERRNO(6), "write", Arg(2, LT, 256))
Packit 56e23f
    f.add_rule(ERRNO(7), "write", Arg(2, LT, 512))
Packit 56e23f
    f.add_rule(ERRNO(8), "write", Arg(2, LT, 1024))
Packit 56e23f
    f.add_rule(ERRNO(9), "write", Arg(2, LT, 2048))
Packit 56e23f
    f.add_rule(ERRNO(10), "write", Arg(2, LT, 4096))
Packit 56e23f
    f.add_rule(ERRNO(11), "write", Arg(2, LT, 8192))
Packit 56e23f
    f.add_rule(ERRNO(12), "write", Arg(2, LT, 16384))
Packit 56e23f
Packit 56e23f
    return f
Packit 56e23f
Packit 56e23f
args = util.get_opt()
Packit 56e23f
ctx = test(args)
Packit 56e23f
util.filter_output(args, ctx)
Packit 56e23f
Packit 56e23f
# kate: syntax python;
Packit 56e23f
# kate: indent-mode python; space-indent on; indent-width 4; mixedindent off;