Skip to content
This repository has been archived by the owner on Sep 15, 2021. It is now read-only.

Commit

Permalink
Bug 1066823 - remove old code that supports tegras in buildbot-config…
Browse files Browse the repository at this point in the history
…s/buildbotcustom/tools/mozharness/puppet r=Callek
  • Loading branch information
kmoir committed Sep 30, 2014
1 parent 47dd030 commit c3a5952
Show file tree
Hide file tree
Showing 11 changed files with 7 additions and 213 deletions.
7 changes: 2 additions & 5 deletions buildfarm/maintenance/foopy_fabric.py
Expand Up @@ -55,11 +55,8 @@ def status(device):
@per_device
@use_json
def reboot(device, json):
if 'tegra' in device:
run("SUT_NAME=%s python /builds/sut_tools/tegra_powercycle.py %s && sleep 1" % (device, device))
else:
bank, relay = json['relayid'].split(":")
run("python /builds/sut_tools/relay.py powercycle %s %s %s ; sleep 5" % (json['relayhost'], bank, relay))
bank, relay = json['relayid'].split(":")
run("python /builds/sut_tools/relay.py powercycle %s %s %s ; sleep 5" % (json['relayhost'], bank, relay))
print OK, "Powercycled %s" % device


Expand Down
18 changes: 0 additions & 18 deletions buildfarm/mobile/kill_stalled.sh

This file was deleted.

13 changes: 0 additions & 13 deletions buildfarm/mobile/tegra_stats.sh

This file was deleted.

2 changes: 1 addition & 1 deletion buildfarm/mobile/watch_devices.sh
Expand Up @@ -111,7 +111,7 @@ function device_check() {

function watch_launcher(){
log "STARTING Watcher"
ls -d /builds/{tegra-*[0-9],panda-*[0-9]} 2>/dev/null | sed 's:.*/::' | while read device; do
ls -d /builds/panda-*[0-9] 2>/dev/null | sed 's:.*/::' | while read device; do
log "..checking $device"
"${0}" "${device}" &
done
Expand Down
3 changes: 0 additions & 3 deletions lib/python/sut_lib/devices.py
Expand Up @@ -16,10 +16,7 @@ def loadDevicesData(filepath):
if len(allDevices) == 0:
allDevices = loadDevicesData(
os.path.join(os.path.dirname(__file__), '../../../buildfarm/mobile'))
tegras = dict()
pandas = dict()
for x in allDevices:
if x.startswith('tegra-'):
tegras[x] = allDevices[x]
if x.startswith('panda-'):
pandas[x] = allDevices[x]
50 changes: 1 addition & 49 deletions lib/python/sut_lib/powermanagement.py
Expand Up @@ -71,52 +71,4 @@ def soft_reboot_and_verify(device, dm, waitTime=90, max_attempts=5, silent=False
return False


def reboot_device(device, debug=False):
"""
Try to reboot the given device, returning True if successful.
snmpset -c private pdu4.build.mozilla.org 1.3.6.1.4.1.1718.3.2.3.1.11.1.1.13 i 3
1.3.6.1.4.1.1718.3.2.3.1.11.a.b.c
^^^^^ outlet id
^^ control action
^ outlet entry
^ outlet tables
^ system tables
^ sentry
^^^^^^^^^^^^^^^^ serverTech enterprises
a Sentry enclosure ID: 1 master 2 expansion
b Input Power Feed: 1 infeed-A 2 infeed-B
c Outlet ID (1 - 16)
y command: 1 turn on, 2 turn off, 3 reboot
a and b are determined by the DeviceID we get from the devices.json file
.AB14
^^ Outlet ID
^ InFeed code
^ Enclosure ID (we are assuming 1 (or A) below)
"""
result = False
if device in devices.tegras:
pdu = devices.tegras[device]['pdu']
deviceID = devices.tegras[device]['pduid']
if deviceID.startswith('.'):
if deviceID[2] == 'B':
b = 2
else:
b = 1
try:
c = int(deviceID[3:])
s = '3.2.3.1.11.1.%d.%d' % (b, c)
oib = '1.3.6.1.4.1.1718.%s' % s
cmd = '/usr/bin/snmpset -v 1 -c private %s %s i 3' % (pdu, oib)
if debug:
log.debug(
'rebooting %s at %s %s' % (device, pdu, deviceID))
if os.system(cmd) == 0:
result = True
except:
dumpException('error running [%s]' % cmd)
result = False

return result

2 changes: 1 addition & 1 deletion sut_tools/reboot.py
Expand Up @@ -19,7 +19,7 @@ def reboot(dm):
proxyIP = getOurIP()
proxyPort = calculatePort()

if 'panda' not in deviceName and 'tegra' not in deviceName:
if 'panda' not in deviceName:
# Attempt to set devicename via env variable 'SUT_NAME'
sname = os.getenv('SUT_NAME')
if sname.strip():
Expand Down
3 changes: 1 addition & 2 deletions sut_tools/smoketest.py
Expand Up @@ -67,8 +67,7 @@ def smoketest(device_name, number):
deviceRoot = dm.getDeviceRoot()

# This does all the steps of verify.py including the cleanup.
if verifyDevice(device_name, checksut=False, doCheckStalled=False,
watcherINI=True) is False:
if verifyDevice(device_name, checksut=False, doCheckStalled=False) is False:
log.error("failed to run verify on %s" % (device_name))
return 1 # Not ok to proceed
log.info("Successfully verified the device")
Expand Down
19 changes: 0 additions & 19 deletions sut_tools/tegra_checkstalled.py

This file was deleted.

29 changes: 0 additions & 29 deletions sut_tools/tegra_powercycle.py

This file was deleted.

74 changes: 1 addition & 73 deletions sut_tools/verify.py
Expand Up @@ -31,9 +31,6 @@
errorFile = None
dm = None

watcherINI = "\r\n[watcher]\r\nPingTarget = talos-remote.pvt.build.mozilla.org\r\nstrikes = 0\r\n"


def dmAlive(dm):
""" Check that a devicemanager connection is still active
Expand Down Expand Up @@ -276,67 +273,7 @@ def cleanupDevice(device, dm):
# Some sort of error happened above
return False


def setWatcherINI(dm):
""" If necessary Installs the (correct) watcher.ini for our infra
Returns False on failure, True on Success
"""
import hashlib
realLoc = "/data/data/com.mozilla.watcher/files/watcher.ini"
currentHash = hashlib.md5(watcherINI).hexdigest()

def watcherDataCurrent():
remoteFileHash = dm._getRemoteHash(realLoc)
if currentHash != remoteFileHash:
return False
else:
return True

if not dmAlive(dm):
return False

try:
if watcherDataCurrent():
return True
except:
setFlag(errorFile, "Unable to identify if watcher.ini is current")
return False

tmpname = '/mnt/sdcard/watcher.ini'
try:
dm._runCmds([{'cmd': 'push %s %s' % (tmpname, len(
watcherINI)), 'data': watcherINI}])
except devicemanager.AgentError, err:
log.info("Error while pushing watcher.ini: %s" % err)
setFlag(errorFile, "Unable to properly upload the watcher.ini")
return False

try:
dm._runCmds(
[{'cmd': 'exec su -c "dd if=%s of=%s"' % (tmpname, realLoc)}])
except devicemanager.AgentError, err:
log.info("Error while moving watcher.ini to %s: %s" % (realLoc, err))
setFlag(errorFile, "Unable to properly upload the watcher.ini")
return False

try:
dm._runCmds([{'cmd': 'exec su -c "chmod 0777 %s"' % realLoc}])
except devicemanager.AgentError, err:
log.info("Error while setting permissions for %s: %s" % (realLoc, err))
setFlag(errorFile, "Unable to properly upload the watcher.ini")
return False

try:
if watcherDataCurrent():
return True
except:
pass
setFlag(errorFile, "Unable to verify the updated watcher.ini")
return False


def verifyDevice(device, checksut=True, doCheckStalled=True, watcherINI=False,
def verifyDevice(device, checksut=True, doCheckStalled=True,
skipWhenMozpoolReady=False):
# Returns False on failure, True on Success
global dm, errorFile
Expand Down Expand Up @@ -391,11 +328,6 @@ def verifyDevice(device, checksut=True, doCheckStalled=True, watcherINI=False,
log.info("verifyDevice: failing to cleanup device")
return False

if watcherINI:
if not setWatcherINI(dm):
log.info("verifyDevice: failing to set watcher.ini")
return False

return True

if __name__ == '__main__':
Expand All @@ -417,11 +349,7 @@ def verifyDevice(device, checksut=True, doCheckStalled=True, watcherINI=False,
else:
device_name = args[0]

# Only attempt updating the watcher INI if we run against a tegra.
doWatcherUpdate = 'tegra' in device_name

if verifyDevice(device_name,
watcherINI=doWatcherUpdate,
skipWhenMozpoolReady=options.skipWhenMozpoolReady) is False:
sys.exit(1) # Not ok to proceed

Expand Down

0 comments on commit c3a5952

Please sign in to comment.