tweak scripts to take mp3 filename argument
authorjjenista <jjenista>
Wed, 26 Oct 2011 15:46:28 +0000 (15:46 +0000)
committerjjenista <jjenista>
Wed, 26 Oct 2011 15:46:28 +0000 (15:46 +0000)
Robust/src/Benchmarks/SSJava/MP3Decoder/observe-new-error-seed.sh
Robust/src/Benchmarks/SSJava/MP3Decoder/run-error.sh
Robust/src/Benchmarks/SSJava/MP3Decoder/run-normal.sh

index ca3be5b3789e9ba5fb38416acfc41d52d0497446..c33ec7dd20096cd7fceb33add53bf97e7dcd7908 100755 (executable)
@@ -1,15 +1,30 @@
 #!/bin/bash
 
+usage () {
+  echo 'usage:'
+  echo '  observe-new-error-seed <inv prob> <random seed> <mp3 filename>'
+}
+
+
 if [[ -z $1 ]] ; then
-  echo 'Please supply an inverse probability (e.g. 1000).'
+  usage
+  echo 'Please supply an inverse probability. (e.g. 1000)'
   exit
 fi
 
 if [[ -z $2 ]] ; then
+  usage
   echo 'Please supply a random seed.'
   exit
 fi
 
+if [[ -z $3 ]] ; then
+  usage
+  echo 'Please supply an mp3 name. (e.g. focus.mp3)'
+  exit
+fi
+
+
 trycommand () {
   $1
   if [[ ! $? ]] ; then
@@ -18,9 +33,10 @@ trycommand () {
   fi  
 }
 
+
 trycommand "make normal"
 trycommand "make cleanerror"
 trycommand "make error INV_ERROR_PROB=$1 RANDOMSEED=$2"
-trycommand "run-normal.sh"
-trycommand "run-error.sh"
+trycommand "run-normal.sh $3"
+trycommand "run-error.sh $3"
 trycommand "plot-normal-vs-error.sh"
index aebe29da77c581f0b2aae8be75f6216a673a79ff..ccd5ad87a302ae88f8e5ea9442ff9a99bf4b1195 100755 (executable)
@@ -1,5 +1,11 @@
 #!/bin/bash
-MP3Playere.bin focus.mp3 > error.txt
+
+if [[ -z $1 ]] ; then
+  echo 'Please supply an mp3 file name.'
+  exit
+fi
+
+MP3Playere.bin $1 > error.txt
 
 grep "SSJAVA: Injecting error" error.txt
 
index 9858108518a6142c613d3e262f357abc04cfd464..af28c67c2a7168e1c2c3ca40874c2d7a49d6ece4 100755 (executable)
@@ -1,4 +1,10 @@
 #!/bin/bash
-MP3Playern.bin focus.mp3 > normal.txt
+
+if [[ -z $1 ]] ; then
+  echo 'Please supply an mp3 file name.'
+  exit
+fi
+
+MP3Playern.bin $1 > normal.txt
 
 mp3samples2plotData.sh normal.txt
\ No newline at end of file