-
Srikanth B R authored
Issue: ------ There are bugs/weaknesses in the search functions used in MTR tests: - include/search_pattern_in_file.inc: This function reads 50000 bytes per chunk and searches for a pattern in the chunk. However, this is bound to fail if the pattern crosses the border between two chunks and can cause sporadic failures. - include/search_pattern.inc: It reads the whole file into a list in memory and then processes lines one by one. It would be efficient if a single line is read at a time instead of the entire file. Also, matching lines which had a pair of single quotes are being ignored when the file is sourced multiple times due to improper cleanup. Fix: ---- Search functions have been consolidated into two inc files: - include/search_pattern.inc: It should be used for searching patterns which occur within a single line. It loads one line from the file at a time and searches the specified pattern in it. A buffer having the specified number of lines prior to the matching line and a file lookup for those after it are used to get context lines. - include/search_pattern_multiline.inc: It reads the whole file into memory and should be used to match patterns which might be spread across multiple lines. Usage of search functions in test scripts was reviewed and they have been modified to use search_pattern.inc for all single-line searches. Reviewed-by:
Pavan Naik <pavan.naik@oracle.com> Deepa Dixit <deepa.dixit@oracle.com> RB: 16811
Srikanth B R authoredIssue: ------ There are bugs/weaknesses in the search functions used in MTR tests: - include/search_pattern_in_file.inc: This function reads 50000 bytes per chunk and searches for a pattern in the chunk. However, this is bound to fail if the pattern crosses the border between two chunks and can cause sporadic failures. - include/search_pattern.inc: It reads the whole file into a list in memory and then processes lines one by one. It would be efficient if a single line is read at a time instead of the entire file. Also, matching lines which had a pair of single quotes are being ignored when the file is sourced multiple times due to improper cleanup. Fix: ---- Search functions have been consolidated into two inc files: - include/search_pattern.inc: It should be used for searching patterns which occur within a single line. It loads one line from the file at a time and searches the specified pattern in it. A buffer having the specified number of lines prior to the matching line and a file lookup for those after it are used to get context lines. - include/search_pattern_multiline.inc: It reads the whole file into memory and should be used to match patterns which might be spread across multiple lines. Usage of search functions in test scripts was reviewed and they have been modified to use search_pattern.inc for all single-line searches. Reviewed-by:
Pavan Naik <pavan.naik@oracle.com> Deepa Dixit <deepa.dixit@oracle.com> RB: 16811
Loading