Skip to content

Commit 847024b

Browse files
author
Yusen Su
committed
feat(jobs): add more crab settings
1 parent eebe6ca commit 847024b

File tree

20 files changed

+424
-179
lines changed

20 files changed

+424
-179
lines changed

CMakeLists.txt

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,8 @@ option(SEA_LLVM_MEM_BUILTINS "Use LLVM builtins memcpy/memmove without memory sa
1414

1515

1616
option(SEA_ENABLE_FUZZ "Enable fuzzing" OFF)
17-
option(SEA_ENABLE_CRAB "Enable Seahorn using Clam/Crab" OFF)
17+
option(SEA_ENABLE_CRAB "Enable Seahorn using Crab" OFF)
18+
option(SEA_ENABLE_CLAM "Enable Seahorn using Clam" OFF)
1819
option(SEA_WITH_BLEEDING_EDGE "Enable bleeding edge proofs" OFF)
1920

2021
option(SEA_ENABLE_KLEE "Enable klee" OFF)
@@ -58,6 +59,10 @@ set(SEA_PP "${SEAHORN_ROOT}/bin/seapp" CACHE STRING "Path to seapp binary")
5859
set(LLVMIR_OPT ${SEA_OPT})
5960

6061
set(AWS_C_COMMON_ROOT ${CMAKE_CURRENT_SOURCE_DIR}/aws-c-common)
62+
set(AWS_C_COMPRESSION_ROOT ${CMAKE_CURRENT_SOURCE_DIR}/aws-c-compression)
63+
set(AWS_C_SDKUTILS_ROOT ${CMAKE_CURRENT_SOURCE_DIR}/aws-c-sdkutils)
64+
set(AWS_C_IO_ROOT ${CMAKE_CURRENT_SOURCE_DIR}/aws-c-io)
65+
set(AWS_C_CAL_ROOT ${CMAKE_CURRENT_SOURCE_DIR}/aws-c-cal)
6166

6267
if(SEA_ENABLE_FUZZ)
6368
find_package(aws-c-common REQUIRED)
@@ -75,5 +80,9 @@ include_directories(BEFORE ${CMAKE_CURRENT_BINARY_DIR}/include)
7580

7681
include_directories(seahorn/include)
7782
include_directories(aws-c-common/include)
83+
include_directories(aws-c-compression/include)
84+
include_directories(aws-c-sdkutils/include)
85+
include_directories(aws-c-io/include)
86+
include_directories(aws-c-cal/include)
7887
include_directories(${SEAHORN_ROOT}/include)
7988
add_subdirectory(seahorn)

scripts/get_exper_brunch_stat.py

Lines changed: 27 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ def read_brunchstat_from_log(log_file_name):
1717
cur_test = None
1818
while line:
1919
# look for next test
20-
new_test = re.search(BRUNCH_DICT["job_name"], line)
20+
new_test = re.search("Testing: ", line)
2121
if new_test:
2222
new_test_data = defaultdict(lambda: 'n/a')
2323
span = new_test.span()
@@ -33,8 +33,7 @@ def read_brunchstat_from_log(log_file_name):
3333
stat_num = stat[-1]
3434
data[-1][stat_name] = stat_num
3535
line = log_file.readline()
36-
if cur_test:
37-
data[cur_test] = move_dict_items_to_lst(row_dict)
36+
3837
log_file.close()
3938
return data
4039

@@ -117,6 +116,30 @@ def write_brunchstat_into_csv(data, out_file):
117116
row = (job_data[k] for k, _ in metric_serlz)
118117
writer.writerow(row)
119118

119+
120+
# def read_timimg_results(result_dir):
121+
# log_file = open(log_file_name, 'r')
122+
# line = log_file.readline()
123+
# data = defaultdict(list)
124+
# row_dict = {}
125+
# while line:
126+
# if "************** ANALYSIS RESULTS ****************" in line:
127+
# result_status = Status.SUCCESS
128+
# if "** OS Error:" in line:
129+
# result_status = Status.TIMEOUT
130+
# if "BRUNCH_STAT" in line:
131+
# parts = line.strip().split()
132+
# name = parts[1]
133+
# if name == "Clam":
134+
# number = float(parts[2])
135+
# if result_status == Status.CLAM_ERROR:
136+
# pairs.append([dirpath.strip().split('/')[1], "error"])
137+
# elif result_status == Status.TIMEOUT:
138+
# pairs.append([dirpath.strip().split('/')[1], "timeout"])
139+
# else:
140+
# pairs.append([dirpath.strip().split('/')[1], number])
141+
# draw_results_table(pairs, result_dir)
142+
120143
if __name__ == "__main__":
121144
parser = argparse.ArgumentParser(
122145
description='in and out files')
@@ -129,4 +152,4 @@ def write_brunchstat_into_csv(data, out_file):
129152
help="ouput csv filename")
130153
args = parser.parse_args()
131154
data = read_brunchstat_from_log(args.logfile)
132-
write_brunchstat_into_csv(data, args.outfile)
155+
write_brunchstat_into_csv(data, args.outfile)

scripts/get_exper_res.py

Lines changed: 29 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -5,18 +5,18 @@
55
import glob
66
import subprocess
77
import 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/')
1111
DATAABSPATH = 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
1313
FILE_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"}
2020
LLVM_VERSION=14
2121

2222
def 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-
114102
def 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

141145
def 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():
176180
def 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-
197200
def 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-
215217
def 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

228232
if __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()

scripts/metrics.yaml

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,12 @@ job_name: "job_name"
22
Result: "result"
33
bmc.circ_sz: "bmc_circuit_size"
44
bmc.dag_sz: "bmc_dag_size"
5-
crab.isderef.not.solve: "crab.isderef.not.solve" # for crab
6-
crab.isderef.solve: "crab.isderef.solve" # for crab
5+
crab.opsem.isderef.not.solve: "opsem.isderef.not.solve" # for crab
6+
crab.opsem.isderef.solve: "opsem.isderef.solve" # for crab
77
crab.pp.isderef.not.solve: "pp.isderef.not.solve"
88
crab.pp.isderef.solve: "pp.isderef.solve"
9+
opsem.crab: "opsem_crab_time"
10+
seapp.crab: "pp_crab_time"
911
BMC: "bmc_time"
1012
BMC.solve: "bmc_solve_time"
1113
Control dependence analysis: "cda_time"

0 commit comments

Comments
 (0)