Blame tests/p_sysstat/25-sa-tests.sh

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 e71fa7
for cmd in "${tests_in_order[@]}"; do
Carlos Rodriguez-Fernandez e71fa7
  t_Log "Running $0 - sa test: ${cmd}"
Carlos Rodriguez-Fernandez e71fa7
  if ! eval "${cmd}" > /dev/null 2>&1; then
Carlos Rodriguez-Fernandez e71fa7
    t_Log "FAIL: $0: sa test: ${cmd}"
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