Presentation is loading. Please wait.

Presentation is loading. Please wait.

PRESTO: Program Analyses and Software Tools Research Group, Ohio State University Regression Test Selection for AspectJ Software Guoqing Xu and Atanas.

Similar presentations


Presentation on theme: "PRESTO: Program Analyses and Software Tools Research Group, Ohio State University Regression Test Selection for AspectJ Software Guoqing Xu and Atanas."— Presentation transcript:

1 PRESTO: Program Analyses and Software Tools Research Group, Ohio State University Regression Test Selection for AspectJ Software Guoqing Xu and Atanas Rountev Ohio State University ICSE’07

2 PRESTO: Program Analyses and Software Tools Research Group, Ohio State University 2 Outline  Background and motivation - Regression test selection - AspectJ semantics and challenges  Contributions - A control-flow representation for AspectJ software - A graph traversal algorithm for test selection - Experimental evaluation  Conclusions

3 PRESTO: Program Analyses and Software Tools Research Group, Ohio State University 3 Regression Test Selection  Select a safe subset of regression tests  Harrold et al., OOPSLA 01 - Java interclass graph (JIG): intra- and inter-procedural flow of control - Simultaneous JIG traversal for P and P' Program P Execute P and record coverage Program P Identify dangerous entities Program P' Select tests JIG edge coverage matrix Dangerous edges in P

4 PRESTO: Program Analyses and Software Tools Research Group, Ohio State University 4 Motivation and Challenges  Aspects can change dramatically the behavior of the original code  Why not select tests based on the woven bytecode? - The discrepancy between the source code and the bytecode can be significant - Compiler-specific artificial code - Shown in our experimental study  A more general question - What is an appropriate static representation for AspectJ software for regression test selection and other analyses?

5 PRESTO: Program Analyses and Software Tools Research Group, Ohio State University 5 AspectJ Semantics  Join points, pointcuts, and advices - before, around (with proceed), after  Shadow - Textual part of the program executed during the time span of a join point  Dynamic pointcut/advice: triggered only when certain run-time conditions hold - if …  Advice precedence rules

