mirror of
https://github.com/openstf/stf
synced 2025-10-04 10:19:30 +02:00
Move more work to devutil.
This commit is contained in:
parent
3c55f91ee9
commit
6c350d0068
2 changed files with 31 additions and 27 deletions
|
@ -26,6 +26,20 @@ devutil.vendorFiles = function(identity) {
|
|||
}
|
||||
}
|
||||
|
||||
devutil.ensureUnusedPort = function(adb, serial, port) {
|
||||
function closedError(err) {
|
||||
return err.message === 'closed'
|
||||
}
|
||||
return adb.openTcpAsync(serial, port)
|
||||
.then(function(conn) {
|
||||
conn.end()
|
||||
throw new Error(util.format('Port "%d" should be unused', port))
|
||||
})
|
||||
.catch(closedError, function(err) {
|
||||
return Promise.resolve(port)
|
||||
})
|
||||
}
|
||||
|
||||
devutil.killProcsByComm = function(adb, serial, comm, bin) {
|
||||
return adb.shellAsync(serial, ['ps', comm])
|
||||
.then(function(out) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue