Skip to content

Commit faf8f24

Browse files
author
Yusen Su
committed
feat: config yamls and fix scripts
1 parent 847024b commit faf8f24

File tree

11 files changed

+107
-86
lines changed

11 files changed

+107
-86
lines changed

scripts/get_exper_brunch_stat.py

Lines changed: 25 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
import csv
44
import argparse
55
import yaml
6-
import glob
6+
import glob, os
77
from collections import defaultdict
88

99
METRICS_FILE = "metrics.yaml"
@@ -25,6 +25,8 @@ def read_brunchstat_from_log(log_file_name):
2525
# remove _unsat_test
2626
cur_test = test_name[:-12]
2727
new_test_data['job_name'] = cur_test
28+
new_test_data['pp_loc'] = get_loc_info(cur_test, True)
29+
new_test_data['opsem_loc'] = get_loc_info(cur_test, False)
2830
data.append(new_test_data)
2931
elif line.startswith("BRUNCH_STAT"):
3032
stat = line.split()
@@ -37,6 +39,27 @@ def read_brunchstat_from_log(log_file_name):
3739
log_file.close()
3840
return data
3941

42+
def get_loc_info(file_name, is_pp):
43+
# Directory where the files are located
44+
directory_path = "/tmp/verify-c-common/"
45+
46+
ir_name = f"{file_name}.ir.peel.fat.pp.ms.bc" if is_pp else f"{file_name}.ir.peel.fat.pp.ms.crab.o.ul.cut.o.bc"
47+
48+
# Construct the full path to the file with its pattern
49+
full_path = os.path.join(directory_path, ir_name)
50+
51+
# Get the LOC of the file
52+
LOC = 'n/a'
53+
with open(full_path, 'r') as file:
54+
lines = file.readlines()
55+
start = False
56+
for line in lines:
57+
if start:
58+
LOC += 1
59+
if '@main' in line:
60+
LOC = 0
61+
start = True
62+
return LOC
4063

4164
def read_symbiotic_bruchstat_from_log(log_file_name, xml_file_dir, time_out):
4265
log_file = open(log_file_name, 'r')
@@ -115,6 +138,7 @@ def write_brunchstat_into_csv(data, out_file):
115138
for job_data in data:
116139
row = (job_data[k] for k, _ in metric_serlz)
117140
writer.writerow(row)
141+
print(f'[Statistics] Please find stat csv file at {out_file}')
118142

119143

120144
# def read_timimg_results(result_dir):

scripts/get_exper_res.py

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,7 @@
55
import glob
66
import subprocess
77
import argparse
8-
from get_exper_brunch_stat import read_brunchstat_from_log, write_brunchstat_into_csv
9-
8+
from get_exper_brunch_stat import *
109
BUILDABSPATH = os.path.abspath('../build/')
1110
DATAABSPATH = os.path.abspath('../') + "/data"
1211
SEAHORN_ROOT = '/home/yusen/seawork/seahorn/build/run' # Put your seahorn root dir here
@@ -62,7 +61,7 @@ def make_new_cmake_conf():
6261
smack_args = ""
6362
return f'cmake -DSEA_LINK=llvm-link-{LLVM_VERSION} -DCMAKE_C_COMPILER=clang-{LLVM_VERSION}\
6463
-DCMAKE_CXX_COMPILER=clang++-{LLVM_VERSION} -DSEA_ENABLE_KLEE={use_klee} {smack_args}\
65-
-DSEA_WITH_BLEEDING_EDGE={use_bleeding_edge} -DSEA_ENABLE_CRAB=OFF\
64+
-DSEA_WITH_BLEEDING_EDGE={use_bleeding_edge} -DSEA_ENABLE_CRAB=ON\
6665
-DSEA_ENABLE_SYMBIOTIC={use_symbiotic} -DSEAHORN_ROOT={SEAHORN_ROOT} ../ -GNinja'
6766

6867

@@ -96,7 +95,7 @@ def collect_res_from_ctest(file_name):
9695
read_data_from_xml(res_data)
9796
write_data_into_csv(
9897
"{dir}/{file}".format(dir="../data", file=file_name), res_data)
99-
print("Done, find result csv file at: %s" % file_name)
98+
print(f'[Results] Please find result csv file at: {os.path.abspath("../data")}')
10099

101100

102101
def run_ctest_for_seahorn():
@@ -108,7 +107,7 @@ def run_ctest_for_seahorn():
108107
set_env = f'env VERIFY_FLAGS=\"{verify_flags}\"'
109108
cmake_conf = make_new_cmake_conf()
110109
command_lst = ["rm -rf *", cmake_conf, "ninja",
111-
f'{set_env} ctest -j 12 -D ExperimentalTest -R . --timeout {args.timeout}']
110+
f'{set_env} ctest -j 1 -D ExperimentalTest -R . --timeout {args.timeout}']
112111
make_build_path(extra)
113112
cddir = "cd " + BUILDABSPATH
114113
for strcmd in command_lst:

