Sha256: 0e3a2ad7c474d6160556768b141ff9488b8fd03f83a52fa9bb355821a06c2143
Contents?: true
Size: 1.8 KB
Versions: 9
Compression:
Stored size: 1.8 KB
Contents
#!/usr/bin/env python # # Seccomp Library test program # # Copyright (c) 2016 Red Hat <pmoore@redhat.com> # Copyright (c) 2017 Canonical Ltd. # Authors: Paul Moore <paul@paul-moore.com> # Tyler Hicks <tyhicks@canonical.com> # # # This library is free software; you can redistribute it and/or modify it # under the terms of version 2.1 of the GNU Lesser General Public License as # published by the Free Software Foundation. # # This library is distributed in the hope that it will be useful, but WITHOUT # ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or # FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License # for more details. # # You should have received a copy of the GNU Lesser General Public License # along with this library; if not, see <http://www.gnu.org/licenses>. # import argparse import sys import util from seccomp import * def test(): api = get_api() if (api < 1): raise RuntimeError("Failed getting initial API level") set_api(1) api = get_api() if api != 1: raise RuntimeError("Failed getting API level 1") set_api(2) api = get_api() if api != 2: raise RuntimeError("Failed getting API level 2") set_api(3) api = get_api() if api != 3: raise RuntimeError("Failed getting API level 3") # Attempt to set a high, invalid API level try: set_api(1024) except ValueError: pass else: raise RuntimeError("Missing failure when setting invalid API level") # Ensure that the previously set API level didn't change api = get_api() if api != 3: raise RuntimeError("Failed getting old API level after setting an invalid API level") test() # kate: syntax python; # kate: indent-mode python; space-indent on; indent-width 4; mixedindent off;
Version data entries
9 entries across 9 versions & 1 rubygems