wtaop.ppt

483 views

Published on

0 Comments
0 Likes
Statistics
Notes
  • Be the first to comment

  • Be the first to like this

No Downloads
Views
Total views
483
On SlideShare
0
From Embeds
0
Number of Embeds
2
Actions
Shares
0
Downloads
12
Comments
0
Likes
0
Embeds 0
No embeds

No notes for slide
  • Does not have side effects on the objects that exist immediately before the advice is invoked.
  • wtaop.ppt

    1. 1. A Regression Test Selection Technique for Aspect-Oriented Programs Guoqing Xu The Ohio State University [email_address]
    2. 2. Outline <ul><li>background </li></ul><ul><li>Problem statement and motivation </li></ul><ul><li>Our analysis </li></ul><ul><li>Implementation status </li></ul><ul><li>Related work </li></ul>
    3. 3. Regression Test Selection <ul><li>Testing after software modifications </li></ul><ul><li>Re-running the entire regression test suite is expensive </li></ul><ul><li>Select a subset of tests to run </li></ul><ul><li>Safe test selection chooses every test case that may reveal a fault </li></ul>
    4. 4. Related Previous Work <ul><li>Rothermel and Harrold, TOSEM 97 </li></ul><ul><ul><li>Graph traversal algorithms </li></ul></ul><ul><li>Harrold et al., OOPSLA 01 </li></ul><ul><ul><li>Java interclass graph (JIG) </li></ul></ul>Copied f rom [Harrold et al., OOPSLA 01] Execute P/ Record Coverage Identify Dangerous Entities Select Tests Program P Program P’ Program P Program P’ P’s Edge Coverage Matrix Dangerous Entities containing edges in P
    5. 5. Regression Testing for AOSD <ul><li>When AO features are added/modified, the program needs to be regression tested </li></ul><ul><li>Case 1: P is an OO program and P’ is an AO version of P </li></ul><ul><li>Case 2: Both P and P’ are AO programs </li></ul><ul><li>How should regression test selection be performed for AO software? </li></ul>
    6. 6. Outline <ul><li>B ackground </li></ul><ul><li>Problem statement and motivation </li></ul><ul><li>Our analysis </li></ul><ul><li>Implementation status </li></ul><ul><li>Related work </li></ul>
    7. 7. Existing Work Applied to AO Programs <ul><li>How to compare two JIGs? </li></ul><ul><ul><li>The JIG of the woven code includes redundant nodes and edges and does not correspond to the logical control flow as presented in the source </li></ul></ul><ul><ul><li>Need new representations </li></ul></ul><ul><li>How to recover CFG edges from the execution trace when computing edge-coverage matrix? (when P is AO program) </li></ul><ul><ul><li>The execution trace is compiler-specific </li></ul></ul><ul><ul><li>Need instrumentation before/during weaving </li></ul></ul>
    8. 8. Existing Work Applied to AO Programs <ul><li>class C { </li></ul><ul><li>public void m (int i) {…} </li></ul><ul><li>3. } </li></ul><ul><li>void bar (C p, int k) { </li></ul><ul><li>p.m(k); </li></ul><ul><li>} </li></ul><ul><li>Java version P </li></ul><ul><li>CFG edge </li></ul><ul><li>Call edge </li></ul>Java Interclass Graph (JIG) bar() p.m() return C.m() … exit exit
    9. 9. Example <ul><li>class C { </li></ul><ul><li>public void m(int i){…}; </li></ul><ul><li>3. } </li></ul><ul><li>void bar(C p, int k) { </li></ul><ul><li>p.m(k); </li></ul><ul><li>} </li></ul><ul><li>aspect Sample{ </li></ul><ul><li>void around (C c, int i): </li></ul><ul><li>call (C.m(int)) && </li></ul><ul><li>target (c) && </li></ul><ul><li>args (i) { </li></ul><ul><li>14. proceed (p , x); </li></ul><ul><li>15. } </li></ul>AspectJ Version P’ bar() p.m() Return C.m() … exit JIG for P C. m () … exit bar() .. around$0 return … c.m() return JIG for P’ (from woven code) ..Sample. around$0
    10. 10. Some Results <ul><li>When we applied the [Harrold et.al. 01] algorithm to several subjects: </li></ul>19 20 testReadFile 4 0 4 0 tracing 1 0 1 0 tjp 3 0 3 0 telecom 1 0 1 0 observer 4 0 4 0 introduction 1 0 1 0 bean V 2 ( AspectJ version ) Num of selected tests V1 (java version) Num of tests Subjects
    11. 11. Possible Approach <ul><li>Create “clean” CFGs in which the wrapper code inserted during weaving is removed </li></ul><ul><ul><li>Graph traversal and comparison corresponds to the “logical” structure of the code, not the compiler-specific woven code </li></ul></ul><ul><li>New representation: AJIG </li></ul><ul><ul><li>Aspect J Inter-module Graph – more later </li></ul></ul><ul><li>For regression test selection, need to consider additional issues </li></ul>
    12. 12. A More Complex Problem <ul><li>class C { </li></ul><ul><li>public void m(int i){…}; </li></ul><ul><li>3. } </li></ul><ul><li>void bar(C p, int k) { </li></ul><ul><li>C.m(k); </li></ul><ul><li>} </li></ul><ul><li>aspect Sample{ </li></ul><ul><li>void around(C c, int i): </li></ul><ul><li>call(C.m(int)) && </li></ul><ul><li>target(c) && </li></ul><ul><li>args(i) { </li></ul><ul><li>System.out.println(i); </li></ul><ul><li>proceed(p , x); </li></ul><ul><li>15. } </li></ul>C. m () bar() return m() AJIG for P’ … exit exit System.out…. <ul><li>Do we need to select all the tests that go through the edge marked in red? </li></ul>
    13. 13. Why it needs to be addressed <ul><li>This is an issue not only for AO software, but also for procedural and OO software </li></ul><ul><li>Advices are often free of side effects </li></ul><ul><ul><li>Study in [Rinard et al. FSE 04] reported 6 “observer” advices out of ten inspected advices </li></ul></ul><ul><ul><li>Recommended for “safe” AO programming </li></ul></ul><ul><li>Adding side-effect-free advices should not result in overly conservative regression test selection </li></ul><ul><li>Approach: use side-effect analysis </li></ul>
    14. 14. Outline <ul><li>Big picture and background </li></ul><ul><li>Problem statement and motivation </li></ul><ul><li>Our analysis </li></ul><ul><li>Implementation status </li></ul><ul><li>Related work </li></ul>
    15. 15. Our Work <ul><li>Consider both situations: </li></ul><ul><ul><li>Case 1: P is an OO version, P’ is an AO version </li></ul></ul><ul><ul><li>Case 2: both P and P’ are AO versions </li></ul></ul><ul><li>Analysis to select regression tests </li></ul><ul><ul><li>Build a new control flow representation: A J IG </li></ul></ul><ul><ul><li>Apply existing graph-traversal algorithm on AJIG </li></ul></ul><ul><ul><li>Side-effect analysis when comparing AJIGs </li></ul></ul>
    16. 16. AJIG <ul><li>Aspect J Inter-module Graph (recent work) </li></ul><ul><ul><li>For the Java parts, same as JIG. </li></ul></ul><ul><ul><li>Shadow node </li></ul></ul><ul><ul><li>A shadow node is associated with </li></ul></ul><ul><ul><ul><ul><li>a set of JIGs of advices </li></ul></ul></ul></ul><ul><ul><ul><ul><li>the precedence of these advices </li></ul></ul></ul></ul><ul><ul><ul><ul><li>an integrated shadow advice JIG </li></ul></ul></ul></ul><ul><ul><li>AJIG supports all static AspectJ pointcut types </li></ul></ul><ul><ul><li>Conservatively approximate the dynamic part of pointcut designators. </li></ul></ul>
    17. 17. Basic Idea <ul><li>Build AJIGs for P and P’. </li></ul><ul><li>Apply the graph-traversal algorithm on AJIGs of P and P’ . </li></ul>
    18. 18. New Test Selection Criterion <ul><li>Side effect related node in AJIG </li></ul><ul><ul><li>Has side effects </li></ul></ul><ul><ul><li>Has some dependency on the nodes that have side effects </li></ul></ul><ul><li>Safe edge in AJIG </li></ul><ul><ul><li>An edge is safe edge, if the sink node of this edge is side effect related. </li></ul></ul>
    19. 19. New Test Selection criterion <ul><li>New Test Selection criterion: </li></ul><ul><ul><li>Dangerous set S computation: for each edge e in P, and its counter part e’ in P’ </li></ul></ul><ul><ul><ul><li>e is not equivalent to e’ and </li></ul></ul></ul><ul><ul><ul><li>both e and e’ are side effect related </li></ul></ul></ul><ul><li>Select a test that execute one or more edges in S </li></ul>
    20. 20. Selection <ul><li>Computing dangerous set S by comparing AJIGs. </li></ul><ul><li>We plan to use some form of side-effect analysis </li></ul><ul><ul><li>Large body of existing work </li></ul></ul><ul><li>Selecting tests. </li></ul>
    21. 21. Implementation progress <ul><li>The implementation of algorithms described in [Harrold et.al. 01] √ </li></ul><ul><li>Building AspectJ Inter-module Graph √ </li></ul><ul><ul><li>Make an extension for the abc compiler that generates the Jimple based CFGs for aspects between the weaving of inter-type declarations and advices. </li></ul></ul><ul><ul><li>Instrument advices at different phases. </li></ul></ul><ul><li>Side effect analysis ongoing work </li></ul><ul><li>Evaluation </li></ul>
    22. 22. Related Work <ul><li>Static/Dynamic Analysis for AO programs. </li></ul><ul><ul><li>abc compiler [AOSD 05] [PLDI 05] [TR 04]. </li></ul></ul><ul><ul><li>Static analysis of aspects [Sereni and Moor, AOSD 02]. </li></ul></ul><ul><ul><li>Zhao’s work on the analysis and testing of AO programs [COMPSAC 03] [WPC 02][AOSD 06]. </li></ul></ul><ul><ul><li>Josh-an open implementation of AspectJ-like languages [Chiba and Nakagawa AOSD 03] </li></ul></ul><ul><ul><li>Classification system for AO programs [Rinard et. al. FSE 04]. </li></ul></ul>
    23. 23. Related Work (Cont’d) <ul><li>Regression Test Selection </li></ul><ul><ul><li>[LW ICSM 91], [CRV ISCE 94], [RH TOSEM 97], [Ball ISSTA 98], [Harrold+ OOPSLA 01], [OSH FSE 04]… </li></ul></ul><ul><li>Change Impact Analysis </li></ul><ul><ul><li>[KGH+ ICSM 94], [RT PASTE 01], [OAH FSE 03], [OAL+ ICSE 04], [RST+ OOPSLA 04], … </li></ul></ul>
    24. 24. <ul><li>Thank you!! </li></ul><ul><li>Questions?? </li></ul>

    ×