1
0
Fork 0
mirror of https://github.com/openstf/stf synced 2025-10-04 10:19:30 +02:00

Update STFService.apk to 1.1.0. Switches to abstract sockets which fixes

adb getting stuck when tethering is being used.
This commit is contained in:
Simo Kinnunen 2016-09-03 04:01:07 +09:00
parent 94fd18aedf
commit 33e4e617bb
4 changed files with 14 additions and 41 deletions

View file

@ -42,14 +42,14 @@ module.exports = syrup.serial()
var agent = {
socket: null
, writer: null
, port: 1090
, sock: 'localabstract:stfagent'
}
var service = {
socket: null
, writer: null
, reader: null
, port: 1100
, sock: 'localabstract:stfservice'
}
function stopAgent() {
@ -229,7 +229,7 @@ module.exports = syrup.serial()
, apk.startIntent.component
))
.then(function() {
return devutil.waitForPort(adb, options.serial, service.port)
return devutil.waitForLocalSocket(adb, options.serial, service.sock)
.timeout(15000)
})
.then(function(conn) {
@ -270,7 +270,7 @@ module.exports = syrup.serial()
return stopAgent()
.timeout(15000)
.then(function() {
return devutil.ensureUnusedPort(adb, options.serial, agent.port)
return devutil.ensureUnusedLocalSocket(adb, options.serial, agent.sock)
.timeout(10000)
})
.then(function() {
@ -285,7 +285,7 @@ module.exports = syrup.serial()
streamutil.talk(log, 'Agent says: "%s"', out)
})
.then(function() {
return devutil.waitForPort(adb, options.serial, agent.port)
return devutil.waitForLocalSocket(adb, options.serial, agent.sock)
.timeout(10000)
})
.then(function(conn) {

View file

@ -17,7 +17,7 @@ module.exports = syrup.serial()
pathutil.vendor('STFService/wire.proto'))
var resource = {
requiredVersion: '1.0.2'
requiredVersion: '1.1.0'
, pkg: 'jp.co.cyberagent.stf'
, main: 'jp.co.cyberagent.stf.Agent'
, apk: pathutil.vendor('STFService/STFService.apk')

View file

@ -9,58 +9,31 @@ function closedError(err) {
return err.message.indexOf('closed') !== -1
}
devutil.ensureUnusedPort = function(adb, serial, port) {
return adb.openTcp(serial, port)
devutil.ensureUnusedLocalSocket = function(adb, serial, sock) {
return adb.openLocal(serial, sock)
.then(function(conn) {
conn.end()
throw new Error(util.format('Port "%d" should be unused', port))
throw new Error(util.format('Local socket "%s" should be unused', sock))
})
.catch(closedError, function() {
return Promise.resolve(port)
return Promise.resolve(sock)
})
}
devutil.waitForPort = function(adb, serial, port) {
return adb.openTcp(serial, port)
devutil.waitForLocalSocket = function(adb, serial, sock) {
return adb.openLocal(serial, sock)
.then(function(conn) {
conn.port = port
conn.sock = sock
return conn
})
.catch(closedError, function() {
return Promise.delay(100)
.then(function() {
return devutil.waitForPort(adb, serial, port)
return devutil.waitForLocalSocket(adb, serial, sock)
})
})
}
devutil.waitForPortToFree = function(adb, serial, port) {
return adb.openTcp(serial, port)
.then(function(conn) {
var resolver = Promise.defer()
function endListener() {
resolver.resolve(port)
}
function errorListener(err) {
resolver.reject(err)
}
conn.on('end', endListener)
conn.on('error', errorListener)
return resolver.promise.finally(function() {
conn.removeListener('end', endListener)
conn.removeListener('error', errorListener)
conn.end()
})
})
.catch(closedError, function() {
return port
})
}
devutil.listPidsByComm = function(adb, serial, comm, bin) {
var users = {
shell: true

Binary file not shown.