source: rtems-schedsim/schedsim/shell/run_scenarios @ f965428

Last change on this file since f965428 was a2aad55, checked in by Joel Sherrill <joel.sherrill@…>, on 05/01/13 at 00:41:56

Remove CVS $

  • Property mode set to 100755
File size: 1.9 KB
Line 
1#! /bin/sh
2#
3
4fatal()
5{
6  echo "$*"
7  exit 1
8}
9
10toggle()
11{
12  case $1 in
13    no)  echo "yes" ;;
14    yes) echo "no" ;;
15    *)   fatal "Unknown value to toggle ($1)" ;;
16  esac
17}
18
19usage()
20{
21cat <<EOF
22run_scenarios [options]
23  -s         - specify scheduler simulator executable (REQUIRED)
24  -1         - toggle running single CPU scenarios (default=no)
25  -4         - toggle running four CPU scenarios (default=no)
26  -A         - toggle all scenario flags
27  -v         - toggle verbose output (default=no)
28EOF
29}
30
31vecho()
32{
33  if [ ${verbose} = "yes" ] ; then
34    echo "$*"
35  fi
36}
37
38verbose=no
39do_all=no
40do_one=no
41do_four=no
42schedsim=
43
44while getopts vs:A14 OPT
45do
46  case "$OPT" in
47    v) verbose=`toggle ${verbose}` ;;
48    s) schedsim=${OPTARG} ;;
49    A) do_all=`toggle ${do_all}`   ;;
50    1) do_one=`toggle ${do_one}`   ;;
51    4) do_four=`toggle ${do_four}` ;;
52    *) usage; exit 1;
53  esac
54done
55
56if [ "X${schedsim}" != "X" ] ; then
57  type ${schedsim} >/dev/null 2>&1 || fatal ${schedsim} not found
58else
59  fatal "schedsim binary must be specified with -s option"
60fi
61
62test -d scenarios || fatal scenarios directory is not present
63
64if [ ${do_all} = "yes" ]; then
65  SCENARIOS="scenarios/*.scen"
66else
67  SCENARIOS=
68fi
69
70if [ ${do_one} = "yes" ]; then
71  SCENARIOS="${SCENARIOS} scenarios/cpus1*.scen"
72fi
73
74if [ ${do_four} = "yes" ]; then
75  SCENARIOS="${SCENARIOS} scenarios/cpus4*.scen"
76fi
77
78test "X${SCENARIOS}" = "X" && fatal "No scenarios specified"
79
80for scenario in `ls -1 ${SCENARIOS}`
81do
82  base=`echo ${scenario} | sed -s 's/\.scen$//'`
83  expected=${base}.expected
84  output=${base}.output
85  vecho Running ${scenario}
86  ${schedsim} $scenario  >${output}
87  if [ -r ${expected} ] ; then
88    diff ${output} ${expected} >/dev/null
89    if [ $? -ne 0 ] ; then
90      echo "FAIL - ${scenario}"
91      echo "    diff ${output} ${expected} "
92    else
93      echo "PASS - ${scenario}"
94    fi
95  else
96      echo "UNKNOWN - ${scenario}"
97      echo "    cp ${output} ${expected} "
98  fi
99done
100
101
Note: See TracBrowser for help on using the repository browser.