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
e2126629
Unverified
Commit
e2126629
authored
Apr 13, 2020
by
Jonah Williams
Committed by
GitHub
Apr 13, 2020
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Revert "Do not wait for connections after process has exited (#54497)" (#54618)
This reverts commit
283ec9e2
.
parent
fe41c972
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
15 additions
and
25 deletions
+15
-25
runner.dart
dev/devicelab/lib/framework/runner.dart
+5
-15
run_test.dart
dev/devicelab/test/run_test.dart
+10
-10
No files found.
dev/devicelab/lib/framework/runner.dart
View file @
e2126629
...
@@ -40,20 +40,12 @@ Future<Map<String, dynamic>> runTask(
...
@@ -40,20 +40,12 @@ Future<Map<String, dynamic>> runTask(
bool
runnerFinished
=
false
;
bool
runnerFinished
=
false
;
final
Completer
<
Uri
>
uri
=
Completer
<
Uri
>();
runner
.
exitCode
.
whenComplete
(()
{
runner
.
exitCode
.
whenComplete
(()
{
if
(!
uri
.
isCompleted
)
{
// The runner process exited prematurely.
uri
.
completeError
(
Exception
(
'The task runner process exited before opening a VM service connection. '
'A common cause for this is when a task script does not actually create '
'a task.'
,
));
}
runnerFinished
=
true
;
runnerFinished
=
true
;
});
});
final
Completer
<
Uri
>
uri
=
Completer
<
Uri
>();
final
StreamSubscription
<
String
>
stdoutSub
=
runner
.
stdout
final
StreamSubscription
<
String
>
stdoutSub
=
runner
.
stdout
.
transform
<
String
>(
const
Utf8Decoder
())
.
transform
<
String
>(
const
Utf8Decoder
())
.
transform
<
String
>(
const
LineSplitter
())
.
transform
<
String
>(
const
LineSplitter
())
...
@@ -76,7 +68,7 @@ Future<Map<String, dynamic>> runTask(
...
@@ -76,7 +68,7 @@ Future<Map<String, dynamic>> runTask(
});
});
try
{
try
{
final
VMIsolateRef
isolate
=
await
_connectToRunnerIsolate
(
await
uri
.
future
,
()
=>
!
runnerFinished
);
final
VMIsolateRef
isolate
=
await
_connectToRunnerIsolate
(
await
uri
.
future
);
final
Map
<
String
,
dynamic
>
taskResult
=
await
isolate
.
invokeExtension
(
'ext.cocoonRunTask'
)
as
Map
<
String
,
dynamic
>;
final
Map
<
String
,
dynamic
>
taskResult
=
await
isolate
.
invokeExtension
(
'ext.cocoonRunTask'
)
as
Map
<
String
,
dynamic
>;
await
runner
.
exitCode
;
await
runner
.
exitCode
;
return
taskResult
;
return
taskResult
;
...
@@ -89,7 +81,7 @@ Future<Map<String, dynamic>> runTask(
...
@@ -89,7 +81,7 @@ Future<Map<String, dynamic>> runTask(
}
}
}
}
Future
<
VMIsolateRef
>
_connectToRunnerIsolate
(
Uri
vmServiceUri
,
bool
Function
()
keepTrying
)
async
{
Future
<
VMIsolateRef
>
_connectToRunnerIsolate
(
Uri
vmServiceUri
)
async
{
final
List
<
String
>
pathSegments
=
<
String
>[
final
List
<
String
>
pathSegments
=
<
String
>[
// Add authentication code.
// Add authentication code.
if
(
vmServiceUri
.
pathSegments
.
isNotEmpty
)
vmServiceUri
.
pathSegments
[
0
],
if
(
vmServiceUri
.
pathSegments
.
isNotEmpty
)
vmServiceUri
.
pathSegments
[
0
],
...
@@ -99,7 +91,7 @@ Future<VMIsolateRef> _connectToRunnerIsolate(Uri vmServiceUri, bool Function() k
...
@@ -99,7 +91,7 @@ Future<VMIsolateRef> _connectToRunnerIsolate(Uri vmServiceUri, bool Function() k
pathSegments
).
toString
();
pathSegments
).
toString
();
final
Stopwatch
stopwatch
=
Stopwatch
()..
start
();
final
Stopwatch
stopwatch
=
Stopwatch
()..
start
();
while
(
keepTrying
()
)
{
while
(
true
)
{
try
{
try
{
// Make sure VM server is up by successfully opening and closing a socket.
// Make sure VM server is up by successfully opening and closing a socket.
await
(
await
WebSocket
.
connect
(
url
)).
close
();
await
(
await
WebSocket
.
connect
(
url
)).
close
();
...
@@ -118,8 +110,6 @@ Future<VMIsolateRef> _connectToRunnerIsolate(Uri vmServiceUri, bool Function() k
...
@@ -118,8 +110,6 @@ Future<VMIsolateRef> _connectToRunnerIsolate(Uri vmServiceUri, bool Function() k
await
Future
<
void
>.
delayed
(
const
Duration
(
milliseconds:
50
));
await
Future
<
void
>.
delayed
(
const
Duration
(
milliseconds:
50
));
}
}
}
}
throw
Exception
(
'Failed to connect to Dart VM service.'
);
}
}
Future
<
void
>
cleanupSystem
()
async
{
Future
<
void
>
cleanupSystem
()
async
{
...
...
dev/devicelab/test/run_test.dart
View file @
e2126629
...
@@ -24,43 +24,43 @@ void main() {
...
@@ -24,43 +24,43 @@ void main() {
return
scriptProcess
;
return
scriptProcess
;
}
}
Future
<
void
>
expectScriptResult
(
List
<
String
>
testNames
,
{
bool
expectSuccess
}
)
async
{
Future
<
void
>
expectScriptResult
(
List
<
String
>
testNames
,
int
expectedExitCode
)
async
{
final
ProcessResult
result
=
await
runScript
(
testNames
);
final
ProcessResult
result
=
await
runScript
(
testNames
);
expect
(
result
.
exitCode
,
expect
Success
?
0
:
isNot
(
equals
(
0
))
,
expect
(
result
.
exitCode
,
expect
edExitCode
,
reason:
'[ stderr from test process ]
\n\n
${result.stderr}
\n\n
[ end of stderr ]'
reason:
'[ stderr from test process ]
\n\n
${result.stderr}
\n\n
[ end of stderr ]'
'
\n\n
[ stdout from test process ]
\n\n
${result.stdout}
\n\n
[ end of stdout ]'
);
'
\n\n
[ stdout from test process ]
\n\n
${result.stdout}
\n\n
[ end of stdout ]'
);
}
}
test
(
'exits with code 0 when succeeds'
,
()
async
{
test
(
'exits with code 0 when succeeds'
,
()
async
{
await
expectScriptResult
(<
String
>[
'smoke_test_success'
],
expectSuccess:
true
);
await
expectScriptResult
(<
String
>[
'smoke_test_success'
],
0
);
});
});
test
(
'accepts file paths'
,
()
async
{
test
(
'accepts file paths'
,
()
async
{
await
expectScriptResult
(<
String
>[
'bin/tasks/smoke_test_success.dart'
],
expectSuccess:
true
);
await
expectScriptResult
(<
String
>[
'bin/tasks/smoke_test_success.dart'
],
0
);
});
});
test
(
'rejects invalid file paths'
,
()
async
{
test
(
'rejects invalid file paths'
,
()
async
{
await
expectScriptResult
(<
String
>[
'lib/framework/adb.dart'
],
expectSuccess:
false
);
await
expectScriptResult
(<
String
>[
'lib/framework/adb.dart'
],
1
);
});
});
test
(
'exits with code 1 when task throws'
,
()
async
{
test
(
'exits with code 1 when task throws'
,
()
async
{
await
expectScriptResult
(<
String
>[
'smoke_test_throws'
],
expectSuccess:
false
);
await
expectScriptResult
(<
String
>[
'smoke_test_throws'
],
1
);
});
});
test
(
'exits with code 1 when fails'
,
()
async
{
test
(
'exits with code 1 when fails'
,
()
async
{
await
expectScriptResult
(<
String
>[
'smoke_test_failure'
],
expectSuccess:
false
);
await
expectScriptResult
(<
String
>[
'smoke_test_failure'
],
1
);
});
});
test
(
'exits with code 1 when fails to connect'
,
()
async
{
test
(
'exits with code 1 when fails to connect'
,
()
async
{
await
expectScriptResult
(<
String
>[
'smoke_test_setup_failure'
],
expectSuccess:
false
);
await
expectScriptResult
(<
String
>[
'smoke_test_setup_failure'
],
1
);
}
);
}
,
skip:
true
);
// https://github.com/flutter/flutter/issues/53707
test
(
'exits with code 1 when results are mixed'
,
()
async
{
test
(
'exits with code 1 when results are mixed'
,
()
async
{
await
expectScriptResult
(<
String
>[
await
expectScriptResult
(<
String
>[
'smoke_test_failure'
,
'smoke_test_failure'
,
'smoke_test_success'
,
'smoke_test_success'
,
],
],
expectSuccess:
false
,
1
,
);
);
});
});
});
});
...
...
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