Blame tests/56-basic-iterate_syscalls.py
|
Packit Service |
10c312 |
#!/usr/bin/env python
|
|
Packit Service |
10c312 |
|
|
Packit Service |
10c312 |
#
|
|
Packit Service |
10c312 |
# Seccomp Library test program
|
|
Packit Service |
10c312 |
#
|
|
Packit Service |
10c312 |
# Copyright (c) 2020 Red Hat <gscrivan@redhat.com>
|
|
Packit Service |
10c312 |
# Author: Giuseppe Scrivano <gscrivan@redhat.com>
|
|
Packit Service |
10c312 |
#
|
|
Packit Service |
10c312 |
|
|
Packit Service |
10c312 |
#
|
|
Packit Service |
10c312 |
# This library is free software; you can redistribute it and/or modify it
|
|
Packit Service |
10c312 |
# under the terms of version 2.1 of the GNU Lesser General Public License as
|
|
Packit Service |
10c312 |
# published by the Free Software Foundation.
|
|
Packit Service |
10c312 |
#
|
|
Packit Service |
10c312 |
# This library is distributed in the hope that it will be useful, but WITHOUT
|
|
Packit Service |
10c312 |
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
|
Packit Service |
10c312 |
# FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
|
|
Packit Service |
10c312 |
# for more details.
|
|
Packit Service |
10c312 |
#
|
|
Packit Service |
10c312 |
# You should have received a copy of the GNU Lesser General Public License
|
|
Packit Service |
10c312 |
# along with this library; if not, see <http://www.gnu.org/licenses>.
|
|
Packit Service |
10c312 |
#
|
|
Packit Service |
10c312 |
|
|
Packit Service |
10c312 |
import argparse
|
|
Packit Service |
10c312 |
import sys
|
|
Packit Service |
10c312 |
|
|
Packit Service |
10c312 |
import util
|
|
Packit Service |
10c312 |
|
|
Packit Service |
10c312 |
from seccomp import *
|
|
Packit Service |
10c312 |
|
|
Packit Service |
10c312 |
arch_list = ["x86",
|
|
Packit Service |
10c312 |
"x86_64",
|
|
Packit Service |
10c312 |
"x32",
|
|
Packit Service |
10c312 |
"arm",
|
|
Packit Service |
10c312 |
"aarch64",
|
|
Packit Service |
10c312 |
"mipsel",
|
|
Packit Service |
10c312 |
"mipsel64",
|
|
Packit Service |
10c312 |
"mipsel64n32",
|
|
Packit Service |
10c312 |
"ppc64le",
|
|
Packit Service |
10c312 |
"riscv64"]
|
|
Packit Service |
10c312 |
|
|
Packit Service |
10c312 |
def test_arch(arch, init):
|
|
Packit Service |
10c312 |
for i in range(init, init + 1000):
|
|
Packit Service |
10c312 |
sys_name = resolve_syscall(arch, i)
|
|
Packit Service |
10c312 |
if sys_name is None:
|
|
Packit Service |
10c312 |
continue
|
|
Packit Service |
10c312 |
n = resolve_syscall(i, sys_name)
|
|
Packit Service |
10c312 |
if i != n:
|
|
Packit Service |
10c312 |
raise RuntimeError("Test failure")
|
|
Packit Service |
10c312 |
|
|
Packit Service |
10c312 |
def test():
|
|
Packit Service |
10c312 |
for i in arch_list:
|
|
Packit Service |
10c312 |
init = 0
|
|
Packit Service |
10c312 |
if i == "x32":
|
|
Packit Service |
10c312 |
init = 0x40000000
|
|
Packit Service |
10c312 |
elif i == "mipsel":
|
|
Packit Service |
10c312 |
init = 4000
|
|
Packit Service |
10c312 |
elif i == "mipsel64":
|
|
Packit Service |
10c312 |
init = 5000
|
|
Packit Service |
10c312 |
elif i == "mipsel64n32":
|
|
Packit Service |
10c312 |
init = 6000
|
|
Packit Service |
10c312 |
test_arch(Arch(i), init)
|
|
Packit Service |
10c312 |
|
|
Packit Service |
10c312 |
# kate: syntax python;
|
|
Packit Service |
10c312 |
# kate: indent-mode python; space-indent on; indent-width 4; mixedindent off;
|