diff options
author | Paul Moore <paul@paul-moore.com> | 2017-02-23 12:57:30 -0500 |
---|---|---|
committer | Paul Moore <paul@paul-moore.com> | 2017-02-23 12:57:30 -0500 |
commit | cbb1c311487a37967504491bbdd0b12e4e9b40ff (patch) | |
tree | 70b9a875d1ba6e2add842aa1a6190c6edadc20e9 | |
parent | ba73ee4f56e8ada7309345cbe08ebf358d60f7e7 (diff) | |
download | libseccomp-cbb1c311487a37967504491bbdd0b12e4e9b40ff.tar.gz |
tests: test some untested arch APIs
Signed-off-by: Paul Moore <paul@paul-moore.com>
-rw-r--r-- | tests/16-sim-arch_basic.c | 15 | ||||
-rwxr-xr-x | tests/16-sim-arch_basic.py | 4 |
2 files changed, 19 insertions, 0 deletions
diff --git a/tests/16-sim-arch_basic.c b/tests/16-sim-arch_basic.c index df89aa3..02c55d6 100644 --- a/tests/16-sim-arch_basic.c +++ b/tests/16-sim-arch_basic.c @@ -40,6 +40,21 @@ int main(int argc, char *argv[]) if (ctx == NULL) return ENOMEM; + /* NOTE: not strictly necessary since we get the native arch by default + * but it serves as a good sanity check for the code and boosts + * our code coverage numbers */ + rc = seccomp_arch_exist(ctx, seccomp_arch_native()); + if (rc != 0) + goto out; + + rc = seccomp_arch_remove(ctx, SCMP_ARCH_NATIVE); + if (rc != 0) + goto out; + + /* NOTE: more sanity/coverage tests (see above) */ + rc = seccomp_arch_add(ctx, SCMP_ARCH_NATIVE); + if (rc != 0) + goto out; rc = seccomp_arch_remove(ctx, SCMP_ARCH_NATIVE); if (rc != 0) goto out; diff --git a/tests/16-sim-arch_basic.py b/tests/16-sim-arch_basic.py index 1bf92d6..7d7a05f 100755 --- a/tests/16-sim-arch_basic.py +++ b/tests/16-sim-arch_basic.py @@ -30,6 +30,10 @@ from seccomp import * def test(args): f = SyscallFilter(KILL) + # NOTE: some of these arch functions are not strictly necessary, but are + # here for test sanity/coverage + f.remove_arch(Arch()) + f.add_arch(Arch()) f.remove_arch(Arch()) f.add_arch(Arch("x86")) f.add_arch(Arch("x86_64")) |