Skip to content

Commit

Permalink
Merge pull request #12 from hxuhack/dev-master
Browse files Browse the repository at this point in the history
When KLEE replay tool encounters an error, its return value conflicts with BOMB_ENDING
  • Loading branch information
zzrcxb authored Jun 10, 2018
2 parents 05c46fa + c67dd9d commit 360a29f
Show file tree
Hide file tree
Showing 6 changed files with 9 additions and 54 deletions.
2 changes: 1 addition & 1 deletion include/a_tester.h
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#pragma once

#define BOMB_ENDING 1
#define BOMB_ENDING 3
#define NORMAL_ENDING 0
7 changes: 5 additions & 2 deletions run_tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ def kill_all(process):
parent.kill()


def ATKrun(target, func_name='logic_bomb', default_stdin_len=10, maxtime=60, source=None, skip=False):
def ATKrun(target, func_name='logic_bomb', default_stdin_len=10, maxtime=60, source=None, skip=False, folder=None):
def params_list_parser(params):
if len(params.strip()) == 0:
return []
Expand All @@ -37,6 +37,8 @@ def params_list_parser(params):
return res

cmds_tp, tp_path, prefix, src_dirs = target
if folder:
src_dirs = (folder, )
if not os.path.exists(prefix):
os.mkdir(prefix)

Expand Down Expand Up @@ -188,13 +190,14 @@ def params_list_parser(params):
parser.add_argument("-t", "--maxtime", required=False, default=60, type=int, help="Max running time for a program")
parser.add_argument("-s", "--source", required=False, type=str, help="Output source code into a directory")
parser.add_argument("-n", "--no_test", action="store_true", help="Don't do the test")
parser.add_argument("-f", "--folder", type=str, help="Overide test dir in config")
args = parser.parse_args()

if args.source:
print("Saving output results in ", args.source)

try:
res = ATKrun(switches[args.engine], func_name=FUNC_NAME, maxtime=args.maxtime, source=args.source, skip=args.no_test)
res = ATKrun(switches[args.engine], func_name=FUNC_NAME, maxtime=args.maxtime, source=args.source, skip=args.no_test, folder=args.folder)
if args.source and args.no_test:
exit(0)
except KeyError:
Expand Down
2 changes: 1 addition & 1 deletion script/angr_run.py
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@ def run_symexe(path, argv_size=2, show_bytes=True, show_model=False):
else:
color = 'red'

if 1 in tests:
if 3 in tests:
exit(1)
elif errored or 139 in tests:
exit(-1)
Expand Down
2 changes: 1 addition & 1 deletion script/klee_run.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@

tests = running_res

if 1 in tests:
if 3 in tests:
exit(1)
elif 139 in tests:
exit(-1)
Expand Down
48 changes: 0 additions & 48 deletions script/klee_run_cpp.py

This file was deleted.

2 changes: 1 addition & 1 deletion script/triton_caller.py
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@
else:
exit(-1)

if 1 in tests:
if 3 in tests:
exit(1)
elif 139 in tests:
exit(-1)
Expand Down

0 comments on commit 360a29f

Please sign in to comment.