Skip to content

Commit 210a2be

Browse files
authored
Merge pull request #2 from Suresoft-GLaDOS/validation
2nd branch update
2 parents 621f912 + 029e809 commit 210a2be

21 files changed

Lines changed: 400 additions & 303 deletions

AFLplusplus

-344 Bytes
Binary file not shown.
0 Bytes
Binary file not shown.
Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
1-
test.c 12 5 test.c 12 5 999999 2 55829
2-
test.c 14 3 test.c 14 3 999998 1 55829
3-
test.c 9 3 test.c 9 3 999998 3 55829
4-
test.c 7 3 test.c 7 3 999998 4 55829
5-
test.c 6 3 test.c 6 3 999998 5 55829
6-
test.c 5 3 test.c 5 3 999998 6 55829
7-
test.c 4 3 test.c 4 3 999998 7 55829
1+
test.c 12 5 test.c 12 5 999999 2 8711
2+
test.c 15 3 test.c 15 3 999998 1 8711
3+
test.c 9 3 test.c 9 3 999998 3 8711
4+
test.c 7 3 test.c 7 3 999998 4 8711
5+
test.c 6 3 test.c 6 3 999998 5 8711
6+
test.c 5 3 test.c 5 3 999998 6 8711
7+
test.c 4 3 test.c 4 3 999998 7 8711
Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,11 @@
1-
revision_file=revision.log
2-
src_dir=src
3-
test_dir=tests
4-
build_cmd=../../../tools/simple-build.py
5-
test_cmd=../../../tools/simple-test.py
6-
ddtest_cmd=../../../tools/DD.py
1+
revision_file=/root/project/MSV/examples/engagement1/if-condition/revision.log
2+
src_dir=/root/project/MSV/examples/engagement1/if-condition/src
3+
test_dir=/root/project/MSV/examples/engagement1/if-condition/tests
4+
build_cmd=/root/project/MSV/tools/simple-build.py
5+
test_cmd=/root/project/MSV/tools/simple-test.py
6+
ddtest_cmd=/root/project/MSV/tools/DD.py
7+
tools_dir=/root/project/MSV/build/benchmarks/../../tools
78
localizer=profile
9+
bugged_file=test.c
10+
fixed_out_file=fixed_
811
single_case_timeout=1
Lines changed: 0 additions & 218 deletions
Original file line numberDiff line numberDiff line change
@@ -1,218 +0,0 @@
1-
Initialize the program!
2-
Verify Test Cases
3-
All passed!
4-
Done Verification
5-
Generating repair candidates!
6-
Processing test.c
7-
Total 108 different repair schemas!!!!
8-
Total 193 different repair candidate templates for scoring!!!
9-
Total 104 different partial repair candidate templates!!
10-
BasicTester pointer: 0x558761af1a90
11-
StringConstTester pointer: 0x558761a62ba0
12-
CondTester pointer: 0x5587619f8500
13-
Generating Candidates...
14-
Candidates size: 108
15-
Generating Codes...
16-
[2] Preprocess the following candidate with CondTester:
17-
108 Candidates
18-
Generating patches with CondTester...
19-
test
20-
Generating patches...
21-
Patch Generated!
22-
ID count: 86
23-
[2] CondTester, a patch instance with id 0:
24-
codes size: 1
25-
res size: 1
26-
result size: 107
27-
Begin building test
28-
Total macros: 86
29-
Saving this fix to: __fixed_test.c
30-
Building with no macros...
31-
Trying to build with all macros...
32-
Build Success!
33-
[3] CondTester, Testing instance id 0:
34-
35-
Total ID: 3
36-
Testing with ID 0
37-
Testing negative cases!
38-
Testing 2 (with abstract condition)
39-
Printing IDs:
40-
__ID0: 8
41-
__ID1: 0
42-
__ID2: 0
43-
Iteration 0
44-
Branch 0: 0
45-
Iteration 1
46-
Branch 0: 1
47-
Trying with NEG_ARG=0!
48-
Passed Negative Cases wiht CondTester!
49-
[1, ]
50-
Testing positive cases!
51-
Passed Positive Cases
52-
Collect values for post processing!
53-
[4] Passed!
54-
Testing negative cases!
55-
Testing 2 (with abstract condition)
56-
Printing IDs:
57-
__ID0: 9
58-
__ID1: 0
59-
__ID2: 0
60-
Iteration 0
61-
Branch 0: 0
62-
Iteration 1
63-
Branch 0: 1
64-
Trying with NEG_ARG=0!
65-
Testing negative cases!
66-
Testing 2 (with abstract condition)
67-
Printing IDs:
68-
__ID0: 10
69-
__ID1: 0
70-
__ID2: 0
71-
Iteration 0
72-
Branch 0: 0
73-
Iteration 1
74-
Branch 0: 1
75-
Trying with NEG_ARG=0!
76-
Testing with ID 1
77-
Testing negative cases!
78-
Testing 2 (with abstract condition)
79-
Printing IDs:
80-
__ID0: 0
81-
__ID1: 36
82-
__ID2: 0
83-
Iteration 0
84-
Branch 0: 0
85-
Iteration 1
86-
Branch 0: 1
87-
Trying with NEG_ARG=0!
88-
Testing negative cases!
89-
Testing 2 (with abstract condition)
90-
Printing IDs:
91-
__ID0: 0
92-
__ID1: 37
93-
__ID2: 0
94-
Iteration 0
95-
Branch 0: 0
96-
Iteration 1
97-
Branch 0: 1
98-
Trying with NEG_ARG=0!
99-
Testing negative cases!
100-
Testing 2 (with abstract condition)
101-
Printing IDs:
102-
__ID0: 0
103-
__ID1: 38
104-
__ID2: 0
105-
Iteration 0
106-
Branch 0: 0
107-
Iteration 1
108-
Branch 0: 1
109-
Trying with NEG_ARG=0!
110-
Testing with ID 2
111-
Testing negative cases!
112-
Testing 2 (with abstract condition)
113-
Printing IDs:
114-
__ID0: 0
115-
__ID1: 0
116-
__ID2: 6
117-
Iteration 0
118-
Branch 0: 0
119-
Iteration 1
120-
Branch 0: 1
121-
Trying with NEG_ARG=0!
122-
Testing negative cases!
123-
Testing 2 (with abstract condition)
124-
Printing IDs:
125-
__ID0: 0
126-
__ID1: 0
127-
__ID2: 7
128-
Iteration 0
129-
Branch 0: 0
130-
Iteration 1
131-
Branch 0: 1
132-
Trying with NEG_ARG=0!
133-
Testing negative cases!
134-
Testing 2 (with abstract condition)
135-
Printing IDs:
136-
__ID0: 0
137-
__ID1: 0
138-
__ID2: 8
139-
Iteration 0
140-
Branch 0: 0
141-
Iteration 1
142-
Branch 0: 1
143-
Trying with NEG_ARG=0!
144-
Testing negative cases!
145-
Testing 2 (with abstract condition)
146-
Printing IDs:
147-
__ID0: 0
148-
__ID1: 0
149-
__ID2: 17
150-
Iteration 0
151-
Branch 0: 0
152-
Iteration 1
153-
Branch 0: 1
154-
Trying with NEG_ARG=0!
155-
Testing negative cases!
156-
Testing 2 (with abstract condition)
157-
Printing IDs:
158-
__ID0: 0
159-
__ID1: 0
160-
__ID2: 18
161-
Iteration 0
162-
Branch 0: 0
163-
Iteration 1
164-
Branch 0: 1
165-
Trying with NEG_ARG=0!
166-
Testing negative cases!
167-
Testing 2 (with abstract condition)
168-
Printing IDs:
169-
__ID0: 0
170-
__ID1: 0
171-
__ID2: 19
172-
Iteration 0
173-
Trying with NEG_ARG=0!
174-
Testing negative cases!
175-
Testing 2 (with abstract condition)
176-
Printing IDs:
177-
__ID0: 0
178-
__ID1: 0
179-
__ID2: 20
180-
Iteration 0
181-
Branch 0: 0
182-
Iteration 1
183-
Branch 0: 1
184-
Passed in iteration!
185-
Passed Negative Cases wiht CondTester!
186-
[1, ]
187-
Testing positive cases!
188-
Passed Positive Cases
189-
Collect values for post processing!
190-
[6] Passed!
191-
Testing negative cases!
192-
Testing 2 (with abstract condition)
193-
Printing IDs:
194-
__ID0: 0
195-
__ID1: 0
196-
__ID2: 21
197-
Iteration 0
198-
Branch 0: 0
199-
Iteration 1
200-
Branch 0: 1
201-
Trying with NEG_ARG=0!
202-
Testing negative cases!
203-
Testing 2 (with abstract condition)
204-
Printing IDs:
205-
__ID0: 0
206-
__ID1: 0
207-
__ID2: 22
208-
Iteration 0
209-
Branch 0: 0
210-
Iteration 1
211-
Branch 0: 1
212-
Trying with NEG_ARG=0!
213-
The total number of explored concrete patches: 0
214-
Repair process ends without working fix!!
215-
Total 108 different repair schemas!!!!
216-
Total 193 different repair candidate templates for scoring!!!
217-
Total number of compiles: 1
218-
Total number of test eval: 53
-13.2 KB
Binary file not shown.

