From e22ec2893d1af78b7ab0f3945678b080266a8434 Mon Sep 17 00:00:00 2001 From: jjenista Date: Wed, 26 Oct 2011 15:46:28 +0000 Subject: [PATCH] tweak scripts to take mp3 filename argument --- .../MP3Decoder/observe-new-error-seed.sh | 22 ++++++++++++++++--- .../Benchmarks/SSJava/MP3Decoder/run-error.sh | 8 ++++++- .../SSJava/MP3Decoder/run-normal.sh | 8 ++++++- 3 files changed, 33 insertions(+), 5 deletions(-) diff --git a/Robust/src/Benchmarks/SSJava/MP3Decoder/observe-new-error-seed.sh b/Robust/src/Benchmarks/SSJava/MP3Decoder/observe-new-error-seed.sh index ca3be5b3..c33ec7dd 100755 --- a/Robust/src/Benchmarks/SSJava/MP3Decoder/observe-new-error-seed.sh +++ b/Robust/src/Benchmarks/SSJava/MP3Decoder/observe-new-error-seed.sh @@ -1,15 +1,30 @@ #!/bin/bash +usage () { + echo 'usage:' + echo ' observe-new-error-seed ' +} + + 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" diff --git a/Robust/src/Benchmarks/SSJava/MP3Decoder/run-error.sh b/Robust/src/Benchmarks/SSJava/MP3Decoder/run-error.sh index aebe29da..ccd5ad87 100755 --- a/Robust/src/Benchmarks/SSJava/MP3Decoder/run-error.sh +++ b/Robust/src/Benchmarks/SSJava/MP3Decoder/run-error.sh @@ -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 diff --git a/Robust/src/Benchmarks/SSJava/MP3Decoder/run-normal.sh b/Robust/src/Benchmarks/SSJava/MP3Decoder/run-normal.sh index 98581085..af28c67c 100755 --- a/Robust/src/Benchmarks/SSJava/MP3Decoder/run-normal.sh +++ b/Robust/src/Benchmarks/SSJava/MP3Decoder/run-normal.sh @@ -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 -- 2.34.1