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

Remove vendor/remote as practically unused due to the stats plugin not being active.

This commit is contained in:
Simo Kinnunen 2015-06-12 17:09:20 +09:00
parent 810be9cfe3
commit aa7eb6f8ec
25 changed files with 0 additions and 156 deletions

View file

@ -1,46 +0,0 @@
var syrup = require('stf-syrup')
var logger = require('../../../util/logger')
var devutil = require('../../../util/devutil')
var lifecycle = require('../../../util/lifecycle')
var streamutil = require('../../../util/streamutil')
module.exports = syrup.serial()
.dependency(require('../support/adb'))
.dependency(require('../resources/remote'))
.define(function(options, adb, remote) {
var log = logger.createLogger('device:plugins:stats')
var service = {
port: 2830
}
function openService() {
return devutil.ensureUnusedPort(adb, options.serial, service.port)
.timeout(10000)
.then(function() {
return adb.shell(options.serial, [
remote.bin
, '--lib', remote.lib
, '--listen-stats', service.port
])
.timeout(10000)
.then(function(out) {
lifecycle.share('Stats shell', out)
streamutil.talk(log, 'Stats shell says: "%s"', out)
})
})
.then(function() {
return devutil.waitForPort(adb, options.serial, service.port)
.timeout(15000)
})
.then(function(conn) {
return lifecycle.share('Stats connection', conn)
})
}
return openService()
.then(function() {
return {}
})
})

View file

@ -1,110 +0,0 @@
var util = require('util')
var Promise = require('bluebird')
var syrup = require('stf-syrup')
var logger = require('../../../util/logger')
var pathutil = require('../../../util/pathutil')
var devutil = require('../../../util/devutil')
var streamutil = require('../../../util/streamutil')
module.exports = syrup.serial()
.dependency(require('../support/adb'))
.dependency(require('../support/properties'))
.dependency(require('../support/abi'))
.define(function(options, adb, properties, abi) {
var log = logger.createLogger('device:resources:remote')
var resources = {
bin: {
src: pathutil.requiredMatch(abi.all.map(function(supportedAbi) {
return pathutil.vendor(util.format(
'remote/libs/%s/remote%s'
, supportedAbi
, abi.pie ? '' : '-nopie'
))
}))
, dest: '/data/local/tmp/remote'
, comm: 'remote'
, mode: 0755
}
, lib: {
src: pathutil.requiredMatch(abi.all.map(function(supportedAbi) {
return pathutil.vendor(util.format(
'remote/external/android-%d/%s/remote_external.so'
, properties['ro.build.version.sdk']
, supportedAbi
))
}))
, dest: '/data/local/tmp/remote_external.so'
, mode: 0755
}
}
function removeResource(res) {
return adb.shell(options.serial, ['rm', res.dest])
.timeout(10000)
.then(function(out) {
return streamutil.readAll(out)
})
.return(res)
}
function installResource(res) {
return adb.push(options.serial, res.src, res.dest, res.mode)
.timeout(10000)
.then(function(transfer) {
return new Promise(function(resolve, reject) {
transfer.on('error', reject)
transfer.on('end', resolve)
})
})
.return(res)
}
function ensureNotBusy(res) {
return adb.shell(options.serial, [res.dest, '--help'])
.timeout(10000)
.then(function(out) {
// Can be "Text is busy", "text busy"
return streamutil.findLine(out, (/busy/i))
.timeout(10000)
.then(function() {
log.info('Binary is busy, will retry')
return Promise.delay(1000)
})
.then(function() {
return ensureNotBusy(res)
})
.catch(streamutil.NoSuchLineError, function() {
return res
})
})
}
function installAll() {
return Promise.all([
removeResource(resources.bin).then(installResource).then(ensureNotBusy)
, removeResource(resources.lib).then(installResource)
])
}
function stop() {
return devutil.killProcsByComm(
adb
, options.serial
, resources.bin.comm
, resources.bin.dest
)
.timeout(15000)
}
return stop()
.then(installAll)
.then(function() {
return {
bin: resources.bin.dest
, lib: resources.lib.dest
}
})
})