Git Product home page Git Product logo

spoonlabs / astor Goto Github PK

View Code? Open in Web Editor NEW
198.0 13.0 107.0 240.29 MB

Automatic program repair for Java with generate-and-validate techniques :v::v:: jGenProg (2014) - jMutRepair (2016) - jKali (2016) - DeepRepair (2017) - Cardumen (2018) - 3sfix (2018)

Home Page: https://hal.archives-ouvertes.fr/hal-01321615/document

License: GNU General Public License v2.0

Java 100.00%
program-repair dynamic-analysis kth inria patch-generation patch repair

astor's Introduction

ASTOR: A Program Repair Library for Java

Build Status

Astor is an automatic software repair framework in Java for Java, done by Inria, the University of Lille, the Université Polytechnique Hauts-de-France, and KTH Royal Institute of Technology. Astor is an acronym standing for "Automatic Software Transformations fOr program Repair".

If you use Astor for academic purposes, please cite the appropriate publication:

Matias Martinez, Martin Monperrus, "ASTOR: A Program Repair Library for Java", in Proceedings of ISSTA, Demonstration Track, 2016.

@inproceedings{martinez:hal-01321615,
 title = {ASTOR: A Program Repair Library for Java},
 author = {Martinez, Matias and Monperrus, Martin},
 booktitle = {Proceedings of ISSTA},
 year = {2016},
 doi = {10.1145/2931037.2948705},
}

See also:

Contributing

We do welcome bug fixes, features and new repair approaches as pull request. Welcome to Astor!

Contributors:

  • Matias Martinez (Université Polytechnique Hauts-de-France, France) (project leader: [email protected])
  • Martin Monperrus (KTH Royal Institute of Technology, Sweden) ([email protected])
  • Thomas Durieux (Inria, France)
  • Martin G. White (William and Mary, USA)
  • Claire Le Goues (CMU, USA)
  • Simon Urli (Inria, France)
  • Yi Wu (Southern University of Science and Technology, China).

jGenProg

jGenProg is an implementation of GenProg. The experiments about jGenProg are described in:

jKali

jKali is an implementation of Kali. The experiments about jKali are described in:

jMutRepair

jMutRepair is an implementation of mutation-based repair. The experiments about jMutRepair are described in

DeepRepair

DeepRepair is an extension of jGenProg leveraging code similarity. The experiments about DeepRepair are described in

Cardumen

Cardumen is a repair approach based on mined templates. The experiments about Cardumen are described in

3sfix

3sfix is a repair approach based on selecting the most similar repair ingredients.

Usage

Usage of Astor in education

Make a PR to add your course here :-)

