Skip to content

Commit

Permalink
Use hashlib.md5 for computing hashes for TEST-SERIALIZE commands
Browse files Browse the repository at this point in the history
Windows has some issue where `hash()` returns different values for the
same string in the different child processes. md5() returns the same
values in each.
  • Loading branch information
timwoj committed Dec 13, 2022
1 parent 8a84682 commit dd84f74
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion btest
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import configparser
import copy
import fnmatch
import glob
import hashlib
import io
import multiprocess as mp
import multiprocess.managers as mp_managers
Expand Down Expand Up @@ -498,7 +499,7 @@ class TestManager(mp_managers.SyncManager):
if not t:
continue

if t.serialize and hash(t.serialize) % self._options.threads != thread_num:
if t.serialize and int(hashlib.md5(t.serialize.encode('utf-8')).hexdigest(), 16) % self._options.threads != thread_num:
# Not ours.
continue

Expand Down

0 comments on commit dd84f74

Please sign in to comment.