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
c3a47b34
Unverified
Commit
c3a47b34
authored
Aug 20, 2020
by
Ian Hickson
Committed by
GitHub
Aug 20, 2020
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Remove more timeouts (#63433)
parent
a2e5e074
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
2 additions
and
53 deletions
+2
-53
flutter_platform.dart
packages/flutter_tools/lib/src/test/flutter_platform.dart
+2
-53
No files found.
packages/flutter_tools/lib/src/test/flutter_platform.dart
View file @
c3a47b34
...
...
@@ -30,30 +30,6 @@ import 'test_compiler.dart';
import
'test_config.dart'
;
import
'watcher.dart'
;
/// The timeout we give the test process to connect to the test harness
/// once the process has entered its main method.
///
/// We time out test execution because we expect some tests to hang and we want
/// to know which test hung, rather than have the entire test harness just do
/// nothing for a few hours until the user (or CI environment) gets bored.
const
Duration
_kTestStartupTimeout
=
Duration
(
minutes:
5
);
/// The timeout we give the test process to start executing Dart code. When the
/// CPU is under severe load, this can take a while, but it's not indicative of
/// any problem with Flutter, so we give it a large timeout.
///
/// See comment under [_kTestStartupTimeout] regarding timeouts.
const
Duration
_kTestProcessTimeout
=
Duration
(
minutes:
5
);
/// Message logged by the test process to signal that its main method has begun
/// execution.
///
/// The test harness responds by starting the [_kTestStartupTimeout] countdown.
/// The CPU may be throttled, which can cause a long delay in between when the
/// process is spawned and when dart code execution begins; we don't want to
/// hold that against the test.
const
String
_kStartTimeoutTimerMessage
=
'sky_shell test process has entered main method'
;
/// The address at which our WebSocket server resides and at which the sky_shell
/// processes will host the Observatory server.
final
Map
<
InternetAddressType
,
InternetAddress
>
_kHosts
=
<
InternetAddressType
,
InternetAddress
>{
...
...
@@ -213,7 +189,6 @@ void catchIsolateErrors() {
void
main
(
)
{
print
(
'
$_kStartTimeoutTimerMessage
'
);
String
serverPort
=
Platform
.
environment
[
'SERVER_PORT'
]
??
''
;
String
server
=
Uri
.
decodeComponent
(
'
$encodedWebsocketUrl
:
\
$serverPort
'
);
StreamChannel
<
dynamic
>
channel
=
serializeSuite
(()
{
...
...
@@ -243,7 +218,7 @@ void main() {
return buffer.toString();
}
enum InitialResult { crashed,
timedOut,
connected }
enum InitialResult { crashed, connected }
enum TestResult { crashed, harnessBailed, testBailed }
...
...
@@ -507,7 +482,6 @@ class FlutterPlatform extends PlatformPlugin {
}
});
final
Completer
<
void
>
timeout
=
Completer
<
void
>();
final
Completer
<
void
>
gotProcessObservatoryUri
=
Completer
<
void
>();
if
(!
enableObservatory
)
{
gotProcessObservatoryUri
.
complete
();
...
...
@@ -543,10 +517,6 @@ class FlutterPlatform extends PlatformPlugin {
watcher
?.
handleStartedProcess
(
ProcessEvent
(
ourTestCount
,
process
,
processObservatoryUri
));
},
startTimeoutTimer:
()
{
Future
<
InitialResult
>.
delayed
(
_kTestStartupTimeout
)
.
then
<
void
>((
_
)
=>
timeout
.
complete
());
},
);
// At this point, three things can happen next:
...
...
@@ -556,8 +526,6 @@ class FlutterPlatform extends PlatformPlugin {
globals
.
printTrace
(
'test
$ourTestCount
: awaiting initial result for pid
${process.pid}
'
);
final
InitialResult
initialResult
=
await
Future
.
any
<
InitialResult
>(<
Future
<
InitialResult
>>[
process
.
exitCode
.
then
<
InitialResult
>((
int
exitCode
)
=>
InitialResult
.
crashed
),
timeout
.
future
.
then
<
InitialResult
>((
void
value
)
=>
InitialResult
.
timedOut
),
Future
<
InitialResult
>.
delayed
(
_kTestProcessTimeout
,
()
=>
InitialResult
.
timedOut
),
gotProcessObservatoryUri
.
future
.
then
<
InitialResult
>((
void
value
)
{
return
webSocket
.
future
.
then
<
InitialResult
>(
(
WebSocket
webSocket
)
=>
InitialResult
.
connected
,
...
...
@@ -582,20 +550,6 @@ class FlutterPlatform extends PlatformPlugin {
await
controller
.
sink
.
done
;
await
watcher
?.
handleTestCrashed
(
ProcessEvent
(
ourTestCount
,
process
));
break
;
case
InitialResult
.
timedOut
:
// Could happen either if the process takes a long time starting
// (_kTestProcessTimeout), or if once Dart code starts running, it takes a
// long time to open the WebSocket connection (_kTestStartupTimeout).
globals
.
printTrace
(
'test
$ourTestCount
: timed out waiting for process with pid
${process.pid}
to connect to test harness'
);
final
String
message
=
_getErrorMessage
(
'Test never connected to test harness.'
,
testPath
,
shellPath
);
controller
.
sink
.
addError
(
message
);
// Awaited for with 'sink.done' below.
unawaited
(
controller
.
sink
.
close
());
globals
.
printTrace
(
'test
$ourTestCount
: waiting for controller sink to close'
);
await
controller
.
sink
.
done
;
await
watcher
?.
handleTestTimedOut
(
ProcessEvent
(
ourTestCount
,
process
));
break
;
case
InitialResult
.
connected
:
globals
.
printTrace
(
'test
$ourTestCount
: process with pid
${process.pid}
connected to test harness'
);
final
WebSocket
testSocket
=
await
webSocket
.
future
;
...
...
@@ -875,7 +829,6 @@ class FlutterPlatform extends PlatformPlugin {
void
_pipeStandardStreamsToConsole
(
Process
process
,
{
void
startTimeoutTimer
(),
Future
<
void
>
reportObservatoryUri
(
Uri
uri
),
})
{
...
...
@@ -889,11 +842,7 @@ class FlutterPlatform extends PlatformPlugin {
.
transform
<
String
>(
const
LineSplitter
())
.
listen
(
(
String
line
)
async
{
if
(
line
==
_kStartTimeoutTimerMessage
)
{
if
(
startTimeoutTimer
!=
null
)
{
startTimeoutTimer
();
}
}
else
if
(
line
.
startsWith
(
"error: Unable to read Dart source 'package:test/"
))
{
if
(
line
.
startsWith
(
"error: Unable to read Dart source 'package:test/"
))
{
globals
.
printTrace
(
'Shell:
$line
'
);
globals
.
printError
(
'
\n\n
Failed to load test harness. Are you missing a dependency on flutter_test?
\n
'
);
}
else
if
(
line
.
startsWith
(
observatoryString
))
{
...
...
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