kesterel2lustre

compile Kernel Esterel to Lustre
git clone https://a3nm.net/git/kesterel2lustre/
Log | Files | Refs | README

runtest.sh (1219B)


      1 #!/bin/bash
      2 
      3 NAME="$1"
      4 INPUT="test/$NAME.in"
      5 PROG="test/$NAME.strl"
      6 LUSTRE="test/$NAME.lus"
      7 KESTEREL2LUSTRE="./kesterel2lustre"
      8 
      9 # check for presence of required tools
     10 # from http://stackoverflow.com/q/592620/414272
     11 hash lustre 2>&- ||
     12   { echo >&2 "No \"lustre\" command in path. Abort."; exit 1; }
     13 hash lux 2>&- ||
     14   { echo >&2 "No \"lustre\" command in path. Abort."; exit 1; }
     15 if [ ! -x $KESTEREL2LUSTRE ]
     16 then
     17   echo "Could not find the executable \"$KESTEREL2LUSTRE\". Did you \"make\"?"
     18   exit 1
     19 fi
     20 
     21 # convert esterel to lustre
     22 rm -f $LUSTRE
     23 $KESTEREL2LUSTRE $PROG > test/$NAME.lus ||
     24   { echo >&2 "$KESTEREL2LUSTRE $PROG returned non-zero exit status. Abort."
     25     exit 2;
     26   }
     27 
     28 
     29 # compile to an executable
     30 cd test
     31 rm -f $NAME.oc
     32 rm -f $NAME.ec
     33 lustre $NAME.lus $NAME 1>&2 ||
     34   { echo >&2 "Running lustre failed. Abort."
     35     exit 2;
     36   }
     37 rm -f $NAME $NAME.xlus
     38 lux $NAME.oc 1>&2 ||
     39   { echo >&2 "Running lux failed. Abort."
     40     exit 2;
     41   }
     42 mv $NAME $NAME.xlus
     43 cd ..
     44 
     45 # pass input to the executable, parse output
     46 cat $INPUT |
     47   tr ' ' '\n' |
     48   sed 's/True/1/;s/False/0/' |
     49   ./test/$NAME.xlus |
     50   awk 'BEGIN { y = 0} (y) {print $1} /^###/ { y = 1 } ' |
     51   tr '\n' ' ' |
     52   sed 's/##*/\n/g' |
     53   sed 's/^ *//;s/ *$//'
     54