Hi Subrata,
Please accept the patch below.
Thanks,
Gowri
---
realtime: fix testpi2 parser from invalid index type error
The patch below fixes invalid array index returned by eval() function
in testpi2 parser.
While a typical testpi2 logfile, where text fragment "pthread pol 2 pri 10"
follows 'Noise Thread' line more than once, is given to testpi2 parser, it
exits with error below:
TypeError: list indices must be integers
The root cause for the error is TestPi2.eval() function that returns
TRUE if the text fragment follows 'Noise Thread' more than once in log
file, None object otherwise.
As an array index can not be evaluated from 'None' object this patch
adds 'else' clause in eval() to return False, instead of None.
Testing information:
This patch has been tested by me in following ways:
Consider truncated log file as below, so as to get count of 1 to
reproduce error scenario.
cat /tmp/rt-ipe-2.6.24-rt1-dvh01-2008-31-01-testpi-2.log
Noise Thread 18583(40) loop 7000 pthread pol 2 pri 40
Noise Thread 18583(40) loop 7100 pthread pol 2 pri 40
Thread 18579(10) loop 0 pthread pol 2 pri 10
Thread 18579(10) loop 100 pthread pol 2 pri 10
Noise Thread 18583(40) loop 7200 pthread pol 2 pri 40
Noise Thread 18583(40) loop 7300 pthread pol 2 pri 40
python parse-testpi2.py /tmp/rt-ipe-2.6.24-rt1-dvh01-2008-31-01-testpi-2.log
Result: FAIL
Change log:
Version 1:
- detached from old patch "ltp: fix unicode warning and array
index problems in pi-tests parsers" of version 2
Signed-off-by: Gowrishankar M <[email protected]>
Tested-by: Gowrishankar M <[email protected]>
Acked-by: Vernon Mauery <[email protected]>
---
Index: ltp-full-20081231/testcases/realtime/func/pi-tests/parse-testpi2.py
===================================================================
--- ltp-full-20081231.orig/testcases/realtime/func/pi-tests/parse-testpi2.py
2009-02-02 12:35:03.000000000 +0530
+++ ltp-full-20081231/testcases/realtime/func/pi-tests/parse-testpi2.py
2009-02-02 12:46:59.000000000 +0530
@@ -54,6 +54,8 @@
prev_line=line
if count>=2:
return True
+ else:
+ return False
def main():
if len(sys.argv) < 2:
------------------------------------------------------------------------------
Apps built with the Adobe(R) Flex(R) framework and Flex Builder(TM) are
powering Web 2.0 with engaging, cross-platform capabilities. Quickly and
easily build your RIAs with Flex Builder, the Eclipse(TM)based development
software that enables intelligent coding and step-through debugging.
Download the free 60 day trial. http://p.sf.net/sfu/www-adobe-com
_______________________________________________
Ltp-list mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/ltp-list