#!/bin/sh

set -e

. "${srcdir:-.}/snap-confine/tests/common.sh"

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

for i in 'PRIO_PROCES' 'PRIO_PROCESSS' 'PRIO_PR0CESS'; do
    printf "Test bad seccomp arg filtering (setpriority %s 0 >= 0)" "$i"
    cat "$TMP"/tmpl >"$TMP"/snap.name.app
    echo "setpriority $i 0 >=0" >>"$TMP"/snap.name.app

    if $L snap.name.app /bin/true 2>/dev/null; then
        # true returned successfully, bad arg test failed
        cat "$TMP"/snap.name.app
        FAIL
    fi

    # all good
    PASS
done
