[ac6e5c7] | 1 | #! /bin/sh |
---|
| 2 | # |
---|
| 3 | # $Id$ |
---|
| 4 | # |
---|
| 5 | |
---|
| 6 | toggle() |
---|
| 7 | { |
---|
| 8 | case $1 in |
---|
| 9 | no) echo "yes" ;; |
---|
| 10 | yes) echo "no" ;; |
---|
| 11 | *) fatal "Unknown value to toggle ($1)" ;; |
---|
| 12 | esac |
---|
| 13 | } |
---|
| 14 | |
---|
| 15 | usage() |
---|
| 16 | { |
---|
| 17 | cat <<EOF |
---|
| 18 | run_scenarios [options] |
---|
| 19 | -1 - toggle running single CPU scenarios (default=no) |
---|
| 20 | -4 - toggle running four CPU scenarios (default=no) |
---|
| 21 | -A - toggle all scenario flags |
---|
| 22 | EOF |
---|
| 23 | } |
---|
| 24 | |
---|
| 25 | vecho() |
---|
| 26 | { |
---|
| 27 | if [ ${verbose} = "yes" ] ; then |
---|
| 28 | echo "$*" |
---|
| 29 | fi |
---|
| 30 | } |
---|
| 31 | |
---|
| 32 | verbose=no |
---|
| 33 | do_all=no |
---|
| 34 | do_one=no |
---|
| 35 | do_four=no |
---|
| 36 | schedsim_dir= |
---|
| 37 | |
---|
| 38 | while getopts vd:A14 OPT |
---|
| 39 | do |
---|
| 40 | case "$OPT" in |
---|
| 41 | v) verbose=`toggle ${verbose}` ;; |
---|
| 42 | d) schedsim_dir=${OPTARG} ;; |
---|
| 43 | A) do_all=`toggle ${do_all}` ;; |
---|
| 44 | 1) do_one=`toggle ${do_one}` ;; |
---|
| 45 | 4) do_four=`toggle ${do_four}` ;; |
---|
| 46 | *) usage; exit 1; |
---|
| 47 | esac |
---|
| 48 | done |
---|
| 49 | |
---|
| 50 | if [ "X${schedsim_dir}" != "X" ] ; then |
---|
| 51 | test -d ${schedsim_dir} || fatal ${schedsim_dir} is not readable |
---|
| 52 | schedsim_dir=${schedsim_dir}/ |
---|
| 53 | fi |
---|
| 54 | |
---|
| 55 | if [ ${do_all} = "yes" ]; then |
---|
| 56 | SCENARIOS="scenarios/*.scen" |
---|
| 57 | else |
---|
| 58 | SCENARIOS= |
---|
| 59 | fi |
---|
| 60 | |
---|
| 61 | if [ ${do_one} = "yes" ]; then |
---|
| 62 | SCENARIOS="${SCENARIOS} scenarios/cpus1*.scen" |
---|
| 63 | fi |
---|
| 64 | |
---|
| 65 | if [ ${do_four} = "yes" ]; then |
---|
| 66 | SCENARIOS="${SCENARIOS} scenarios/cpus4*.scen" |
---|
| 67 | fi |
---|
| 68 | |
---|
| 69 | for scenario in `ls -1 ${SCENARIOS}` |
---|
| 70 | do |
---|
| 71 | base=`echo ${scenario} | sed -s 's/\.scen$//'` |
---|
| 72 | expected=${base}.expected |
---|
| 73 | output=${base}.output |
---|
| 74 | vecho Running ${scenario} |
---|
| 75 | ${schedsim_dir}/schedsim $scenario >${output} |
---|
| 76 | if [ -r ${expected} ] ; then |
---|
| 77 | diff ${output} ${expected} >/dev/null |
---|
| 78 | if [ $? -ne 0 ] ; then |
---|
| 79 | echo "FAIL - ${scenario}" |
---|
| 80 | echo " diff ${output} ${expected} " |
---|
| 81 | else |
---|
| 82 | echo "PASS - ${scenario}" |
---|
| 83 | fi |
---|
| 84 | else |
---|
| 85 | echo "UNKNOWN - ${scenario}" |
---|
| 86 | echo " cp ${output} ${expected} " |
---|
| 87 | fi |
---|
| 88 | done |
---|
| 89 | |
---|
| 90 | |
---|