#!../common/bats/bin/bats
# -*-sh-*-

load ../common/test_helper_functions
source ../common/functions || exit 1

if [ -s ../TEST_ENV ];then
    source ../TEST_ENV
fi

if [ ! -z "$SIMPLE_CI" ]; then
	skip "Not supported in simple CI setup"
fi

check_rms

@test "[memlock] check increased soft limit" {

    run_serial_binary -o .cmd_output prlimit -l -o SOFT

    for limit in `cat .cmd_output | grep -v SOFT`; do
        if [ "$limit" != "unlimited" ];then
            flunk $limit
        fi
    done

    rm -f .cmd_output

}

@test "[memlock] check increased hard limit" {

    run_serial_binary -o .cmd_output prlimit -l -o HARD

    for limit in `cat .cmd_output | grep -v HARD`; do
        if [ "$limit" != "unlimited" ];then
            flunk $limit
        fi
    done

    rm -f .cmd_output

}
