Title: [274394] trunk/Tools
- Revision
- 274394
- Author
- gsnedd...@apple.com
- Date
- 2021-03-13 19:22:18 -0800 (Sat, 13 Mar 2021)
Log Message
Move LayoutTestFinder.split_into_chunks to Manager._split_into_chunks
https://bugs.webkit.org/show_bug.cgi?id=223137
Reviewed by Jonathan Bedard.
* Scripts/webkitpy/layout_tests/controllers/layout_test_finder.py:
(LayoutTestFinder.split_into_chunks):
* Scripts/webkitpy/layout_tests/controllers/manager.py:
(Manager._split_into_chunks):
(Manager._prepare_lists):
Modified Paths
Diff
Modified: trunk/Tools/ChangeLog (274393 => 274394)
--- trunk/Tools/ChangeLog 2021-03-14 02:47:53 UTC (rev 274393)
+++ trunk/Tools/ChangeLog 2021-03-14 03:22:18 UTC (rev 274394)
@@ -1,3 +1,16 @@
+2021-03-13 Sam Sneddon <gsnedd...@apple.com>
+
+ Move LayoutTestFinder.split_into_chunks to Manager._split_into_chunks
+ https://bugs.webkit.org/show_bug.cgi?id=223137
+
+ Reviewed by Jonathan Bedard.
+
+ * Scripts/webkitpy/layout_tests/controllers/layout_test_finder.py:
+ (LayoutTestFinder.split_into_chunks):
+ * Scripts/webkitpy/layout_tests/controllers/manager.py:
+ (Manager._split_into_chunks):
+ (Manager._prepare_lists):
+
2021-03-13 Aakash Jain <aakash_j...@apple.com>
[build.webkit.org] run buildbot checkconfig in services ews
Modified: trunk/Tools/Scripts/webkitpy/layout_tests/controllers/layout_test_finder.py (274393 => 274394)
--- trunk/Tools/Scripts/webkitpy/layout_tests/controllers/layout_test_finder.py 2021-03-14 02:47:53 UTC (rev 274393)
+++ trunk/Tools/Scripts/webkitpy/layout_tests/controllers/layout_test_finder.py 2021-03-14 03:22:18 UTC (rev 274394)
@@ -189,62 +189,3 @@
return None
else:
return line
-
- def split_into_chunks(self, test_names):
- """split into a list to run and a set to skip, based on --run-chunk and --run-part."""
- if not self._options.run_chunk and not self._options.run_part:
- return test_names, set()
-
- # If the user specifies they just want to run a subset of the tests,
- # just grab a subset of the non-skipped tests.
- chunk_value = self._options.run_chunk or self._options.run_part
- try:
- (chunk_num, chunk_len) = chunk_value.split(":")
- chunk_num = int(chunk_num)
- assert(chunk_num >= 0)
- test_size = int(chunk_len)
- assert(test_size > 0)
- except AssertionError:
- _log.critical("invalid chunk '%s'" % chunk_value)
- return (None, None)
-
- # Get the number of tests
- num_tests = len(test_names)
-
- # Get the start offset of the slice.
- if self._options.run_chunk:
- chunk_len = test_size
- # In this case chunk_num can be really large. We need
- # to make the worker fit in the current number of tests.
- slice_start = (chunk_num * chunk_len) % num_tests
- else:
- # Validate the data.
- assert(test_size <= num_tests)
- assert(chunk_num <= test_size)
-
- # To count the chunk_len, and make sure we don't skip
- # some tests, we round to the next value that fits exactly
- # all the parts.
- rounded_tests = num_tests
- if rounded_tests % test_size != 0:
- rounded_tests = (num_tests + test_size - (num_tests % test_size))
-
- chunk_len = rounded_tests // test_size
- slice_start = chunk_len * (chunk_num - 1)
- # It does not mind if we go over test_size.
-
- # Get the end offset of the slice.
- slice_end = min(num_tests, slice_start + chunk_len)
-
- tests_to_run = test_names[slice_start:slice_end]
-
- _log.debug('chunk slice [%d:%d] of %d is %d tests' % (slice_start, slice_end, num_tests, (slice_end - slice_start)))
-
- # If we reached the end and we don't have enough tests, we run some
- # from the beginning.
- if slice_end - slice_start < chunk_len:
- extra = chunk_len - (slice_end - slice_start)
- _log.debug(' last chunk is partial, appending [0:%d]' % extra)
- tests_to_run.extend(test_names[0:extra])
-
- return (tests_to_run, set(test_names) - set(tests_to_run))
Modified: trunk/Tools/Scripts/webkitpy/layout_tests/controllers/manager.py (274393 => 274394)
--- trunk/Tools/Scripts/webkitpy/layout_tests/controllers/manager.py 2021-03-14 02:47:53 UTC (rev 274393)
+++ trunk/Tools/Scripts/webkitpy/layout_tests/controllers/manager.py 2021-03-14 03:22:18 UTC (rev 274394)
@@ -128,6 +128,65 @@
return tests_to_skip
+ def _split_into_chunks(self, test_names):
+ """split into a list to run and a set to skip, based on --run-chunk and --run-part."""
+ if not self._options.run_chunk and not self._options.run_part:
+ return test_names, set()
+
+ # If the user specifies they just want to run a subset of the tests,
+ # just grab a subset of the non-skipped tests.
+ chunk_value = self._options.run_chunk or self._options.run_part
+ try:
+ (chunk_num, chunk_len) = chunk_value.split(":")
+ chunk_num = int(chunk_num)
+ assert(chunk_num >= 0)
+ test_size = int(chunk_len)
+ assert(test_size > 0)
+ except AssertionError:
+ _log.critical("invalid chunk '%s'" % chunk_value)
+ return (None, None)
+
+ # Get the number of tests
+ num_tests = len(test_names)
+
+ # Get the start offset of the slice.
+ if self._options.run_chunk:
+ chunk_len = test_size
+ # In this case chunk_num can be really large. We need
+ # to make the worker fit in the current number of tests.
+ slice_start = (chunk_num * chunk_len) % num_tests
+ else:
+ # Validate the data.
+ assert(test_size <= num_tests)
+ assert(chunk_num <= test_size)
+
+ # To count the chunk_len, and make sure we don't skip
+ # some tests, we round to the next value that fits exactly
+ # all the parts.
+ rounded_tests = num_tests
+ if rounded_tests % test_size != 0:
+ rounded_tests = (num_tests + test_size - (num_tests % test_size))
+
+ chunk_len = rounded_tests // test_size
+ slice_start = chunk_len * (chunk_num - 1)
+ # It does not mind if we go over test_size.
+
+ # Get the end offset of the slice.
+ slice_end = min(num_tests, slice_start + chunk_len)
+
+ tests_to_run = test_names[slice_start:slice_end]
+
+ _log.debug('chunk slice [%d:%d] of %d is %d tests' % (slice_start, slice_end, num_tests, (slice_end - slice_start)))
+
+ # If we reached the end and we don't have enough tests, we run some
+ # from the beginning.
+ if slice_end - slice_start < chunk_len:
+ extra = chunk_len - (slice_end - slice_start)
+ _log.debug(' last chunk is partial, appending [0:%d]' % extra)
+ tests_to_run.extend(test_names[0:extra])
+
+ return (tests_to_run, set(test_names) - set(tests_to_run))
+
def _prepare_lists(self, paths, test_names, device_type=None):
tests_to_skip = self._skip_tests(test_names, self._expectations[device_type], self._http_tests(test_names))
tests_to_run = [test for test in test_names if test not in tests_to_skip]
@@ -139,7 +198,7 @@
elif self._options.order == 'random':
random.shuffle(tests_to_run)
- tests_to_run, tests_in_other_chunks = self._finder.split_into_chunks(tests_to_run)
+ tests_to_run, tests_in_other_chunks = self._split_into_chunks(tests_to_run)
self._expectations[device_type].add_skipped_tests(tests_in_other_chunks)
tests_to_skip.update(tests_in_other_chunks)
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes