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
63f2fb9f
Unverified
Commit
63f2fb9f
authored
Sep 26, 2018
by
Jonah Williams
Committed by
GitHub
Sep 26, 2018
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add coverage directory to fuchsia coverage script (#22236)
parent
84c61ad6
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
24 additions
and
5 deletions
+24
-5
fuchsia_tester.dart
packages/flutter_tools/bin/fuchsia_tester.dart
+18
-3
coverage_collector.dart
packages/flutter_tools/lib/src/test/coverage_collector.dart
+6
-2
No files found.
packages/flutter_tools/bin/fuchsia_tester.dart
View file @
63f2fb9f
...
@@ -30,6 +30,7 @@ const String _kOptionTestDirectory = 'test-directory';
...
@@ -30,6 +30,7 @@ const String _kOptionTestDirectory = 'test-directory';
const
String
_kOptionSdkRoot
=
'sdk-root'
;
const
String
_kOptionSdkRoot
=
'sdk-root'
;
const
String
_kOptionIcudtl
=
'icudtl'
;
const
String
_kOptionIcudtl
=
'icudtl'
;
const
String
_kOptionTests
=
'tests'
;
const
String
_kOptionTests
=
'tests'
;
const
String
_kOptionCoverageDirectory
=
'coverage-directory'
;
const
List
<
String
>
_kRequiredOptions
=
<
String
>[
const
List
<
String
>
_kRequiredOptions
=
<
String
>[
_kOptionPackages
,
_kOptionPackages
,
_kOptionShell
,
_kOptionShell
,
...
@@ -55,6 +56,7 @@ Future<Null> run(List<String> args) async {
...
@@ -55,6 +56,7 @@ Future<Null> run(List<String> args) async {
..
addOption
(
_kOptionSdkRoot
,
help:
'Path to the SDK platform files'
)
..
addOption
(
_kOptionSdkRoot
,
help:
'Path to the SDK platform files'
)
..
addOption
(
_kOptionIcudtl
,
help:
'Path to the ICU data file'
)
..
addOption
(
_kOptionIcudtl
,
help:
'Path to the ICU data file'
)
..
addOption
(
_kOptionTests
,
help:
'Path to json file that maps Dart test files to precompiled dill files'
)
..
addOption
(
_kOptionTests
,
help:
'Path to json file that maps Dart test files to precompiled dill files'
)
..
addOption
(
_kOptionCoverageDirectory
,
help:
'The path to the directory that will have coverage collected'
)
..
addFlag
(
_kOptionCoverage
,
..
addFlag
(
_kOptionCoverage
,
defaultsTo:
false
,
defaultsTo:
false
,
negatable:
false
,
negatable:
false
,
...
@@ -85,6 +87,14 @@ Future<Null> run(List<String> args) async {
...
@@ -85,6 +87,14 @@ Future<Null> run(List<String> args) async {
if
(!
fs
.
isDirectorySync
(
sdkRootSrc
.
path
))
{
if
(!
fs
.
isDirectorySync
(
sdkRootSrc
.
path
))
{
throwToolExit
(
'Cannot find SDK files at
${sdkRootSrc.path}
'
);
throwToolExit
(
'Cannot find SDK files at
${sdkRootSrc.path}
'
);
}
}
Directory
coverageDirectory
;
final
String
coverageDirectoryPath
=
argResults
[
_kOptionCoverageDirectory
];
if
(
coverageDirectoryPath
!=
null
)
{
if
(!
fs
.
isDirectorySync
(
coverageDirectoryPath
))
{
throwToolExit
(
'Cannot find coverage directory at
$coverageDirectoryPath
'
);
}
coverageDirectory
=
fs
.
directory
(
coverageDirectoryPath
);
}
// Put the tester shell where runTests expects it.
// Put the tester shell where runTests expects it.
// TODO(tvolkert,garymm): Switch to a Fuchsia-specific Artifacts impl.
// TODO(tvolkert,garymm): Switch to a Fuchsia-specific Artifacts impl.
...
@@ -131,9 +141,14 @@ Future<Null> run(List<String> args) async {
...
@@ -131,9 +141,14 @@ Future<Null> run(List<String> args) async {
if
(
collector
!=
null
)
{
if
(
collector
!=
null
)
{
// collector expects currentDirectory to be the root of the dart
// collector expects currentDirectory to be the root of the dart
// package (i.e. contains lib/ and test/ sub-dirs).
// package (i.e. contains lib/ and test/ sub-dirs). In some cases,
fs
.
currentDirectory
=
testDirectory
.
parent
;
// test files may appear to be in the root directory.
if
(!
await
collector
.
collectCoverageData
(
argResults
[
_kOptionCoveragePath
]))
if
(
coverageDirectory
==
null
)
{
fs
.
currentDirectory
=
testDirectory
.
parent
;
}
else
{
fs
.
currentDirectory
=
testDirectory
;
}
if
(!
await
collector
.
collectCoverageData
(
argResults
[
_kOptionCoveragePath
],
coverageDirectory:
coverageDirectory
))
throwToolExit
(
'Failed to collect coverage data'
);
throwToolExit
(
'Failed to collect coverage data'
);
}
}
}
finally
{
}
finally
{
...
...
packages/flutter_tools/lib/src/test/coverage_collector.dart
View file @
63f2fb9f
...
@@ -83,6 +83,7 @@ class CoverageCollector extends TestWatcher {
...
@@ -83,6 +83,7 @@ class CoverageCollector extends TestWatcher {
Future
<
String
>
finalizeCoverage
({
Future
<
String
>
finalizeCoverage
({
coverage
.
Formatter
formatter
,
coverage
.
Formatter
formatter
,
Duration
timeout
,
Duration
timeout
,
Directory
coverageDirectory
,
})
async
{
})
async
{
printTrace
(
'formating coverage data'
);
printTrace
(
'formating coverage data'
);
if
(
_globalHitmap
==
null
)
if
(
_globalHitmap
==
null
)
...
@@ -90,7 +91,9 @@ class CoverageCollector extends TestWatcher {
...
@@ -90,7 +91,9 @@ class CoverageCollector extends TestWatcher {
if
(
formatter
==
null
)
{
if
(
formatter
==
null
)
{
final
coverage
.
Resolver
resolver
=
coverage
.
Resolver
(
packagesPath:
PackageMap
.
globalPackagesPath
);
final
coverage
.
Resolver
resolver
=
coverage
.
Resolver
(
packagesPath:
PackageMap
.
globalPackagesPath
);
final
String
packagePath
=
fs
.
currentDirectory
.
path
;
final
String
packagePath
=
fs
.
currentDirectory
.
path
;
final
List
<
String
>
reportOn
=
<
String
>[
fs
.
path
.
join
(
packagePath
,
'lib'
)];
final
List
<
String
>
reportOn
=
coverageDirectory
==
null
?
<
String
>[
fs
.
path
.
join
(
packagePath
,
'lib'
)]
:
<
String
>[
coverageDirectory
.
path
];
formatter
=
coverage
.
LcovFormatter
(
resolver
,
reportOn:
reportOn
,
basePath:
packagePath
);
formatter
=
coverage
.
LcovFormatter
(
resolver
,
reportOn:
reportOn
,
basePath:
packagePath
);
}
}
final
String
result
=
await
formatter
.
format
(
_globalHitmap
);
final
String
result
=
await
formatter
.
format
(
_globalHitmap
);
...
@@ -98,10 +101,11 @@ class CoverageCollector extends TestWatcher {
...
@@ -98,10 +101,11 @@ class CoverageCollector extends TestWatcher {
return
result
;
return
result
;
}
}
Future
<
bool
>
collectCoverageData
(
String
coveragePath
,
{
bool
mergeCoverageData
=
false
})
async
{
Future
<
bool
>
collectCoverageData
(
String
coveragePath
,
{
bool
mergeCoverageData
=
false
,
Directory
coverageDirectory
})
async
{
final
Status
status
=
logger
.
startProgress
(
'Collecting coverage information...'
);
final
Status
status
=
logger
.
startProgress
(
'Collecting coverage information...'
);
final
String
coverageData
=
await
finalizeCoverage
(
final
String
coverageData
=
await
finalizeCoverage
(
timeout:
const
Duration
(
seconds:
30
),
timeout:
const
Duration
(
seconds:
30
),
coverageDirectory:
coverageDirectory
,
);
);
status
.
stop
();
status
.
stop
();
printTrace
(
'coverage information collection complete'
);
printTrace
(
'coverage information collection complete'
);
...
...
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