Message ID | e9c95b309190c10502e17917db915cb55cb61a81.1248102188.git.mgoldish@redhat.com (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
On Mon, Jul 20, 2009 at 12:07 PM, Michael Goldish<mgoldish@redhat.com> wrote: > Allow kvm_config to parse weird lines that seem to contain several operators, > such as: > time_filter_re = "(?<=TIME: ...)" > > The '?<=' is recognized as the operator instead of the '='. > To fix this, select the operator closest to the beginning of the line. Applied. > Signed-off-by: Michael Goldish <mgoldish@redhat.com> > --- > Â client/tests/kvm/kvm_config.py | Â Â 6 ++++-- > Â 1 files changed, 4 insertions(+), 2 deletions(-) > > diff --git a/client/tests/kvm/kvm_config.py b/client/tests/kvm/kvm_config.py > index 95eefcb..99ccb2a 100755 > --- a/client/tests/kvm/kvm_config.py > +++ b/client/tests/kvm/kvm_config.py > @@ -294,10 +294,12 @@ class config: > Â Â Â Â Â Â # Look for a known operator in the line > Â Â Â Â Â Â operators = ["?+=", "?<=", "?=", "+=", "<=", "="] > Â Â Â Â Â Â op_found = None > + Â Â Â Â Â Â op_pos = len(line) > Â Â Â Â Â Â for op in operators: > - Â Â Â Â Â Â Â Â if op in line: > + Â Â Â Â Â Â Â Â pos = line.find(op) > + Â Â Â Â Â Â Â Â if pos >= 0 and pos < op_pos: > Â Â Â Â Â Â Â Â Â Â op_found = op > - Â Â Â Â Â Â Â Â Â Â break > + Â Â Â Â Â Â Â Â Â Â op_pos = pos > > Â Â Â Â Â Â # Found an operator? > Â Â Â Â Â Â if op_found: > -- > 1.5.4.1 > > _______________________________________________ > Autotest mailing list > Autotest@test.kernel.org > http://test.kernel.org/cgi-bin/mailman/listinfo/autotest >
diff --git a/client/tests/kvm/kvm_config.py b/client/tests/kvm/kvm_config.py index 95eefcb..99ccb2a 100755 --- a/client/tests/kvm/kvm_config.py +++ b/client/tests/kvm/kvm_config.py @@ -294,10 +294,12 @@ class config: # Look for a known operator in the line operators = ["?+=", "?<=", "?=", "+=", "<=", "="] op_found = None + op_pos = len(line) for op in operators: - if op in line: + pos = line.find(op) + if pos >= 0 and pos < op_pos: op_found = op - break + op_pos = pos # Found an operator? if op_found:
Allow kvm_config to parse weird lines that seem to contain several operators, such as: time_filter_re = "(?<=TIME: ...)" The '?<=' is recognized as the operator instead of the '='. To fix this, select the operator closest to the beginning of the line. Signed-off-by: Michael Goldish <mgoldish@redhat.com> --- client/tests/kvm/kvm_config.py | 6 ++++-- 1 files changed, 4 insertions(+), 2 deletions(-)