From 7033474550adbe3265ca7ffe404c717e760cf865 Mon Sep 17 00:00:00 2001 From: jjenista Date: Mon, 11 Oct 2010 19:09:04 +0000 Subject: [PATCH] an example showing empty reach state propagation that we considered for CC submission, and an example of generating reach graphs at a desired program point --- .../disjoint/cc-submission-example/makefile | 30 ++++++++++++ .../disjoint/cc-submission-example/test.java | 48 +++++++++++++++++++ Robust/src/Tests/disjoint/tiny/makefile | 27 +++++++++++ Robust/src/Tests/disjoint/tiny/test.java | 17 +++++++ 4 files changed, 122 insertions(+) create mode 100644 Robust/src/Tests/disjoint/cc-submission-example/makefile create mode 100644 Robust/src/Tests/disjoint/cc-submission-example/test.java create mode 100644 Robust/src/Tests/disjoint/tiny/makefile create mode 100644 Robust/src/Tests/disjoint/tiny/test.java diff --git a/Robust/src/Tests/disjoint/cc-submission-example/makefile b/Robust/src/Tests/disjoint/cc-submission-example/makefile new file mode 100644 index 00000000..75b09b46 --- /dev/null +++ b/Robust/src/Tests/disjoint/cc-submission-example/makefile @@ -0,0 +1,30 @@ +PROGRAM=test + +SOURCE_FILES=$(PROGRAM).java + +BUILDSCRIPT=~/research/Robust/src/buildscript + +BSFLAGS= -mainclass Test -joptimize -justanalyze -disjoint -disjoint-k 1 -enable-assertions +DEBUGFLAGS= -disjoint-debug-snap-method graphLoop 0 10 true #-disjoint-write-dots all #-disjoint-write-initial-contexts -disjoint-write-ihms + +all: $(PROGRAM).bin + +view: PNGs + eog *.png & + +PNGs: DOTs + d2p *COMPLETE*.dot + +DOTs: $(PROGRAM).bin + +$(PROGRAM).bin: $(SOURCE_FILES) + $(BUILDSCRIPT) $(BSFLAGS) $(DEBUGFLAGS) -o $(PROGRAM) $(SOURCE_FILES) + +clean: + rm -f $(PROGRAM).bin + rm -fr tmpbuilddirectory + rm -f *~ + rm -f *.dot + rm -f *.png + rm -f aliases.txt + rm -f effects.txt diff --git a/Robust/src/Tests/disjoint/cc-submission-example/test.java b/Robust/src/Tests/disjoint/cc-submission-example/test.java new file mode 100644 index 00000000..a52b2752 --- /dev/null +++ b/Robust/src/Tests/disjoint/cc-submission-example/test.java @@ -0,0 +1,48 @@ +public class Graph { + public Graph() {} + public Vertex vertex; +} + +public class Vertex { + public Vertex() {} + public Vertex f; + public boolean marked; + public void updateVertex(); +} + + +public class Test { + + static public void main( String[] args ) { + Test.graphLoop( 2 ); + } + + + static public void graphLoop( int nGraphs ) { + + Graph[] a = new Graph[nGraphs]; + + for( int i = 0; i < nGraphs; i++ ) { + + Graph g = disjoint graphs new Graph(); + Vertex v1 = new Vertex(); + g.vertex = v1; + Vertex v2 = new Vertex(); + v2.f = v1; v1.f = v2 ; + a[i] = g; + } + /* + for( int i = 0; i < nGraphs; i++ ) { + + Graph g = a[i]; + Vertex v = g.vertex; + + while( !v.marked ) { + v.marked = true; + v.updateVertex(); + v=v.f; + } + } + */ + } +} diff --git a/Robust/src/Tests/disjoint/tiny/makefile b/Robust/src/Tests/disjoint/tiny/makefile new file mode 100644 index 00000000..5f210cab --- /dev/null +++ b/Robust/src/Tests/disjoint/tiny/makefile @@ -0,0 +1,27 @@ +PROGRAM=test + +SOURCE_FILES=$(PROGRAM).java + +BUILDSCRIPT=~/research/Robust/src/buildscript +BSFLAGS= -mainclass Test -disjoint -disjoint-k 1 -disjoint-alias-file aliases.txt normal -enable-assertions -justanalyze #-joptimize #-disjoint-write-dots final + +all: $(PROGRAM).bin + +view: PNGs + eog *.png & + +PNGs: DOTs + d2p *COMPLETE*.dot + +DOTs: $(PROGRAM).bin + +$(PROGRAM).bin: $(SOURCE_FILES) + $(BUILDSCRIPT) $(BSFLAGS) -o $(PROGRAM) $(SOURCE_FILES) + +clean: + rm -f $(PROGRAM).bin + rm -fr tmpbuilddirectory + rm -f *~ + rm -f *.dot + rm -f *.png + rm -f aliases.txt diff --git a/Robust/src/Tests/disjoint/tiny/test.java b/Robust/src/Tests/disjoint/tiny/test.java new file mode 100644 index 00000000..730ed866 --- /dev/null +++ b/Robust/src/Tests/disjoint/tiny/test.java @@ -0,0 +1,17 @@ +public class Foo { + public Foo() {} +} + +public class Test { + static public void main( String[] args ) { + Foo[] x = new Foo[10]; + + genreach yo; + + for( int i = 0; i < 10; i++ ) { + x[i] = new Foo(); + } + + System.out.println( x[0] ); + } +} -- 2.34.1