minor fixes to --live-test

This commit is contained in:
Bernardo Damele 2013-01-30 10:32:56 +00:00
parent e8bd3c9c9f
commit 8519717f25
2 changed files with 7 additions and 7 deletions

View File

@ -135,7 +135,7 @@ def liveTest():
vars_[child.tagName] = randomStr(6) if var == "random" else var vars_[child.tagName] = randomStr(6) if var == "random" else var
for case in livetests.getElementsByTagName("case"): for case in livetests.getElementsByTagName("case"):
console_output = False parse_from_console_output = False
count += 1 count += 1
name = None name = None
parse = [] parse = []
@ -162,9 +162,9 @@ def liveTest():
value = replaceVars(item.getAttribute("value"), vars_) value = replaceVars(item.getAttribute("value"), vars_)
if item.hasAttribute("console_output"): if item.hasAttribute("console_output"):
console_output = bool(item.getAttribute("console_output")) parse_from_console_output = bool(item.getAttribute("console_output"))
parse.append((value, console_output)) parse.append((value, parse_from_console_output))
msg = "running live test case: %s (%d/%d)" % (name, count, length) msg = "running live test case: %s (%d/%d)" % (name, count, length)
logger.info(msg) logger.info(msg)
@ -292,8 +292,8 @@ def runCase(switches=None, parse=None):
with codecs.open(conf.dumper.getOutputFile(), "rb", UNICODE_ENCODING) as f: with codecs.open(conf.dumper.getOutputFile(), "rb", UNICODE_ENCODING) as f:
content = f.read() content = f.read()
for item, console_output in parse: for item, parse_from_console_output in parse:
parse_on = console if console_output else content parse_on = console if parse_from_console_output else content
if item.startswith("r'") and item.endswith("'"): if item.startswith("r'") and item.endswith("'"):
if not re.search(item[2:-1], parse_on, re.DOTALL): if not re.search(item[2:-1], parse_on, re.DOTALL):

View File

@ -3110,7 +3110,7 @@
<answers value="do you want to overwrite it=Y"/> <answers value="do you want to overwrite it=Y"/>
</switches> </switches>
<parse> <parse>
<item value="the local file /etc/passwd and the remote file /tmp/passwd-${random} have the same size" console_output="True"/> <item value="the local file /etc/passwd and the remote file /tmp/passwd-${random} has the same size" console_output="True"/>
</parse> </parse>
</case> </case>
<!-- End of file system access switches --> <!-- End of file system access switches -->
@ -3399,7 +3399,7 @@
</switches> </switches>
<parse> <parse>
<item value="banner: '5.1.66-0+squeeze1'"/> <item value="banner: '5.1.66-0+squeeze1'"/>
<item value="r'100% \[===.+=\] 17/17 ETA 00:00'" console_output="True"/> <item value="r'100\% \[===.+=\] 17\/17'" console_output="True"/>
</parse> </parse>
</case> </case>
<case name="Multiple parameters"> <case name="Multiple parameters">