@@ -164,9 +164,13 @@ ConfigFile* BenchProgram::getCurrentConfig() {
164164
165165void BenchProgram::createSrcClone (const std::string &subDir) {
166166 assert ( src_dirs.count (subDir) == 0 );
167- std::string copy = " cp -rf " ;
167+ // The path name of the original src_directory from the config file
168+ // This must be present in the file system ortherwise, we will hit errors!
169+ const std::string ori_src_dir = getFullPath (config.getStr (" src_dir" ),
170+ this ->work_dir );
171+ const std::string copy = " cp -Tfr " ;
168172 std::string cmd=copy;
169- cmd += ori_src_dir + " " + work_dir + " /" + subDir;
173+ cmd += ori_src_dir + " " + this -> work_dir + " /" + subDir;
170174 execute_cmd_until_succ (cmd);
171175
172176 cmd=copy;
@@ -243,7 +247,6 @@ void BenchProgram::Init(const std::string &workDirPath, bool no_clean_up,bool in
243247 test_cnt = 0 ;
244248 this ->cache = NULL ;
245249 this ->no_clean_up = no_clean_up;
246- this ->ori_src_dir = config.getStr (" src_dir" );
247250 this ->wrap_ld = false ;
248251 if (config.hasValue (" wrap_ld" ))
249252 this ->wrap_ld = (config.getStr (" wrap_ld" ) == " yes" );
@@ -282,7 +285,7 @@ void BenchProgram::Init(const std::string &workDirPath, bool no_clean_up,bool in
282285 // We create an initial clone of the basic src direcotry
283286 src_dirs.clear ();
284287 createSrcClone (" src" );
285- this ->src_dir = getFullPath (this ->work_dir + " /src " );
288+ this ->src_dir = getFullPath (" src " , this ->work_dir );
286289
287290 std::string ori_test_dir = config.getStr (" test_dir" );
288291 if (ori_test_dir != " " ) {
@@ -294,7 +297,7 @@ void BenchProgram::Init(const std::string &workDirPath, bool no_clean_up,bool in
294297 }
295298 else {
296299 this ->work_dir = getFullPath (workDirPath);
297- this ->src_dir = getFullPath (work_dir + " / src" );
300+ this ->src_dir = getFullPath (" src" , this -> work_dir );
298301 src_dirs.clear ();
299302 // src_dirs.insert(std::make_pair("src", true));
300303
@@ -346,17 +349,18 @@ void BenchProgram::Init(const std::string &workDirPath, bool no_clean_up,bool in
346349 if (dep_dir != " " ){
347350 dep_dir = getFullPath (dep_dir);
348351 }
349- this ->test_dir = getFullPath (work_dir+ " / tests" );
352+ this ->test_dir = getFullPath (" tests" , this -> work_dir );
350353 this ->build_log_file = work_dir + " /build.log" ;
351354 // Clean up builg log for every execution
352355 std::string cmd = std::string (" rm -rf " ) + build_log_file;
353356 int ret = system (cmd.c_str ());
354357 assert ( ret == 0 );
355- this ->build_cmd = getFullPath (config.getStr (" build_cmd" ));
356- this ->test_cmd = getFullPath (config.getStr (" test_cmd" ));
357- this ->ddtest_cmd =getFullPath (config.getStr (" tools_dir" ))+" /DD.py" ;
358- this ->prophet_src =getFullPath (config.getStr (" tools_dir" ))+" /../src" ;
359- this ->afl_cmd =getFullPath (config.getStr (" tools_dir" ))+" /run-afl.py" ;
358+ this ->build_cmd = getFullPath (config.getStr (" build_cmd" ), this ->work_dir );
359+ this ->test_cmd = getFullPath (config.getStr (" test_cmd" ), this ->work_dir );
360+ this ->ddtest_cmd = getFullPath (config.getStr (" tools_dir" )+" /DD.py" ,
361+ this ->work_dir );
362+ this ->prophet_src = getFullPath (config.getStr (" tools_dir" )+" /../src" ,
363+ this ->work_dir );
360364 this ->localization_filename = work_dir + " /" + LOCALIZATION_RESULT;
361365 this ->conditionNum =false ;
362366
@@ -382,7 +386,8 @@ void BenchProgram::Init(const std::string &workDirPath, bool no_clean_up,bool in
382386 sin >> case_timeout;
383387 }
384388
385- std::string revision_file = config.getStr (" revision_file" );
389+ std::string revision_file = getFullPath (config.getStr (" revision_file" ),
390+ this ->work_dir );
386391 parseRevisionLog (revision_file, negative_cases, positive_cases);
387392}
388393
@@ -483,7 +488,7 @@ bool incrementalBuild(time_t timeout_limit, const std::string &src_dir, const st
483488
484489bool BenchProgram::buildFull (const std::string &subDir, time_t timeout_limit, bool force_reconf,std::vector<long long > compile_macro,std::vector<std::string> files,std::vector<long long > writer_macro) {
485490 assert (src_dirs.count (subDir) != 0 );
486- std::string src_dir = getFullPath (work_dir + " / " + subDir);
491+ std::string src_dir = getFullPath (subDir, this -> work_dir );
487492
488493 for (int i=0 ;i<files.size ();i++){
489494 std::string code;
@@ -1089,7 +1094,7 @@ std::vector<long long> BenchProgram::buildWithRepairedCode(const std::string &wr
10891094 outlog_printf (2 ," Search %s!\n " ,it->first .c_str ());
10901095
10911096 ExecutionTimer timer;
1092- std::string src_dir = getFullPath (work_dir + " / src" );
1097+ std::string src_dir = getFullPath (" src" , this -> work_dir );
10931098 removeMacros (fileCodeMap,src_dir);
10941099 std::string cmd;
10951100 cmd=ddtest_cmd+" -l " +build_log_file+" -s " +src_dir;
@@ -1188,7 +1193,7 @@ std::vector<long long> BenchProgram::buildWithRepairedCode(const std::string &wr
11881193 outlog_printf (2 ," Search %s!\n " ,it->first .c_str ());
11891194
11901195 ExecutionTimer timer;
1191- std::string src_dir = getFullPath (work_dir + " / src" );
1196+ std::string src_dir = getFullPath (" src" , this -> work_dir );
11921197 removeMacros (fileCodeMap,src_dir);
11931198 std::string cmd;
11941199 cmd=ddtest_cmd+" -l " +build_log_file+" -s " +src_dir+" -d " +BuildSubDir.getValue ();
@@ -1314,9 +1319,9 @@ BenchProgram::TestCaseSetTy BenchProgram::testSet(const std::string &subDir,
13141319 // cmd+=" -s "+std::to_string(switchId)+"-"+std::to_string(caseNum);
13151320
13161321 if (!pass_basic_src_dir)
1317- cmd = cmd + " " + getFullPath (work_dir + " / " + subDir) + " " + test_dir + " " + work_dir + " " ;
1322+ cmd = cmd + " " + getFullPath (subDir, this -> work_dir ) + " " + test_dir + " " + work_dir + " " ;
13181323 else
1319- cmd = cmd + " -p " + getFullPath (work_dir + " / " + subDir) + " " + src_dir + " " + test_dir + " " + work_dir + " " ;
1324+ cmd = cmd + " -p " + getFullPath (subDir, this -> work_dir ) + " " + src_dir + " " + test_dir + " " + work_dir + " " ;
13201325 std::ostringstream sout;
13211326 sout << cmd;
13221327 for (TestCaseSetTy::const_iterator it = case_set.begin (); it != case_set.end (); it ++)
@@ -1573,4 +1578,4 @@ std::unique_ptr<clang::ASTUnit> BenchProgram::buildClangASTUnit(const std::strin
15731578 std::string cmd = "rm -rf " + work_dir + "/profile";
15741579 int ret = system(cmd.c_str());
15751580 assert( ret == 0);
1576- }*/
1581+ }*/
0 commit comments