[libvirt] [test-API PATCH 2/2] parser: put the syntax checking to testcase line at end of flags checking

Guannan Ren gren at redhat.com
Fri Apr 13 07:56:59 UTC 2012


    we use the "re.match(".+:.+", tripped_casename)" only check testcase
    name line, such as domain:start, we don't want it to check flag.
    placing it just after flags checking is right place.
---
 parser.py |    5 +++--
 1 files changed, 3 insertions(+), 2 deletions(-)

diff --git a/parser.py b/parser.py
index 18f6ccd..e569d7f 100644
--- a/parser.py
+++ b/parser.py
@@ -327,8 +327,6 @@ class CaseFileParser(object):
 
                 tripped_caselist = casestring.strip().split()
                 tripped_casename = tripped_caselist[0]
-                if not re.match(".+:.+", tripped_casename):
-                    raise exception.CaseConfigfileError("casename line format error!")
 
                 if self.debug:
                     self.debug_print("we begin to handle the case",
@@ -416,6 +414,9 @@ class CaseFileParser(object):
                     list.append(option_case)
                     continue
 
+                if not re.match(".+:.+", tripped_casename):
+                    raise exception.CaseConfigfileError("%s line format error!" % tripped_casename)
+
                 for caselist in list:
                     newdict = {}
                     newdict[tripped_casename] = {}
-- 
1.7.7.5




More information about the libvir-list mailing list