zzuf/test/check-zzuf-M-max-memory
2015-01-05 18:11:43 +01:00

49 lines
1.1 KiB
Bash
Executable File

#!/bin/sh
#
# check-zzuf-M-max-memory - check that zzuf catches excessive memory allocs
#
# Copyright © 2002—2015 Sam Hocevar <sam@hocevar.net>
#
# This program is free software. It comes without any warranty, to
# the extent permitted by applicable law. You can redistribute it
# and/or modify it under the terms of the Do What the Fuck You Want
# to Public License, Version 2, as published by the WTFPL Task Force.
# See http://www.wtfpl.net/ for more details.
#
. "$(dirname "$0")/functions.inc"
ulimit -c 0
PROGRAM="$DIR/bug-memory"
if [ ! -f "$PROGRAM" ]; then
echo "error: test/bug-memory is missing"
exit 1
fi
start_test "zzuf -M test"
new_test "bug-memory < /file-00"
if ! $PROGRAM < "$DIR/file-00"; then
fail_test " unexpected exit status $?"
else
pass_test " OK"
fi
new_test "zzuf -qi -r0 bug-memory < /file-00"
if ! $ZZUF -r0 -qi "$PROGRAM" < "$DIR/file-00"; then
fail_test " unexpected exit status $?"
else
pass_test " OK"
fi
new_test "zzuf -qi bug-memory < file-00"
if $ZZUF -M 256 -qi "$PROGRAM" < "$DIR/file-00"; then
fail_test " unexpected exit status $?"
else
pass_test " OK"
fi
stop_test