Blame tests/57-basic-rawsysrc.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 Cisco Systems, Inc. <pmoore2@cisco.com>
|
|
Packit Service |
10c312 |
# Author: Paul Moore <paul@paul-moore.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 |
import os
|
|
Packit Service |
10c312 |
|
|
Packit Service |
10c312 |
import util
|
|
Packit Service |
10c312 |
|
|
Packit Service |
10c312 |
from seccomp import *
|
|
Packit Service |
10c312 |
|
|
Packit Service |
10c312 |
def test():
|
|
Packit Service |
10c312 |
# this test really isn't conclusive, but considering how python does error
|
|
Packit Service |
10c312 |
# handling it may be the best we can do
|
|
Packit Service |
10c312 |
f = SyscallFilter(ALLOW)
|
|
Packit Service |
10c312 |
dummy = open("/dev/null", "w")
|
|
Packit Service |
10c312 |
os.close(dummy.fileno())
|
|
Packit Service |
10c312 |
try:
|
|
Packit Service |
10c312 |
f = f.export_pfc(dummy)
|
|
Packit Service |
10c312 |
except RuntimeError:
|
|
Packit Service |
10c312 |
pass
|
|
Packit Service |
10c312 |
|
|
Packit Service |
10c312 |
test()
|
|
Packit Service |
10c312 |
|
|
Packit Service |
10c312 |
# kate: syntax python;
|
|
Packit Service |
10c312 |
# kate: indent-mode python; space-indent on; indent-width 4; mixedindent off;
|