Skip to content

Commit

Permalink
Add crashExit argument for inference tool. (#8)
Browse files Browse the repository at this point in the history
  • Loading branch information
CharlesZ-Chen authored Nov 7, 2017
1 parent bade285 commit f7b35dd
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions do_like_javac/tools/infer.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import os
import os,sys
import argparse
import common

Expand All @@ -20,14 +20,20 @@
infer_group.add_argument('-cfArgs', '--cfArgs', metavar='<cfArgs>',
action='store',default='',
help='arguments for checker framework')
infer_group.add_argument('-crashExit', '--crashExit', type=bool,
action='store', default=False,
help='set True then dljc will early exit if it found a round of inference crashed during the iteration.')

def run(args, javac_commands, jars):
print os.environ
idx = 0
for jc in javac_commands:
jaif_file = "logs/infer_result_{}.jaif".format(idx)
cmd = get_tool_command(args, jc['javac_switches']['classpath'], jc['java_files'], jaif_file)
common.run_cmd(cmd, args, 'infer')
status = common.run_cmd(cmd, args, 'infer')
if args.crashExit and not status['return_code'] == 0:
print "----- CF Inference crashed! Terminates DLJC. -----"
sys.exit(1)
idx += 1

def get_tool_command(args, target_classpath, java_files, jaif_file="default.jaif"):
Expand Down

0 comments on commit f7b35dd

Please sign in to comment.