Astor in the literature

  • M. Wen, J. Chen, R. Wu, D. Hao, and S. Cheung. Context-aware patch generation for better automated program repair. In Proceedings of the 40th International Conference on Software Engineering (ICSE 2018).

  • X. Liu and H. Zhong, Mining stackoverflow for program repair, IEEE 25th International Conference on Software Analysis, Evolution and Reengineering (SANER), 2018.

  • Urli, S., Yu, Z., Seinturier, L., & Monperrus, M. How to design a program repair bot?: insights from the repairnator project. In Proceedings of the 40th International Conference on Software Engineering: Software Engineering in Practice (pp. 95-104). ACM. 2018.

  • K. Naitou, A. Tanikado, S. Matsumoto, Y. Higo, S. Kusumoto, H. Kirinuki, T. Kurabayashi, H. Tanno, Haruto. Toward introducing automated program repair techniques to industrial software development. ICPC, 2018.

  • L. Azevedo, A. Dantas, C. Camilo-Junior. DroidBugs: An Android Benchmark for Automated Program Repair. arXiv preprint arXiv:1809.07353, 2018.

  • Ye, H., Martinez, M., & Monperrus, M. A Comprehensive Study of Automatic Program Repair on the QuixBugs Benchmark. arXiv preprint arXiv:1805.03454, 2018.

  • C. Trad, R. Abou Assi, W. Masri, F. Zaraket. CFAAR: Control Flow Alteration to Assist Repair. ArXiv preprint arXiv:1808.09229, 2018.

  • A. Tanikado, H. Yokoyama, M. Yamamoto, S. Sumi, Y. Higo, and S. Kusumoto. New strategies for selecting reuse candidates on automated program repair. In 2017 IEEE 41st Annual Computer Software and Appli- cations Conference (COMPSAC), volume 2, pages 266–267, July 2017.

  • Ming Wen, Junjie Chen, Rongxin Wu, Dan Hao, and Shing-Chi Cheung. An empirical analysis of the influence of fault space on search-based automated program repair. Arxiv 1707.05172, 2017.

  • Liu, Yuefei. Understanding and generating patches for bugs introduced by third-party library upgrades. Master’s thesis, 2017.

  • Qi Xin and Steven P Reiss. Leveraging syntax-related code for automated program repair. In Proceedings of the 32nd IEEE/ACM International Conference on Automated Software Engineering (ASE), pages 660–670. IEEE, 2017.

  • Matias Martinez, Thomas Durieux, Romain Sommerard, Jifeng Xuan, and Martin Monperrus. Automatic repair of real bugs in java: A large-scale experiment on the defects4j dataset. Empirical Software Engineering, pages 1–29, 2016

  • Xuan Bach D Le, David Lo, and Claire Le Goues. History driven program repair. In Software Analysis, Evolution, and Reengineering (SANER), 2016 IEEE 23rd International Conference on, volume 1, pages 213–224. IEEE, 2016.

  • Yingfei Xiong, Jie Wang, Runfa Yan, Jiachen Zhang, Shi Han, Gang Huang, and Lu Zhang. Precise condition synthesis for program repair. In Proceedings of the 39th International Conference on Software Engineering, ICSE ’17, pages 416–426, Piscataway, NJ, USA, 2017. IEEE Press.

  • Yuan Yuan and Wolfgang Banzhaf. Arja: Automated repair of java programs via multi-objective genetic programming, 2017. Arviv 1712.07804.

  • Liushan Chen, Yu Pei, and Carlo A. Furia. Contract-based program repair without the contracts. In Proceedings of the 32Nd IEEE/ACM International Conference on Automated Software Engineering, ASE 2017, pages 637–647, Piscataway, NJ, USA, 2017. IEEE Press

  • Ripon K. Saha, Yingjun Lyu, Hiroaki Yoshida, and Mukul R. Prasad. Elixir: Effective object oriented program repair. In Proceedings of the 32Nd IEEE/ACM International Conference on Automated Software Engineering, ASE 2017, pages 648–659, Piscataway, NJ, USA, 2017. IEEE Press.

  • Manish Motwani, Sandhya Sankaranarayanan, Ren ́e Just, and Yuriy Brun. Do automated program repair techniques repair hard and important bugs? Empirical Software Engineering, pages 1–47, 2017.

  • H. Yokoyama, Y. Higo, and S. Kusumoto. Evaluating automated program repair using characteristics of defects. In 2017 8th International Workshop on Empirical Software Engineering in Practice (IWESEP), pages 47–52, March 2017.

  • Xinyuan Liu, Muhan Zeng, Yingfei Xiong, Lu Zhang, and Gang Huang. Identifying patch correctness in test-based automatic program repair. arXiv preprint arXiv:1706.09120, 2017.

  • Jiajun Jiang and Yingfei Xiong. Can defects be fixed with weak test suites? an analysis of 50 defects from defects4j. arXiv preprint arXiv:1705.04149, 2017.

astor's People

Contributors

alcides avatar andre15silva avatar bqcuong avatar chenzimin avatar clegoues avatar darkonedic avatar dependabot[bot] avatar dginelli avatar gameonlp avatar heidensi avatar hsellik avatar jakkusakura avatar javierron avatar jose avatar jphgoodwin avatar martinezmatias avatar martingwhite avatar maximooliveira avatar monperrus avatar ruizhengu avatar surli avatar tdurieux avatar wolgo avatar yanicakj avatar zhongxingyu avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

astor's Issues

Repair Tests

testExample340CommandLine
Ne passe pas

testExample309CommandLine
Ne passe pas

testExample288CommandLine
Ne passe pas

when a argument is missing, MainjGenProg does not say which one

Hi Matias,

We're trying to run the Math-issue-280 directly with all arguments (and not with "-bug280").

One argument is missing but we don't know the one.

 fr.inria.main.evolution.MainjGenProg  -srcjavafolder examples/Math-issue-280/src/java/ -srctestfolder examples/Math-issue-280/src/test/  -binjavafolder examples/Math-issue-280/target/classes/ -bintestfolder  examples/Math-issue-280/target/test-classes/

What's the missing argument?

Duplicates elements

output += java.lang.String.format("%d is the median\n", n3.value)
output += java.lang.String.format("%d is the median\n", n1.value)
Signature:

