astor a program repair library for java
play

ASTOR: A PROGRAM REPAIR LIBRARY FOR JAVA Matias Martinez - PowerPoint PPT Presentation

ASTOR: A PROGRAM REPAIR LIBRARY FOR JAVA Matias Martinez University of Valenciennes, France Martin Monperrus University of Lille, France 1 AUTOMATIC SOFTWARE REPAIR Automatic repair is the transformation of an unacceptable behavior of a


  1. ASTOR: A PROGRAM REPAIR LIBRARY FOR JAVA Matias Martinez University of Valenciennes, France Martin Monperrus University of Lille, France 1

  2. AUTOMATIC SOFTWARE REPAIR ➤ Automatic repair is the transformation of an unacceptable behavior of a program execution into an acceptable one according to a specification . Approach Program P Program P’ Specification Artifacts (Correctness (Bug Report, Oracle) Traces, ......) 2

  3. AUTOMATIC SOFTWARE REPAIR ➤ Emerging repair approaches during last 10 years ➤ GenProg (Weimer, Le Goues et al.) ➤ AutoFix (Pei et al.) ➤ Nopol (Xuan et al.) ➤ SPR (Long et al.) ➤ Par (Kim et al.) ➤ Angelix(Mechtaev et al.) ➤ RSRepair (Qi et al.) ➤ …… 3

  4. AUTOMATIC SOFTWARE REPAIR- CONTEXT ➤ A repair approach is both an algorithm and its realization in a prototype ➤ Prototypes are hard-wired for a given programming language ➤ Prototypes are not always publicly available ➤ To reimplement those approaches from scratch 
 is costly 4

  5. OUR GOALS ➤ We wanted a Java platform for ➤ implementing existing state-of-the-art repair approaches. ➤ extending defined approaches. ➤ implement new approaches.

  6. ASTOR ➤ Astor: Automatic Software Transformations fOr program Repair ➤ Implemented in Java, for repairing Java code ➤ We envision that the research community will use Astor for setting up comparative evaluations and for exploring the design space of automatic repair for Java 6

  7. CONTRIBUTION ➤ Astor includes an implementation of 3 repair approaches. ➤ They can be used ‘out of the box’ ➤ Astor provides Extension points to: ➤ Extend or override behavior of implemented approaches ➤ Implement new approaches using routines that Astor provides 7

  8. REPAIR APPROACHES ➤ Test-suite based repair approaches use test-suite as program specification ➤ One or more failing test cases → program has a bug ➤ All test passes → program is valid ➤ Generate and validate approaches : ➤ Candidate Patch 1 → validation → unsuccessful ➤ Candidate Patch 2 → validation → unsuccessful ➤ …. ➤ Candidate Patch n → validation → successful 8

  9. REPAIR WORKFLOW Executes the test suite: at least one failing test case Computes buggy suspiciousness of components While (not solution and not timeout) { Steps that can be Selects a suspicious component C customized according to approach Selects one repair operation O Applies O on C to generate C' Validates candidate solution with C' by executing test suite } 9

  10. THREE REPAIR MODES ➤ jGenProg based on GenProg (Le Goues, Weimer et al.) ➤ Genetic programming, synthesizes patches by reusing existing code ➤ Inserts, replaces and removes statements. ➤ jMutation based on MutationRepair (Debroy and Wong) ➤ Mutates operators on if conditions. ➤ jKali based on Kali (Qi et al.) ➤ Removes statements and blocks, adds return statements, replace if expressions. 10

  11. HOW TO RUN ASTOR?

  12. ASTOR INSTALLATION ➤ Download ➤ git clone https://github.com/SpoonLabs/astor.git ➤ Installation (Maven): ➤ mvn clean ➤ mvn compile ➤ <Astor_folder>/target/astor-Y.X.Z-SNAPSHOT-jar-with- dependencies.jar 12

  13. COMMAND java -cp astor.jar fr.inria.main.evolution.MainAstor -mode jgenprog -location ./math_70 -dependencies ./libs/junit-4.4.jar -failing org.apache.commons.BisectionSolverTest -out /tmp/astorDemo 13

  14. OUTPUT

  15. OUTPUT ➤ Patched source code files ➤ Summary file: <patch> <operation generation="123" line="72" location="org.apache.commons.BisectionSolver" type="ReplaceOp"> <original>return solve(min, max)</original> <modified>return solve(f, min, max)</modified> </operation> </patch> 15

  16. EXPERIMENTS DONE USING ASTOR

  17. Martinez, M., Durieux, T., Sommerard, R. Xuan, J. et Monperrus, M. EVALUATION Empir Software Eng (2016). doi:10.1007/s10664-016-9470-4 ➤ Repairing bugs from Defects4J dataset (Just et al.) ➤ Patches for 33 out of 224 bug (14.7%) jGenProg jKali jMutRepair C1, C3, C5, C7, C13, C15, C25, C1, C5, C13, C15, C25, C26 C1, C7, C25, C26 Chart 7 6 4 Lang - - L27 0 0 1 M2, M5, M7, M8, M28, M40, M49, M50, M2, M8, M28, M32, M40, M49, M2, 28, 40, 50, 57, 58, 81, 82, Math M53, M60, M70, M71, M73, M78, M80, M50, M78, M80, M81, M82, 84, 85, 88 M81, M82, M84, M85, M95 M84, M85, M95 20 14 11 T4, T11 T4, T11 Time T11 2 2 1 29 22 17 Total 17

  18. EXTENDING ASTOR

  19. LIST OF EXTENSION POINTS Command line arguments for extending Astor: - customop - customengine - opselectionstrategy - ingredientstrategy

  20. EXAMPLE OF EXTENSION POINT java -cp astor.jar:<myjar> fr.inria.main.evolution.MainAstor -mode jgenprog -location ./examples/math_70 -dependencies ./libs/junit-4.4.jar -failing org.apache.commons.BisectionSolverTest -out /tmp/astorDemo -maxtime 100 -opselectionstrategy astor.CustomStrategy

  21. NEW STRATEGY TO SELECT OPERATOR public abstract class OperatorSelectionStrategy { protected OperatorSpace operatorSpace; public OperatorSelectionStrategy(OperatorSpace space) { super(); this.operatorSpace = space; } public abstract AstorOperator getNextOperator(); public abstract AstorOperator getNextOperator(Location location); public OperatorSpace getOperatorSpace() { return operatorSpace; } }

  22. EXAMPLE OF EXTENSION POINT java -cp astor.jar:<myjar> fr.inria.main.evolution.MainAstor -mode jgenprog -location ./examples/math_70 -dependencies ./libs/junit-4.4.jar -failing org.apache.BisectionSolverTest -out /tmp/astorDemo -maxtime 100 -customop astor.OperatorX:astor.OperatorY

  23. NEW REPAIR OPERATOR public abstract class AstorOperator { public abstract boolean applyChangesInModel(ModificationInstance opInstance, ProgramVariant p); public abstract boolean undoChangesInModel(ModificationInstance opInstance, ProgramVariant p); public boolean canBeAppliedToPoint(ModificationPoint point){ … }; …… }

  24. PAPER AT ISSTA ➤ Matias Martinez and Martin Monperrus. 2016. ASTOR: a program repair library for Java (demo). In Proceedings of the 25th International Symposium on Software Testing and Analysis (ISSTA 2016). DOI: http://dx.doi.org/ 10.1145/2931037.2948705

  25. CONCLUSION ➤ A repair tool implemented in Java for repairing Java code ➤ Includes 3 implementation of state of the art repair algorithms ➤ Provides extension points for customize and implement new approaches ➤ Source code and results publicly available Questions? 25

Download Presentation
Download Policy: The content available on the website is offered to you 'AS IS' for your personal information and use only. It cannot be commercialized, licensed, or distributed on other websites without prior consent from the author. To download a presentation, simply click this link. If you encounter any difficulties during the download process, it's possible that the publisher has removed the file from their server.

Recommend


More recommend