Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Sign in
Toggle navigation
F
Front-End
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
abdullh.alsoleman
Front-End
Commits
025f7ae6
Unverified
Commit
025f7ae6
authored
Mar 31, 2020
by
Casey Hillers
Committed by
GitHub
Mar 31, 2020
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add ability to shard customer tests (#53433)
parent
730a440f
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
38 additions
and
2 deletions
+38
-2
run_tests.dart
dev/customer_testing/run_tests.dart
+38
-2
No files found.
dev/customer_testing/run_tests.dart
View file @
025f7ae6
...
...
@@ -25,6 +25,18 @@ Future<bool> run(List<String> arguments) async {
help:
'How many times to run each test. Set to a high value to look for flakes.'
,
valueHelp:
'count'
,
)
..
addOption
(
'shards'
,
defaultsTo:
'1'
,
help:
'How many shards to split the tests into. Used in continuous integration.'
,
valueHelp:
'count'
,
)
..
addOption
(
'shard-index'
,
defaultsTo:
'0'
,
help:
'The current shard to run the tests with the range [0 .. shards - 1]. Used in continuous integration.'
,
valueHelp:
'count'
,
)
..
addFlag
(
'skip-on-fetch-failure'
,
defaultsTo:
false
,
...
...
@@ -70,6 +82,8 @@ Future<bool> run(List<String> arguments) async {
final
bool
skipTemplate
=
parsedArguments
[
'skip-template'
]
as
bool
;
final
bool
verbose
=
parsedArguments
[
'verbose'
]
as
bool
;
final
bool
help
=
parsedArguments
[
'help'
]
as
bool
;
final
int
numberShards
=
int
.
tryParse
(
parsedArguments
[
'shards'
]
as
String
);
final
int
shardIndex
=
int
.
tryParse
(
parsedArguments
[
'shard-index'
]
as
String
);
final
List
<
File
>
files
=
parsedArguments
.
rest
.
expand
((
String
path
)
=>
Glob
(
path
).
listSync
())
...
...
@@ -94,16 +108,38 @@ Future<bool> run(List<String> arguments) async {
if
(
verbose
)
print
(
'Starting run_tests.dart...'
);
if
(
files
.
length
<
shardIndex
)
print
(
'Warning: There are more shards than tests. Some shards will not run any tests.'
);
if
(
numberShards
<=
shardIndex
)
{
print
(
'Error: There are more shard indexes than shards.'
);
return
help
;
}
// Best attempt at evenly splitting tests among the shards
final
List
<
File
>
shardedFiles
=
<
File
>[];
for
(
int
i
=
shardIndex
;
i
<
files
.
length
;
i
+=
numberShards
)
{
shardedFiles
.
add
(
files
[
i
]);
}
int
testCount
=
0
;
int
failures
=
0
;
if
(
verbose
)
{
final
String
s
=
files
.
length
==
1
?
''
:
's'
;
print
(
'
${files.length}
file
$s
specified.'
);
final
String
ss
=
shardedFiles
.
length
==
1
?
''
:
's'
;
print
(
'
${files.length}
file
$s
specified.
${shardedFiles.length}
test
$ss
in shard #
$shardIndex
.'
);
print
(
''
);
}
for
(
final
File
file
in
files
)
{
if
(
verbose
)
{
print
(
'Tests in this shard:'
);
for
(
final
File
file
in
shardedFiles
)
print
(
file
.
path
);
}
print
(
''
);
for
(
final
File
file
in
shardedFiles
)
{
if
(
verbose
)
print
(
'Processing
${file.path}
...'
);
TestFile
instructions
;
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment