source: rtems-schedsim/schedsim/shell/run_scenarios @ 205f794

Last change on this file since 205f794 was 205f794, checked in by Joel Sherrill <joel.sherrill@…>, on 05/26/14 at 19:08:12

Add initial support for make check

+ Enhance run_scenario to run from build tree. Required specification
of both executable and scenario directory

+ check-local stanzas have first cut at which scenarios to run for
each scheduler.

TODO:

+ Verify behavior of each scheduler versus expected output.

+ Ensure list of scenarios executed is complete and appropriate. For
example, SMP schedulers should avoid disable preemption scenarios.

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