From 83b1487bdfdbab3a13e1cc42631201030fb2ba62 Mon Sep 17 00:00:00 2001 From: Ian Jackson Date: Tue, 3 Apr 2007 17:10:49 +0100 Subject: [PATCH] * set some default timeouts (these should be settable with options, really). -- Ian Jackson Fri, 23 Mar 2007 16:58:42 +0000 --- debian/changelog | 4 +++- runner/adt-run | 28 +++++++++++++++++++--------- 2 files changed, 22 insertions(+), 10 deletions(-) diff --git a/debian/changelog b/debian/changelog index 6bcc368..b7b0807 100644 --- a/debian/changelog +++ b/debian/changelog @@ -6,8 +6,10 @@ autopkgtest (0.7.2~~iwj) unstable; urgency=low * adt-testreport-onepackage: new ability to test binary as well as source packages, using new --instantiate option. * new `timeout=' option on `execute' virt server command. + * set some default timeouts (these should be settable with options, + really). - -- Ian Jackson Fri, 23 Mar 2007 16:58:42 +0000 + -- Ian Jackson Fri, 23 Mar 2007 16:58:42 +0000 autopkgtest (0.7.2) feisty; urgency=low diff --git a/runner/adt-run b/runner/adt-run index 403a9d3..3521af3 100755 --- a/runner/adt-run +++ b/runner/adt-run @@ -45,6 +45,7 @@ signal.signal(signal.SIGINT, signal.SIG_DFL) # undo stupid Python SIGINT thing 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"] @@ -737,7 +738,7 @@ class Testbed: 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) @@ -781,7 +782,8 @@ class Testbed: ]]) 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) @@ -848,7 +850,7 @@ class Testbed: 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, @@ -877,6 +879,9 @@ class Testbed: ','.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) @@ -1068,7 +1073,7 @@ class Test: 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() @@ -1414,7 +1419,8 @@ END 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) @@ -1423,7 +1429,8 @@ END 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)) @@ -1439,7 +1446,8 @@ def source_rules_command(act,script,what,which,work,cwd, 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 = [] @@ -1509,7 +1517,8 @@ def build_source(act, control_override): ]]) 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') @@ -1620,7 +1629,8 @@ def build_source(act, control_override): 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) -- 2.30.2