java.lang.String introclassJava.median_3b2376ab_003#outputPLUS(java.lang.String#format(java.lang.String, java.lang.Object[])("%d is the median\n",int introclassJava.IntObj#value))

Arguments

Improving management of command line arguments

Output folder

We could separate the "workingFolder" and "output". Right now It's the same....

Undefined cases

Running example bug288 produces the following errors:

[ERROR] fr.inria.astor.core.manipulation.sourcecode.VariableResolver.fitInPlace(VariableResolver.java:308) -
Undefined case spoon.support.reflect.code.CtThisAccessImpl
[ERROR] fr.inria.astor.core.manipulation.sourcecode.VariableResolver.fitInPlace(VariableResolver.java:308) -
Undefined case spoon.support.reflect.code.CtNewArrayImpl
[ERROR] fr.inria.astor.core.manipulation.sourcecode.VariableResolver.fitInPlace(VariableResolver.java:308) -
Undefined case spoon.support.reflect.code.CtConditionalImpl

My environment references spoon-core-5.1.0.jar.

add support for multiple test suite

srctestfolder can take several test folders separated by ":"

the output json files give the kinds of number of failures for each different test folder.

this would be used for playing with different "extended tests" (beyond manual tests)

Configuration

From Reviewer:
it seems there are a lot of settings regarding the structure of the project
that needs to be provided by the user. You might want to consider to implement a Maven plugin, as to avoid all this overhead (eg resolution of classpath). Furthermore, it is
unclear whether multi­module Maven projects are supported (from your description, I would guess not, but I might be mistaken of course).

Variables

Check variables related to a ModPoint.
Create a Test Case

Problems handling package-info when compiling Hadoop-submodule

I am using Astor to do some automated bug repair work. Now I have problems compiling Hadoop submodule (i.e. hadoop/hadoop-common-project/hadoop-auth).

Seems that Spoon can NOT get the declared type from package-info.java file. Is there anyone knowing how to fix this issue? Thanks a lot!

The command line argument I use:
java -cp $(cat /tmp/astor-classpath.txt):target/classes fr.inria.main.evolution.MainjGenProg -loglevel debug -hadoop11859

I add an option in AbstractMain.java to run this bug, the folder 11859hadp is the a submodule of Hadoop project (hadoop/hadoop-common-project/hadoop-auth), which can be compiled and tested separately:

if (cmd.hasOption("hadoop11859")) {
	dependenciespath = gatherDependencies(
			"libBugs/11859hadp/lib/");
	folder = "11859hadp";
	failing = "org.apache.hadoop.security.authentication.server.TestPseudoAuthenticationHandler";
	location = ("libBugs/11859hadp/");
	packageToInstrument = "org.apache.hadoop.security.authentication.server";
	faultLocalizationThreshold = 0.5;
}

As for other configuration, I just use the configuration.properties file, only change the alternativecompliancelevel from 4 to 7.

the log information is listed below:

2017-08-30 17:59:15,128 INFO main - building model: /Users/someone/git/astor/./outputMutation/AstorMain-11859hadp//src//default, compliance level: 8
2017-08-30 17:59:15,136 INFO main - Classpath for building SpoonModel [too long to list all of them]
2017-08-30 17:59:16,885 ERROR main - Problem compiling the model with compliance level 8
2017-08-30 17:59:16,885 ERROR main - inconsistent compilation unit: '/Users/someone/git/astor/outputMutation/AstorMain-11859hadp/src/default/org/apache/hadoop/security/authentication/server/package-info.java': declared types are []
2017-08-30 17:59:16,885 INFO main - building model: /Users/someone/git/astor/./outputMutation/AstorMain-11859hadp//src//default, compliance level: 7
2017-08-30 17:59:16,887 INFO main - Classpath for building SpoonModel [too long to list all of them]
Exception in thread "main" java.lang.RuntimeException: inconsistent compilation unit: '/Users/someone/git/astor/outputMutation/AstorMain-11859hadp/src/default/org/apache/hadoop/security/authentication/server/package-info.java': declared types are []
    at spoon.support.reflect.cu.CompilationUnitImpl.getMainType(CompilationUnitImpl.java:68)
    at spoon.support.compiler.jdt.JDTBasedSpoonCompiler.generateProcessedSourceFilesUsingCUs(JDTBasedSpoonCompiler.java:498)
    at spoon.support.compiler.jdt.JDTBasedSpoonCompiler.generateProcessedSourceFiles(JDTBasedSpoonCompiler.java:203)
    at spoon.support.compiler.jdt.JDTBasedSpoonCompiler.generateProcessedSourceFiles(JDTBasedSpoonCompiler.java:192)
    at fr.inria.astor.core.manipulation.MutationSupporter.buildModel(MutationSupporter.java:90)
    at fr.inria.astor.core.manipulation.MutationSupporter.buildModel(MutationSupporter.java:71)
    at fr.inria.astor.approaches.jgenprog.JGenProg.initModel(JGenProg.java:152)
    at fr.inria.astor.approaches.jgenprog.JGenProg.createInitialPopulation(JGenProg.java:62)
    at fr.inria.main.evolution.AstorMain.createEngine(AstorMain.java:97)
    at fr.inria.main.evolution.AstorMain.run(AstorMain.java:142)
    at fr.inria.main.AbstractMain.executeExample(AbstractMain.java:708)
    at fr.inria.main.evolution.AstorMain.execute(AstorMain.java:209)
    at fr.inria.main.evolution.AstorMain.main(AstorMain.java:199)
    at fr.inria.main.evolution.MainjGenProg.main(MainjGenProg.java:14)