scripts/metrics.yaml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,16 @@
11
job_name: "job_name"
22
Result: "result"
3+
pp_loc: "pp_loc"
4+
opsem_loc: "opsem_loc"
35
bmc.circ_sz: "bmc_circuit_size"
46
bmc.dag_sz: "bmc_dag_size"
57
crab.opsem.isderef.not.solve: "opsem.isderef.not.solve" # for crab
68
crab.opsem.isderef.solve: "opsem.isderef.solve" # for crab
79
crab.pp.isderef.not.solve: "pp.isderef.not.solve"
810
crab.pp.isderef.solve: "pp.isderef.solve"
911
opsem.crab: "opsem_crab_time"
12+
opsem.crab.solve: "opsem_crab_solve_time"
13+
pp.crab.solve: "pp_crab_solve_time"
1014
seapp.crab: "pp_crab_time"
1115
BMC: "bmc_time"
1216
BMC.solve: "bmc_solve_time"

seahorn/CMakeLists.txt

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -438,8 +438,12 @@ add_definitions(
438438
)
439439

440440
configure_file(include/config.h.in ${PROJECT_BINARY_DIR}/include/config.h)
441-
configure_file(sea.yaml sea.yaml @ONLY)
442-
configure_file(sea_crab_base.yaml sea.crab.yaml @ONLY)
441+
if(SEA_ENABLE_CRAB)
442+
configure_file(sea_crab_base.yaml sea.yaml @ONLY)
443+
else()
444+
configure_file(sea.yaml sea.yaml @ONLY)
445+
endif()
446+
configure_file(sea_crab.yaml sea.crab.yaml @ONLY)
443447
configure_file(sea_cex_base.yaml sea.cex.yaml @ONLY)
444448
configure_file(sea_vac.yaml sea.vac.yaml @ONLY)
445449
configure_file(sea_pcond.yaml sea.pcond.yaml @ONLY)

seahorn/include/bounds.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,5 @@ size_t fuzz_max_array_list_item_size(void);
4040
*/
4141
size_t fuzz_max_array_list_len(void);
4242

43-
size_t crab_max_array_size(void);
4443

4544
SEAHORN_EXTERN_C_END

seahorn/lib/bounds.c

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,5 +8,4 @@ size_t sea_max_array_list_item_size(void) { return MAX_ITEM_SIZE; }
88
size_t sea_max_array_list_len(void) { return MAX_INITIAL_ITEM_ALLOCATION; }
99
size_t fuzz_max_array_list_len(void) { return MAX_INITIAL_ITEM_ALLOCATION_FUZZ; }
1010
size_t fuzz_max_array_list_item_size(void) { return MAX_ITEM_SIZE_FUZZ; }
11-
size_t sea_max_table_size(void) { return MAX_TABLE_SIZE; }
12-
size_t crab_max_array_size(void) { return MAX_ARRAY_SIZE; }
11+
size_t sea_max_table_size(void) { return MAX_TABLE_SIZE; }

seahorn/sea.yaml

Lines changed: 0 additions & 46 deletions
This file was deleted.

seahorn/sea.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
sea_base.yaml

seahorn/sea_base.yaml

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ verify_options:
1111
externalize-addr-taken-functions: ''
1212
no-kill-vaarg: ''
1313
with-arith-overflow: true
14-
horn-unify-assumes: true
14+
horn-unify-assumes: false
1515
horn-gsa: ''
1616
# do not instrument library functions with memory assertions
1717
no-fat-fns: 'bcmp,memcpy,assert_bytes_match,ensure_linked_list_is_allocated,sea_aws_linked_list_is_valid'
@@ -23,9 +23,9 @@ verify_options:
2323
bmc: opsem
2424
horn-vcgen-use-ite: ''
2525
# ignore control flow
26-
horn-vcgen-only-dataflow: true
26+
horn-vcgen-only-dataflow: false
2727
# reduce by data dependence
28-
horn-bmc-coi: true
28+
horn-bmc-coi: false
2929
# static allocator supports symbolic allocation size
3030
sea-opsem-allocator: static
3131
# stack allocation from a symbolic starting point
@@ -43,4 +43,5 @@ verify_options:
4343
temp-dir: /tmp/verify-c-common
4444
# time and result stats
4545
horn-stats: true
46-
ignore-define-verifier-fns: ''
46+
# seapp-peel-loops: 1
47+
ignore-define-verifier-fns: ''

