Giter Site home page Giter Site 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 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

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

Results

Operation Type property sometimes is Null

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)

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).

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?

Time

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

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)

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.

Output folder

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

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))

Repair Tests

testExample340CommandLine
Ne passe pas

testExample309CommandLine
Ne passe pas

testExample288CommandLine
Ne passe pas

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.

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.

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

Arguments

Improving management of command line arguments

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?

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.