From d247a2366e1b8a2d76ee644926bd96a9467ac7e0 Mon Sep 17 00:00:00 2001 From: Ian Jackson Date: Tue, 31 Oct 2006 15:06:53 +0000 Subject: [PATCH] adt-virt-xenlvm wip --- debian/changelog | 2 +- virt-subproc/adt-virt-xenlvm | 33 +++++++++++++++++++-------------- 2 files changed, 20 insertions(+), 15 deletions(-) diff --git a/debian/changelog b/debian/changelog index d87f0c4..383ad3a 100644 --- a/debian/changelog +++ b/debian/changelog @@ -6,7 +6,7 @@ autopkgtest (0.6.2~iwj) unstable; urgency=low the args and getting confused. * New adt-virt-xenlvm WIP - -- + -- Ian Jackson Tue, 31 Oct 2006 15:03:05 +0000 autopkgtest (0.6.1) edgy; urgency=low diff --git a/virt-subproc/adt-virt-xenlvm b/virt-subproc/adt-virt-xenlvm index abcbaab..366bcbc 100755 --- a/virt-subproc/adt-virt-xenlvm +++ b/virt-subproc/adt-virt-xenlvm @@ -33,10 +33,13 @@ import string from optparse import OptionParser import VirtSubproc as vsp +witholder = None + def parse_args(): global down, debuglevel, xlargs usage = "%prog []" + for a in fixme must check args fit --= as expected by adt-xenlvm fixme then put set of args into global xlargs @@ -45,33 +48,35 @@ def parse_args(): vsp.down = down def hook_open(): - global downtmp hook_cleanup() withholder = subprocess.Popen( ['adt-xenlvm-with-testbed'] + xlargs + ['--','sh','-ec','echo y; exec cat'], stdin=subprocess.PIPE, stdout=subprocess.PIPE ) - l = withholder.stdin.readline(2) + l = withholder.stdout.readline(2) rc = withholder.poll() if rc is not None: bomb("with-testbed failed, code %d" % rc) if l != "y\n": bomb("with-testbed sh gave wrong output `%s', not `l'" % l.rstrip("\n")) - - fixme make temp dir somewhere more predictable - vsp.execute('true', downp=True) - downtmp = vsp.execute('mktemp -t -d', downp=True, outp=True) + downtmp = '/root/adt-downtmp' + vsp.execute('mkdir %s' % downtmp, downp=True) return downtmp def hook_stop(): - fixme make this right - vsp.execute('rm -rf --', c[1:2]) - os.mkdir(c[1]) + withholder.stdin.close() + withholder.stdout.close() + rc = withholder.wait() + withholder = None + if rc: bomb("with-testbed failed at shutdown, code %d" % rc) def hook_cleanup(): - fixme make this right - vsp.execute('rm -rf --', [downtmp], downp=True) - -fixme other hooks, main program - + if withholder is not None: + withholder.stdin.close() + withholder.stdout.close() + rc = withholder.wait() + withholder = None + if rc: print >>sys.stderr, ( + "with-testbed failed during cleanup, code %d" % rc) + parse_args() vsp.main() -- 2.30.2