#!/bin/bash # this is so that ./ cmd names work if [ ! -f m.run ]; then echo "Must run from local directory" exit 0 fi # if no test specified then check tests if [ "$1" = "" ]; then cp -p `which bash` .m.chk.bash cp -p `which date` .m.chk.date cp -p `which usleep` .m.chk.usleep wait=`cat m.cfg.chk` exec ./m.chk $wait fi # otherwise run specified test test_w=`cat m.cfg.run` test_n=$1 test_d=.m.tst.$test_n # get command for given test name case "$test_n" in ldt) test_c="date +%Y_%m_%d_%H_%M_%S" ;; cpi) test_c="cat /proc/interrupts" ;; cpm) test_c="cat /proc/meminfo" ;; cps) test_c="cat /proc/slabinfo" ;; upt) test_c="uptime" ;; vms) test_c="vmstat" ;; pso) test_c="ps auxww" ;; top) test_c="top -n 1 -b" ;; *) test_c="echo unknown test --$test_n--" ;; esac # setup local copies so we tell what is what with ps cp -p `which bash` .m.cmd.bash.$test_n cp -p `which date` .m.cmd.date.$test_n cp -p `which tee` .m.cmd.tee.$test_n cp -p `which usleep` .m.cmd.usleep.$test_n cat m.template | sed s:TEST:$test_n:g > $test_d chmod 755 $test_d # run the test exec ./$test_d $test_w $test_n "$test_c"