From a8e0a26b6117013e81cbbffa7eb2af3cb599c049 Mon Sep 17 00:00:00 2001 From: Lubomir Bulej Date: Tue, 27 May 2014 23:21:40 +0000 Subject: [PATCH] Sanitized the build system before merging the new DiSL agent: - The build.xml file has been cleaned up extensively. - The build system for examples has been simplified and cleaned up. - There is support for binary DiSL releases with examples and documentation. - Examples should be used with a binary DiSL distribution (see output/dist). - Moved the disl.py launcher out of the examples subdirectory. - Test suite Runner has been modified to accept locations and native library names from outside. --- .classpath | 16 +- COPYING | 7 +- README | 34 +- README_TESTS | 30 +- USERERRORS => USER_ERRORS | 0 {example => bin}/disl.py | 84 +- build.properties | 66 +- build.xml | 791 +++++++++++------- {doc-intro => doc/intro}/dislintro.tex | 0 {doc-intro => doc/intro}/fig/architecture.eps | 0 {doc-intro => doc/intro}/fig/overview.eps | 0 doc/{ => javadoc}/overview.html | 0 {logo => doc/logo}/disl.svg | 0 {logo => doc/logo}/disl.xcf | Bin {logo => doc/logo}/disl2.svg | 0 {logo => doc/logo}/orig/mil.jpg | Bin example/build.properties | 10 - example/dispatch/app/build.xml | 23 - example/dispatch/build.xml | 25 - example/dispatch/instr/build.xml | 33 - example/dynamic/app/build.xml | 23 - example/dynamic/build.xml | 22 - example/dynamic/instr/build.xml | 31 - example/guard/app/build.xml | 23 - example/guard/build.xml | 22 - example/guard/instr/build.xml | 31 - example/marker/app/build.xml | 23 - example/marker/build.xml | 22 - example/marker/instr/build.xml | 31 - example/scope/app/build.xml | 23 - example/scope/build.xml | 22 - example/scope/instr/build.xml | 31 - example/smoke/app/build.xml | 23 - example/smoke/build.xml | 22 - example/smoke/instr/build.xml | 31 - example/static/app/build.xml | 23 - example/static/build.xml | 22 - example/static/instr/build.xml | 31 - {example => examples}/README | 64 +- examples/build-example.xml | 68 ++ examples/build.properties | 20 + {example => examples}/build.xml | 0 examples/dispatch/build.xml | 3 + .../dispatch/src-app}/Main.java | 0 .../dispatch/src-inst}/CodeExecuted.java | 0 .../dispatch/src-inst}/CodeExecutedRE.java | 0 .../dispatch/src-inst}/CodeLengthSC.java | 0 .../dispatch/src-inst}/DiSLClass.java | 0 .../dispatch/src-inst}/MANIFEST.MF | 0 examples/dynamic/build.xml | 3 + .../dynamic/src-app}/Main.java | 0 .../dynamic/src-inst}/DiSLClass.java | 0 .../dynamic/src-inst}/MANIFEST.MF | 0 examples/guard/build.xml | 3 + .../src => examples/guard/src-app}/Main.java | 0 .../guard/src-inst}/DiSLClass.java | 0 .../guard/src-inst}/GuardNo.java | 0 .../guard/src-inst}/GuardYes.java | 0 .../guard/src-inst}/MANIFEST.MF | 0 .../src-inst}/MethodInvocationMarker.java | 0 examples/marker/build.xml | 3 + .../src => examples/marker/src-app}/Main.java | 0 .../marker/src-inst}/DiSLClass.java | 0 .../marker/src-inst}/MANIFEST.MF | 0 .../src-inst}/MethodInvocationMarker.java | 0 examples/scope/build.xml | 3 + .../src => examples/scope/src-app}/Main.java | 0 .../scope/src-app}/my/ClassTest.java | 0 .../scope/src-app}/my/pkg/ClassBigTest.java | 0 .../scope/src-app}/my/pkg/ClassTest.java | 0 .../scope/src-inst}/DiSLClass.java | 0 .../scope/src-inst}/MANIFEST.MF | 0 examples/smoke/build.xml | 3 + .../src => examples/smoke/src-app}/Main.java | 0 .../smoke/src-inst}/DiSLClass.java | 0 .../smoke/src-inst}/MANIFEST.MF | 0 examples/static/build.xml | 3 + .../src => examples/static/src-app}/Main.java | 0 .../static/src-inst}/DiSLClass.java | 0 .../static/src-inst}/DumbLoopContext.java | 0 .../static/src-inst}/DumbLoopGuard.java | 0 .../static/src-inst}/MANIFEST.MF | 0 src-agent-c/Makefile | 8 +- src-re-agent/Makefile | 7 +- .../ch/usi/dag/disl/test/utils/Runner.java | 37 +- 85 files changed, 819 insertions(+), 981 deletions(-) rename USERERRORS => USER_ERRORS (100%) rename {example => bin}/disl.py (86%) rename {doc-intro => doc/intro}/dislintro.tex (100%) rename {doc-intro => doc/intro}/fig/architecture.eps (100%) rename {doc-intro => doc/intro}/fig/overview.eps (100%) rename doc/{ => javadoc}/overview.html (100%) rename {logo => doc/logo}/disl.svg (100%) rename {logo => doc/logo}/disl.xcf (100%) rename {logo => doc/logo}/disl2.svg (100%) rename {logo => doc/logo}/orig/mil.jpg (100%) delete mode 100644 example/build.properties delete mode 100644 example/dispatch/app/build.xml delete mode 100644 example/dispatch/build.xml delete mode 100644 example/dispatch/instr/build.xml delete mode 100644 example/dynamic/app/build.xml delete mode 100644 example/dynamic/build.xml delete mode 100644 example/dynamic/instr/build.xml delete mode 100644 example/guard/app/build.xml delete mode 100644 example/guard/build.xml delete mode 100644 example/guard/instr/build.xml delete mode 100644 example/marker/app/build.xml delete mode 100644 example/marker/build.xml delete mode 100644 example/marker/instr/build.xml delete mode 100644 example/scope/app/build.xml delete mode 100644 example/scope/build.xml delete mode 100644 example/scope/instr/build.xml delete mode 100644 example/smoke/app/build.xml delete mode 100644 example/smoke/build.xml delete mode 100644 example/smoke/instr/build.xml delete mode 100644 example/static/app/build.xml delete mode 100644 example/static/build.xml delete mode 100644 example/static/instr/build.xml rename {example => examples}/README (78%) create mode 100644 examples/build-example.xml create mode 100644 examples/build.properties rename {example => examples}/build.xml (100%) create mode 100644 examples/dispatch/build.xml rename {example/dispatch/app/src => examples/dispatch/src-app}/Main.java (100%) rename {example/dispatch/instr/src => examples/dispatch/src-inst}/CodeExecuted.java (100%) rename {example/dispatch/instr/src => examples/dispatch/src-inst}/CodeExecutedRE.java (100%) rename {example/dispatch/instr/src => examples/dispatch/src-inst}/CodeLengthSC.java (100%) rename {example/dispatch/instr/src => examples/dispatch/src-inst}/DiSLClass.java (100%) rename {example/dispatch/instr/src => examples/dispatch/src-inst}/MANIFEST.MF (100%) create mode 100644 examples/dynamic/build.xml rename {example/dynamic/app/src => examples/dynamic/src-app}/Main.java (100%) rename {example/dynamic/instr/src => examples/dynamic/src-inst}/DiSLClass.java (100%) rename {example/dynamic/instr/src => examples/dynamic/src-inst}/MANIFEST.MF (100%) create mode 100644 examples/guard/build.xml rename {example/guard/app/src => examples/guard/src-app}/Main.java (100%) rename {example/guard/instr/src => examples/guard/src-inst}/DiSLClass.java (100%) rename {example/guard/instr/src => examples/guard/src-inst}/GuardNo.java (100%) rename {example/guard/instr/src => examples/guard/src-inst}/GuardYes.java (100%) rename {example/guard/instr/src => examples/guard/src-inst}/MANIFEST.MF (100%) rename {example/guard/instr/src => examples/guard/src-inst}/MethodInvocationMarker.java (100%) create mode 100644 examples/marker/build.xml rename {example/marker/app/src => examples/marker/src-app}/Main.java (100%) rename {example/marker/instr/src => examples/marker/src-inst}/DiSLClass.java (100%) rename {example/marker/instr/src => examples/marker/src-inst}/MANIFEST.MF (100%) rename {example/marker/instr/src => examples/marker/src-inst}/MethodInvocationMarker.java (100%) create mode 100644 examples/scope/build.xml rename {example/scope/app/src => examples/scope/src-app}/Main.java (100%) rename {example/scope/app/src => examples/scope/src-app}/my/ClassTest.java (100%) rename {example/scope/app/src => examples/scope/src-app}/my/pkg/ClassBigTest.java (100%) rename {example/scope/app/src => examples/scope/src-app}/my/pkg/ClassTest.java (100%) rename {example/scope/instr/src => examples/scope/src-inst}/DiSLClass.java (100%) rename {example/scope/instr/src => examples/scope/src-inst}/MANIFEST.MF (100%) create mode 100644 examples/smoke/build.xml rename {example/smoke/app/src => examples/smoke/src-app}/Main.java (100%) rename {example/smoke/instr/src => examples/smoke/src-inst}/DiSLClass.java (100%) rename {example/smoke/instr/src => examples/smoke/src-inst}/MANIFEST.MF (100%) create mode 100644 examples/static/build.xml rename {example/static/app/src => examples/static/src-app}/Main.java (100%) rename {example/static/instr/src => examples/static/src-inst}/DiSLClass.java (100%) rename {example/static/instr/src => examples/static/src-inst}/DumbLoopContext.java (100%) rename {example/static/instr/src => examples/static/src-inst}/DumbLoopGuard.java (100%) rename {example/static/instr/src => examples/static/src-inst}/MANIFEST.MF (100%) diff --git a/.classpath b/.classpath index c051b8fb..b5f2844f 100644 --- a/.classpath +++ b/.classpath @@ -1,15 +1,15 @@ - - - - - - + + + + + + - + - + diff --git a/COPYING b/COPYING index 879bd478..a05deef6 100644 --- a/COPYING +++ b/COPYING @@ -1,6 +1,7 @@ ================================================================================ -= DiSL += DiSL ================================================================================ + Apache License Version 2.0, January 2004 http://www.apache.org/licenses/ @@ -205,7 +206,7 @@ ================================================================================ -= LIBRARIES += LIBRARIES ================================================================================ -Licenses for libraries used in the project are in the lib directory. +Licenses for the libraries used in the project are in the lib directory. diff --git a/README b/README index 89677998..6ba1b3a1 100644 --- a/README +++ b/README @@ -1,15 +1,15 @@ DiSL ==== -DiSL is a Java bytecode instrumentation framework intended for observation -of programs executing in the Java Virtual Machine. It has been mainly used -for development of dynamic program analysis instrumentations, but it can be -used equally well to develop instrumentations for, e.g. runtime performance +DiSL is a Java bytecode instrumentation framework intended for observation of +programs executing in the Java Virtual Machine. It has been mainly used for +development of dynamic program analysis instrumentations, but it can be used +equally well to develop instrumentations for, e.g. runtime performance monitoring, or other tasks not bent on altering program execution. DiSL is inspired by AOP, but in contrast to mainstream AOP languages, it -features an open join point model where any region of bytecodes can serve as -a join point (i.e., code location to be instrumented). DiSL also reconciles +features an open join point model where any region of bytecodes can serve as a +join point (i.e., code location to be instrumented). DiSL also reconciles high-level language concepts, such as the pointcut/advice programming model found in AOP, with high expressiveness, and efficiency of bytecode manipulation performed using low-level libraries such as ASM. As a result, @@ -45,23 +45,29 @@ javahome/var.local.tmp file to javahome/var.local and modify it to set the JAVA_HOME variable to point to the root of the JDK installation you want to use. -Finally, to compile DiSL, run the "ant" command in the root directory. +Finally, to compile DiSL, run the "ant" command in the top-level directory. -You can create javadoc documentation by running "ant javadoc". +DOCUMENTATION ============= -EXAMPLES ======== +Please look at http://disl.projects.ow2.org/xwiki/bin/view/Main/Doc. -For the basic instrumentation example, please look in the example directory. -Also the src-test directory contains simple examples of DiSL features. +After building DiSL, you will find the API documentation and an introduction +to instrumenting applications with DiSL in the output/dist/doc directory. -DOCUMENTATION ============= +EXAMPLES ======== -Please look at http://disl.projects.ow2.org/xwiki/bin/view/Main/Doc. +For a set of simple examples showcasing basic DiSL features, please look in +the "examples" directory. Note that the "examples" are meant to be used with +DiSL a distribution directory layout, which will be created in the +"output/dist" directory after buildig DiSL. + +In addition, the "src-test" directory contains additional examples used for +testing other DiSL features -- these can be run using Ant. USER ERRORS =========== If you get a Java error during instrumentation or running your application, -please look at USERERRORS document describing most common problems. +please look at the USER_ERRORS document describing most common problems. diff --git a/README_TESTS b/README_TESTS index 3fc2ed3e..cf49aff4 100644 --- a/README_TESTS +++ b/README_TESTS @@ -6,16 +6,18 @@ located in the ch.usi.dag.disl.test.junit package and complex tests in the ch.usi.dag.disl.test.suite package that invoke all parts of the framework (client, server, ...) and verify computed results. -All tests are performed calling -- ant test +All tests are executed by running +$ ant test -To use the for debuging purpose during development a single suite test (for -example "after" test) can be invoked calling -- ant suite-test -Dtest.name=after +To use the tests for debuging purposes during development, a single test suite +(for example, "after") can be executed by running +$ ant test -Dtest.name=after -Parameters specified to ant at command line starting with "-Ddisl." are passed -to the test. For example to show tests output specify -- -Ddisl.test.verbose=true +Properties passed to Ant on the command line starting with "-Ddisl.", +"-Ddislserver.", and "-Ddislreserver." are passed to the test. For example, +to save the outputs produced by the test suites, use + +-Ddisl.test.verbose=true When built with "ant prepare-test" tests can be also run directly. They are packed in the "build-test" directory. @@ -28,12 +30,12 @@ Implementation is a bit tricky in few aspects. Firstly, building of suite test apps and instrumentations is handled by a scripted target that lists all directories in a "ch.usi.dag.disl.test.suite" -package and one by one "app" and "instr" package are jared. +package, and produces "app" and "inst" jars for each suite. -Secondly, when running the instances of client and server using Process API +Secondly, when running the instances of client and server using Process API, never forget to clear environment variables as inherited classpath could cause -serious troubles. - -If a suite instr test contains a manifest file it's used and if none is present -"DiSLClass" is default for "DiSL-Classes" attribute. +serious trouble. +If a suite instr source directory contains a manifest file, it will be used +when packaging the instrumentation into a jar, otherwise a default manifest +will be used, with the "DiSL-Classes" attribute set to "DiSLClass". diff --git a/USERERRORS b/USER_ERRORS similarity index 100% rename from USERERRORS rename to USER_ERRORS diff --git a/example/disl.py b/bin/disl.py similarity index 86% rename from example/disl.py rename to bin/disl.py index a8493966..bc61ad8b 100755 --- a/example/disl.py +++ b/bin/disl.py @@ -12,7 +12,7 @@ from subprocess import * # CONSTANTS ###################################################################### # default disl_home value, relative to the script -DEFAULT_DISL_HOME = "../../" +DEFAULT_DISL_HOME = os.path.relpath ("%s/.." % os.path.dirname(__file__)) # string to be substituted by the actual value of DISL_HOME in paths VARIABLE_DISL_HOME = "${DISL_HOME}" @@ -34,7 +34,7 @@ def disl_home(): # LIB_SUFFIX ###################################################################### def lib_suffix(): - if platform.system() == "Darwin": + if platform.system() == "Darwin": return ".jnilib" else: return ".so" @@ -44,11 +44,11 @@ def lib_suffix(): ###################################################################### def general_parser(parser): # positional variant of i for simplicity - # both cannot be set at once - parser.add_argument("instr", + # both cannot be set at once + parser.add_argument("inst", default=None, nargs="?", - help="path to jar containing disl instrumentation code, same as '-i'") + help="path to jar containing DiSL instrumentation code, same as '-i'") # positional variant of c_app for simplicity # both cannot be set at once @@ -65,18 +65,18 @@ def general_parser(parser): parser.add_argument("-cs", action="store_true", default=True, - help="set to start client and server") + help="start client and DiSL server") parser.add_argument("-cse", action="store_true", default=False, - help="set to start client, server and remote evaluation") + help="start client, DiSL server and Shadow VM server") parser.add_argument("-i", dest="instrumentation", default=None, metavar="PATH", - help="path to jar containing disl instrumentation code, same as 'instr'") + help="path to jar containing DiSL instrumentation code, same as 'inst'") parser.add_argument("-t", dest="test_dir", @@ -140,14 +140,14 @@ def server_parser(parser): default=[], metavar="A", nargs="+", - help="java options of the server") + help="options for the DiSL server JVM") group.add_argument("-s_args", action="append", default=[], metavar="A", nargs="+", - help="arguments to the server application") + help="DiSL server arguments") group.add_argument("-s_out", default=None, @@ -194,7 +194,7 @@ def server_parser(parser): help="listening network port") return - + ###################################################################### # EVALUATION_PARSER @@ -207,14 +207,14 @@ def evaluation_parser(parser): default=[], nargs="+", metavar="A", - help="java options of the evaluation server") + help="options for the Shadow VM server JVM") group.add_argument("-e_args", action="append", default=[], nargs="+", metavar="A", - help="arguments to the evaluation server application") + help="Shadow VM server arguments") group.add_argument("-e_out", default=None, @@ -251,11 +251,12 @@ def documentation_parser(parser): parser.formatter_class=argparse.RawTextHelpFormatter parser.description = """ -This script is a DiSL client application, server and evaluation server starter. +This is a DiSL application, DiSL instrumentation server, and Shadow VM server launcher. -By default a client application that will be instrumented and the server that -will instrument the application will be started. To start remote evaluation -server too. Specify '-cse' option. +By default, the script starts a DiSL instrumentation server VM and a client application +VM that will be instrumented using DiSL. For instrumentations using remote analysis +execution in Shadow VM, the Shadow VM server needs to be started as well, which needs +to be specified explicitly using the '-cse' option. To pass option like arguments (starting with dash) one must either use equal sign or positional variant of the argument if it's present. For example @@ -272,9 +273,9 @@ variable. EXAMPLES: To execute the example application run following: - ./disl.py -- instr/build/disl-instr.jar -jar app/build/example-app.jar + ./disl.py -- build/example-inst.jar -jar build/example-app.jar or - ./disl.py -cs -i=instr/build/disl-instr.jar -c_app=-jar c_app=app/build/example-app.jar + ./disl.py -cs -i=build/example-inst.jar -c_app="-jar build/example-app.jar" """ ###################################################################### @@ -284,8 +285,8 @@ def make_parser(): parser = argparse.ArgumentParser() general_parser(parser) client_parser(parser) - server_parser(parser) - evaluation_parser(parser) + server_parser(parser) + evaluation_parser(parser) documentation_parser(parser) return parser @@ -346,15 +347,15 @@ def parse_arguments(parser): if args.e_port is not None: args.e_opts+= ["-Ddislreserver.port="+args.e_port] - # supply instrumentation from positional instr if set - if args.instrumentation is not None and args.instr is not None: - parser.error("-i and instr set both") - if args.instr is not None: - args.instrumentation = args.instr + # supply instrumentation from positional 'inst' if set + if args.instrumentation is not None and args.inst is not None: + parser.error("-i and -inst set both") + if args.inst is not None: + args.instrumentation = args.inst # supply c_app from positional app if set if args.c_app is not None and args.app is not None: - parser.error("-c_app and app set both") + parser.error("-c_app and -app set both") if args.app is not None: args.c_app = args.app @@ -398,7 +399,7 @@ def run(cmd, out, err): if err is not None: err_f = open(err, "w") - process = Popen(cmd, stdout=out_f, stderr=err_f, shell=False) + process = Popen(cmd, stdout=out_f, stderr=err_f, shell=False) return process @@ -407,12 +408,12 @@ def run(cmd, out, err): ###################################################################### def run_server(args, parser): if args.instrumentation is None: - parser.error("argument instr (-i) is required to run the client") + parser.error("argument instr (-i) is required to run the client") try_kill(".server.pid") - s_jar = args.disl_home+"/build/disl-server.jar" - s_class = "ch.usi.dag.dislserver.DiSLServer" + s_jar = args.disl_home+"/lib/disl-server.jar" + s_class = "ch.usi.dag.dislserver.DiSLServer" s_cmd = ["java"] s_cmd+= args.s_opts @@ -435,12 +436,12 @@ def run_server(args, parser): ###################################################################### def run_evaluation(args, parser): if args.instrumentation is None: - parser.error("argument instr (-i) is required to run the client") + parser.error("argument instr (-i) is required to run the client") try_kill(".evaluation.pid") - e_jar = args.disl_home+"/build/dislre-server.jar" - e_class = "ch.usi.dag.dislreserver.DiSLREServer" + e_jar = args.disl_home+"/lib/dislre-server.jar" + e_class = "ch.usi.dag.dislreserver.DiSLREServer" e_cmd = ["java"] e_cmd+= args.s_opts @@ -464,15 +465,15 @@ def run_evaluation(args, parser): ###################################################################### def run_client(args, parser): if args.c_app is None: - parser.error("argument app (-c_app) is required to run the client") + parser.error("argument app (-c_app) is required to run the client") if args.instrumentation is None: - parser.error("argument instr (-i) is required to run the client") + parser.error("argument instr (-i) is required to run the client") - cagent = args.disl_home+"/build/libdislagent"+lib_suffix() - eagent = args.disl_home+"/build/libdislreagent"+lib_suffix() - jagent = args.disl_home+"/build/disl-agent.jar" - dispatch = args.disl_home+"/build/dislre-dispatch.jar" + cagent = args.disl_home+"/lib/libdislagent"+lib_suffix() + eagent = args.disl_home+"/lib/libdislreagent"+lib_suffix() + jagent = args.disl_home+"/lib/disl-agent.jar" + dispatch = args.disl_home+"/lib/dislre-dispatch.jar" c_cmd = ["java"] c_cmd+= args.c_opts @@ -492,7 +493,7 @@ def run_client(args, parser): #print c_cmd - client = run(c_cmd, args.c_out, args.c_err) + client = run(c_cmd, args.c_out, args.c_err) client.wait() # let server and evaluation finish @@ -532,6 +533,7 @@ def main(): ###################################################################### # ENTRY_POINT ###################################################################### + if __name__ == "__main__": main() diff --git a/build.properties b/build.properties index 34d88e8c..ca0bb978 100644 --- a/build.properties +++ b/build.properties @@ -1,34 +1,60 @@ +lib.dir=lib + asm.lib=asm-debug-all-4.1.jar -asm.path=lib/${asm.lib} +asm.path=${lib.dir}/${asm.lib} junit.core.lib=junit-4.11.jar -junit.core.path=lib/${junit.core.lib} +junit.core.path=${lib.dir}/${junit.core.lib} junit.hamcrest.lib=hamcrest-core-1.3.jar -junit.hamcrest.path=lib/${junit.hamcrest.lib} +junit.hamcrest.path=${lib.dir}/${junit.hamcrest.lib} ant-contrib.lib=ant-contrib-0.6.jar ant-contrib.resource=net/sf/antcontrib/antlib.xml -ant-contrib.path=lib/${ant-contrib.lib} +ant-contrib.path=${lib.dir}/${ant-contrib.lib} + +src.bin=bin src.disl=src -src.dynbypass=src-dynbypass -src.dynbypass.act=src-dynbypass-act -src.agent.java=src-agent-java -src.agent.c=src-agent-c -src.reserver=src-re-server -src.redispatch=src-re-disp -src.reagent=src-re-agent +src.disl.bypass=src-dynbypass +src.disl.bypass.dynamic=src-dynbypass-act +src.disl.agent=src-agent-c +src.disl.agent.java=src-agent-java +src.shvm=src-re-server +src.shvm.dispatch=src-re-disp +src.shvm.agent=src-re-agent src.test=src-test src.util=src-util +src.doc=doc +src.doc.jdoc=${src.doc}/javadoc +src.doc.intro=${src.doc}/intro +src.examples=examples + + +out.dir=output -bin=bin -build=build -build.thread=build-thread -build.afterbootstrap=build-abs -build.test=build-test -dist=dist -test=test +build=${out.dir}/build +build.util=${build}/util +build.disl=${build}/disl +build.disl.thread=${build.disl}-thread +build.disl.bypass=${build.disl}-bypass +build.disl.agent.java=${build.disl}-agent +build.shvm=${build}/shvm +build.shvm.dispatch=${build.shvm}-dispatch +build.test=${build}/test +build.test.jars=${build.test}-jars +build.doc=${build}/doc +build.doc.intro=${build.doc}-intro -extendedthread.path=${build}/extendedthread.jar +dist=${out.dir}/dist +dist.bin=${dist}/bin +dist.lib=${dist}/lib +dist.doc=${dist}/doc +dist.doc.jdoc=${dist.doc}/javadoc +dist.doc.intro=${dist.doc}/intro +dist.examples=${dist}/examples -instr.jar.name=disl-instr.jar +release=${out.dir}/release +release.bin.zip=${release}/disl-${disl.version}-bin.zip +release.bin.tar=${release}/disl-${disl.version}-bin.tar.bz2 +release.src.zip=${release}/disl-${disl.version}-src.zip +release.src.tar=${release}/disl-${disl.version}-src.tar.bz2 diff --git a/build.xml b/build.xml index b30c6e93..363063f0 100644 --- a/build.xml +++ b/build.xml @@ -1,137 +1,233 @@ - + - + - - + + + + + + + + + + + + + + + + + + + + + + + + - + - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - + + + - - + + + + + - - - - - - - - - - - - - - + + + + + + - - - - + + + + + - - - - - - - - - + - - - + + + + + + - - - + + + + + + + + + + + + + + + - - - - + + + + + + - - - + + + + + + + + + + + - - - + + + + + + - - - - - + + + + + + - - - - + + + - - - - - - - - + - - + + + + + + + - - + + + @@ -140,261 +236,384 @@ - - - + + + + - - - - - - - - + + - - - - + - - + + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + - - - - - - - - + - - - - - - - - + + + + + + + + + + + - - - - - - - + + + + + + - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + - - - - - - - - + + + + + + + + - + - - + + - - - - - - + + + + + + - - - - - - - - - + + + + + + + + - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + - - - - - + + + - - + + Running a single test suite: ${test.name} + + + + + Running all tests. + + + + + + - - + - + + + + + + + + + + + + + + + + - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/doc-intro/dislintro.tex b/doc/intro/dislintro.tex similarity index 100% rename from doc-intro/dislintro.tex rename to doc/intro/dislintro.tex diff --git a/doc-intro/fig/architecture.eps b/doc/intro/fig/architecture.eps similarity index 100% rename from doc-intro/fig/architecture.eps rename to doc/intro/fig/architecture.eps diff --git a/doc-intro/fig/overview.eps b/doc/intro/fig/overview.eps similarity index 100% rename from doc-intro/fig/overview.eps rename to doc/intro/fig/overview.eps diff --git a/doc/overview.html b/doc/javadoc/overview.html similarity index 100% rename from doc/overview.html rename to doc/javadoc/overview.html diff --git a/logo/disl.svg b/doc/logo/disl.svg similarity index 100% rename from logo/disl.svg rename to doc/logo/disl.svg diff --git a/logo/disl.xcf b/doc/logo/disl.xcf similarity index 100% rename from logo/disl.xcf rename to doc/logo/disl.xcf diff --git a/logo/disl2.svg b/doc/logo/disl2.svg similarity index 100% rename from logo/disl2.svg rename to doc/logo/disl2.svg diff --git a/logo/orig/mil.jpg b/doc/logo/orig/mil.jpg similarity index 100% rename from logo/orig/mil.jpg rename to doc/logo/orig/mil.jpg diff --git a/example/build.properties b/example/build.properties deleted file mode 100644 index cb81a19a..00000000 --- a/example/build.properties +++ /dev/null @@ -1,10 +0,0 @@ -lib.path=../../../build - -dislserver.path=${lib.path}/disl-server.jar -dislre.server.path=${lib.path}/dislre-server.jar -dislre.dispatch.path=${lib.path}/dislre-dispatch.jar - -asm.lib=asm-debug-all-4.0.jar -asm.path=${lib.path}/${asm.lib} - -instr.jar.name=disl-instr.jar diff --git a/example/dispatch/app/build.xml b/example/dispatch/app/build.xml deleted file mode 100644 index e1100058..00000000 --- a/example/dispatch/app/build.xml +++ /dev/null @@ -1,23 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - diff --git a/example/dispatch/build.xml b/example/dispatch/build.xml deleted file mode 100644 index 76e997f2..00000000 --- a/example/dispatch/build.xml +++ /dev/null @@ -1,25 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/example/dispatch/instr/build.xml b/example/dispatch/instr/build.xml deleted file mode 100644 index b3b4ec3a..00000000 --- a/example/dispatch/instr/build.xml +++ /dev/null @@ -1,33 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/example/dynamic/app/build.xml b/example/dynamic/app/build.xml deleted file mode 100644 index e1100058..00000000 --- a/example/dynamic/app/build.xml +++ /dev/null @@ -1,23 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - diff --git a/example/dynamic/build.xml b/example/dynamic/build.xml deleted file mode 100644 index 22bfd4a5..00000000 --- a/example/dynamic/build.xml +++ /dev/null @@ -1,22 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - diff --git a/example/dynamic/instr/build.xml b/example/dynamic/instr/build.xml deleted file mode 100644 index c131580f..00000000 --- a/example/dynamic/instr/build.xml +++ /dev/null @@ -1,31 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/example/guard/app/build.xml b/example/guard/app/build.xml deleted file mode 100644 index e1100058..00000000 --- a/example/guard/app/build.xml +++ /dev/null @@ -1,23 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - diff --git a/example/guard/build.xml b/example/guard/build.xml deleted file mode 100644 index 22bfd4a5..00000000 --- a/example/guard/build.xml +++ /dev/null @@ -1,22 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - diff --git a/example/guard/instr/build.xml b/example/guard/instr/build.xml deleted file mode 100644 index c131580f..00000000 --- a/example/guard/instr/build.xml +++ /dev/null @@ -1,31 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/example/marker/app/build.xml b/example/marker/app/build.xml deleted file mode 100644 index e1100058..00000000 --- a/example/marker/app/build.xml +++ /dev/null @@ -1,23 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - diff --git a/example/marker/build.xml b/example/marker/build.xml deleted file mode 100644 index 22bfd4a5..00000000 --- a/example/marker/build.xml +++ /dev/null @@ -1,22 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - diff --git a/example/marker/instr/build.xml b/example/marker/instr/build.xml deleted file mode 100644 index c131580f..00000000 --- a/example/marker/instr/build.xml +++ /dev/null @@ -1,31 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/example/scope/app/build.xml b/example/scope/app/build.xml deleted file mode 100644 index e1100058..00000000 --- a/example/scope/app/build.xml +++ /dev/null @@ -1,23 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - diff --git a/example/scope/build.xml b/example/scope/build.xml deleted file mode 100644 index 22bfd4a5..00000000 --- a/example/scope/build.xml +++ /dev/null @@ -1,22 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - diff --git a/example/scope/instr/build.xml b/example/scope/instr/build.xml deleted file mode 100644 index c131580f..00000000 --- a/example/scope/instr/build.xml +++ /dev/null @@ -1,31 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/example/smoke/app/build.xml b/example/smoke/app/build.xml deleted file mode 100644 index e1100058..00000000 --- a/example/smoke/app/build.xml +++ /dev/null @@ -1,23 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - diff --git a/example/smoke/build.xml b/example/smoke/build.xml deleted file mode 100644 index 22bfd4a5..00000000 --- a/example/smoke/build.xml +++ /dev/null @@ -1,22 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - diff --git a/example/smoke/instr/build.xml b/example/smoke/instr/build.xml deleted file mode 100644 index c131580f..00000000 --- a/example/smoke/instr/build.xml +++ /dev/null @@ -1,31 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/example/static/app/build.xml b/example/static/app/build.xml deleted file mode 100644 index e1100058..00000000 --- a/example/static/app/build.xml +++ /dev/null @@ -1,23 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - diff --git a/example/static/build.xml b/example/static/build.xml deleted file mode 100644 index 22bfd4a5..00000000 --- a/example/static/build.xml +++ /dev/null @@ -1,22 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - diff --git a/example/static/instr/build.xml b/example/static/instr/build.xml deleted file mode 100644 index c131580f..00000000 --- a/example/static/instr/build.xml +++ /dev/null @@ -1,31 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/example/README b/examples/README similarity index 78% rename from example/README rename to examples/README index 46480dd5..5c880a51 100644 --- a/example/README +++ b/examples/README @@ -1,17 +1,17 @@ ================================================================================ = DiSL SETUP EXAMPLE ================================================================================ -These simple examples illustrates a basic instrumentation setup. It shows, how -the instrumentation should be packaged and contains a scripts that should ease -running DiSL together with your program. -They can be also used as a quick start. +These examples demonstrate fthe basic features of DiSL. In addition, they +provide guidelines on how to package the instrumentation classes and how to run +the instrumented application using a simple launcher script that takes care of +starting the necessary Java virtual machines. -These examples demonstrates following features of DiSL. -------------------------------------------------------------------------------- -- smoke -------------------------------------------------------------------------------- + The simplest of the examples. The application prints a "hello" message from the main and exits while DiSL instruments the entry and exit of the main method and prints more text around the "hello". @@ -20,9 +20,11 @@ The code in the function annotated with "@After" and "@Before" is a snippet. That's the code that is according to information specified in the annotation instrumented into the client application class' code. + -------------------------------------------------------------------------------- -- scope -------------------------------------------------------------------------------- + This example demonstrates the scoping features. That means the ways how can the instrumentation application filter application methods based on class-name, method-name, parameter-types and return-type and instrument just the right @@ -30,20 +32,22 @@ methods. For example those from specified package, class or just those returning the right types or accepting the right parameters or a combination of these + -------------------------------------------------------------------------------- -- marker -------------------------------------------------------------------------------- + This example shows how to place instrumentation code on different locations across methods. That means one can, using scopes, declare methods that should be processed. But the marker enables to specify where exactly the code should -be placed. +be placed. The code might be added at the method body level (BodyMarker), basic block level (BasicBlockMarker) or even instruction level (e.g. MethodInvocationMarker). The marker essentially splits the method body into instrumentation regions. There are some already predefined markers but custom markers might be created. Creation of custom marker is also shown in the -example. +example. The marker basically goes trough (scoped) method code and whenever it finds a region between two instruction interesting it marks it. However, the marker @@ -54,16 +58,20 @@ Then there are region specifiers. They specifiy at which entry or exit of the region the code should be placed. There is (After), (Before), (AfterReturning), (AfterThrow). + -------------------------------------------------------------------------------- -- guard -------------------------------------------------------------------------------- + This is another way to select a region for instrumentation. A snippet annotation might specify a guard class that has a guard method which decides whether a snippet will or will not be included. + -------------------------------------------------------------------------------- -- static -------------------------------------------------------------------------------- + This example shows how to use a static context information in snippets or guard methods. A static context is information derived from the original method's code. There are multiples classes implementing "StaticContext" interface that @@ -76,9 +84,11 @@ order that can be used in the snippet. For example static context might tell how many instructions there are in the method or if it contains a loop. + -------------------------------------------------------------------------------- -- dynamic -------------------------------------------------------------------------------- + This example shows how snippets can use also runtime information. For example values of local variables, object instance in member methods, method arguments or current exceptions. @@ -87,46 +97,52 @@ or current exceptions. -------------------------------------------------------------------------------- -- dispatch -------------------------------------------------------------------------------- + This example shows how to evaluate instrumented code on evaluation jvm. For -more details try running this example directly using disl.py and supplying +more details try running this example directly using "disl.py" and supplying 'c_out' and 'e_out' options. ================================================================================ -= HOW TO RUN THE EXAMPLE += HOW TO RUN THE EXAMPLES ================================================================================ -First be sure that you compiled DiSL (see README in the root directory). Then -follow the steps: -Enter the examples directory, for example "smoke". +If you have downloaded a binary DiSL distribution, enter the "examples" +directory. If you are using a source DiSL distribution, first compile DiSL by +running "ant" in the top-level directory (see README), then enter the +"output/dist/examples" directory. -Then the easiest way to run the example is to execute "ant run". +Choose an example you want to run, for example "smoke", and enter the +corresponding directory. To run the example, just execute "ant run". -This command builds and packs the application and the instrumentation -application. And then starts the instrumentation server and later on also the -application +This command builds and packages the application and the instrumentation +classes and then, using the laucher script, starts the DiSL instrumentation +server and later on the application VM. The output of the application and the applied instrumentation should be visible -on command line. +on the console. -When compiled the example can be also run using "disl.py" script directly. This -enables more detailed settings. To learn more about this run "./disl.py -h" +When compiled, the example can be also run using the "disl.py" launcher script +found in the "bin" directory, which allows specifying more options. To learn +more about the launcher script, run "disl.py -h" in the "bin" directory. ================================================================================ = NOTE ================================================================================ -If you want to use "disl.py" to run your application, don't forget to set -"DISL_HOME" variable correctly or it can be specified to "disl.py" at command -line or inside the script as a default value. + +If you want to use "disl.py" to run your application, don't forget to either +set the DISL_HOME variable, or use the "-d" option to pass the DiSL home +directory to the "disl.py" launcher script. ================================================================================ = NOTE ================================================================================ + If you want to include use some library in your instrumentation you should insert it directly to the instrumentation jar using jarjar. http://code.google.com/p/jarjar/ -Other option is to provide library's classpath to the "disl.py" utility. - +Alternatively, you can provide the library's classpath to the "disl.py" +utility. diff --git a/examples/build-example.xml b/examples/build-example.xml new file mode 100644 index 00000000..dfc044d0 --- /dev/null +++ b/examples/build-example.xml @@ -0,0 +1,68 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/examples/build.properties b/examples/build.properties new file mode 100644 index 00000000..c0d6b083 --- /dev/null +++ b/examples/build.properties @@ -0,0 +1,20 @@ +disl.home=.. +lib.path=${disl.home}/lib +bin.path=${disl.home}/bin + +disl.server.path=${lib.path}/disl-server.jar +shvm.server.path=${lib.path}/dislre-server.jar +shvm.dispatch.path=${lib.path}/dislre-dispatch.jar + +asm.version=4.1 +asm.path=${lib.path}/asm-debug-all-${asm.version}.jar + +src.app=src-app +src.inst=src-inst + +build=build +build.app=${build}/app +build.inst=${build}/inst + +app.jar.name=example-app.jar +inst.jar.name=example-inst.jar diff --git a/example/build.xml b/examples/build.xml similarity index 100% rename from example/build.xml rename to examples/build.xml diff --git a/examples/dispatch/build.xml b/examples/dispatch/build.xml new file mode 100644 index 00000000..56f417ec --- /dev/null +++ b/examples/dispatch/build.xml @@ -0,0 +1,3 @@ + + + diff --git a/example/dispatch/app/src/Main.java b/examples/dispatch/src-app/Main.java similarity index 100% rename from example/dispatch/app/src/Main.java rename to examples/dispatch/src-app/Main.java diff --git a/example/dispatch/instr/src/CodeExecuted.java b/examples/dispatch/src-inst/CodeExecuted.java similarity index 100% rename from example/dispatch/instr/src/CodeExecuted.java rename to examples/dispatch/src-inst/CodeExecuted.java diff --git a/example/dispatch/instr/src/CodeExecutedRE.java b/examples/dispatch/src-inst/CodeExecutedRE.java similarity index 100% rename from example/dispatch/instr/src/CodeExecutedRE.java rename to examples/dispatch/src-inst/CodeExecutedRE.java diff --git a/example/dispatch/instr/src/CodeLengthSC.java b/examples/dispatch/src-inst/CodeLengthSC.java similarity index 100% rename from example/dispatch/instr/src/CodeLengthSC.java rename to examples/dispatch/src-inst/CodeLengthSC.java diff --git a/example/dispatch/instr/src/DiSLClass.java b/examples/dispatch/src-inst/DiSLClass.java similarity index 100% rename from example/dispatch/instr/src/DiSLClass.java rename to examples/dispatch/src-inst/DiSLClass.java diff --git a/example/dispatch/instr/src/MANIFEST.MF b/examples/dispatch/src-inst/MANIFEST.MF similarity index 100% rename from example/dispatch/instr/src/MANIFEST.MF rename to examples/dispatch/src-inst/MANIFEST.MF diff --git a/examples/dynamic/build.xml b/examples/dynamic/build.xml new file mode 100644 index 00000000..56f417ec --- /dev/null +++ b/examples/dynamic/build.xml @@ -0,0 +1,3 @@ + + + diff --git a/example/dynamic/app/src/Main.java b/examples/dynamic/src-app/Main.java similarity index 100% rename from example/dynamic/app/src/Main.java rename to examples/dynamic/src-app/Main.java diff --git a/example/dynamic/instr/src/DiSLClass.java b/examples/dynamic/src-inst/DiSLClass.java similarity index 100% rename from example/dynamic/instr/src/DiSLClass.java rename to examples/dynamic/src-inst/DiSLClass.java diff --git a/example/dynamic/instr/src/MANIFEST.MF b/examples/dynamic/src-inst/MANIFEST.MF similarity index 100% rename from example/dynamic/instr/src/MANIFEST.MF rename to examples/dynamic/src-inst/MANIFEST.MF diff --git a/examples/guard/build.xml b/examples/guard/build.xml new file mode 100644 index 00000000..56f417ec --- /dev/null +++ b/examples/guard/build.xml @@ -0,0 +1,3 @@ + + + diff --git a/example/guard/app/src/Main.java b/examples/guard/src-app/Main.java similarity index 100% rename from example/guard/app/src/Main.java rename to examples/guard/src-app/Main.java diff --git a/example/guard/instr/src/DiSLClass.java b/examples/guard/src-inst/DiSLClass.java similarity index 100% rename from example/guard/instr/src/DiSLClass.java rename to examples/guard/src-inst/DiSLClass.java diff --git a/example/guard/instr/src/GuardNo.java b/examples/guard/src-inst/GuardNo.java similarity index 100% rename from example/guard/instr/src/GuardNo.java rename to examples/guard/src-inst/GuardNo.java diff --git a/example/guard/instr/src/GuardYes.java b/examples/guard/src-inst/GuardYes.java similarity index 100% rename from example/guard/instr/src/GuardYes.java rename to examples/guard/src-inst/GuardYes.java diff --git a/example/guard/instr/src/MANIFEST.MF b/examples/guard/src-inst/MANIFEST.MF similarity index 100% rename from example/guard/instr/src/MANIFEST.MF rename to examples/guard/src-inst/MANIFEST.MF diff --git a/example/guard/instr/src/MethodInvocationMarker.java b/examples/guard/src-inst/MethodInvocationMarker.java similarity index 100% rename from example/guard/instr/src/MethodInvocationMarker.java rename to examples/guard/src-inst/MethodInvocationMarker.java diff --git a/examples/marker/build.xml b/examples/marker/build.xml new file mode 100644 index 00000000..56f417ec --- /dev/null +++ b/examples/marker/build.xml @@ -0,0 +1,3 @@ + + + diff --git a/example/marker/app/src/Main.java b/examples/marker/src-app/Main.java similarity index 100% rename from example/marker/app/src/Main.java rename to examples/marker/src-app/Main.java diff --git a/example/marker/instr/src/DiSLClass.java b/examples/marker/src-inst/DiSLClass.java similarity index 100% rename from example/marker/instr/src/DiSLClass.java rename to examples/marker/src-inst/DiSLClass.java diff --git a/example/marker/instr/src/MANIFEST.MF b/examples/marker/src-inst/MANIFEST.MF similarity index 100% rename from example/marker/instr/src/MANIFEST.MF rename to examples/marker/src-inst/MANIFEST.MF diff --git a/example/marker/instr/src/MethodInvocationMarker.java b/examples/marker/src-inst/MethodInvocationMarker.java similarity index 100% rename from example/marker/instr/src/MethodInvocationMarker.java rename to examples/marker/src-inst/MethodInvocationMarker.java diff --git a/examples/scope/build.xml b/examples/scope/build.xml new file mode 100644 index 00000000..56f417ec --- /dev/null +++ b/examples/scope/build.xml @@ -0,0 +1,3 @@ + + + diff --git a/example/scope/app/src/Main.java b/examples/scope/src-app/Main.java similarity index 100% rename from example/scope/app/src/Main.java rename to examples/scope/src-app/Main.java diff --git a/example/scope/app/src/my/ClassTest.java b/examples/scope/src-app/my/ClassTest.java similarity index 100% rename from example/scope/app/src/my/ClassTest.java rename to examples/scope/src-app/my/ClassTest.java diff --git a/example/scope/app/src/my/pkg/ClassBigTest.java b/examples/scope/src-app/my/pkg/ClassBigTest.java similarity index 100% rename from example/scope/app/src/my/pkg/ClassBigTest.java rename to examples/scope/src-app/my/pkg/ClassBigTest.java diff --git a/example/scope/app/src/my/pkg/ClassTest.java b/examples/scope/src-app/my/pkg/ClassTest.java similarity index 100% rename from example/scope/app/src/my/pkg/ClassTest.java rename to examples/scope/src-app/my/pkg/ClassTest.java diff --git a/example/scope/instr/src/DiSLClass.java b/examples/scope/src-inst/DiSLClass.java similarity index 100% rename from example/scope/instr/src/DiSLClass.java rename to examples/scope/src-inst/DiSLClass.java diff --git a/example/scope/instr/src/MANIFEST.MF b/examples/scope/src-inst/MANIFEST.MF similarity index 100% rename from example/scope/instr/src/MANIFEST.MF rename to examples/scope/src-inst/MANIFEST.MF diff --git a/examples/smoke/build.xml b/examples/smoke/build.xml new file mode 100644 index 00000000..56f417ec --- /dev/null +++ b/examples/smoke/build.xml @@ -0,0 +1,3 @@ + + + diff --git a/example/smoke/app/src/Main.java b/examples/smoke/src-app/Main.java similarity index 100% rename from example/smoke/app/src/Main.java rename to examples/smoke/src-app/Main.java diff --git a/example/smoke/instr/src/DiSLClass.java b/examples/smoke/src-inst/DiSLClass.java similarity index 100% rename from example/smoke/instr/src/DiSLClass.java rename to examples/smoke/src-inst/DiSLClass.java diff --git a/example/smoke/instr/src/MANIFEST.MF b/examples/smoke/src-inst/MANIFEST.MF similarity index 100% rename from example/smoke/instr/src/MANIFEST.MF rename to examples/smoke/src-inst/MANIFEST.MF diff --git a/examples/static/build.xml b/examples/static/build.xml new file mode 100644 index 00000000..56f417ec --- /dev/null +++ b/examples/static/build.xml @@ -0,0 +1,3 @@ + + + diff --git a/example/static/app/src/Main.java b/examples/static/src-app/Main.java similarity index 100% rename from example/static/app/src/Main.java rename to examples/static/src-app/Main.java diff --git a/example/static/instr/src/DiSLClass.java b/examples/static/src-inst/DiSLClass.java similarity index 100% rename from example/static/instr/src/DiSLClass.java rename to examples/static/src-inst/DiSLClass.java diff --git a/example/static/instr/src/DumbLoopContext.java b/examples/static/src-inst/DumbLoopContext.java similarity index 100% rename from example/static/instr/src/DumbLoopContext.java rename to examples/static/src-inst/DumbLoopContext.java diff --git a/example/static/instr/src/DumbLoopGuard.java b/examples/static/src-inst/DumbLoopGuard.java similarity index 100% rename from example/static/instr/src/DumbLoopGuard.java rename to examples/static/src-inst/DumbLoopGuard.java diff --git a/example/static/instr/src/MANIFEST.MF b/examples/static/src-inst/MANIFEST.MF similarity index 100% rename from example/static/instr/src/MANIFEST.MF rename to examples/static/src-inst/MANIFEST.MF diff --git a/src-agent-c/Makefile b/src-agent-c/Makefile index 1194e66b..c6bf6f8e 100644 --- a/src-agent-c/Makefile +++ b/src-agent-c/Makefile @@ -3,8 +3,6 @@ ifneq (, $(wildcard javahome/var)) include javahome/var endif -BUILDDIR=../build - # Source lists LIBNAME=dislagent SOURCES=dislagent.c @@ -42,8 +40,8 @@ ifeq ($(DEBUG), TRUE) CFLAGS += -DDEBUG endif -build: $(LIBRARY) - cp $(LIBRARY) $(BUILDDIR) + +all: $(LIBRARY) # Build native library $(LIBRARY): $(OBJECTS) @@ -55,5 +53,3 @@ clean: debug: $(MAKE) DEBUG=TRUE - -all: build diff --git a/src-re-agent/Makefile b/src-re-agent/Makefile index a1d9bf3d..3a9d53a0 100644 --- a/src-re-agent/Makefile +++ b/src-re-agent/Makefile @@ -3,8 +3,6 @@ ifneq (, $(wildcard javahome/var)) include javahome/var endif -BUILDDIR=../build - # Source lists LIBNAME=dislreagent SOURCES=dislreagent.c @@ -46,8 +44,7 @@ ifneq ($(DEBUGFULL),) CFLAGS += -DDEBUG -DDEBUGANL -g3 endif -build: $(LIBRARY) - cp $(LIBRARY) $(BUILDDIR) +all: $(LIBRARY) # Build native library $(LIBRARY): $(OBJECTS) @@ -62,5 +59,3 @@ debug: debugfull: $(MAKE) DEBUGFULL=TRUE - -all: build diff --git a/src-test/ch/usi/dag/disl/test/utils/Runner.java b/src-test/ch/usi/dag/disl/test/utils/Runner.java index 90eaaeeb..21d17678 100644 --- a/src-test/ch/usi/dag/disl/test/utils/Runner.java +++ b/src-test/ch/usi/dag/disl/test/utils/Runner.java @@ -3,6 +3,7 @@ package ch.usi.dag.disl.test.utils; import static java.util.concurrent.TimeUnit.SECONDS; import java.io.File; +import java.io.FileNotFoundException; import java.io.IOException; import java.util.LinkedList; import java.util.List; @@ -20,22 +21,22 @@ public abstract class Runner { protected static final String _ENV_JAVA_HOME_ = "JAVA_HOME"; protected static final String _JAVA_COMMAND_ = __getJavaCommand (); - protected static final File _DISL_BUILD_DIR_ = new File ("build"); - protected static final File _DISL_AGENT_JAR_ = new File (_DISL_BUILD_DIR_, "disl-agent.jar"); - protected static final File _DISL_AGENT_LIB_ = new File (_DISL_BUILD_DIR_, "libdislagent.so"); + protected static final File _DISL_LIB_DIR_ = new File (System.getProperty ("disl.lib.dir", "lib")); + protected static final File _DISL_AGENT_JAR_ = new File (_DISL_LIB_DIR_, "disl-agent.jar"); + protected static final File _DISL_AGENT_LIB_ = new File (_DISL_LIB_DIR_, System.getProperty ("disl.agent.lib", "libdislagent.so")); - protected static final File _DISL_SERVER_JAR_ = new File (_DISL_BUILD_DIR_, "disl-server.jar"); + protected static final File _DISL_SERVER_JAR_ = new File (_DISL_LIB_DIR_, "disl-server.jar"); protected static final Class _DISL_SERVER_MAIN_CLASS_ = DiSLServer.class; - protected static final File _DISL_RE_AGENT_LIB_ = new File (_DISL_BUILD_DIR_, "libdislreagent.so"); - protected static final File _DISL_RE_DISPATCH_JAR_ = new File (_DISL_BUILD_DIR_, "dislre-dispatch.jar"); + protected static final File _DISL_RE_AGENT_LIB_ = new File (_DISL_LIB_DIR_, System.getProperty ("shvm.agent.lib", "libdislreagent.so")); + protected static final File _DISL_RE_DISPATCH_JAR_ = new File (_DISL_LIB_DIR_, "dislre-dispatch.jar"); - protected static final File _DISL_RE_SERVER_JAR_ = new File (_DISL_BUILD_DIR_, "dislre-server.jar"); + protected static final File _DISL_RE_SERVER_JAR_ = new File (_DISL_LIB_DIR_, "dislre-server.jar"); protected static final Class _DISL_RE_SERVER_MAIN_CLASS_ = DiSLREServer.class; // - protected static final File _TEST_BUILD_DIR_ = new File ("build-test"); + protected static final File _TEST_LIB_DIR_ = new File (System.getProperty ("test.lib.dir", "test-jars")); static final boolean TEST_DEBUG = Boolean.getBoolean ("disl.test.debug"); // @@ -68,15 +69,27 @@ public abstract class Runner { // public void start () throws IOException { - final File testInstrJar = new File ( - _TEST_BUILD_DIR_, String.format ("disl-instr-%s.jar", __testName) + final File testInstJar = new File ( + _TEST_LIB_DIR_, String.format ("%s-inst.jar", __testName) ); + if (!testInstJar.exists ()) { + throw new FileNotFoundException (String.format ( + "instrumentation jar not found: %s", testInstJar.toString () + )); + } + final File testAppJar = new File ( - _TEST_BUILD_DIR_, String.format ("disl-app-%s.jar", __testName) + _TEST_LIB_DIR_, String.format ("%s-app.jar", __testName) ); - _start (testInstrJar, testAppJar); + if (!testAppJar.exists ()) { + throw new FileNotFoundException (String.format ( + "application jar not found: %s", testAppJar.toString () + )); + } + + _start (testInstJar, testAppJar); } protected abstract void _start ( -- GitLab