seahorn/sea_cex_base.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
#
88
verify_options:
99
# Optimization lelel. Lower to O1 for clearer counterexamples
10-
'-O1': ''
10+
'-O3': ''
1111
#
1212
# PREPROCESSING
1313
#
@@ -38,7 +38,7 @@ verify_options:
3838
# stack allocation from a symbolic starting point
3939
horn-explicit-sp0: false
4040
# lambdas for memory
41-
horn-bv2-lambdas: true
41+
horn-bv2-lambdas: ''
4242
# use z3 simplifier during vcgen
4343
horn-bv2-simplify: true
4444
# wide memory manager to track pointer sizes

seahorn/sea_crab.yaml

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
verify_options:
2+
# Use crab infer bounds / range (before loop unrolling)
3+
seapp-crab-lower-is-deref: true
4+
seapp-crab-dom: 'zones'
5+
seapp-crab-stats: true
6+
seapp-crab-disable-warning: true
7+
seapp-crab-obj-reduction: 'OPT'
8+
# Use crab infer bounds(after loop unrolling)
9+
horn-bv2-crab-check-is-deref: ''
10+
horn-bmc-crab-dom: 'zones'
11+
horn-bv2-crab-obj-reduction: 'OPT'
12+
# log: 'opsem-crab'
13+
# log: 'opsem-crab-ir'
14+
crab-disable-warning: true
15+
# Statistics
16+
# crab-show-stats: ''
17+
# horn-bv2-crab-stats: ''
18+
# log: 'opsem-crab-ir:opsem-crab:seapp-crab-ir:seapp-crab'

seahorn/sea_crab_base.yaml

Lines changed: 41 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -1,30 +1,48 @@
11
verify_options:
2+
# Optimization level.
3+
'-O3': ''
4+
#
5+
# PREPROCESSING
6+
#
7+
inline: ''
8+
enable-loop-idiom: ''
9+
enable-indvar: ''
10+
no-lower-gv-init-struct: ''
11+
externalize-addr-taken-functions: ''
12+
no-kill-vaarg: ''
13+
with-arith-overflow: true
14+
# disable program transformation to single assume
215
horn-unify-assumes: false
16+
# do not instrument library functions with memory assertions
17+
no-fat-fns: 'bcmp,memcpy,assert_bytes_match,ensure_linked_list_is_allocated,sea_aws_linked_list_is_valid'
318
horn-gsa: false
19+
# context-sensitive type-aware alias analysis
20+
dsa: sea-cs-t
21+
# weak support for function pointers. sea-dsa is better but less stable
22+
devirt-functions: 'types'
23+
# bit-precise memory-precise operational semantics
24+
bmc: opsem
25+
horn-vcgen-use-ite: ''
426
# ignore control flow
527
horn-vcgen-only-dataflow: false
628
# reduce by data dependence
729
horn-bmc-coi: false
8-
# Use crab solve sea.is_deref
9-
horn-bv2-crab-check-is-deref: ''
10-
# reduce used by object domain
11-
# horn-bv2-crab-reduce: ''
12-
# loop peeling
13-
seapp-peel-loops: 1
14-
# Use crab infer bounds / range (after loop unrolling)
15-
# horn-bv2-crab-rng: ''
16-
horn-bmc-crab-dom: 'zones'
17-
horn-bv2-crab-obj-reduction: 'OPT'
18-
# horn-bv2-crab-stats: ''
19-
# log: 'opsem-crab'
20-
# log: 'opsem-crab-ir'
21-
crab-disable-warning: true
22-
# Statistics
23-
# horn-bv2-crab-stats: ''
24-
# Use crab infer bounds / range (before loop unrolling)
25-
seapp-crab-lower-is-deref: true
26-
seapp-crab-dom: 'zones'
27-
seapp-crab-stats: true
28-
seapp-crab-disable-warning: true
29-
seapp-crab-obj-reduction: 'OPT'
30-
# log: 'opsem-crab-ir:opsem-crab:seapp-crab-ir:seapp-crab'
30+
# static allocator supports symbolic allocation size
31+
sea-opsem-allocator: static
32+
# stack allocation from a symbolic starting point
33+
horn-explicit-sp0: false
34+
# lambdas for memory
35+
horn-bv2-lambdas: ''
36+
# use z3 simplifier during vcgen
37+
horn-bv2-simplify: true
38+
# wide memory manager to track pointer sizes
39+
horn-bv2-extra-widemem: ''
40+
# intermediate results in human readable form for debugging
41+
'-S': ''
42+
# keep intermediate results for debugging
43+
keep-temps: ''
44+
temp-dir: /tmp/verify-c-common
45+
# time and result stats
46+
horn-stats: true
47+
# ignore converting function with prefix sea_nd to nd function
48+
ignore-define-verifier-fns: ''

0 commit comments

Comments
 (0)