From b08293e544fb5eb5e004f02139e4aa06660395b6 Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Sun, 14 Apr 2024 22:34:44 +0200 Subject: Adding debian version 2:4.0.4-4. Signed-off-by: Daniel Baumann --- debian/tests/free | 50 ++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 50 insertions(+) create mode 100644 debian/tests/free (limited to 'debian/tests/free') diff --git a/debian/tests/free b/debian/tests/free new file mode 100644 index 0000000..f44ea43 --- /dev/null +++ b/debian/tests/free @@ -0,0 +1,50 @@ +#!/bin/sh + +exec 2>&1 + +test_no_arguments() { + ( free >"${stdoutF}" 2>"${stderrF}" ) + rtrn=$? + + assertEquals "free exit value" "0" "${rtrn}" + grep -E '^[[:space:]]+total[[:space:]]+used[[:space:]]+free[[:space:]]+shared[[:space:]]+buff/cache[[:space:]]+available$' "${stdoutF}" > /dev/null + assertTrue 'header line' $? + + grep -E '^Mem:([[:space:]]+[[:digit:]]+){6}$' "${stdoutF}" > /dev/null + assertTrue 'Mem line' $? + grep -E '^Swap:([[:space:]]+[[:digit:]]+){3}$' "${stdoutF}" > /dev/null + assertTrue 'Swap line' $? +} + +test_total() { + ( free -t >"${stdoutF}" 2>"${stderrF}" ) + rtrn=$? + + assertEquals "free exit value" "0" "${rtrn}" + grep -E '^[[:space:]]+total[[:space:]]+used[[:space:]]+free[[:space:]]+shared[[:space:]]+buff/cache[[:space:]]+available$' "${stdoutF}" > /dev/null + assertTrue 'header line' $? + + grep -E '^Mem:([[:space:]]+[[:digit:]]+){6}$' "${stdoutF}" > /dev/null + assertTrue 'Mem line' $? + grep -E '^Swap:([[:space:]]+[[:digit:]]+){3}$' "${stdoutF}" > /dev/null + assertTrue 'Swap line' $? + grep -E '^Total:([[:space:]]+[[:digit:]]+){3}$' "${stdoutF}" > /dev/null + assertTrue 'Total line' $? +} + +oneTimeSetUp() { + # Define global variables for command output. + stdoutF="${AUTOPKGTEST_TMP}/stdout" + stderrF="${AUTOPKGTEST_TMP}/stderr" +} + +setUp() { + # Truncate the output files. + cp /dev/null "${stdoutF}" + cp /dev/null "${stderrF}" +} + + +# shellcheck disable=SC1091 +. shunit2 + -- cgit v1.2.3