add batch-mode script
authoryeom <yeom>
Tue, 6 Mar 2012 02:27:32 +0000 (02:27 +0000)
committeryeom <yeom>
Tue, 6 Mar 2012 02:27:32 +0000 (02:27 +0000)
Robust/src/Benchmarks/SSJava/MP3Decoder/114.mp3 [new file with mode: 0755]
Robust/src/Benchmarks/SSJava/MP3Decoder/Player.java
Robust/src/Benchmarks/SSJava/MP3Decoder/makefile
Robust/src/Benchmarks/SSJava/MP3Decoder/run-batch-mode.sh [new file with mode: 0755]
Robust/src/Benchmarks/SSJava/MP3Decoder/run-error-batchmode.sh [new file with mode: 0755]

diff --git a/Robust/src/Benchmarks/SSJava/MP3Decoder/114.mp3 b/Robust/src/Benchmarks/SSJava/MP3Decoder/114.mp3
new file mode 100755 (executable)
index 0000000..a4734b9
Binary files /dev/null and b/Robust/src/Benchmarks/SSJava/MP3Decoder/114.mp3 differ
index 965c703..568a249 100644 (file)
@@ -206,8 +206,8 @@ public class Player {
       // @LOC("O") SampleBuffer output = (SampleBuffer) decoder.decodeFrame(h);\r
       decoder.decodeFrame(h);\r
 \r
-      DEBUG_OUTPUT_CHECKSUM();\r
-      // DEBUG_OUTPUT();\r
+     // DEBUG_OUTPUT_CHECKSUM();\r
+       DEBUG_OUTPUT();\r
       // synchronized (this)\r
       // {\r
       // out = audio;\r
index 83adb83..3f7f58b 100644 (file)
@@ -12,7 +12,7 @@ RANDOMSEED=12345
 endif
 
 SSJAVA= -ssjava -ssjavadebug
-BSFLAGS= -32bit -mainclass $(PROGRAM)  -heapsize-mb 1000  -nooptimize -debug -garbagestats #-printlinenum #-joptimize
+BSFLAGS= -32bit -mainclass $(PROGRAM)  -heapsize-mb 1350  -nooptimize -debug -garbagestats #-printlinenum #-joptimize
 NORMAL= -ssjava-inject-error 0 0
 INJECT_ERROR= -ssjava-inject-error $(INV_ERROR_PROB) $(RANDOMSEED)
 
diff --git a/Robust/src/Benchmarks/SSJava/MP3Decoder/run-batch-mode.sh b/Robust/src/Benchmarks/SSJava/MP3Decoder/run-batch-mode.sh
new file mode 100755 (executable)
index 0000000..59e8954
--- /dev/null
@@ -0,0 +1,46 @@
+#!/bin/bash
+trycommand () {
+  $1
+  if [[ ! $? ]] ; then
+    echo "FAILED: $1"
+    exit
+  fi  
+}
+
+F=114.mp3
+H=errinj-history.txt
+D=errinj-diff.tmp
+X=errinj-diff-ranges.tmp
+T=errinj-range.tmp
+
+trycommand "rm $H"
+
+for (( i=0;i<100;i++))
+do
+  echo 'idx' $i >> $H
+  trycommand "rm $X"
+  echo "### make normal"
+  trycommand "make normal"
+  trycommand "make cleanerror"
+  echo "### make error"
+  trycommand "make error INV_ERROR_PROB=10000000 RANDOMSEED=90$i"
+  echo "### run normal"
+  trycommand "run-normal.sh $F"
+  echo "### run error"
+  trycommand "run-error-batchmode.sh $F $H"
+  diff normal.txt error.txt > $D
+  sed \
+  -e '/^[^0-9]/ d' \
+  -e  's/\(.*\),\(.*\)c.*/\1/' \
+  -e  's/\(.*\)c.*/\1/' \
+  -e  's/\(.*\)a.*/\1/' \
+  $D >> $X
+  if [[ -s $D ]] ; then
+    awk 'NR==1;END{print}' $X > $T
+    awk 'NR==1{s=$0;getline;e=$0;if(s==e) print "NO DIFF";else print s"\n"e}' $T >> $H
+  else
+    echo 'NO DIFF' >> $H
+  fi
+done
+
+
diff --git a/Robust/src/Benchmarks/SSJava/MP3Decoder/run-error-batchmode.sh b/Robust/src/Benchmarks/SSJava/MP3Decoder/run-error-batchmode.sh
new file mode 100755 (executable)
index 0000000..79041c4
--- /dev/null
@@ -0,0 +1,18 @@
+#!/bin/bash
+
+if [[ -z $1 ]] ; then
+  echo 'Please supply an mp3 file name.'
+  exit
+fi
+
+MP3Playere.bin $1 > error.txt
+
+grep "SSJAVA: Injecting error" error.txt
+
+awk '{if($1=="SSJAVA:" && $2=="Injecting"){print "inj",x};{x=$1} }' error.txt >> $2 
+
+X=converterTempFile
+
+sed -e '/^SSJAVA:/ d' -e '1,/+++/ d' error.txt > $X  
+
+mv $X error.txt