Arguments used to the experiment

I read astor's paper and the readme, and succeeded to repair some bugs contained at examples folder.However I couldn't generate patches reported in docs/bugs_repaired.md to some bugs(Math-5,7) downloaded from defects4j manually.
Could you give me more information about how to execute astor on defects4j (or the bugs not contained in the examples folder of astor)?

For example, I executed astor to math-5 in the following arguments:

-location ../defects4j/tmp/math-5-buggy
-mode jgenprog -scope local -srcjavafolder /src/java -srctestfolder /src/test/
-binjavafolder /target/classes -bintestfolder /target/test-classes -flthreshold 0.5 -seed 10 -maxtime 100 -stopfirst true

-failing org.apache.commons.math3.complex.ComplexTest:org.apache.commons.math3.util.FastMathTest
(obteined by mvn test

-dependencies ./examples/libs/junit-4.10.jar:./examples/libs/hamcrest-core-1.1.jar
(obteined by mvn dependency:build-classpath

-javacompliancelevel 8 ##how should we determine this argument?

Results

Operation Type property sometimes is Null

Improve calculation of Regression Test

See ProjectRepairFacade#calculateRegression and FaultLocalizationFacade.

  1. we calculate tests that conform regression parsing classes
  2. We preprocess the previous result (Stored in ProjectProperties)
  3. We send to Gzoltar to execute the regression
    4)We analyze the test that Gzoltar could analyze. (Stored in ConfigurationProperties and)

Problem: when FL is not executed.

Astor in Java8

When we use java 8 (jdk and maven pom change) we have 2 failing test.
Results :

Failed tests:
JGenProgTest.testExample280CommandLine:66->BaseEvolutionaryTest.validatePatchExistence:92 null [UPDATE: OK, it works, changing the nr of generations]
jKaliTest.testMath2ExampleRemoveModeOneSolution:102 expected:<1> but was:<0>

Tests run: 24, Failures: 2, Errors: 0, Skipped: 3

[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE

Time

In a program variant that is solution, we store the generation but not the time

IntroClass

Some code transformations fail:

ERROR main - Error: the model was not the same from the original after this generation
2016-02-04 10:18:08,367 ERROR main - Parent diferent to block
2016-02-04 10:18:08,411 ERROR main - Parent diferent to block
2016-02-04 10:18:08,474 ERROR main - Parent diferent to block
2016-02-04 10:18:08,503 ERROR main - Parent diferent to block
2016-02-04 10:18:08,591 ERROR main - Error: parent not found

Command:

java -cp /Users/matias/develop/code/astor/target/astor-0.0.2-SNAPSHOT-jar-with-dependencies.jar fr.inria.main.evolution.AstorMain -location /Users/matias/develop/IntroClassJava/dataset/median/3b2376ab97bb5d1a5dbbf2b45cf062db320757549c761936d19df05e856de894e45695014cd8063cdc22148b13fa1803b3c9e77356931d66f4fbec0efacf7829/003/ -failing introclassJava.median_3b2376ab_003BlackboxTest:introclassJava.median_3b2376ab_003WhiteboxTest -dependencies /Users/matias/develop/code/astor/examples/libs/junit-4.11.jar

Path too long

Is it possible to rename the directory astor/examples/introclass/3b2376... using a shorter name? Otherwise paths in that subtree are too long for some systems when extracting or cloning.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.