#! /bin/sh # fatal() { echo "$*" exit 1 } toggle() { case $1 in no) echo "yes" ;; yes) echo "no" ;; *) fatal "Unknown value to toggle ($1)" ;; esac } usage() { cat </dev/null 2>&1 || fatal ${schedsim} not found else fatal "schedsim binary must be specified with -s option" fi scen=${scenarios_dir}/scenarios test -d ${scen}|| \ fatal ${scen} directory is not present if [ ${do_all} = "yes" ]; then SCENARIOS="${scen}/*.scen" else for i in $* do SCENARIOS="${SCENARIOS} ${scen}/${i}" done fi if [ ${do_one} = "yes" ]; then SCENARIOS="${SCENARIOS} ${scen}/cpus1*.scen" fi if [ ${do_four} = "yes" ]; then SCENARIOS="${SCENARIOS} ${scen}/cpus4*.scen" fi test "X${SCENARIOS}" = "X" && fatal "No scenarios specified" for scenario in ${SCENARIOS} do test -r ${scenario} || fatal "Scenario ${scenario} not found!" done scenarios=0 passed=0 failed=0 for scenario in ${SCENARIOS} do base=`echo ${scenario} | sed -s 's/\.scen$//'` expected=${base}.expected output=${base}.output vecho Running ${scenario} run=`expr ${run} + 1` ${schedsim} $scenario >${output} if [ $? -ne 0 ] ; then failed=`expr ${failed} + 1` echo "FAIL - ${scenario}" elif [ -r ${expected} ] ; then diff ${output} ${expected} >/dev/null if [ $? -ne 0 ] ; then failed=`expr ${failed} + 1` echo "FAIL - ${scenario}" echo " diff ${output} ${expected} " else passed=`expr ${passed} + 1` echo "PASS - ${scenario}" fi else echo "UNKNOWN - ${scenario}" fi done echo "=== Test report for `basename ${schedsim}`" echo "Run: " ${run} echo "Passed: " ${passed} echo "Failed: " ${failed} exit 0