mirror of
https://github.com/openglow-org/forgefirm.git
synced 2026-09-28 01:01:12 -07:00
bench: harden the debug-kernel drills against bench facts
Three fixes found running the drills: the splat regex no longer matches the benign "RCU lockdep checking is enabled" boot banner; the 40 V regulator search reaches its reg-fixed-voltage driver (regulators:40v) so the forced-defer drill resolves the resource instead of skipping; and require_idle waits out the run-through-'running' a forgectrl restart passes through instead of refusing.
This commit is contained in:
@@ -29,9 +29,12 @@ import sys
|
|||||||
import time
|
import time
|
||||||
|
|
||||||
CNC_DRV = '/sys/bus/platform/drivers/glowforge_cnc'
|
CNC_DRV = '/sys/bus/platform/drivers/glowforge_cnc'
|
||||||
SPLAT = re.compile(r'BUG:|WARNING:|INFO: possible|held lock|lockdep|'
|
# Real splat markers only - not the benign "RCU lockdep checking is
|
||||||
|
# enabled" boot banner (a bare "lockdep" match would flag it).
|
||||||
|
SPLAT = re.compile(r'BUG:|WARNING:|INFO: possible|held lock|'
|
||||||
r'circular locking|bad unlock|sleeping function|'
|
r'circular locking|bad unlock|sleeping function|'
|
||||||
r'still has locks held|DEBUG_LOCKS_WARN')
|
r'still has locks held|DEBUG_LOCKS_WARN|'
|
||||||
|
r'lock held when returning')
|
||||||
|
|
||||||
|
|
||||||
def sh(cmd, check=False):
|
def sh(cmd, check=False):
|
||||||
@@ -68,19 +71,25 @@ def require_debug_kernel():
|
|||||||
|
|
||||||
|
|
||||||
def require_idle():
|
def require_idle():
|
||||||
|
# The controller re-init after a forgectrl restart passes briefly
|
||||||
|
# through 'running'; wait a few seconds for it to settle before
|
||||||
|
# refusing.
|
||||||
st = ''
|
st = ''
|
||||||
try:
|
for _ in range(8):
|
||||||
st = open('/sys/glowforge/cnc/state').read().strip()
|
try:
|
||||||
except OSError:
|
st = open('/sys/glowforge/cnc/state').read().strip()
|
||||||
pass
|
except OSError:
|
||||||
if st not in ('idle', 'disabled'):
|
st = ''
|
||||||
print('REFUSED: cnc/state is %r, not idle.' % st)
|
if st in ('idle', 'disabled'):
|
||||||
sys.exit(2)
|
return
|
||||||
|
time.sleep(1)
|
||||||
|
print('REFUSED: cnc/state is %r, not idle.' % st)
|
||||||
|
sys.exit(2)
|
||||||
|
|
||||||
|
|
||||||
def forgectrl(action):
|
def forgectrl(action):
|
||||||
sh('/etc/init.d/forgectrl %s' % action)
|
sh('/etc/init.d/forgectrl %s' % action)
|
||||||
time.sleep(3)
|
time.sleep(5)
|
||||||
|
|
||||||
|
|
||||||
def drill_load_unload():
|
def drill_load_unload():
|
||||||
@@ -117,11 +126,13 @@ def regulator_provider():
|
|||||||
# The 40 V regulator the cnc probe holds exclusively; unbinding its
|
# The 40 V regulator the cnc probe holds exclusively; unbinding its
|
||||||
# provider makes the re-bind probe defer. Resolve from the cnc node's
|
# provider makes the re-bind probe defer. Resolve from the cnc node's
|
||||||
# 40v-supply phandle if present, else the known fixed regulator name.
|
# 40v-supply phandle if present, else the known fixed regulator name.
|
||||||
for d in glob.glob('/sys/bus/platform/drivers/*regulator*'):
|
drivers = (glob.glob('/sys/bus/platform/drivers/*regulator*') +
|
||||||
|
glob.glob('/sys/bus/platform/drivers/reg-fixed*'))
|
||||||
|
for d in drivers:
|
||||||
for dev in os.listdir(d):
|
for dev in os.listdir(d):
|
||||||
if dev in ('bind', 'unbind', 'module', 'uevent'):
|
if dev in ('bind', 'unbind', 'module', 'uevent'):
|
||||||
continue
|
continue
|
||||||
if '40v' in dev.lower() or 'reg_40v' in dev.lower():
|
if '40v' in dev.lower(): # e.g. regulators:40v
|
||||||
return os.path.basename(d), dev
|
return os.path.basename(d), dev
|
||||||
return None, None
|
return None, None
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user