#!/bin/sh

set -e

# shellcheck source=snap-confine/tests/common.sh
. "${srcdir:-.}/snap-confine/tests/common.sh"

get_common_syscalls >"$TMP"/tmpl
cat >>"$TMP"/tmpl <<EOF
getpriority
EOF

for i in PRIO_PROCESS PRIO_PGRP PRIO_USER ; do
    cat "$TMP"/tmpl >"$TMP"/snap.name.app
    echo "setpriority $i - -" >>"$TMP"/snap.name.app

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