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
1c2d3f32
Unverified
Commit
1c2d3f32
authored
Aug 28, 2018
by
Ian Hickson
Committed by
GitHub
Aug 28, 2018
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Shut down gradle at the end of each task (#20968)
Apparently Gradle leaks memory and it's causing failures.
parent
53b63581
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
52 additions
and
5 deletions
+52
-5
README.md
dev/devicelab/README.md
+6
-0
runner.dart
dev/devicelab/lib/framework/runner.dart
+39
-0
utils.dart
dev/devicelab/lib/framework/utils.dart
+7
-5
No files found.
dev/devicelab/README.md
View file @
1c2d3f32
...
...
@@ -108,6 +108,12 @@ Android SDK at `.../engine/src/third_party/android_tools/sdk`.
You can find where your Android SDK is using
`flutter doctor`
.
## Warnings
Running devicelab will do things to your environment.
Notably, it will start and stop gradle, for instance.
## Running all tests
To run all tests defined in
`manifest.yaml`
, use option
`-a`
(
`--all`
):
...
...
dev/devicelab/lib/framework/runner.dart
View file @
1c2d3f32
...
...
@@ -6,6 +6,7 @@ import 'dart:async';
import
'dart:convert'
;
import
'dart:io'
;
import
'package:path/path.dart'
as
path
;
import
'package:vm_service_client/vm_service_client.dart'
;
import
'package:flutter_devicelab/framework/utils.dart'
;
...
...
@@ -81,6 +82,7 @@ Future<Map<String, dynamic>> runTask(String taskName, { bool silent = false }) a
}
finally
{
if
(!
runnerFinished
)
runner
.
kill
(
ProcessSignal
.
sigkill
);
await
cleanupSystem
();
await
stdoutSub
.
cancel
();
await
stderrSub
.
cancel
();
}
...
...
@@ -125,3 +127,40 @@ Future<VMIsolateRef> _connectToRunnerIsolate(int vmServicePort) async {
}
}
}
Future
<
void
>
cleanupSystem
()
async
{
print
(
'
\n\n
Cleaning up system after task...'
);
final
String
javaHome
=
await
findJavaHome
();
if
(
javaHome
!=
null
)
{
// To shut gradle down, we have to call "gradlew --stop".
// To call gradlew, we need to have a gradle-wrapper.properties file along
// with a shell script, a .jar file, etc. We get these from various places
// as you see in the code below, and we save them all into a temporary dir
// which we can then delete after.
// All the steps below are somewhat tolerant of errors, because it doesn't
// really matter if this succeeds every time or not.
print
(
'
\n
Telling Gradle to shut down (JAVA_HOME=
$javaHome
)'
);
final
String
gradlewBinaryName
=
Platform
.
isWindows
?
'gradlew.bat'
:
'gradlew'
;
final
Directory
tempDir
=
Directory
.
systemTemp
.
createTempSync
(
'flutter_devicelab_shutdown_gradle.'
);
recursiveCopy
(
new
Directory
(
path
.
join
(
flutterDirectory
.
path
,
'bin'
,
'cache'
,
'artifacts'
,
'gradle_wrapper'
)),
tempDir
);
copy
(
new
File
(
path
.
join
(
path
.
join
(
flutterDirectory
.
path
,
'packages'
,
'flutter_tools'
),
'templates'
,
'create'
,
'android.tmpl'
,
'gradle'
,
'wrapper'
,
'gradle-wrapper.properties'
)),
new
Directory
(
path
.
join
(
tempDir
.
path
,
'gradle'
,
'wrapper'
)));
if
(!
Platform
.
isWindows
)
{
await
exec
(
'chmod'
,
<
String
>[
'a+x'
,
path
.
join
(
tempDir
.
path
,
gradlewBinaryName
)],
canFail:
true
,
);
}
await
exec
(
path
.
join
(
tempDir
.
path
,
gradlewBinaryName
),
<
String
>[
'--stop'
],
environment:
<
String
,
String
>{
'JAVA_HOME'
:
javaHome
},
workingDirectory:
tempDir
.
path
,
canFail:
true
,
);
rmTree
(
tempDir
);
print
(
'
\n
'
);
}
else
{
print
(
'Could not determine JAVA_HOME; not shutting down Gradle.'
);
}
}
\ No newline at end of file
dev/devicelab/lib/framework/utils.dart
View file @
1c2d3f32
...
...
@@ -236,7 +236,7 @@ Future<Process> startProcess(
_runningProcesses
.
add
(
processInfo
);
process
.
exitCode
.
then
((
int
exitCode
)
{
print
(
'
exit
code:
$exitCode
'
);
print
(
'
"
$executable
" exit
code:
$exitCode
'
);
_runningProcesses
.
remove
(
processInfo
);
});
...
...
@@ -266,8 +266,9 @@ Future<int> exec(
List
<
String
>
arguments
,
{
Map
<
String
,
String
>
environment
,
bool
canFail
=
false
,
// as in, whether failures are ok. False means that they are fatal.
String
workingDirectory
,
})
async
{
final
Process
process
=
await
startProcess
(
executable
,
arguments
,
environment:
environment
);
final
Process
process
=
await
startProcess
(
executable
,
arguments
,
environment:
environment
,
workingDirectory:
workingDirectory
);
final
Completer
<
Null
>
stdoutDone
=
new
Completer
<
Null
>();
final
Completer
<
Null
>
stderrDone
=
new
Completer
<
Null
>();
...
...
@@ -288,7 +289,7 @@ Future<int> exec(
final
int
exitCode
=
await
process
.
exitCode
;
if
(
exitCode
!=
0
&&
!
canFail
)
fail
(
'Executable failed with exit code
$exitCode
.'
);
fail
(
'Executable
"
$executable
"
failed with exit code
$exitCode
.'
);
return
exitCode
;
}
...
...
@@ -301,8 +302,9 @@ Future<String> eval(
List
<
String
>
arguments
,
{
Map
<
String
,
String
>
environment
,
bool
canFail
=
false
,
// as in, whether failures are ok. False means that they are fatal.
String
workingDirectory
,
})
async
{
final
Process
process
=
await
startProcess
(
executable
,
arguments
,
environment:
environment
);
final
Process
process
=
await
startProcess
(
executable
,
arguments
,
environment:
environment
,
workingDirectory:
workingDirectory
);
final
StringBuffer
output
=
new
StringBuffer
();
final
Completer
<
Null
>
stdoutDone
=
new
Completer
<
Null
>();
...
...
@@ -325,7 +327,7 @@ Future<String> eval(
final
int
exitCode
=
await
process
.
exitCode
;
if
(
exitCode
!=
0
&&
!
canFail
)
fail
(
'Executable failed with exit code
$exitCode
.'
);
fail
(
'Executable
"
$executable
"
failed with exit code
$exitCode
.'
);
return
output
.
toString
().
trimRight
();
}
...
...
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