Bug 1429463 - Use 'chunk' variable name instead of 'suite'. r=me

--HG--
extra : histedit_source : b75d43c6e7ea9212bca305dc3430fc210c70467c%2C259186696138c2c63db64db1bcd9d1501d1aadb9
This commit is contained in:
Marco Castelluccio 2018-11-13 20:54:31 +01:00
Родитель 70d9f1eb85
Коммит d9538dfb46
1 изменённых файлов: 11 добавлений и 11 удалений

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

@ -182,18 +182,18 @@ def tests_covering_file(cursor, path):
return set(e[0] for e in cursor.fetchall())
def tests_in_chunk(cursor, platform, suite):
def tests_in_chunk(cursor, platform, chunk):
'''Returns a set of tests that are contained in a given chunk.
'''
cursor.execute('SELECT path FROM chunk_to_test WHERE platform=? AND chunk=?',
(platform, suite))
(platform, chunk))
# Because of bug 1480103, some entries in this table contain both a file name and a test name,
# separated by a space. With the split, only the file name is kept.
return set(e[0].split(' ')[0] for e in cursor.fetchall())
def chunks_covering_file(cursor, path):
'''Returns a set of (platform, suite) tuples with the chunks that cover a given source file.
'''Returns a set of (platform, chunk) tuples with the chunks that cover a given source file.
'''
cursor.execute('SELECT platform, chunk FROM file_to_chunk WHERE path=?', (path,))
return set(cursor.fetchall())
@ -211,7 +211,7 @@ def find_tests(changed_files):
Returns: a (test_files, test_chunks) tuple with two sets.
test_files - contains tests that should be run to verify changes to changed_files.
test_chunks - contains (platform, suite) tuples with chunks that should be
test_chunks - contains (platform, chunk) tuples with chunks that should be
run. These chunnks do not support running a subset of the tests (like
cppunit or gtest), so the whole chunk must be run.
'''
@ -254,13 +254,13 @@ def find_tests(changed_files):
remaining_test_chunks = set()
# For all test_chunks, try to find the tests contained by them in the
# chunk_to_test mapping.
for platform, suite in test_chunks:
tests = tests_in_chunk(c, platform, suite)
for platform, chunk in test_chunks:
tests = tests_in_chunk(c, platform, chunk)
if tests:
for test in tests:
test_files.add(test.replace('\\', '/'))
else:
remaining_test_chunks.add((platform, suite))
remaining_test_chunks.add((platform, chunk))
return test_files, remaining_test_chunks
@ -305,17 +305,17 @@ def filter_tasks_by_chunks(tasks, chunks):
'''Find all tasks that will run the given chunks.
'''
selected_tasks = set()
for platform, suite in chunks:
for platform, chunk in chunks:
platform = PLATFORM_MAP.get(platform, platform)
match = False
for task in tasks:
# Suite names taken from the chunk mapping are not consistent with the
# Chunk names taken from the chunk mapping are not consistent with the
# task names, so we're using string inclusion to find the tests.
if platform in task and suite in task:
if platform in task and chunk in task:
selected_tasks.add(task)
match = True
if not match:
print('Warning: no task found for chunk', platform, suite)
print('Warning: no task found for chunk', platform, chunk)
return list(selected_tasks)