tmpdir = None # pathstring on host
testbed = None # Testbed
errorcode = 0 # exit status that we are going to use
+timeouts = { 'short':10, 'install':300, 'test':300, 'build':3000 }
binaries = None # Binaries (.debs we have registered)
build_essential = ["build-essential"]
help='use binary package DEB according'
' to most recent --binaries-* settings')
+ def cb_actnoarg(op,optstr,value,parser, largsentry):
+ parser.largs.append(largsentry)
+ pa('','--instantiate', action='callback', callback=cb_actnoarg,
+ callback_args=((None, ('instantiate',)),),
+ help='instantiate testbed now (during testing phase)'
+ ' and install packages'
+ ' selected for automatic installation, even'
+ ' if this might apparently not be required otherwise')
+
pa_action('override-control', 'CONTROL', ('control',), is_act=0,
help='run tests from control file CONTROL instead,'
' (applies to next test suite only)')
if kind == 'dsc': fwhatx = '/' + os.path.basename(pathstr)
else: fwhatx = '-'+kind
- af = constructor(what+fwhatx, pathstr, arghandling['tb'])
+ if pathstr is None: af = None
+ else: af = constructor(what+fwhatx, pathstr, arghandling['tb'])
opts.actions.append(Action(kind, af, arghandling, what))
def setup_trace():
if not tb._need_reset_apt: return
what = 'aptget-update-reset'
cmdl = ['apt-get','-qy','update']
- rc = tb.execute(what, cmdl)
+ rc = tb.execute(what, cmdl, timeout=timeouts['install'])
if rc:
pstderr("\n" "warning: failed to restore"
" testbed apt cache, exit code %d" % rc)
]])
cmdl = ['python','-c',script]
what = 'install-deps'
- rc = testbed.execute(what+'-debinstall', cmdl, script=script)
+ rc = testbed.execute(what+'-debinstall', cmdl, script=script,
+ timeout=timeouts['install'])
if rc: badpkg('dependency install failed, exit code %d' % rc)
def needs_reset(tb):
tb._debug('needs_reset, previously=%s' % tb.modified, 1)
return rl[0]
def execute(tb, what, cmdl,
si='/dev/null', so='/dev/null', se=None, cwd=None,
- script=False, tmpdir=None):
+ script=False, tmpdir=None, timeout=timeouts['short']):
# Options for script:
# False - do not call debug_subprocess, no synch. reporting required
# None or string - call debug_subprocess with that value,
','.join(map(urllib.quote, cmdl)),
si, so, se_use, cwd]
+ if timeout is not None and timeout > 0:
+ cmdl.append('timeout=%d' % timeout)
+
if xdump is not None and 'execute-debug' in tb.caps: cmdl += [xdump]
if tmpdir is not None: cmdl.append('env=TMPDIR=%s' % tmpdir)
rc = testbed.execute('test-'+t.what, tfl,
so=so.write(True), se=se.write(True), cwd=tree.read(True),
- tmpdir=tmpdir)
+ tmpdir=tmpdir, timeout=timeouts['test'])
so_read = so.read()
se_read = se.read()
what = 'apt-get-reinstall'
cmdl = (b.apt_get() + ['--reinstall','install'] +
[pkg for pkg in pkgs_reinstall])
- rc = testbed.execute(what, cmdl, script=None)
+ rc = testbed.execute(what, cmdl, script=None,
+ timeout=timeouts['install'])
if rc: badpkg("installation of basic binarries failed,"
" exit code %d" % rc)
what = 'apt-get-install-%s' % pkg
testbed.blame(pkg)
cmdl = b.apt_get() + ['install',pkg]
- rc = testbed.execute(what, cmdl, script=None)
+ rc = testbed.execute(what, cmdl, script=None,
+ timeout=timeouts['install'])
if rc: badpkg("installation of %s failed, exit code %d"
% (pkg, rc))
so = TemporaryFile('%s-%s-results' % (what,which))
rc = testbed.execute('%s-%s' % (what,which),
['sh','-ec',script]+xargs, script=script,
- so=so.write(True), cwd=cwd)
+ so=so.write(True), cwd=cwd,
+ timeout=timeouts['build'])
results = open(so.read()).read().rstrip('\n')
if len(results): results = results.split("\n")
else: results = []
]])
cmdl = ['python','-c',script]
whatp = what+'-dpkgsource'
- rc = testbed.execute(what, cmdl, script=script)
+ rc = testbed.execute(what, cmdl, script=script,
+ timeout=timeouts['install'])
if rc: badpkg('dpkg-source install failed, exit code %d' % rc)
work = TemporaryDir(what+'-build')
cmdl = ['python','-c',script]
whatp = what+'-builddeps'
- rc = testbed.execute(what, cmdl, script=script)
+ rc = testbed.execute(what, cmdl, script=script,
+ timeout=timeouts['install'])
if rc: badpkg('build-depends install failed,'
' exit code %d' % rc)
binaries = Binaries()
for act in opts.actions:
- if not act.af.spec_tbp:
+ if act.af is not None and not act.af.spec_tbp:
testbed.register_ephemeral(act.af)
binaries.reset()
act.binaries = []
if act.kind.endswith('tree') or act.kind == 'dsc':
control_override = None
+ if act.kind == 'instantiate':
+ pass
debug_a1('builds done.')
debug_a3('run_tests ...')
run_tests(stanzas, act.af)
control_override = None
+ if act.kind == 'instantiate':
+ testbed.prepare([])
debug_a1('tests done.')
def main():