Bug 1605929 [wpt PR 20918] - wptrunner: Make sure payloads are encoded to binary before computing md5 hashes, a=testonly

Automatic update from web-platform-tests
wptrunner: Make sure payloads are encoded to binary before computing md5 hashes (#20918)

--

wpt-commits: c185f3d960eead15cd00f8c18409b8331bdb513e
wpt-pr: 20918
This commit is contained in:
Élie ROUDNINSKI 2020-01-06 16:08:00 +00:00 коммит произвёл moz-wptsync-bot
Родитель d9a44c5391
Коммит 216ac26dc0
1 изменённых файлов: 3 добавлений и 3 удалений

Просмотреть файл

@ -5,7 +5,7 @@ from abc import ABCMeta, abstractmethod
from six.moves.queue import Empty
from collections import defaultdict, deque
from multiprocessing import Queue
from six import iteritems
from six import ensure_binary, iteritems
from six.moves import xrange
from . import manifestinclude
@ -51,7 +51,7 @@ class HashChunker(TestChunker):
def __call__(self, manifest):
chunk_index = self.chunk_number - 1
for test_type, test_path, tests in manifest:
h = int(hashlib.md5(test_path).hexdigest(), 16)
h = int(hashlib.md5(ensure_binary(test_path)).hexdigest(), 16)
if h % self.total_chunks == chunk_index:
yield test_type, test_path, tests
@ -65,7 +65,7 @@ class DirectoryHashChunker(TestChunker):
def __call__(self, manifest):
chunk_index = self.chunk_number - 1
for test_type, test_path, tests in manifest:
h = int(hashlib.md5(os.path.dirname(test_path)).hexdigest(), 16)
h = int(hashlib.md5(ensure_binary(os.path.dirname(test_path))).hexdigest(), 16)
if h % self.total_chunks == chunk_index:
yield test_type, test_path, tests