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
bd69e2c4
Commit
bd69e2c4
authored
Nov 09, 2015
by
Hixie
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Run 'pub get' the first time the tests are run
parent
b5754d44
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
43 additions
and
14 deletions
+43
-14
init.dart
packages/flutter_tools/lib/src/commands/init.dart
+6
-6
test.dart
packages/flutter_tools/lib/src/commands/test.dart
+23
-3
process.dart
packages/flutter_tools/lib/src/process.dart
+11
-5
loader.dart
packages/flutter_tools/lib/src/test/loader.dart
+3
-0
No files found.
packages/flutter_tools/lib/src/commands/init.dart
View file @
bd69e2c4
...
@@ -59,12 +59,12 @@ class InitCommand extends Command {
...
@@ -59,12 +59,12 @@ class InitCommand extends Command {
if
(
argResults
[
'pub'
])
{
if
(
argResults
[
'pub'
])
{
print
(
"Running pub get..."
);
print
(
"Running pub get..."
);
Process
process
=
await
Process
.
star
t
(
int
code
=
await
runCommandAndStreamOutpu
t
(
sdkBinaryName
(
'pub'
),
[
'get'
],
workingDirectory:
out
.
path
);
[
sdkBinaryName
(
'pub'
),
'get'
],
stdout
.
addStream
(
process
.
stdout
);
workingDirectory:
out
.
path
stderr
.
addStream
(
process
.
stderr
);
);
i
nt
code
=
await
process
.
exitCode
;
i
f
(
code
!=
0
)
if
(
code
!=
0
)
return
code
;
return
code
;
}
}
print
(
message
);
print
(
message
);
...
...
packages/flutter_tools/lib/src/commands/test.dart
View file @
bd69e2c4
...
@@ -11,6 +11,7 @@ import 'package:test/src/executable.dart' as executable;
...
@@ -11,6 +11,7 @@ import 'package:test/src/executable.dart' as executable;
import
'../artifacts.dart'
;
import
'../artifacts.dart'
;
import
'../build_configuration.dart'
;
import
'../build_configuration.dart'
;
import
'../process.dart'
;
import
'../test/loader.dart'
as
loader
;
import
'../test/loader.dart'
as
loader
;
import
'flutter_command.dart'
;
import
'flutter_command.dart'
;
...
@@ -36,7 +37,8 @@ class TestCommand extends FlutterCommand {
...
@@ -36,7 +37,8 @@ class TestCommand extends FlutterCommand {
@override
@override
Future
<
int
>
runInProject
()
async
{
Future
<
int
>
runInProject
()
async
{
List
<
String
>
testArgs
=
argResults
.
rest
.
toList
();
List
<
String
>
testArgs
=
argResults
.
rest
.
toList
();
Directory
testDir
=
new
Directory
(
path
.
join
(
ArtifactStore
.
flutterRoot
,
'packages/unit/test'
));
Directory
flutterDir
=
new
Directory
(
path
.
join
(
ArtifactStore
.
flutterRoot
,
'packages/unit'
));
// see https://github.com/flutter/flutter/issues/50
Directory
testDir
=
new
Directory
(
path
.
join
(
flutterDir
.
path
,
'test'
));
if
(
testArgs
.
isEmpty
)
{
if
(
testArgs
.
isEmpty
)
{
testArgs
.
addAll
(
testDir
.
listSync
(
recursive:
true
,
followLinks:
false
)
testArgs
.
addAll
(
testDir
.
listSync
(
recursive:
true
,
followLinks:
false
)
.
where
((
FileSystemEntity
entity
)
=>
entity
.
path
.
endsWith
(
'_test.dart'
)
&&
FileSystemEntity
.
isFileSync
(
entity
.
path
))
.
where
((
FileSystemEntity
entity
)
=>
entity
.
path
.
endsWith
(
'_test.dart'
)
&&
FileSystemEntity
.
isFileSync
(
entity
.
path
))
...
@@ -47,9 +49,27 @@ class TestCommand extends FlutterCommand {
...
@@ -47,9 +49,27 @@ class TestCommand extends FlutterCommand {
testArgs
.
insert
(
0
,
'--no-color'
);
testArgs
.
insert
(
0
,
'--no-color'
);
List
<
BuildConfiguration
>
configs
=
buildConfigurations
;
List
<
BuildConfiguration
>
configs
=
buildConfigurations
;
bool
foundOne
=
false
;
bool
foundOne
=
false
;
File
pubSpecYaml
=
new
File
(
path
.
join
(
flutterDir
.
path
,
'pubspec.yaml'
));
File
pubSpecLock
=
new
File
(
path
.
join
(
flutterDir
.
path
,
'pubspec.lock'
));
if
(!
pubSpecYaml
.
existsSync
())
{
print
(
'
${flutterDir.path}
has no pubspec.yaml'
);
return
1
;
}
if
(!
pubSpecLock
.
existsSync
()
||
pubSpecYaml
.
lastModifiedSync
().
isAfter
(
pubSpecLock
.
lastModifiedSync
()))
{
print
(
"Running pub get..."
);
int
code
=
await
runCommandAndStreamOutput
(
[
sdkBinaryName
(
'pub'
),
'get'
],
workingDirectory:
flutterDir
.
path
);
if
(
code
!=
0
)
return
code
;
}
String
currentDirectory
=
Directory
.
current
.
path
;
String
currentDirectory
=
Directory
.
current
.
path
;
Directory
.
current
=
testDir
.
path
;
Directory
.
current
=
flutterDir
.
path
;
// TODO(ianh): Verify that this directory has had 'pub get' run in it at least once.
loader
.
installHook
();
loader
.
installHook
();
for
(
BuildConfiguration
config
in
configs
)
{
for
(
BuildConfiguration
config
in
configs
)
{
if
(!
config
.
testable
)
if
(!
config
.
testable
)
...
...
packages/flutter_tools/lib/src/process.dart
View file @
bd69e2c4
...
@@ -12,11 +12,17 @@ final Logger _logging = new Logger('sky_tools.process');
...
@@ -12,11 +12,17 @@ final Logger _logging = new Logger('sky_tools.process');
/// This runs the command and streams stdout/stderr from the child process to
/// This runs the command and streams stdout/stderr from the child process to
/// this process' stdout/stderr.
/// this process' stdout/stderr.
Future
<
int
>
runCommandAndStreamOutput
(
List
<
String
>
cmd
,
Future
<
int
>
runCommandAndStreamOutput
(
List
<
String
>
cmd
,
{
{
String
prefix:
''
,
RegExp
filter
})
async
{
String
prefix:
''
,
RegExp
filter
,
String
workingDirectory
})
async
{
_logging
.
info
(
cmd
.
join
(
' '
));
_logging
.
info
(
cmd
.
join
(
' '
));
Process
proc
=
Process
proc
=
await
Process
.
start
(
await
Process
.
start
(
cmd
[
0
],
cmd
.
getRange
(
1
,
cmd
.
length
).
toList
());
cmd
[
0
],
cmd
.
getRange
(
1
,
cmd
.
length
).
toList
(),
workingDirectory:
workingDirectory
);
proc
.
stdout
.
transform
(
UTF8
.
decoder
).
listen
((
String
data
)
{
proc
.
stdout
.
transform
(
UTF8
.
decoder
).
listen
((
String
data
)
{
List
<
String
>
dataLines
=
data
.
trimRight
().
split
(
'
\n
'
);
List
<
String
>
dataLines
=
data
.
trimRight
().
split
(
'
\n
'
);
if
(
filter
!=
null
)
{
if
(
filter
!=
null
)
{
...
@@ -65,7 +71,7 @@ String runSync(List<String> cmd) => _runWithLoggingSync(cmd);
...
@@ -65,7 +71,7 @@ String runSync(List<String> cmd) => _runWithLoggingSync(cmd);
/// Return the platform specific name for the given Dart SDK binary. So, `pub`
/// Return the platform specific name for the given Dart SDK binary. So, `pub`
/// ==> `pub.bat`.
/// ==> `pub.bat`.
String
sdkBinaryName
(
String
name
)
{
String
sdkBinaryName
(
String
name
)
{
return
Platform
.
isWindows
?
'
$
{name}
.bat'
:
name
;
return
Platform
.
isWindows
?
'
$
name
.bat'
:
name
;
}
}
String
_runWithLoggingSync
(
List
<
String
>
cmd
,
{
bool
checked:
false
})
{
String
_runWithLoggingSync
(
List
<
String
>
cmd
,
{
bool
checked:
false
})
{
...
...
packages/flutter_tools/lib/src/test/loader.dart
View file @
bd69e2c4
...
@@ -120,6 +120,9 @@ void main() {
...
@@ -120,6 +120,9 @@ void main() {
case
-
0x0b
:
// ProcessSignal.SIGSEGV
case
-
0x0b
:
// ProcessSignal.SIGSEGV
output
+=
'Segmentation fault in subprocess for:
$path
\n
'
;
output
+=
'Segmentation fault in subprocess for:
$path
\n
'
;
break
;
break
;
case
-
0x06
:
// ProcessSignal.SIGABRT
output
+=
'Aborted while running:
$path
\n
'
;
break
;
default
:
default
:
output
+=
'Unexpected exit code
$exitCode
from subprocess for:
$path
\n
'
;
output
+=
'Unexpected exit code
$exitCode
from subprocess for:
$path
\n
'
;
}
}
...
...
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