diff options
author | Jonas Devlieghere <jonas@devlieghere.com> | 2020-01-23 16:35:42 -0800 |
---|---|---|
committer | Jonas Devlieghere <jonas@devlieghere.com> | 2020-01-23 16:37:03 -0800 |
commit | 47d7a81ba4bb4be2e6027fb44aa4cbfaffe9c3f2 (patch) | |
tree | e5d0ff408cb38d0b5f3623294de5caf3d96fb093 /lldb/utils | |
parent | 19c76989bb505c3117730c47df85fd3800ea2767 (diff) | |
download | llvm-47d7a81ba4bb4be2e6027fb44aa4cbfaffe9c3f2.tar.gz |
[lldb/Util] Use md5 instead of python's hash function.
Because of the way the Python hash function works, it's not guaranteed
to be the same. This was causing a lot of reproducers to be generated
for the same tests, even though the CWD or arguments didn't change.
Switching to an MD5 hash should fix that.
Diffstat (limited to 'lldb/utils')
-rwxr-xr-x | lldb/utils/lldb-repro/lldb-repro.py | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/lldb/utils/lldb-repro/lldb-repro.py b/lldb/utils/lldb-repro/lldb-repro.py index f7579e8d14d3..c1d62994f2f3 100755 --- a/lldb/utils/lldb-repro/lldb-repro.py +++ b/lldb/utils/lldb-repro/lldb-repro.py @@ -18,6 +18,7 @@ import sys import os import tempfile import subprocess +import hashlib def help(): @@ -29,11 +30,12 @@ def main(): help() return 1 - # Compute a hash based on the input arguments and the current working + # Compute an MD5 hash based on the input arguments and the current working # directory. - args = ' '.join(sys.argv[2:]) - cwd = os.getcwd() - input_hash = str(hash((cwd, args))) + h = hashlib.md5() + h.update(' '.join(sys.argv[2:])) + h.update(os.getcwd()) + input_hash = h.hexdigest() # Use the hash to "uniquely" identify a reproducer path. reproducer_path = os.path.join(tempfile.gettempdir(), input_hash) |