From cbb1c311487a37967504491bbdd0b12e4e9b40ff Mon Sep 17 00:00:00 2001 From: Paul Moore Date: Thu, 23 Feb 2017 12:57:30 -0500 Subject: tests: test some untested arch APIs Signed-off-by: Paul Moore --- tests/16-sim-arch_basic.c | 15 +++++++++++++++ tests/16-sim-arch_basic.py | 4 ++++ 2 files changed, 19 insertions(+) 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")) -- cgit v1.2.1