Skip to content

Commit

Permalink
Handle two corner cases in creduce-clang-crash.py
Browse files Browse the repository at this point in the history
Summary:
First, call os.path.normpath on the filename argument. I passed in
./foo-asdf.cpp, and this meant that the script failed to find the
filename, and bad things happened.

Second, call os.path.abspath on binaries. CReduce runs the
interestingness test in a temp dir, so relative paths will not work.

Reviewers: akhuang

Subscribers: cfe-commits

Tags: #clang

Differential Revision: https://reviews.llvm.org/D71098
  • Loading branch information
rnk committed Dec 6, 2019
1 parent 532196d commit 1f822f2
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions clang/utils/creduce-clang-crash.py
Expand Up @@ -30,6 +30,7 @@ def verbose_print(*args, **kwargs):
print(*args, **kwargs)

def check_file(fname):
fname = os.path.normpath(fname)
if not os.path.isfile(fname):
sys.exit("ERROR: %s does not exist" % (fname))
return fname
Expand All @@ -40,6 +41,8 @@ def check_cmd(cmd_name, cmd_dir, cmd_path=None):
or absolute path to cmd_dir/cmd_name.
"""
if cmd_path:
# Make the path absolute so the creduce test can be run from any directory.
cmd_path = os.path.abspath(cmd_path)
cmd = find_executable(cmd_path)
if cmd:
return cmd
Expand Down

0 comments on commit 1f822f2

Please sign in to comment.