chiark / gitweb /
Bugfix: Do not duplicate previous stanzas (closes: #637333).
authorIan Jackson <ijackson@chiark.greenend.org.uk>
Sun, 14 Aug 2011 20:20:56 +0000 (21:20 +0100)
committerIan Jackson <ijackson@chiark.greenend.org.uk>
Sun, 14 Aug 2011 20:20:56 +0000 (21:20 +0100)
Thanks to report from Timo Lindfors

debian/changelog
runner/adt-run

index c2b790c221d157eeb758f954ff8a547dc2526ae2..3e750db28d3a4324050fa51430085deed1dbf70f 100644 (file)
@@ -3,6 +3,7 @@ autopkgtest (2.0.1) unstable; urgency=medium
   * Bugfixes:
     - Python backtrace (no method "bomb") on bad tests/control syntax.
     - Permit tests/control fields with medial capital letters.
+    - Do not duplicate previous stanzas (closes: #637333).
 
  --
 
index 115bc1a1293d571a059d432725843c732bd4eba0..c43ebb75a61458463333a1599797a6bd0336f718 100755 (executable)
@@ -1205,15 +1205,18 @@ def read_control(act, tree, control_override):
 
        lno = 0
        def badctrl(m): testbed.bomb('tests/control line %d: %s' % (lno, m))
-       stz = None      # stz[field_name][index] = (lno, value)
+       stz = { }       # stz[field_name][index] = (lno, value)
                        # special field names:
                        # stz[' lno'] = number
                        # stz[' tests'] = list of Test objects
+                       # empty dictionary means we're between stanzas
+       def in_stanza(stz):
+               return stz.has_key(' lno')
        def end_stanza(stz):
-               if stz is None: return
+               if not in_stanza(stz): return
                stz[' errs'] = 0
-               stanzas.append(stz)
-               stz = None
+               stanzas.append(stz.copy())
+               stz.clear()
                hcurrent = None
 
        initre = regexp.compile('([A-Z][-0-9a-zA-Z]*)\s*\:\s*(.*)$')
@@ -1228,7 +1231,7 @@ def read_control(act, tree, control_override):
                if initmat:
                        (fname, l) = initmat.groups()
                        fname = string.capwords(fname)
-                       if stz is None:
+                       if not in_stanza(stz):
                                stz = { ' lno': lno, ' tests': [] }
                        if not stz.has_key(fname): stz[fname] = [ ]
                        hcurrent = stz[fname]