Blame tests/45-sim-chain_code_coverage.py

Packit Service 8eee21
#!/usr/bin/env python
Packit Service 8eee21
Packit Service 8eee21
#
Packit Service 8eee21
# Seccomp Library test program
Packit Service 8eee21
#
Packit Service 8eee21
# Copyright (c) 2018 Oracle and/or its affiliates.  All rights reserved.
Packit Service 8eee21
# Author: Tom Hromatka <tom.hromatka@oracle.com>
Packit Service 8eee21
#
Packit Service 8eee21
Packit Service 8eee21
#
Packit Service 8eee21
# This library is free software; you can redistribute it and/or modify it
Packit Service 8eee21
# under the terms of version 2.1 of the GNU Lesser General Public License as
Packit Service 8eee21
# published by the Free Software Foundation.
Packit Service 8eee21
#
Packit Service 8eee21
# This library is distributed in the hope that it will be useful, but WITHOUT
Packit Service 8eee21
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
Packit Service 8eee21
# FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public License
Packit Service 8eee21
# for more details.
Packit Service 8eee21
#
Packit Service 8eee21
# You should have received a copy of the GNU Lesser General Public License
Packit Service 8eee21
# along with this library; if not, see <http://www.gnu.org/licenses>.
Packit Service 8eee21
#
Packit Service 8eee21
Packit Service 8eee21
import argparse
Packit Service 8eee21
import sys
Packit Service 8eee21
Packit Service 8eee21
import util
Packit Service 8eee21
Packit Service 8eee21
from seccomp import *
Packit Service 8eee21
Packit Service 8eee21
def test(args):
Packit Service 8eee21
    f = SyscallFilter(KILL)
Packit Service 8eee21
    # the syscall and argument numbers are all fake to make the test simpler
Packit Service 8eee21
    f.add_rule_exactly(ALLOW, 1008, Arg(0, GE, 1))
Packit Service 8eee21
    f.add_rule_exactly(ALLOW, 1008, Arg(1, GE, 2))
Packit Service 8eee21
    f.add_rule_exactly(ALLOW, 1008, Arg(0, GT, 3))
Packit Service 8eee21
    f.add_rule_exactly(ALLOW, 1008, Arg(2, MASKED_EQ, 0xf, 4))
Packit Service 8eee21
    f.add_rule_exactly(ALLOW, 1008, Arg(2, MASKED_EQ, 0xff, 5))
Packit Service 8eee21
    f.add_rule_exactly(ALLOW, 1008, Arg(2, MASKED_EQ, 0xff, 6))
Packit Service 8eee21
Packit Service 8eee21
    return f
Packit Service 8eee21
Packit Service 8eee21
args = util.get_opt()
Packit Service 8eee21
ctx = test(args)
Packit Service 8eee21
util.filter_output(args, ctx)
Packit Service 8eee21
Packit Service 8eee21
# kate: syntax python;
Packit Service 8eee21
# kate: indent-mode python; space-indent on; indent-width 4; mixedindent off;