Instrumenting AspectJ

69 views
Skip to first unread message

Francisco Servant

unread,
Jul 28, 2010, 3:22:54 PM7/28/10
to iBugs
Hello,

I can see in the Technical Report that for dynamic tools, we need to
instrument the Jars created in the folder 'org.aspectj/modules/aj-
build/jars/'.

However, in the README file for iBugs, it is said:
"Depending on the version of AspectJ, you will find the testing
drivers in folder 'org.aspectj/modules/aj-build/jars' in file 'testing-
drivers-all.jar', 'testing-drivers-test-all.jar' or 'run-all-junit-
tests-test-all.jar'. The jar file contains all test files and the
compiler itself."

My goal is to instrument just the AspectJ compiler that will be called
when I execute a single test case by calling 'gentestscript'. Also, I
want to exclude the testing source code from the instrumentation.

The way that I am doing this right now is instrumenting only the files
'testing-drivers-all.jar', 'testing-drivers-test-all.jar' or 'run-all-
junit-tests-test-all.jar' in all versions, and no other .jar file
inside the folder 'org.aspectj/modules/aj-build/jars/'.

Besides, I only instrument classes that follow these patterns:
"org.aspectj\..*" and "org.eclipse.ajdt\..*".
In order to exclude the classes that represent test cases, I exclude
these patterns: ".*test.*".

Is this the correct way to do it? Am I missing anything?



Finally, I am using Cobertura for instrumentation and I receive errors
when instrumenting some classes:

a) Errors saying that I should add debug info to classes which name
end up in $1.
I assume that these are abstract classes, so it is ok.

b) Errors saying that I should add debug info to classes of the
pattern "org.aspectj.org.objectweb.asm\..*"
I assume these are libraries and no AspectJ bugs will contain the
fault there, so it should be ok too.

c) 'java.util.zip.ZipException: duplicate entry' errors in many
classes
I assume this is ok too, because the class just exists twice and was
already instrumented.

Are these assumptions correct? Or shall I modify iBugs' scripts to
include the '-g' parameter in other places?


I guess that I ended up writing a double-checking email instead of a
questions email, but you would still help me a lot if you confirm
whether I am right or not.

Thank you!!
Francisco

Valentin Dallmeier

unread,
Jul 29, 2010, 5:16:49 AM7/29/10
to ib...@googlegroups.com
Hi!

On Wed, Jul 28, 2010 at 9:22 PM, Francisco Servant <fser...@ics.uci.edu> wrote:
> Hello,
>
> I can see in the Technical Report that for dynamic tools, we need to
> instrument the Jars created in the folder 'org.aspectj/modules/aj-
> build/jars/'.
>
> However, in the README file for iBugs, it is said:
> "Depending on the version of AspectJ, you will find the testing
> drivers in folder 'org.aspectj/modules/aj-build/jars' in file 'testing-
> drivers-all.jar', 'testing-drivers-test-all.jar' or 'run-all-junit-
> tests-test-all.jar'. The jar file contains all test files and the
> compiler itself."
>
> My goal is to instrument just the AspectJ compiler that will be called
> when I execute a single test case by calling 'gentestscript'. Also, I
> want to exclude the testing source code from the instrumentation.
>
> The way that I am doing this right now is instrumenting only the files
> 'testing-drivers-all.jar', 'testing-drivers-test-all.jar' or 'run-all-
> junit-tests-test-all.jar' in all versions, and no other .jar file
> inside the folder 'org.aspectj/modules/aj-build/jars/'.
>
> Besides, I only instrument classes that follow these patterns:
> "org.aspectj\..*" and "org.eclipse.ajdt\..*".
> In order to exclude the classes that represent test cases, I exclude
> these patterns: ".*test.*".
>
> Is this the correct way to do it? Am I missing anything?

It should work this way. I see no obvious flaws.

>
>
>
> Finally, I am using Cobertura for instrumentation and I receive errors
> when instrumenting some classes:
>
> a) Errors saying that I should add debug info to classes which name
> end up in $1.
>        I assume that these are abstract classes, so it is ok.

These are anonymous inner classes.

>
> b) Errors saying that I should add debug info to classes of the
> pattern "org.aspectj.org.objectweb.asm\..*"
>        I assume these are libraries and no AspectJ bugs will contain the
> fault there, so it should be ok too.

I did a quick grep over repository.xml and found no bugs fixed in asm classes:

cat repository.xml | grep "<file name=" | grep objectweb | wc -l
0

>
> c) 'java.util.zip.ZipException: duplicate entry' errors in many
> classes
>        I assume this is ok too, because the class just exists twice and was
> already instrumented.

This is a flaw of AspectJ's build process which includes classes
several times in a jar file. It should be safe to ignore those
messages.


>
> Are these assumptions correct? Or shall I modify iBugs' scripts to
> include the '-g' parameter in other places?

Except for the anonymous inner classes everything looks fine. I'm
unsure if you need to have debug information for those.

>
>
> I guess that I ended up writing a double-checking email instead of a
> questions email, but you would still help me a lot if you confirm
> whether I am right or not.

No problem. I'm always glad to help. Keep asking those questions as
they provide vital information for other users of iBUGS. I hope my
answers are helpful.

Valentin

Reply all
Reply to author
Forward
0 new messages