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