6 PRESTO: Program Analyses and Software Tools Research Group, Ohio State University 6 Running Example class Point { int x; void setX(int x) { this.x = x; } static void main(String[] a) { Point p = new Point(); p.setX(10); } } aspect BoundPoint { pointcut setterX(Point p) : call(void Point.setX(*)) && target(p); … // advices } /* before1 */ before(Point p, int x) : setterX(p) && args(x) throws … { … if (…) throw ex … } /* around1 */ void around(Point p, int x) : setterX(p) && args(x) && if(x==0) { … proceed(p,x); … } /* before2 */ before(Point p) : setterX(p) { … } /* after1 */ after(Point p) : setterX(p) { … }

7 PRESTO: Program Analyses and Software Tools Research Group, Ohio State University 7 AspectJ Semantic try { before1(); if (x==0) around1(); else { before2(); p.setX(); } } catch(Throwable e) { after1(); throw e; } after1(); around1() { before2(); p.setX(); } main(…) { … p.setX(10); … }

8 PRESTO: Program Analyses and Software Tools Research Group, Ohio State University 8 Control-Flow Representation  AspectJ Inter-module Graph (AJIG) - JIG-like representation for “ normal ” calls  No join points - New representation for interactions at join points  Interaction graph  Multiple advices applicable at a join point - Model complex interactions among multiple advices  Dynamic advices - E.g. model the invocation of around1 in the example  void around(Point p, int x) : … if(x==0)

9 PRESTO: Program Analyses and Software Tools Research Group, Ohio State University 9 Multiple Advice Invocation  Input: a list of advices that statically match a shadow  Sort the list using precedence rules, taking into account the shadow - before1, around1, before2, p.setX, after1  Build advice nesting tree - Create a root node, and put every advice under root - Scan the list, build around subtrees; advices that are invoked within an around advice A are the children of A - Parent-child relationships represent nesting of advice time span

10 PRESTO: Program Analyses and Software Tools Research Group, Ohio State University 10 Advice Nesting Tree before1 root before1 around1 before2 p.setX after1 around1 before2 p.setX after1

11 PRESTO: Program Analyses and Software Tools Research Group, Ohio State University 11 Modeling of “ proceed ”  Important observation - Advices at one level are invoked by the call to proceed in their parent advice  Introduction of placeholder methods ph_* - A call to a ph_proceed represents a call to proceed - ph_root is called to replace the shadow - The CFG for a ph_proceed method contains a sequence of call/return nodes pairs for all advices that are invoked by proceed

12 PRESTO: Program Analyses and Software Tools Research Group, Ohio State University 12 root around1 before2 p.setX before1 after1

13 PRESTO: Program Analyses and Software Tools Research Group, Ohio State University 13 Handling of After Advices  Normal subgraph - {after1}  Exceptional subgraph - {after1} Normal subgraph Exceptional subgraph

14 PRESTO: Program Analyses and Software Tools Research Group, Ohio State University 14 Handling of Dynamic Advices  Challenges - No way to know whether a dynamic advice is invoked at run time - Advices that are nested within a dynamic around advice A are still invoked even if A is not invoked  Solutions - Introduce placeholder decision making nodes ph_decision - Create a ph_decision node before the call node of each dynamic advice

15 PRESTO: Program Analyses and Software Tools Research Group, Ohio State University 15 Example  Create a ph_decison node  Create a “T” edge going from ph_decison to the guarded advice  Create an “F” edge - For a non-around advice, link the edge to the next call node - For an around advice, link the edge to the call node of its ph_proceed - Redirect edges before1 return around1 return ph_decision T T F ph_proceed1 F F exit return

16 PRESTO: Program Analyses and Software Tools Research Group, Ohio State University 16 Graph Traversal Algorithm  Edge-level comparison for edges outside the interaction graph  Interaction graph comparison - Interprocedural traversal  Compare the calling structure  Schedule advice bodies for further processing - Intraprocedural comparison  Edge-level comparison for advice bodies

17 PRESTO: Program Analyses and Software Tools Research Group, Ohio State University 17 Inter-procedural traversal Case 1: if ad1 != ad2 e is dangerous

18 PRESTO: Program Analyses and Software Tools Research Group, Ohio State University 18 Inter-procedural traversal Case 2: e is dangerous

19 PRESTO: Program Analyses and Software Tools Research Group, Ohio State University 19 Inter-procedural traversal Case 3: if ad1 == ad2 e is dangerous else ‘T’ is dangerous 3a: if ad1 is non-around compare(e’’, e’) 3b: else compare(ph, e’)

20 PRESTO: Program Analyses and Software Tools Research Group, Ohio State University 20 Empirical Evaluation Subject#Shadows#versions#Tests bean11742 tracing 32545 Telecom 19641 quicksort 15324 nullcheck 146463 dcm 1103363 lod 359363

21 PRESTO: Program Analyses and Software Tools Research Group, Ohio State University 21 35% more 23.8% more

22 PRESTO: Program Analyses and Software Tools Research Group, Ohio State University 22 Study 1 (Cond.)  Compiler changes names of existing advices when adding a new advice  Compiler inlines an advice when removing some control flow paths from it  Compiler generates try-catch block, when adding an afterThrowing advice  Compiler inserts dynamic residue that performs run-time check before dynamic advice  Conclusion - These are not program changes - Such changes prevent JIG-based approach from selecting the changes only made in the source.

23 PRESTO: Program Analyses and Software Tools Research Group, Ohio State University 23 Study 2-Test Suite Reduction bean tracing telecom quicksort

24 PRESTO: Program Analyses and Software Tools Research Group, Ohio State University 24 Study 2-Test Suite Reduction nullcheckdcm loc JIG- 98.8% AJIG- 69.0%

25 PRESTO: Program Analyses and Software Tools Research Group, Ohio State University 25 Conclusions  Bytecode level analysis does not work for AspectJ program  A source code level control-flow representation AJIG - Multiple advice invocation - Dynamic advice  A graph traversal algorithm  Evaluation - Our approach outperforms the JIG-based approach

26 PRESTO: Program Analyses and Software Tools Research Group, Ohio State University 26  Questions?

27 PRESTO: Program Analyses and Software Tools Research Group, Ohio State University 27 Empirical Evaluation Subject#Shadows#versions#Tests%mc%ic bean11842100 tracing 32645100 Telecom 1974110075 quicksort 1542410095 nullcheck 14656354.176.6 dcm 110346354.253.8 lod 35946354.166 %ic = #dynamic interactions/#static interactions


Download ppt "PRESTO: Program Analyses and Software Tools Research Group, Ohio State University Regression Test Selection for AspectJ Software Guoqing Xu and Atanas."

Similar presentations


Ads by Google