From: jjenista Date: Wed, 20 Jan 2010 00:37:25 +0000 (+0000) Subject: finding mlp analysis bugs X-Git-Url: http://demsky.eecs.uci.edu/git/?a=commitdiff_plain;h=39dbd289e6f4d032510055ca599ad07c0902c58e;p=IRC.git finding mlp analysis bugs --- diff --git a/Robust/src/Tests/mlp/regression/test.java b/Robust/src/Tests/mlp/regression/test.java index 8b7647f2..1f2572f6 100644 --- a/Robust/src/Tests/mlp/regression/test.java +++ b/Robust/src/Tests/mlp/regression/test.java @@ -22,7 +22,7 @@ public class Test { int sum = 0; for( int j = 0; j <= i; ++j ) { sum = calculateStuff( sum, 1, 0 ); - } + } } sese forceVirtualReal { if( i % 3 == 0 ) { @@ -44,7 +44,7 @@ public class Test { for( int l = 0; l < 3; ++l ) { sum = calculateStuff( sum, 2, 2 ); } - } + } sese prnt { mightPrint( x, i, sum, g ); } diff --git a/Robust/src/Tests/mlp/tinyTest/makefile b/Robust/src/Tests/mlp/tinyTest/makefile index dc6e0117..294772a8 100644 --- a/Robust/src/Tests/mlp/tinyTest/makefile +++ b/Robust/src/Tests/mlp/tinyTest/makefile @@ -1,33 +1,28 @@ -PROGRAM=test +PROGRAM1=testSingle +PROGRAM2=testMulti -SOURCE_FILES=$(PROGRAM).java +SOURCE_FILES=test.java BUILDSCRIPT=~/research/Robust/src/buildscript USEMLP= -mlp 8 2 -mlpdebug # use to turn mlp on and off and make sure rest of build not broken -BSFLAGS= -nooptimize -debug -garbagestats -mainclass Test -ownership -ownallocdepth 1 -enable-assertions -flatirusermethods #-ownwritedots final -ownaliasfile aliases.txt +BSFLAGS= -nooptimize -debug -garbagestats -mainclass Test -ownership -ownallocdepth 1 -enable-assertions -ownaliasfile aliases.txt -all: $(PROGRAM).bin +all: $(PROGRAM1).bin $(PROGRAM2).bin -view: PNGs - eog *.png & +$(PROGRAM1).bin: $(SOURCE_FILES) + $(BUILDSCRIPT) $(BSFLAGS) -o $(PROGRAM1) $(SOURCE_FILES) -PNGs: DOTs - d2p *COMPLETE*.dot - -DOTs: $(PROGRAM).bin - -$(PROGRAM).bin: $(SOURCE_FILES) - $(BUILDSCRIPT) $(USEMLP) $(BSFLAGS) -o $(PROGRAM) $(SOURCE_FILES) - -nomlp: $(SOURCE_FILES) - $(BUILDSCRIPT) $(BSFLAGS) -o $(PROGRAM) $(SOURCE_FILES) +$(PROGRAM2).bin: $(SOURCE_FILES) + $(BUILDSCRIPT) $(USEMLP) $(BSFLAGS) -o $(PROGRAM2) $(SOURCE_FILES) clean: - rm -f $(PROGRAM).bin + rm -f $(PROGRAM1).bin + rm -f $(PROGRAM2).bin rm -fr tmpbuilddirectory rm -f *~ rm -f *.dot rm -f *.png rm -f aliases.txt - rm -f mlpReport* + rm -f mlpReport*txt + rm -f results*txt diff --git a/Robust/src/Tests/mlp/tinyTest/runTests b/Robust/src/Tests/mlp/tinyTest/runTests new file mode 100755 index 00000000..53dbd1b3 --- /dev/null +++ b/Robust/src/Tests/mlp/tinyTest/runTests @@ -0,0 +1,18 @@ +echo 'Each single/multi output line pair should be identical' + +echo '' > resultsSingle.txt +echo '' > resultsMulti.txt + +for i in $(seq 3) +do +echo 'running...' +./testSingle.bin $[ i ] >> resultsSingle.txt +./testMulti.bin $[ i ] >> resultsMulti.txt +./testSingle.bin $[ i*7 ] >> resultsSingle.txt +./testMulti.bin $[ i*7 ] >> resultsMulti.txt +./testSingle.bin $[ 50+i*7 ] >> resultsSingle.txt +./testMulti.bin $[ 50+i*7 ] >> resultsMulti.txt +done + +echo 'Diffing results' +diff resultsSingle.txt resultsMulti.txt diff --git a/Robust/src/Tests/mlp/tinyTest/test.java b/Robust/src/Tests/mlp/tinyTest/test.java index 8b7647f2..968b4a58 100644 --- a/Robust/src/Tests/mlp/tinyTest/test.java +++ b/Robust/src/Tests/mlp/tinyTest/test.java @@ -12,18 +12,17 @@ public class Test { int x = Integer.parseInt( args[0] ); Foo f = new Foo( x + 10000 ); doSomeWork( x, f ); - nullMethodBodyFinalNode(); } public static void doSomeWork( int x, Foo f ) { + + int total = 0; + for( int i = 0; i < x; ++i ) { sese calc { Foo g = new Foo( i ); - int sum = 0; - for( int j = 0; j <= i; ++j ) { - sum = calculateStuff( sum, 1, 0 ); - } - } + int sum = 0; + } sese forceVirtualReal { if( i % 3 == 0 ) { sum = sum + (i % 20); @@ -35,60 +34,14 @@ public class Test { } if( i % 2 == 0 ) { sese change { - for( int k = 0; k < i*2; ++k ) { - sum = calculateStuff( sum, k, 1 ); - } sum = sum + 1; - } - - for( int l = 0; l < 3; ++l ) { - sum = calculateStuff( sum, 2, 2 ); - } - } - sese prnt { - mightPrint( x, i, sum, g ); - } - } - } - - public static int calculateStuff( int sum, int num, int mode ) { - int answer = sum; - sese makePlaceholderStallAfter { - sum = sum + 1; + } + } + total = total + sum + g.z; } - sum = sum + 1; - if( mode == 0 ) { - sese mode1 { - answer = sum + num; - } - } else if( mode == 1 ) { - sese mode2 { - answer = sum + (num/2); - } - } else { - sese mode3 { - answer = sum / num; - } - } - return answer; - } - - public static void nullMethodBodyFinalNode() { - int y = 1; - sese nothing { - int x = 0; - } - y = x; - if( x > y ) { - return; - } else { - return; - } - } - public static void mightPrint( int x, int i, int sum, Foo g ) { - if( i == x - 1 ) { - System.out.println( "Results "+i+", "+x+", "+sum+", "+g.z ); + sese prnt { + System.out.println( "Results "+x+", "+total ); } } }