Skip to content

Commit

Permalink
given work around fix for hit pass but not hit regression
Browse files Browse the repository at this point in the history
  • Loading branch information
SongXueZhi committed Sep 29, 2021
1 parent 1cd1413 commit bdbe0c4
Show file tree
Hide file tree
Showing 3 changed files with 44 additions and 23 deletions.
20 changes: 20 additions & 0 deletions miner/resources/fastjson_fcp.csv
Original file line number Diff line number Diff line change
@@ -1,3 +1,23 @@
ba07c7fbda7ffb4f5fad24f5d02c03794db8c7c9
1ccd0f19e72487545ba01078928b99aebc92505d
4a9ca8518545eaf6d2f3d3e437b2d2af0af57bff
5ca2b3bd42add17fe2c4ff56d88ea5cfd457ae30
7a63aa6ff33e0ad34023d70a56c621cd8886394e
97b01a76efa7940c28f2f182c51e4b856fa36d75
e4c86bb66a3a2b521178848adf0c50a5d842f777
341fc39f1b341ff1574e83c6cf51536cce758fcf
c758b1f79bf2078f50e0c922058a2ba92cd14314
d672cc22ae2857406da3f2acf2fe6a0d2346224f
c8c0005a1c00a3ac7622c87f9733147611494361
70eaae0eb5307be0d9701037c1d2e8067cc5aeba
0e257a3f8c96588d04e128668a61bf9ff6d0f720
485bf7d5119dc8b9599f1adcc542aa84d98c54c7
4f02ba33c30d9fa3c1d2b5623afa891f5bd2493f
7154e20e0fa11675b700d9812d3f4da1b599325f
97d0eb057803450f7cf5f6a5b67a09427880d919
89f0721acd6d121ea4dddbd3974537b2bb3ddd58
7f41acca74fa517748b13667cc8da5d4b7b6e7b3
fbac83f3ec563d80aeb6929c1e4bdffbd98c5117
dc5aa6a27009da6992f08fe2cc7f5d8bb88c23ee
b1a0dd73e907b27d17cf52e9c97c88973b9b1f3c
f9f862357372a400c441a5974e4987e3d649dca9
Expand Down
41 changes: 21 additions & 20 deletions miner/src/main/java/regminer/miner/migrate/BICFinder.java
Original file line number Diff line number Diff line change
Expand Up @@ -116,19 +116,19 @@ public Regression searchBIC(@NotNull PotentialRFC pRFC) {

//handle hit result
if (a >= 0 || (falPoint - passPoint) == 1) {
String working="";
String bic ="";
String working = "";
String bic = "";
if (a >= 0) {
working = arr[a];
bic = arr[a+1];
}else if (a<0 && passPoint>=0 && (falPoint-passPoint)==1){
bic = arr[a + 1];
} else if (a < 0 && passPoint >= 0 && (falPoint - passPoint) == 1) {
working = arr[passPoint];
bic =arr[falPoint];
bic = arr[falPoint];
}
if (working==""&&bic==""){
if (working == "" && bic == "") {
FileUtilx.log("work and bic eq empty");
System.out.println("work and bic eq empty");
return null;
return null;
}
FileUtilx.log("regression+1");
// 如果是regression组合一下需要记录的相关数据
Expand All @@ -137,10 +137,10 @@ public Regression searchBIC(@NotNull PotentialRFC pRFC) {
String testcaseString = combinedRegressionTestResult();
String bfcpId = pRFC.getBuggyCommitId();
// 删除bfc目录下的其他构建测试历史文件
new SycFileCleanup().cleanDirectoryOnFilter(bfcFile, Arrays.asList(bfcId, bfcpId, bic,working));// 删除在regression定义以外的项目文件
new SycFileCleanup().cleanDirectoryOnFilter(bfcFile, Arrays.asList(bfcId, bfcpId, bic, working));// 删除在regression定义以外的项目文件
return new Regression(Conf.PROJRCT_NAME + "_" + bfcId, bfcId, bfcpId, bic, working,
pRFC.fileMap.get(bfcId).getPath(), pRFC.fileMap.get(bfcpId).getPath(), pRFC.fileMap.get(bic).getPath(), pRFC.fileMap.get(working).getPath(), testcaseString);
}else if(a<0 && passPoint>=0 &&(falPoint-passPoint)>1){
} else if (a < 0 && passPoint >= 0 && (falPoint - passPoint) > 1) {
FileUtilx.log("regression+1,with gap");
exec.setDirectory(new File(Conf.PROJECT_PATH));
String testcaseString = combinedRegressionTestResult();
Expand All @@ -158,7 +158,7 @@ public Regression searchBIC(@NotNull PotentialRFC pRFC) {
public void searchStepByStep(String[] arr) {
int now = passPoint + 1;
int i = 0;
while (now <= falPoint && i < 50) {
while (now <= falPoint && i < 2) {
++i;
int a = getTestResult(arr[now], now);
if (a == TestCaseMigrator.PASS) {
Expand All @@ -171,7 +171,7 @@ public void searchStepByStep(String[] arr) {
}
now = falPoint - 1;
i = 0;
while (now >= passPoint && i < 50) {
while (now >= passPoint && i < 2) {
++i;
int a = getTestResult(arr[now], now);
if (a == TestCaseMigrator.PASS) {
Expand Down Expand Up @@ -207,11 +207,19 @@ public String combinedRegressionTestResult() {
}

public int getTestResult(String bic, int index) {
int statu = -2000;
if (status[index] != -2000) {
return status[index];
statu = status[index];
} else {
return test(bic, index);
statu = test(bic, index);
}
if (statu == TestCaseMigrator.FAL && index < falPoint) {
falPoint = index;
}
if (statu == TestCaseMigrator.PASS && index > passPoint) {
passPoint = index;
}
return statu;
}

public int test(String bic, int index) {
Expand Down Expand Up @@ -278,7 +286,6 @@ public int search(String[] arr, int low, int high) {
// 查找成功条件
int statu = getTestResult(arr[middle], middle);


if (statu == TestCaseMigrator.FAL && middle - 1 >= 0
&& getTestResult(arr[middle - 1], middle - 1) == TestCaseMigrator.PASS) {
return middle - 1;
Expand All @@ -287,12 +294,6 @@ && getTestResult(arr[middle - 1], middle - 1) == TestCaseMigrator.PASS) {
&& getTestResult(arr[middle + 1], middle + 1) == TestCaseMigrator.FAL) {
return middle;
}
if (statu == TestCaseMigrator.FAL && middle < falPoint) {
falPoint = middle;
}
if (statu == TestCaseMigrator.PASS && middle > passPoint) {
passPoint = middle;
}
// 查找策略
if (statu == TestCaseMigrator.CE) {
// 指数跳跃查找
Expand Down
6 changes: 3 additions & 3 deletions miner/src/test/java/regminer/start/MinerTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -47,20 +47,20 @@ public void regressionTest() throws Exception {
Miner.pRFCs = (LinkedList<PotentialRFC>) pBFCDetector.detectPotentialBFC(filter);
Miner.singleThreadHandle();
}

@Ignore
@Test
public void testSearchSuccess() throws Exception {
List<String> filter = new ArrayList<>();
filter.add("5ca2b3bd42add17fe2c4ff56d88ea5cfd457ae30");
//filter.add("11ea8be0626d0d8de285ca73b779b074437194e2");
filter.add("69e1509843f5dd5ea3f91cb3dcd9fdb0fb100147");
filter.add("296fbdb5c555c10321e56eebdb62b146b0606d66");
PotentialBFCDetector pBFCDetector = new PotentialBFCDetector(Miner.repo, Miner.git);
Miner.pRFCs = null;
Miner.pRFCs = (LinkedList<PotentialRFC>) pBFCDetector.detectPotentialBFC(filter);
Miner.singleThreadHandle();
}

//fastjson_fcp.csv
@Ignore
@Test
public void testRegressionInFAlCePass() throws Exception {
List<String> filter = new ArrayList<>(FileUtilx.readSetFromFile("resources/fastjson_fcp.csv"));
Expand Down

0 comments on commit bdbe0c4

Please sign in to comment.