chiark / gitweb /
adt-virt-xenlvm wip
authorIan Jackson <ian@anarres>
Tue, 31 Oct 2006 15:06:53 +0000 (15:06 +0000)
committerIan Jackson <ian@anarres>
Tue, 31 Oct 2006 15:06:53 +0000 (15:06 +0000)
debian/changelog
virt-subproc/adt-virt-xenlvm

index d87f0c48c7f8d4f045e28d1236104a112388f28f..383ad3a5bf8afc8b0acff3ef9b62cebe7a1b3fc6 100644 (file)
@@ -6,7 +6,7 @@ autopkgtest (0.6.2~iwj) unstable; urgency=low
     the args and getting confused.
   * New adt-virt-xenlvm WIP
 
- --
+ -- Ian Jackson <ian@davenant.greenend.org.uk>  Tue, 31 Oct 2006 15:03:05 +0000
 
 autopkgtest (0.6.1) edgy; urgency=low
 
index abcbaab9fde298fd1c0831b3e2e01564886d3460..366bcbca6ec833560ba272f3dfd1215143aa34df 100755 (executable)
@@ -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 [<adt-xenlvm options>]"
+       for a in 
 
        fixme must check args fit --<var>=<value> 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()