21
21
22
22
scripts/parallel-properties.py -J 32 binary.gb --timeout 600
23
23
24
- See --help for the list of available command-line options.
24
+ See --help for the list of available command-line options. Any additional
25
+ options to be passed to CBMC can be added to the command line.
25
26
"""
26
27
27
28
import argparse
@@ -213,23 +214,13 @@ def output_result(result_entry, stats, status, verbose):
213
214
return (result , result_str )
214
215
215
216
216
- def verify_one (goto_binary , unwind , unwindset , unwinding_assertions , depth ,
217
- object_bits , prop , verbose , timeout , stats ):
217
+ def verify_one (goto_binary , cbmc_args , prop , verbose , timeout , stats ):
218
218
# run CBMC with extended statistics
219
219
cbmc_cmd = ['cbmc' , '--verbosity' , '8' , goto_binary ,
220
220
'--property' , prop ['name' ], '--reachability-slice' ,
221
221
# '--full-slice',
222
222
'--slice-formula' ]
223
- if unwind :
224
- cbmc_cmd .extend (['--unwind' , unwind ])
225
- if unwindset :
226
- cbmc_cmd .extend (['--unwindset' , unwindset ])
227
- if unwinding_assertions :
228
- cbmc_cmd .extend (['--unwinding-assertions' ])
229
- if depth :
230
- cbmc_cmd .extend (['--depth' , str (depth )])
231
- if object_bits :
232
- cbmc_cmd .extend (['--object-bits' , str (object_bits )])
223
+ cbmc_cmd .extend (cbmc_args )
233
224
(cbmc_ret , stderr_output , t , cnf_vars , cnf_clauses ) = run_cmd_with_timeout (
234
225
cbmc_cmd , timeout , verbose )
235
226
result_entry = {'time' : t , 'property' : prop , 'variables' : cnf_vars ,
@@ -244,8 +235,7 @@ def verify_one(goto_binary, unwind, unwindset, unwinding_assertions, depth,
244
235
return output_result (result_entry , stats , C_ERROR , verbose )
245
236
246
237
247
- def verify (goto_binary , unwind , unwindset , unwinding_assertions , depth ,
248
- object_bits , verbose , timeout , n_jobs , stats ):
238
+ def verify (goto_binary , cbmc_args , verbose , timeout , n_jobs , stats ):
249
239
# find names of desired properties
250
240
show_prop_cmd = ['goto-instrument' , '--verbosity' , '4' , '--json-ui' ,
251
241
'--show-properties' , goto_binary ]
@@ -259,10 +249,8 @@ def verify(goto_binary, unwind, unwindset, unwinding_assertions, depth,
259
249
lock = multiprocessing .Lock ()
260
250
261
251
with concurrent .futures .ThreadPoolExecutor (max_workers = n_jobs ) as e :
262
- future_to_result = {e .submit (verify_one , goto_binary , unwind ,
263
- unwindset , unwinding_assertions , depth ,
264
- object_bits , prop , verbose , timeout ,
265
- stats ): prop
252
+ future_to_result = {e .submit (verify_one , goto_binary , cbmc_args ,
253
+ prop , verbose , timeout , stats ): prop
266
254
for prop in json_props [1 ]['properties' ]}
267
255
for future in concurrent .futures .as_completed (future_to_result ):
268
256
prop = future_to_result [future ]
@@ -295,40 +283,18 @@ def main():
295
283
'-v' , '--verbose' ,
296
284
action = 'store_true' ,
297
285
help = 'enable verbose output' )
298
- parser .add_argument (
299
- '--unwind' ,
300
- type = str ,
301
- help = 'loop unwinding, forwarded to CBMC' ),
302
- parser .add_argument (
303
- '--unwindset' ,
304
- type = str ,
305
- help = 'loop unwinding, forwarded to CBMC' ),
306
- parser .add_argument (
307
- '--unwinding-assertions' ,
308
- action = 'store_true' ,
309
- help = 'enable unwinding assertions, forwarded to CBMC' ),
310
- parser .add_argument (
311
- '--depth' ,
312
- type = int ,
313
- help = 'symex depth, forwarded to CBMC' ),
314
- parser .add_argument (
315
- '--object-bits' ,
316
- type = int ,
317
- help = 'object bits, forwarded to CBMC' ),
318
286
parser .add_argument (
319
287
'goto_binary' ,
320
288
help = 'instrumented goto binary to verify' )
321
- args = parser .parse_args ()
289
+ args , cbmc_args = parser .parse_known_args ()
322
290
323
291
logger = get_logger (args .verbose )
324
292
325
293
stats = {}
326
294
results = {}
327
295
results ['results' ] = verify (
328
- args .goto_binary , args .unwind , args .unwindset ,
329
- args .unwinding_assertions ,
330
- args .depth , args .object_bits , args .verbose ,
331
- args .timeout , args .parallel , stats )
296
+ args .goto_binary , cbmc_args , args .verbose , args .timeout ,
297
+ args .parallel , stats )
332
298
333
299
if args .statistics :
334
300
results ['statistics' ] = stats
0 commit comments