new miner
This commit is contained in:
@@ -22,8 +22,8 @@ public class Launcher {
|
||||
|
||||
Properties appProps = new Properties();
|
||||
|
||||
// String appConfigPath = "/Users/anil.koyuncu/projects/fixminer/fixminer_source/src/main/resource/app.properties";
|
||||
String appConfigPath = args[0];
|
||||
String appConfigPath = "/Users/anilkoyuncu/projects/fixminer/fixminer_source/src/main/resource/app.properties";
|
||||
// String appConfigPath = args[0];
|
||||
appProps.load(new FileInputStream(appConfigPath));
|
||||
|
||||
// String portInner = appProps.getProperty("portInner","6380");
|
||||
|
||||
@@ -43,7 +43,8 @@ public class EDiffParser extends Parser {
|
||||
// GumTree results
|
||||
boolean isJava =false;
|
||||
List<Action> gumTreeResults = null;
|
||||
if (revFile.getName().endsWith(".c") & prevFile.getName().endsWith(".c") || revFile.getName().endsWith(".h") & prevFile.getName().endsWith(".h")){
|
||||
if (true){
|
||||
// if (revFile.getName().endsWith(".c") & prevFile.getName().endsWith(".c") || revFile.getName().endsWith(".h") & prevFile.getName().endsWith(".h")){
|
||||
// gumTreeResults = new GumTreeComparer().compareCFilesWithGumTree(prevFile, revFile);
|
||||
|
||||
|
||||
|
||||
+52
-22
@@ -88,6 +88,7 @@ public class HierarchicalRegrouperForC {
|
||||
for(HierarchicalActionSet a:reActionSets){
|
||||
HierarchicalActionSet hierarchicalActionSet = removeBlocks(a);
|
||||
hierarchicalActionSet = removeIFthenBlocks(hierarchicalActionSet);
|
||||
hierarchicalActionSet = removeParentForSingle(hierarchicalActionSet);
|
||||
reActionSets1.add(hierarchicalActionSet);
|
||||
|
||||
}
|
||||
@@ -97,19 +98,23 @@ public class HierarchicalRegrouperForC {
|
||||
|
||||
private HierarchicalActionSet removeBlocks(HierarchicalActionSet actionSet){
|
||||
List<HierarchicalActionSet> subActions = actionSet.getSubActions();
|
||||
Action action = actionSet.getAction();
|
||||
if (subActions.size() == 1){
|
||||
HierarchicalActionSet subaction = subActions.get(0);
|
||||
Action action1 = subaction.getAction();
|
||||
//else,then,block
|
||||
if(subaction.getAstNodeType().equals("block")){//|| subaction.getAstNodeType().equals("then") || subaction.getAstNodeType().equals("else")){
|
||||
List<HierarchicalActionSet> subSubActions = subaction.getSubActions();
|
||||
if(subSubActions.size() == 1){
|
||||
if(action.getClass().equals(action1.getClass())) {
|
||||
if (subaction.getAstNodeType().equals("block")) {//|| subaction.getAstNodeType().equals("then") || subaction.getAstNodeType().equals("else")){
|
||||
List<HierarchicalActionSet> subSubActions = subaction.getSubActions();
|
||||
if (subSubActions.size() == 1) {
|
||||
|
||||
HierarchicalActionSet subsubsubAction = subSubActions.get(0);
|
||||
List<Integer> keysByValue = NodeMap_new.getKeysByValue(NodeMap_new.StatementMap, subsubsubAction.getAstNodeType());
|
||||
if(keysByValue != null && keysByValue.size() ==1){
|
||||
subsubsubAction.setParent(null);
|
||||
return removeBlocks(subsubsubAction);
|
||||
HierarchicalActionSet subsubsubAction = subSubActions.get(0);
|
||||
List<Integer> keysByValue = NodeMap_new.getKeysByValue(NodeMap_new.StatementMap, subsubsubAction.getAstNodeType());
|
||||
if (keysByValue != null && keysByValue.size() == 1) {
|
||||
subsubsubAction.setParent(null);
|
||||
return removeBlocks(subsubsubAction);
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -117,29 +122,54 @@ public class HierarchicalRegrouperForC {
|
||||
return actionSet;
|
||||
|
||||
}
|
||||
private HierarchicalActionSet removeIFthenBlocks(HierarchicalActionSet actionSet){
|
||||
|
||||
private HierarchicalActionSet removeParentForSingle(HierarchicalActionSet actionSet){
|
||||
List<HierarchicalActionSet> subActions = actionSet.getSubActions();
|
||||
Action action = actionSet.getAction();
|
||||
if (subActions.size() == 1){
|
||||
HierarchicalActionSet subaction = subActions.get(0);
|
||||
//else,then,block
|
||||
if(subaction.getAstNodeType().equals("then")|| subaction.getAstNodeType().equals("else")){//|| subaction.getAstNodeType().equals("then") || subaction.getAstNodeType().equals("else")){
|
||||
List<HierarchicalActionSet> subSubActions = subaction.getSubActions();
|
||||
if(subSubActions.size() == 1){
|
||||
Action action1 = subaction.getAction();
|
||||
//else,then,block
|
||||
if(action.getClass().equals(action1.getClass())) {
|
||||
if(!(subaction.getAstNodeType().equals("condition") || subaction.getAstNodeType().equals("init"))){
|
||||
List<Integer> keysByValue = NodeMap_new.getKeysByValue(NodeMap_new.StatementMap, subaction.getAstNodeType());
|
||||
if(keysByValue != null && keysByValue.size() ==1){
|
||||
subaction.setParent(null);
|
||||
return removeParentForSingle(subaction);
|
||||
}}}
|
||||
}
|
||||
return actionSet;
|
||||
|
||||
HierarchicalActionSet subsubsubAction = subSubActions.get(0);
|
||||
if(subsubsubAction.getAstNodeType().equals("block")){
|
||||
List<HierarchicalActionSet> subActions1 = subsubsubAction.getSubActions();
|
||||
if (subActions1.size() ==1){
|
||||
HierarchicalActionSet hierarchicalActionSet = subActions1.get(0);
|
||||
List<Integer> keysByValue = NodeMap_new.getKeysByValue(NodeMap_new.StatementMap, hierarchicalActionSet.getAstNodeType());
|
||||
if(keysByValue != null && keysByValue.size() ==1){
|
||||
hierarchicalActionSet.setParent(null);
|
||||
return removeBlocks(hierarchicalActionSet);
|
||||
}
|
||||
private HierarchicalActionSet removeIFthenBlocks(HierarchicalActionSet actionSet){
|
||||
List<HierarchicalActionSet> subActions = actionSet.getSubActions();
|
||||
Action action = actionSet.getAction();
|
||||
if (subActions.size() == 1){
|
||||
HierarchicalActionSet subaction = subActions.get(0);
|
||||
//else,then,block
|
||||
Action action1 = subaction.getAction();
|
||||
//else,then,block
|
||||
if(action.getClass().equals(action1.getClass())) {
|
||||
if (subaction.getAstNodeType().equals("then") || subaction.getAstNodeType().equals("else")) {//|| subaction.getAstNodeType().equals("then") || subaction.getAstNodeType().equals("else")){
|
||||
List<HierarchicalActionSet> subSubActions = subaction.getSubActions();
|
||||
if (subSubActions.size() == 1) {
|
||||
|
||||
HierarchicalActionSet subsubsubAction = subSubActions.get(0);
|
||||
if (subsubsubAction.getAstNodeType().equals("block")) {
|
||||
List<HierarchicalActionSet> subActions1 = subsubsubAction.getSubActions();
|
||||
if (subActions1.size() == 1) {
|
||||
HierarchicalActionSet hierarchicalActionSet = subActions1.get(0);
|
||||
List<Integer> keysByValue = NodeMap_new.getKeysByValue(NodeMap_new.StatementMap, hierarchicalActionSet.getAstNodeType());
|
||||
if (keysByValue != null && keysByValue.size() == 1) {
|
||||
hierarchicalActionSet.setParent(null);
|
||||
return removeBlocks(hierarchicalActionSet);
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -10,6 +10,7 @@ import edu.lu.uni.serval.utils.EDiffHelper;
|
||||
import edu.lu.uni.serval.utils.PoolBuilder;
|
||||
import org.apache.commons.io.FileUtils;
|
||||
import org.javatuples.Pair;
|
||||
import org.junit.Assert;
|
||||
import org.junit.Test;
|
||||
import redis.clients.jedis.Jedis;
|
||||
import redis.clients.jedis.JedisPool;
|
||||
@@ -31,8 +32,8 @@ public class HunkParserTest {
|
||||
public void testSimple() throws IOException {
|
||||
// String input = "/Users/anil.koyuncu/projects/test/fixminer-core/python/data/gumInputLinux/revFiles/7f52f3_3845d29_drivers#pci#host#pcie-altera.c";
|
||||
|
||||
// String root = "/Users/anil.koyuncu/projects/fixminer/gumInputLinux/linux/";
|
||||
String root = "/Users/anil.koyuncu/projects/fixminer/fixminer-core/python/data/gumInputLinux/";
|
||||
// String root = "//Users/anilkoyuncu/projects/gumInputLinux/";
|
||||
String root = "/Users/anilkoyuncu/projects/fixminer/fixminer-core/python/data/gumInputLinux/";
|
||||
String filename ="";
|
||||
// filename ="freebsd_ceca9b8_b864ac4_sys#kern#sched_ule.c"; //too long
|
||||
// filename ="openbsd_e592ec_39c81a_sys#arch#i386#pci#pci_machdep.c"; //not parseable 56 "parameter_list" "" () ( (57 "parameter" "" () ( (22 "decl" "" () ())))
|
||||
@@ -52,21 +53,21 @@ public class HunkParserTest {
|
||||
// filename ="omp_19fae3_1e4dcd_src#mca#mpool#sm#mpool_sm_mmap.c"; // cannot find
|
||||
// filename ="FFmpeg_a8343bf_2b2039_libavformat#riff.c"; // ok
|
||||
// filename ="freebsd_32766e4_200ff4_sbin#routed#parms.c"; // ok
|
||||
filename ="openbsd_150ddd_cf0e20_usr.sbin#user#user.c"; //notok
|
||||
filename ="openbsd_6fac1e_c3b383_usr.bin#tmux#window-copy.c"; //notok
|
||||
filename ="freebsd_0cb6f2_b4c742_sys#dev#ipw#if_ipw.c"; //notok
|
||||
filename ="php-src_7defd5_da06f7_ext#mbstring#mbstring.c"; //notok (19 "expr_stmt" "" () ()))))
|
||||
filename ="libtiff_177169_71715f_tools#tiff2ps.c"; //notok (19 "expr_stmt" "" () ()))))
|
||||
// filename ="openbsd_150ddd_cf0e20_usr.sbin#user#user.c"; //notok
|
||||
// filename ="openbsd_6fac1e_c3b383_usr.bin#tmux#window-copy.c"; //notok
|
||||
// filename ="freebsd_0cb6f2_b4c742_sys#dev#ipw#if_ipw.c"; //notok
|
||||
// filename ="php-src_7defd5_da06f7_ext#mbstring#mbstring.c"; //notok (19 "expr_stmt" "" () ()))))
|
||||
// filename ="libtiff_177169_71715f_tools#tiff2ps.c"; //notok (19 "expr_stmt" "" () ()))))
|
||||
filename ="linux_955c1dd_0aaee4_drivers#gpu#drm#i915#gvt#handlers.c"; //notok (19 "expr_stmt" "" () ()))))
|
||||
|
||||
// filename ="FFmpeg_0726b2_66d2ff_libav#jpeg.c";
|
||||
String pj = filename.split("_")[0];
|
||||
filename = filename.replace(pj+"_","");
|
||||
root = root + pj + "/";
|
||||
// root = root + "codeflaws/";
|
||||
|
||||
// root = root + pj + "/";
|
||||
root = root + "codeflaws/";
|
||||
|
||||
|
||||
filename ="287-A-14208510-14208532.c";
|
||||
// filename = "474-A-15925943-15925951.c"; //mot ok
|
||||
// filename = "6-C-11536006-11536039.c"; //okish
|
||||
// filename = "500-A-18298071-18298124.c"; //ok
|
||||
@@ -85,7 +86,7 @@ public class HunkParserTest {
|
||||
|
||||
EDiffHunkParser parser = new EDiffHunkParser();
|
||||
|
||||
String srcMLPath = "/Users/anil.koyuncu/Downloads/srcML.0.9.5/bin/srcml";
|
||||
String srcMLPath = "/usr/local/bin/srcml";
|
||||
// String srcMLPath = "/Users/anil.koyuncu/Downloads/srcML.0.9.5/bin/srcml";
|
||||
parser.parseChangedSourceCodeWithGumTree2(prevFile, revFile, srcMLPath);
|
||||
// ITree t = new SrcmlCppTreeGenerator().generateFromFile(input).getRoot();
|
||||
@@ -93,6 +94,7 @@ public class HunkParserTest {
|
||||
|
||||
}
|
||||
|
||||
|
||||
@Test
|
||||
public void dumpFnction() throws Exception {
|
||||
String pattern = "function/20/gstreamer_0af74c_e8bae0_libs#gst#net#gstptpclock.c.txt_0";
|
||||
|
||||
File diff suppressed because one or more lines are too long
File diff suppressed because it is too large
Load Diff
@@ -4,8 +4,6 @@ import akka.actor.ActorRef;
|
||||
import akka.actor.ActorSystem;
|
||||
import edu.lu.uni.serval.fixminer.akka.ediff.*;
|
||||
import edu.lu.uni.serval.utils.CallShell;
|
||||
import edu.lu.uni.serval.utils.EDiffHelper;
|
||||
import edu.lu.uni.serval.utils.FileHelper;
|
||||
import edu.lu.uni.serval.utils.PoolBuilder;
|
||||
import org.apache.commons.io.FileUtils;
|
||||
import org.slf4j.Logger;
|
||||
@@ -13,9 +11,9 @@ import org.slf4j.LoggerFactory;
|
||||
import redis.clients.jedis.Jedis;
|
||||
import redis.clients.jedis.JedisPool;
|
||||
|
||||
import java.io.*;
|
||||
import java.nio.file.Files;
|
||||
import java.nio.file.Paths;
|
||||
import java.io.File;
|
||||
import java.io.FileNotFoundException;
|
||||
import java.io.IOException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
@@ -64,6 +62,7 @@ public class EnhancedASTDiff {
|
||||
.filter(x -> !x.getName().startsWith("."))
|
||||
.filter(x -> !x.getName().startsWith("cocci"))
|
||||
.filter(x -> !x.getName().endsWith(".index"))
|
||||
.filter(x -> x.getName().endsWith("codeflaws"))
|
||||
.collect(Collectors.toList());
|
||||
|
||||
|
||||
@@ -152,7 +151,8 @@ public class EnhancedASTDiff {
|
||||
File prevFile = new File(gumTreeInput + "prevFiles/prev_" + fileName);// previous file
|
||||
fileName = fileName + ".txt";
|
||||
File diffentryFile = new File(gumTreeInput + "DiffEntries/" + fileName); // DiffEntry file
|
||||
|
||||
// if(FileHelper.readFile(diffentryFile).split("@@\\s\\-\\d+,*\\d*\\s\\+\\d+,*\\d*\\s@@").length > 2)
|
||||
// continue;
|
||||
MessageFile msgFile = new MessageFile(revFile, prevFile, diffentryFile);
|
||||
|
||||
msgFiles.add(msgFile);
|
||||
|
||||
@@ -3,15 +3,16 @@ pjName = gumInput
|
||||
portInner = 6380
|
||||
portDumps = 6399
|
||||
parallelism = AKKA
|
||||
numOfWorkers = 30
|
||||
numOfWorkers = 14
|
||||
hostname = localhost
|
||||
hunkLimit = 10
|
||||
|
||||
#inputPath = /Users/anilkoyuncu/projects/gumInputLinux
|
||||
inputPath = /Users/anil.koyuncu/projects/fixminer/fixminer-core/python/data/gumInputLinux
|
||||
redisPath = /Users/anil.koyuncu/projects/fixminer/fixminer-core/python/data/redis
|
||||
inputPath = /Users/anilkoyuncu/projects/fixminer/fixminer-core/python/data/gumInputLinux
|
||||
#redisPath = /Users/anil.koyuncu/projects/fixminer/fixminer-core/python/data/redis
|
||||
redisPath = /Users/anilkoyuncu/projects/fixminer/fixminer-core/python/data/redis
|
||||
#srcMLPath= /Users/anil.koyuncu/Downloads/srcML/src2srcml
|
||||
srcMLPath= /Users/anil.koyuncu/Downloads/srcML.0.9.5/bin/srcml
|
||||
srcMLPath= /usr/local/bin/srcml
|
||||
actionType = ALL
|
||||
eDiffTimeout = 900
|
||||
|
||||
|
||||
@@ -0,0 +1,10 @@
|
||||
|
||||
const static ctl_serialize_action
|
||||
static int test(){
|
||||
field = ATOM(TST);
|
||||
if(IS_ERR(fields->mode))
|
||||
return PTR_ERROR(fields->mode);
|
||||
if(a>0)
|
||||
return 1;
|
||||
return 0;
|
||||
}
|
||||
@@ -0,0 +1,6 @@
|
||||
static int test(){
|
||||
field = ATOM(TST);
|
||||
if(IS_ERR(fields->mode))
|
||||
return PTR_ERROR(fields->mode);
|
||||
return 0;
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
static ctl_serialize_action
|
||||
static int test(){
|
||||
field = ATOM(TST);
|
||||
if(IS_ERR(fields->mode))
|
||||
return PTR_ERROR(fields->mode);
|
||||
else if(a>0)
|
||||
return 1;
|
||||
return 0;
|
||||
}
|
||||
@@ -0,0 +1,4 @@
|
||||
static int test(){
|
||||
field = ATOM(TST);
|
||||
return PTR_ERROR_OR_ZERO(fields->mode);
|
||||
}
|
||||
@@ -0,0 +1,5 @@
|
||||
struct b {
|
||||
int x;
|
||||
double y;
|
||||
float z;
|
||||
};
|
||||
@@ -0,0 +1,5 @@
|
||||
struct a {
|
||||
int x;
|
||||
double y;
|
||||
float z;
|
||||
};
|
||||
Reference in New Issue
Block a user