From 430816123d02dd2e9a55448c4bb566008bdd5910 Mon Sep 17 00:00:00 2001 From: Ian Jackson Date: Sun, 14 Aug 2011 21:20:56 +0100 Subject: [PATCH] Bugfix: Do not duplicate previous stanzas (closes: #637333). Thanks to report from Timo Lindfors --- debian/changelog | 1 + runner/adt-run | 13 ++++++++----- 2 files changed, 9 insertions(+), 5 deletions(-) diff --git a/debian/changelog b/debian/changelog index c2b790c..3e750db 100644 --- a/debian/changelog +++ b/debian/changelog @@ -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). -- diff --git a/runner/adt-run b/runner/adt-run index 115bc1a..c43ebb7 100755 --- a/runner/adt-run +++ b/runner/adt-run @@ -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] -- 2.30.2