source: rtems-schedsim/schedsim/shell/run_scenarios @ 5686d7d

Last change on this file since 5686d7d was 5686d7d, checked in by Joel Sherrill <joel.sherrill@…>, on 06/28/11 at 18:43:12

2011-06-28 Joel Sherrill <joel.sherrill@…>

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