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
971ca4b8
Commit
971ca4b8
authored
Dec 15, 2016
by
Ian Hickson
Committed by
GitHub
Dec 15, 2016
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Check exit code for test subprocess (#7269)
parent
502592e5
Changes
11
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
11 changed files
with
310 additions
and
158 deletions
+310
-158
README.md
dev/automated_tests/test_smoke_test/README.md
+1
-1
crash1_test.dart
dev/automated_tests/test_smoke_test/crash1_test.dart
+16
-0
crash2_test.dart
dev/automated_tests/test_smoke_test/crash2_test.dart
+12
-0
fail_test.dart
dev/automated_tests/test_smoke_test/fail_test.dart
+1
-1
missing_import_test.broken_dart
...ted_tests/test_smoke_test/missing_import_test.broken_dart
+10
-0
pass_test.dart
dev/automated_tests/test_smoke_test/pass_test.dart
+1
-1
syntax_error_test.broken_dart
...mated_tests/test_smoke_test/syntax_error_test.broken_dart
+9
-0
test.sh
dev/bots/test.sh
+4
-0
test.dart
packages/flutter_tools/lib/src/commands/test.dart
+7
-7
coverage_collector.dart
packages/flutter_tools/lib/src/test/coverage_collector.dart
+3
-3
flutter_platform.dart
packages/flutter_tools/lib/src/test/flutter_platform.dart
+246
-145
No files found.
dev/automated_tests/test_smoke_test/README.md
View file @
971ca4b8
This directory is used by //
/flutter/travi
s/test.sh to verify that
This directory is used by //
flutter/dev/bot
s/test.sh to verify that
`flutter test`
actually correctly fails when a test fails.
dev/automated_tests/test_smoke_test/crash1_test.dart
0 → 100644
View file @
971ca4b8
// Copyright 2016 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:io'
as
system
;
import
'package:flutter_test/flutter_test.dart'
;
// this is a test to make sure our tests consider engine crashes to be failures
// see //flutter/dev/bots/test.sh
void
main
(
)
{
test
(
'test smoke test -- this test should fail'
,
()
async
{
system
.
Process
.
killPid
(
system
.
pid
,
system
.
ProcessSignal
.
SIGSEGV
);
});
}
\ No newline at end of file
dev/automated_tests/test_smoke_test/crash2_test.dart
0 → 100644
View file @
971ca4b8
// Copyright 2016 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:io'
as
system
;
// this is a test to make sure our tests consider engine crashes to be failures
// see //flutter/dev/bots/test.sh
void
main
(
)
{
system
.
Process
.
killPid
(
system
.
pid
,
system
.
ProcessSignal
.
SIGSEGV
);
}
\ No newline at end of file
dev/automated_tests/test_smoke_test/fail_test.dart
View file @
971ca4b8
...
...
@@ -5,7 +5,7 @@
import
'package:flutter_test/flutter_test.dart'
;
// this is a test to make sure our tests actually catch failures
// see //
/flutter/travi
s/test.sh
// see //
flutter/dev/bot
s/test.sh
void
main
(
)
{
test
(
'test smoke test -- this test SHOULD FAIL'
,
()
async
{
...
...
dev/automated_tests/test_smoke_test/missing_import_test.broken_dart
0 → 100644
View file @
971ca4b8
// Copyright 2016 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.
// this is a test to make sure our tests consider syntax errors to be failures
// see //flutter/dev/bots/test.sh
void main() {
fail(); // inspired by https://github.com/flutter/flutter/issues/2698
}
dev/automated_tests/test_smoke_test/pass_test.dart
View file @
971ca4b8
...
...
@@ -5,7 +5,7 @@
import
'package:flutter_test/flutter_test.dart'
;
// this is a test to make sure our tests actually catch failures
// see //
/flutter/travi
s/test.sh
// see //
flutter/dev/bot
s/test.sh
void
main
(
)
{
test
(
'test smoke test -- this test should pass'
,
()
async
{
...
...
dev/automated_tests/test_smoke_test/syntax_error_test.broken_dart
0 → 100644
View file @
971ca4b8
// Copyright 2016 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.
// this is a test to make sure our tests consider syntax errors to be failures
// see //flutter/dev/bots/test.sh
The challenge: demand satisfaction
If they apologize, no need for further action.
dev/bots/test.sh
View file @
971ca4b8
...
...
@@ -22,6 +22,10 @@ flutter analyze --flutter-repo
# verify that the tests actually return failure on failure and success on success
(
cd
dev/automated_tests
;
!
flutter
test
test_smoke_test/fail_test.dart
>
/dev/null
)
(
cd
dev/automated_tests
;
flutter
test
test_smoke_test/pass_test.dart
>
/dev/null
)
(
cd
dev/automated_tests
;
!
flutter
test
test_smoke_test/crash1_test.dart
>
/dev/null
)
(
cd
dev/automated_tests
;
!
flutter
test
test_smoke_test/crash2_test.dart
>
/dev/null
)
(
cd
dev/automated_tests
;
!
flutter
test
test_smoke_test/syntax_error_test.broken_dart
>
/dev/null
)
(
cd
dev/automated_tests
;
!
flutter
test
test_smoke_test/missing_import_test.broken_dart
>
/dev/null
)
(
cd
packages/flutter_driver
;
!
flutter drive
--use-existing-app
-t
test_driver/failure.dart
>
/dev/null 2>&1
)
COVERAGE_FLAG
=
...
...
packages/flutter_tools/lib/src/commands/test.dart
View file @
971ca4b8
...
...
@@ -6,7 +6,7 @@ import 'dart:async';
import
'dart:io'
;
import
'package:path/path.dart'
as
path
;
import
'package:test/src/executable.dart'
as
executable
;
// ignore: implementation_imports
import
'package:test/src/executable.dart'
as
test
;
// ignore: implementation_imports
import
'../base/common.dart'
;
import
'../base/logger.dart'
;
...
...
@@ -77,9 +77,9 @@ class TestCommand extends FlutterCommand {
Directory
.
current
=
testDirectory
;
}
printTrace
(
'running test package with arguments:
$testArgs
'
);
await
executable
.
main
(
testArgs
);
await
test
.
main
(
testArgs
);
// test.main() sets dart:io's exitCode global.
printTrace
(
'test package returned with exit code
$exitCode
'
);
return
exitCode
;
}
finally
{
Directory
.
current
=
currentDirectory
;
...
...
@@ -164,10 +164,10 @@ class TestCommand extends FlutterCommand {
if
(
argResults
[
'coverage'
])
testArgs
.
insert
(
0
,
'--concurrency=1'
);
loader
.
installHook
()
;
loader
.
shellPath
=
tools
.
getHostToolPath
(
HostTool
.
SkyShell
);
if
(!
FileSystemEntity
.
isFileSync
(
loader
.
shellPath
))
throwToolExit
(
'Cannot find Flutter shell at
${loader.shellPath}
'
);
final
String
shellPath
=
tools
.
getHostToolPath
(
HostTool
.
SkyShell
)
??
Platform
.
environment
[
'SKY_SHELL'
]
;
if
(!
FileSystemEntity
.
isFileSync
(
shellPath
))
throwToolExit
(
'Cannot find Flutter shell at
$shellPath
'
);
loader
.
installHook
(
shellPath:
shellPath
);
Cache
.
releaseLockEarly
();
...
...
packages/flutter_tools/lib/src/test/coverage_collector.dart
View file @
971ca4b8
...
...
@@ -20,14 +20,14 @@ class CoverageCollector {
void
collectCoverage
({
String
host
,
int
port
,
Process
processToKill
Process
processToKill
,
})
{
if
(
enabled
)
{
assert
(
_jobs
!=
null
);
_jobs
.
add
(
_startJob
(
host:
host
,
port:
port
,
processToKill:
processToKill
processToKill:
processToKill
,
));
}
else
{
processToKill
.
kill
();
...
...
@@ -37,7 +37,7 @@ class CoverageCollector {
Future
<
Null
>
_startJob
({
String
host
,
int
port
,
Process
processToKill
Process
processToKill
,
})
async
{
int
pid
=
processToKill
.
pid
;
printTrace
(
'collecting coverage data from pid
$pid
on port
$port
'
);
...
...
packages/flutter_tools/lib/src/test/flutter_platform.dart
View file @
971ca4b8
This diff is collapsed.
Click to expand it.
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