diff --git a/parser.py b/parser.py index 4282c4efc5a5c632461c7fe31ac08be0a68f413e..45e7c4afb98929b6190fe7ba6131cd8b0368866e 100755 --- a/parser.py +++ b/parser.py @@ -170,10 +170,14 @@ def ekl_parser(file): 'descr': split_line[11], 'device path': '|'.join(split_line[13:]), } - - # FIXME:? EKL file has an inconsistent line structure, - # sometime we see a line that consits ' dump of GOP->I\n' - # easiest way to skip is check for blank space in the first char + # Sometimes the EKL has a '\n ' in the log string, so if we see that, + # we need to append the line to the previous log entry. + elif split_line[0] != '' and split_line[0][0] == " " and n >= 1: + temp_list[n-1]['log'] = temp_list[n-1]['log'] + line + # Sometimes the EKL has a '\n/' in the log string, so if we see that, + # we need to append the line to the previous log entry. + elif split_line[0] != '' and split_line[0][0] == "/" and n >= 1: + temp_list[n-1]['log'] = temp_list[n-1]['log'] + line elif split_line[0] != '' and split_line[0][0] != " ": try: # deliminiate on ':' for tests @@ -274,6 +278,8 @@ def dict_2_md(input_list, file): test_string = "|" for y in k: v = x[y] if y in x else '' + # Escape any | in the string for proper markup table formatting + v = v.replace("|", r"\|") test_string += v + "|" file.write(test_string + '\n') # seprate table from other items in MD @@ -806,7 +812,24 @@ def gen_md(md, res_keys, bins, meta): resultfile.write( "|{}:|{}|\n".format(k.title(), len(bins[k]))) - resultfile.write("\n\n") + resultfile.write("\n") + resultfile.write("- Dropped: " + "The test is in the .seq file, " + "but there is no test sub-set or " + "results in the .ekl.\n") + resultfile.write("- Failure: " + "The test has a failed result in the .ekl.\n") + resultfile.write("- Ignored: " + "The test result is ignored by the .yaml rules.\n") + resultfile.write("- Pass: " + "The test has a passed result in the .ekl. " + "(Not printed in this results.md)\n") + resultfile.write("- Skipped: " + "The test sub-set is present in the .ekl, " + "but no test results are in the .ekl.\n") + resultfile.write("- Warning: " + "The test has a warning result in the .ekl.\n") + resultfile.write("\n---\n\n") # Loop on all the result values we found (except PASS) for the sections # listing the tests by group diff --git a/sample/sample.ekl b/sample/sample.ekl index 8679b6f2493a36ff3bdb59e345975a9a7094a10b..e3dd276d77f5e12e17ce8b8ec7918898df330148 100644 Binary files a/sample/sample.ekl and b/sample/sample.ekl differ diff --git a/tests/test-parser b/tests/test-parser index ca8005f00e7243134577fa148da78bdc78ad1f06..273e822cf4d84095e4c0ecfdce182464b6cc7618 100755 --- a/tests/test-parser +++ b/tests/test-parser @@ -34,8 +34,11 @@ args=(--config sample/sample.yaml sample/sample.ekl sample/sample.seq) parser.py "${args[@]}" |& tee "$out" grep -q 'Identified.* as "Test sample' "$out" grep -q 'Updated 1 test.* after applying 1 rule' "$out" +if grep -q 'ERROR' "$out"; then false; fi grep -q 'Meta-data' result.md +if grep -q 'Pci(0|0)' result.md; then false; fi + echo -n 'null config, ' >&3 parser.py "${args[@]}" --config /dev/null |& tee "$out"