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

Last change on this file since ac6e5c7 was ac6e5c7, checked in by Joel Sherrill <joel.sherrill@…>, on May 17, 2011 at 7:31:16 PM

2011-05-17 Joel Sherrill <joel.sherrill@…>

  • Makefile.am: Merge and update code. Simulators for Deterministic Priority and SMP Simple Schedulers now work.
  • run_scenarios: New file.
  • Property mode set to 100755
File size: 1.7 KB
Line 
1#! /bin/sh
2#
3#  $Id$
4#
5
6toggle()
7{
8  case $1 in
9    no)  echo "yes" ;;
10    yes) echo "no" ;;
11    *)   fatal "Unknown value to toggle ($1)" ;;
12  esac
13}
14
15usage()
16{
17cat <<EOF
18run_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
22EOF
23}
24
25vecho()
26{
27  if [ ${verbose} = "yes" ] ; then
28    echo "$*"
29  fi
30}
31
32verbose=no
33do_all=no
34do_one=no
35do_four=no
36schedsim_dir=
37
38while getopts vd:A14 OPT
39do
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
48done
49
50if [ "X${schedsim_dir}" != "X" ] ; then
51  test -d ${schedsim_dir} || fatal ${schedsim_dir} is not readable
52  schedsim_dir=${schedsim_dir}/
53fi
54
55if [ ${do_all} = "yes" ]; then
56  SCENARIOS="scenarios/*.scen"
57else
58  SCENARIOS=
59fi
60
61if [ ${do_one} = "yes" ]; then
62  SCENARIOS="${SCENARIOS} scenarios/cpus1*.scen"
63fi
64
65if [ ${do_four} = "yes" ]; then
66  SCENARIOS="${SCENARIOS} scenarios/cpus4*.scen"
67fi
68
69for scenario in `ls -1 ${SCENARIOS}`
70do
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
88done
89
90
Note: See TracBrowser for help on using the repository browser.