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
5b02aaab
Commit
5b02aaab
authored
Apr 20, 2017
by
P.Y. Laligand
Committed by
GitHub
Apr 20, 2017
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Added a simple test runner for Fuchsia. (#9461)
parent
ca2bf1ef
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
126 additions
and
3 deletions
+126
-3
BUILD.gn
packages/flutter_tools/BUILD.gn
+22
-3
fuchsia_tester.dart
packages/flutter_tools/bin/fuchsia_tester.dart
+104
-0
No files found.
packages/flutter_tools/BUILD.gn
View file @
5b02aaab
...
...
@@ -2,15 +2,14 @@
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
import("//build/dart/dart_package.gni")
import("//build/dart/dart_tool.gni")
dart_
tool
("flutter_tools") {
dart_
package
("flutter_tools") {
package_name = "flutter_tools"
source_dir = "lib"
main_dart = "bin/fuchsia_builder.dart"
deps = [
"//dart/pkg/analyzer",
"//dart/third_party/pkg/linter",
...
...
@@ -39,3 +38,23 @@ dart_tool("flutter_tools") {
"//third_party/dart-pkg/pub/yaml",
]
}
dart_tool("fuchsia_builder") {
main_dart = "bin/fuchsia_builder.dart"
deps = [
":flutter_tools",
]
}
dart_tool("fuchsia_tester") {
main_dart = "bin/fuchsia_tester.dart"
deps = [
":flutter_tools",
]
non_dart_deps = [
"//flutter/shell",
]
}
packages/flutter_tools/bin/fuchsia_tester.dart
0 → 100644
View file @
5b02aaab
// Copyright 2015 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
import
'dart:async'
;
import
'package:args/args.dart'
;
import
'package:process/process.dart'
;
import
'package:test/src/executable.dart'
as
test
;
// ignore: implementation_imports
import
'../lib/src/base/common.dart'
;
import
'../lib/src/base/config.dart'
;
import
'../lib/src/base/context.dart'
;
import
'../lib/src/base/file_system.dart'
;
import
'../lib/src/base/io.dart'
;
import
'../lib/src/base/logger.dart'
;
import
'../lib/src/base/os.dart'
;
import
'../lib/src/base/platform.dart'
;
import
'../lib/src/cache.dart'
;
import
'../lib/src/dart/package_map.dart'
;
import
'../lib/src/globals.dart'
;
import
'../lib/src/test/flutter_platform.dart'
as
loader
;
import
'../lib/src/usage.dart'
;
// Note: this was largely inspired by lib/src/commands/test.dart.
const
String
_kOptionPackages
=
"packages"
;
const
String
_kOptionShell
=
"shell"
;
const
String
_kOptionTestDirectory
=
"test-directory"
;
const
String
_kOptionFlutterRoot
=
"flutter-root"
;
const
List
<
String
>
_kRequiredOptions
=
const
<
String
>[
_kOptionPackages
,
_kOptionShell
,
_kOptionTestDirectory
,
_kOptionFlutterRoot
,
];
Future
<
Null
>
main
(
List
<
String
>
args
)
async
{
final
AppContext
executableContext
=
new
AppContext
();
executableContext
.
setVariable
(
Logger
,
new
StdoutLogger
());
executableContext
.
runInZone
(()
{
// Initialize the context with some defaults.
context
.
putIfAbsent
(
Platform
,
()
=>
const
LocalPlatform
());
context
.
putIfAbsent
(
FileSystem
,
()
=>
const
LocalFileSystem
());
context
.
putIfAbsent
(
ProcessManager
,
()
=>
const
LocalProcessManager
());
context
.
putIfAbsent
(
Logger
,
()
=>
new
StdoutLogger
());
context
.
putIfAbsent
(
Cache
,
()
=>
new
Cache
());
context
.
putIfAbsent
(
Config
,
()
=>
new
Config
());
context
.
putIfAbsent
(
OperatingSystemUtils
,
()
=>
new
OperatingSystemUtils
());
context
.
putIfAbsent
(
Usage
,
()
=>
new
Usage
());
return
run
(
args
);
});
}
Iterable
<
String
>
_findTests
(
Directory
directory
)
{
return
directory
.
listSync
(
recursive:
true
,
followLinks:
false
)
.
where
((
FileSystemEntity
entity
)
=>
entity
.
path
.
endsWith
(
'_test.dart'
)
&&
fs
.
isFileSync
(
entity
.
path
))
.
map
((
FileSystemEntity
entity
)
=>
fs
.
path
.
absolute
(
entity
.
path
));
}
Future
<
Null
>
run
(
List
<
String
>
args
)
async
{
final
ArgParser
parser
=
new
ArgParser
()
..
addOption
(
_kOptionPackages
,
help:
'The .packages file'
)
..
addOption
(
_kOptionShell
,
help:
'The Flutter shell binary'
)
..
addOption
(
_kOptionTestDirectory
,
help:
'Directory containing the tests'
)
..
addOption
(
_kOptionFlutterRoot
,
help:
'Flutter root'
);
final
ArgResults
argResults
=
parser
.
parse
(
args
);
if
(
_kRequiredOptions
.
any
((
String
option
)
=>
!
argResults
.
options
.
contains
(
option
)))
{
printError
(
'Missing option! All options must be specified.'
);
exit
(
1
);
}
// TODO(pylaligand): use a temp directory instead.
Cache
.
flutterRoot
=
argResults
[
_kOptionFlutterRoot
];
final
Directory
testDirectory
=
fs
.
directory
(
argResults
[
_kOptionTestDirectory
]);
final
Iterable
<
String
>
tests
=
_findTests
(
testDirectory
);
final
List
<
String
>
testArgs
=
<
String
>[];
testArgs
.
add
(
'--'
);
testArgs
.
addAll
(
tests
);
final
String
shellPath
=
argResults
[
_kOptionShell
];
if
(!
fs
.
isFileSync
(
shellPath
))
{
throwToolExit
(
'Cannot find Flutter shell at
$shellPath
'
);
}
loader
.
installHook
(
shellPath:
shellPath
,
debuggerMode:
false
,
);
PackageMap
.
globalPackagesPath
=
fs
.
path
.
normalize
(
fs
.
path
.
absolute
(
argResults
[
_kOptionPackages
]));
fs
.
currentDirectory
=
testDirectory
;
await
test
.
main
(
testArgs
);
if
(
exitCode
!=
0
)
{
exit
(
exitCode
);
}
}
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