You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

27 lines
643 B

#!/bin/bash
# Author: Carlos Rodriguez-Fernandez <carlosrodrifernandez@gmail.com>
t_Log "Running $0 - sa tests"
tests_in_order=(
"/usr/lib64/sa/sa1 --boot"
"sar -u | grep -q -e 'LINUX RESTART'"
"/usr/lib64/sa/sa1 1 1"
"sleep 3 && /usr/lib64/sa/sa1 1 1 && sar -u | grep -q -e 'Average'"
"/usr/lib64/sa/sa2 -A"
)
output_file=$(mktemp)
trap "rm -f ${output_file}" EXIT
for cmd in "${tests_in_order[@]}"; do
t_Log "Running $0 - sa test: ${cmd}"
if ! eval "${cmd}" > ${output_file} 2>&1; then
t_Log "FAIL: $0: sa test: ${cmd}"
cat ${output_file}
exit 1
else
t_Log "PASS: $0: sa test: ${cmd}"
fi
done