55import glob
66import subprocess
77import argparse
8- from get_exper_brunch_stat import *
8+ from get_exper_brunch_stat import read_brunchstat_from_log , write_brunchstat_into_csv
99
10- BUILDABSPATH = os .path .abspath ('../exper /' )
10+ BUILDABSPATH = os .path .abspath ('../build /' )
1111DATAABSPATH = os .path .abspath ('../' ) + "/data"
12- SEAHORN_ROOT = '../../build- seahorn' # Put your seahorn root dir here
12+ SEAHORN_ROOT = '/home/yusen/seawork/ seahorn/build/run ' # Put your seahorn root dir here
1313FILE_DICT = {
1414 "" : "seahorn.csv" ,
1515 "--vac" : "seahorn(vac).csv" ,
1616 "--horn-bmc-solver=smt-y2" : "seahorn(smt-y2).csv" ,
1717 "--cex" : "seahorn(cex).csv" ,
1818 "--cex --horn-bmc-solver=smt-y2" : "seahorn(cex, smt-y2).csv" ,
19- "klee" : "klee.csv" , "symbiotic" : "symbiotic.csv" }
19+ "klee" : "klee.csv" , "symbiotic" : "symbiotic.csv" , "clam" : "clam.csv" }
2020LLVM_VERSION = 14
2121
2222def extra_to_filename (extra , suffix = '.csv' , prefix = '' ):
@@ -52,7 +52,7 @@ def make_new_cmake_conf():
5252 use_klee = "ON" if args .klee else "OFF"
5353 use_symbiotic = "ON" if args .symbiotic else "OFF"
5454 use_bleeding_edge = "ON" if args .bleed_edge else "OFF"
55- use_crab = "ON" if "--crab" in extra else "OFF"
55+ # use_crab = "ON" if "--crab" in extra else "OFF"
5656 if args .smack_parser :
5757 use_smack = "ON" if args .smack else "OFF"
5858 smack_enable_no_mem_split = "ON" if args .mem_no_split else "OFF"
@@ -62,7 +62,7 @@ def make_new_cmake_conf():
6262 smack_args = ""
6363 return f'cmake -DSEA_LINK=llvm-link-{ LLVM_VERSION } -DCMAKE_C_COMPILER=clang-{ LLVM_VERSION } \
6464 -DCMAKE_CXX_COMPILER=clang++-{ LLVM_VERSION } -DSEA_ENABLE_KLEE={ use_klee } { smack_args } \
65- -DSEA_WITH_BLEEDING_EDGE={ use_bleeding_edge } -DSEA_ENABLE_CRAB={ use_crab } \
65+ -DSEA_WITH_BLEEDING_EDGE={ use_bleeding_edge } -DSEA_ENABLE_CRAB=OFF \
6666 -DSEA_ENABLE_SYMBIOTIC={ use_symbiotic } -DSEAHORN_ROOT={ SEAHORN_ROOT } ../ -GNinja'
6767
6868
@@ -99,18 +99,6 @@ def collect_res_from_ctest(file_name):
9999 print ("Done, find result csv file at: %s" % file_name )
100100
101101
102- def extra_to_filename (extra , suffix = 'csv' ):
103- '''extra: --a=b --c=d to filename: a.b.c.d.csv'''
104- if (len (extra ) == 0 ):
105- return f'base.{ suffix } '
106- parts = []
107- for flag in extra :
108- if flag .startswith ('--' ):
109- flag = flag [2 :]
110- parts .extend (flag .split ('=' ))
111- return f'{ "_" .join (parts )} .{ suffix } '
112-
113-
114102def run_ctest_for_seahorn ():
115103 print ("[SeaHorn] Start making SeaHorn results..." )
116104 set_env = ''
@@ -120,7 +108,7 @@ def run_ctest_for_seahorn():
120108 set_env = f'env VERIFY_FLAGS=\" { verify_flags } \" '
121109 cmake_conf = make_new_cmake_conf ()
122110 command_lst = ["rm -rf *" , cmake_conf , "ninja" ,
123- f'{ set_env } ctest -j{ os . cpu_count () } -D ExperimentalTest -R . --timeout { args .timeout } ' ]
111+ f'{ set_env } ctest -j 12 -D ExperimentalTest -R . --timeout { args .timeout } ' ]
124112 make_build_path (extra )
125113 cddir = "cd " + BUILDABSPATH
126114 for strcmd in command_lst :
@@ -137,6 +125,22 @@ def run_ctest_for_seahorn():
137125 collect_stat_from_ctest_log (extra_to_filename (extra , suffix = '.brunch.csv' ),
138126 True if "--crab" in extra else False )
139127
128+ def run_ctest_for_clam ():
129+ print ("[Clam] Start making Clam results..." )
130+ cmake_conf = make_new_cmake_conf ()
131+ command_lst = ["rm -rf *" , cmake_conf , "ninja" ,
132+ f'ctest -j{ os .cpu_count ()} -D ExperimentalTest -R smack_ --timeout 200' ]
133+ make_build_path (["--clam" ])
134+ for strcmd in command_lst :
135+ cddir += " ; " + strcmd
136+ if args .debug :
137+ print (f'[Command] { cddir } ' )
138+ process = subprocess .Popen (
139+ '/bin/bash' ,
140+ stdin = subprocess .PIPE ,
141+ stdout = get_output_level ())
142+ _ = process .communicate (cddir .encode ())
143+ collect_res_from_ctest (FILE_DICT ["klee" ])
140144
141145def collect_stat_from_ctest_log (outfile , use_crab ):
142146 test_tmpdir = os .path .join (BUILDABSPATH , 'Testing' , 'Temporary' )
@@ -176,8 +180,8 @@ def run_ctest_for_klee():
176180def run_ctest_for_smack ():
177181 cmake_conf = make_new_cmake_conf ()
178182 command_lst = ["rm -rf *" , cmake_conf , "ninja" ,
179- f'ctest -j{ os .cpu_count ()} -D ExperimentalTest -R smack_ --timeout { args . timeout } ' ]
180- print ("Start making SMACK results..." )
183+ f'ctest -j{ os .cpu_count ()} -D ExperimentalTest -R smack_ --timeout 200 ' ]
184+ print ("[SMACK] Start making SMACK results..." )
181185 make_build_path (["--smack" ])
182186 cddir = "cd " + BUILDABSPATH
183187 for strcmd in command_lst :
@@ -193,7 +197,6 @@ def run_ctest_for_smack():
193197 collect_res_from_ctest (extra_to_filename (
194198 [str (args .precise ), str (args .checks ), mem_split ]))
195199
196-
197200def run_ctest_for_symbiotic ():
198201 cmake_conf = make_new_cmake_conf ()
199202 command_lst = ["rm -rf *" , cmake_conf , "ninja" ,
@@ -211,7 +214,6 @@ def run_ctest_for_symbiotic():
211214 _ = process .communicate (cddir .encode ())
212215 collect_stat_from_ctest_log (FILE_DICT ["symbiotic" ])
213216
214-
215217def main ():
216218 os .makedirs (DATAABSPATH , exist_ok = True )
217219 os .makedirs (BUILDABSPATH , exist_ok = True )
@@ -223,6 +225,8 @@ def main():
223225 run_ctest_for_smack ()
224226 if args .symbiotic :
225227 run_ctest_for_symbiotic ()
228+ if args .clam :
229+ run_ctest_for_clam ()
226230
227231
228232if __name__ == "__main__" :
@@ -232,6 +236,7 @@ def main():
232236 parser .add_argument ('--seahorn' , action = 'store_true' , default = True )
233237 parser .add_argument ('--klee' , action = 'store_true' , default = False )
234238 parser .add_argument ('--symbiotic' , action = 'store_true' , default = False )
239+ parser .add_argument ('--clam' , action = 'store_true' , default = False )
235240 parser .add_argument ('--bleed_edge' , action = 'store_true' , default = False )
236241 parser .add_argument ('--debug' , action = 'store_true' , default = False )
237242 parser .add_argument ('--timeout' , type = int , default = 2000 ,
@@ -262,4 +267,4 @@ def main():
262267 args .seahorn = False
263268 if args .symbiotic :
264269 args .seahorn = False
265- main ()
270+ main ()
0 commit comments