Skip to content

zuzkajelcicova/CS454-Automated_patching_using_GP

Repository files navigation

CS454-Automated_patching_using_GP

The project contains the following directories:

  • documentation
    • project execution plan
    • project presentations
  • fault_localization
    • contains GZoltar that will generate gzoltar.csv file with code line numbers and their likelihood of being faulty
    • contains 2 files:
      • gzoltar.csv - code line numbers with their likelihood of being faulty
      • suspicious.csv - file generated by the system. Here only code line numbers and probabilities are included
  • GAOutput
    • stores pottentially fixed .java programs
  • parsed
    • stores AST tree as an .xml file. Three types of .xml files are always generated:
      • file representing the original faulty program (faulty.xml)
      • file representing the original faulty program extended with line numbers (faultyWithLines.xml)
      • file that is a potential fix for the faulty program (fixed.xml)
  • resources
    • stores 2 types of .java files
      • faulty program(s) submitted for repairing (e.g. GCS.java)
      • faulty program submitted for repairing that is extended with line numbers (CodeWithLines.java)
  • src
    • Main.java and potentially fixed .java programs along with their positive and negative test cases
    • AST
      • classes responsible for AST manipulation (replace/insert/delete), generation and conversion from .java to .xml and vice versa, populating statement/candidate/faulty lists (temporary), extending AST and .java code with line numbers, translation of the output of GZoltar to AST nodes (in progress), ...
    • General
      • classes necessary for loading .class files on runtime, monitoring time spent, and a general class Utils.java for as a reference point for file names, paths, allowed operations, ...
    • GP
      • classes defining datastructures of a Bug, Edit and Patch, and genetic operations (crossovers, mutations) as well as tournament selection
    • tests
      • JUnit tests for the system

The system is currently divided into 2 main parts. Firstly, GZoltar file of a faulty program that will contain code lines and their likelihood of being faulty must be extracted. This file (gzoltar.csv) will be used by the rest of the system to execute the main genetic algorithm. Below are the two aforementioned steps.

1. Usage of GZoltar

Usage as Eclipse Plugin

1. Download Java 8 32 Bit and Eclipse Mars 32 bit
2. Follow steps mentioned here: http://www.gzoltar.com/eclipse-plugin.html
3. Open new project
4. Press CTRL + F5 to run GZoltar
5. Output files of Gzoltar are created in folder "gzoltar" in the project directory 

Usage as CLI

1. Use: "com.gzoltar-0.0.11-jar-with-dependencies.java" in fault_localization\fl-main\start-gzoltar
2. Run: "java -jar ./com.gzoltar-0.0.11-jar-with-dependencies.jar projectPath ProjectName classDirectory"
3. Run (Example): "java -jar ./com.gzoltar-0.0.11-jar-with-dependencies.jar ../src/triangle triangle target/classes/:target/test-classes"
4. Output files of Gzoltar are created in folder "gzoltar" in the project directory 

2. Running full system

In order to run the current version of the system, instructions below must be followed (precondition: GZoltar file has been obtained in the previous step).

1. Install SRCML https://www.srcml.org/#download for parsing the .java and .xml code
2. Run Main.java with the following papameters: 
   "faultyProgramName srcMlPath -p populationSize -t timeInMinutes -b noOfBugsToSolve -cpf classFolderPathOfFaultyProgram".
   
   A specific example can be seen below:
   GCD "C:\\Program Files\\srcML 0.9.5\\bin" -p 50 -t 90 -b 1 -cfp "C:\\Users\\admin\\git\\CS454-Automated_patching_using_GP\\out\\production\\CS454_AutomatedPatching
   
3. The potentially fixed program can be found in the src/ directory. Its name matches the faulty program name.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 3

  •  
  •  
  •  

Languages