#!/bin/sh

set -e

. "${srcdir:-.}/common.sh"

get_common_syscalls >"$TMP"/tmpl
cat >>"$TMP"/tmpl <<EOF
# what we are testing
EOF

for i in CLONE_NEWIPC CLONE_NEWNET CLONE_NEWNS CLONE_NEWPID CLONE_NEWUSER CLONE_NEWUTS ; do
    cat "$TMP"/tmpl >"$TMP"/snap.name.app
    echo "setns - $i" >>"$TMP"/snap.name.app

    printf "Test good seccomp arg filtering (setns - %s)" "$i"
    # ensure that the command "true" can run with the right filter
    if $L snap.name.app /bin/true ; then
        PASS
    else
        dmesg|tail -n1
        FAIL
    fi
done