src/BenchProgram.cpp

Lines changed: 39 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -141,7 +141,7 @@ void BenchProgram::createSrcClone(const std::string &subDir) {
141141

142142
cmd=copy;
143143
cmd+= ori_src_dir+"/.git "+work_dir+"/"+subDir;
144-
system(cmd.c_str());
144+
int res=system(cmd.c_str());
145145
src_dirs.insert(std::make_pair(subDir, false));
146146
}
147147

@@ -772,25 +772,25 @@ std::vector<long long> BenchProgram::buildWithRepairedCode(const std::string &wr
772772
bool added=false;
773773

774774
while(std::getline(buildLog,line)){
775-
// if (line.find("undefined reference to") != std::string::npos) {
776-
// size_t pos = line.find("undefined reference to");
777-
// size_t start = line.find("'", pos);
778-
// if (start == line.length() || start == line.length() - 1 || start == line.length() - 2)
779-
// start = line.find("`", pos);
780-
// size_t end = line.find("'", start + 1);
781-
// std::string errorFunc = line.substr(start + 1, end - start - 1);
782-
783-
// for (std::map<long long, std::string>::const_iterator it = macroWithCode.begin(); it != macroWithCode.end(); it++)
784-
// {
785-
// if (it->second.find(errorFunc) != std::string::npos)
786-
// {
787-
// if(linkErrorMacros.find(it->first)==linkErrorMacros.end())
788-
// added=true;
789-
// linkErrorMacros.insert(it->first);
790-
// }
791-
// }
792-
// }
793-
if (line.find("error: ")!=std::string::npos){
775+
if (line.find("undefined reference to") != std::string::npos) {
776+
size_t pos = line.find("undefined reference to");
777+
size_t start = line.find("'", pos);
778+
if (start == line.length() || start == line.length() - 1 || start == line.length() - 2)
779+
start = line.find("`", pos);
780+
size_t end = line.find("'", start + 1);
781+
std::string errorFunc = line.substr(start + 1, end - start - 1);
782+
783+
for (std::map<long long, std::string>::const_iterator it = macroWithCode.begin(); it != macroWithCode.end(); it++)
784+
{
785+
if (it->second.find(errorFunc) != std::string::npos)
786+
{
787+
if(linkErrorMacros.find(it->first)==linkErrorMacros.end())
788+
added=true;
789+
linkErrorMacros.insert(it->first);
790+
}
791+
}
792+
}
793+
else if (line.find("error: ")!=std::string::npos){
794794
if (line.find("linker command")==std::string::npos){
795795
std::string fileName;
796796
size_t location=line.find(".c:");
@@ -960,7 +960,7 @@ std::vector<long long> BenchProgram::buildWithRepairedCode(const std::string &wr
960960
}
961961
cmd+=" -j 10 ";
962962
// cmd+=" > DD.log";
963-
ret = system(cmd.c_str());
963+
ret = explain_system_on_error(cmd.c_str());
964964

965965
if (ret==0) {
966966
total_repair_build_time += timer.getSeconds();
@@ -1009,28 +1009,27 @@ std::vector<long long> BenchProgram::buildWithRepairedCode(const std::string &wr
10091009

10101010
fail.clear();
10111011
for (std::map<std::string,std::vector<long long>>::const_iterator it=macroFile.begin();it!=macroFile.end();it++){
1012-
std::string candidateMacro="'";
1012+
std::string candidateMacro="";
10131013
for (std::set<long long>::iterator it2=fail_temp.begin();it2!=fail_temp.end();it2++){
10141014
if (std::find(it->second.begin(),it->second.end(),*it2)!=it->second.end());
10151015
candidateMacro+=std::to_string(*it2)+",";
10161016
}
10171017

1018-
if (candidateMacro!="'"){
1018+
if (candidateMacro!=""){
10191019
candidateMacro.pop_back();
10201020
}
10211021
else continue; // No fail macro in this file, skip it!
1022-
candidateMacro+="'";
10231022

1024-
std::string compile_macros="'";
1023+
std::string compile_macros="";
10251024
if (macros.size()!=0){
10261025
for (std::vector<long long>::iterator it2=macros.begin();it2!=macros.end();it2++){
10271026
compile_macros+=std::to_string(*it2)+",";
10281027
}
10291028

1030-
if (compile_macros!="'"){
1029+
if (compile_macros!=""){
10311030
compile_macros.pop_back();
10321031
}
1033-
compile_macros+="'";
1032+
compile_macros+="";
10341033
}
10351034

10361035
outlog_printf(2,"Search %s!\n",it->first.c_str());
@@ -1039,15 +1038,23 @@ std::vector<long long> BenchProgram::buildWithRepairedCode(const std::string &wr
10391038
std::string src_dir = getFullPath(work_dir + "/src");
10401039
removeMacros(fileCodeMap,src_dir);
10411040
std::string cmd;
1042-
cmd=ddtest_cmd+" -l "+build_log_file+" -s "+src_dir+" -m "+candidateMacro;
1043-
if (macros.size()!=0)
1044-
cmd+=" -n "+compile_macros;
1041+
cmd=ddtest_cmd+" -l "+build_log_file+" -s "+src_dir;
1042+
std::ofstream macroFile("/tmp/macros.tmp");
1043+
macroFile << candidateMacro;
1044+
macroFile.close();
1045+
if (macros.size()!=0){
1046+
cmd+=" -n ";
1047+
std::ofstream macroFile2("/tmp/compile_macros.tmp");
1048+
macroFile2 << compile_macros;
1049+
macroFile2.close();
1050+
}
1051+
// cmd+=" -n "+compile_macros;
10451052
// cmd+=" -t "+build_cmd;
10461053
if (dep_dir!="") cmd+=" -p "+dep_dir;
10471054
cmd+=" -w "+src_dir+"/"+it->first;
10481055
cmd+=" -j 10 ";
1049-
// cmd+=" > DD.log";
1050-
ret = system(cmd.c_str());
1056+
// cmd+=" > DD.log 2&>1";
1057+
ret = explain_system_on_error(cmd.c_str());
10511058

10521059
if (ret==0) {
10531060
total_repair_build_time += timer.getSeconds();

0 commit comments

Comments
 (0)