Package: autopkgtest
Version: 2.11
Severity: normal
Tags: patch

When debugging test suites that go crazy on ci.debian.net, while we
still use schroot, it would be useful to identify which schroot sessions
are left open. The attached patch adds an option that one can use to
specify a name to the schroot session created by adt-virt-schroot.


-- System Information:
Debian Release: jessie/sid
  APT prefers unstable
  APT policy: (500, 'unstable'), (500, 'testing'), (1, 'experimental')
Architecture: amd64 (x86_64)

Kernel: Linux 3.13-1-amd64 (SMP w/4 CPU cores)
Locale: LANG=pt_BR.UTF-8, LC_CTYPE=pt_BR.UTF-8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/dash

Versions of packages autopkgtest depends on:
ii  apt-utils      0.9.16.1
ii  debhelper      9.20140228
ii  pbuilder       0.215
ii  python         2.7.5-5
ii  python-debian  0.1.21+nmu2

autopkgtest recommends no packages.

Versions of packages autopkgtest suggests:
pn  autopkgtest-xenlvm  <none>
ii  lxc                 1.0.0-2
pn  qemu-system         <none>
ii  qemu-utils          1.7.0+dfsg-5
ii  schroot             1.6.8-1

-- no debconf information

-- 
Antonio Terceiro <terce...@debian.org>
From 7e352853243b98668dcd73df31d6998b7de269d8 Mon Sep 17 00:00:00 2001
From: Antonio Terceiro <terce...@debian.org>
Date: Sat, 29 Mar 2014 11:58:22 -0300
Subject: [PATCH] Add new option -s/--session-id to adt-virt-schroot

---
 debian/changelog              | 8 ++++++++
 virt-subproc/adt-virt-schroot | 7 +++++--
 2 files changed, 13 insertions(+), 2 deletions(-)

diff --git a/debian/changelog b/debian/changelog
index c58df01..2566411 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -1,5 +1,6 @@
 autopkgtest (2.12) UNRELEASED; urgency=medium
 
+  [ Martin Pitt ]
   New features:
   * Add new options -s/--shell-fail for running a shell in the testbed after
     every failed test, and --shell for running a shell in the testbed after
@@ -16,6 +17,13 @@ autopkgtest (2.12) UNRELEASED; urgency=medium
     backports to old releases, and running them before releasing a new package
     is sufficient.
 
+  [ Antonio Terceiro ]
+  New features:
+  * Add new option -s/--session-id to adt-virt-schroot, allowing the user to
+    specifiy a custom schroot session id. This is useful for debugging test
+    suites that go crazy on ci.debian.net, so you can `schroot --list
+    --all-sessions` and see which sessions are still open.
+
  -- Martin Pitt <mp...@debian.org>  Mon, 24 Mar 2014 08:20:28 +0100
 
 autopkgtest (2.11) unstable; urgency=medium
diff --git a/virt-subproc/adt-virt-schroot b/virt-subproc/adt-virt-schroot
index 62c6ac3..918f4d6 100755
--- a/virt-subproc/adt-virt-schroot
+++ b/virt-subproc/adt-virt-schroot
@@ -66,17 +66,19 @@ def match(exp_names, ids, extract_id):
 
 
 def parse_args():
-    global schroot
+    global schroot, sessid
 
     usage = "%prog [<options>] <schroot>"
     parser = OptionParser(usage=usage)
 
     parser.add_option('-d', '--debug', action='store_true')
+    parser.add_option('-s', '--session-id')
 
     (opts, args) = parser.parse_args()
     if len(args) != 1:
         parser.error("need exactly one arg, schroot name")
 
+    sessid = opts.session_id
     schroot = args[0]
 
     info = VirtSubproc.execute('schroot --config -c', [schroot],
@@ -111,7 +113,8 @@ def parse_args():
 def hook_open():
     global schroot, sessid
     sessid = VirtSubproc.execute(
-        'schroot -b -c', [schroot], downp=False, outp=True)
+        'schroot -b -c', [schroot] + (sessid and ['-n', sessid] or []),
+        downp=False, outp=True)
     VirtSubproc.down = ['schroot', '-r', '-d', '/', '-c', sessid]
     if 'root-on-testbed' in capabilities:
         VirtSubproc.down += ['-u', 'root']
-- 
1.9.1

Attachment: signature.asc
Description: Digital signature

Reply via email to