Update utility which creates CSV file for metrics
Add support for two new parameters "test_phase" and "processor".
Resolves openbmc/openbmc-test-automation#1652
Change-Id: Ide0de01596f173ff9d9f69595d6ea537970b23c7
Signed-off-by: Steven Sombar <ssombar@us.ibm.com>
diff --git a/tools/ct_metrics/gen_csv_results.py b/tools/ct_metrics/gen_csv_results.py
index 801f4ff..8c10b2d 100755
--- a/tools/ct_metrics/gen_csv_results.py
+++ b/tools/ct_metrics/gen_csv_results.py
@@ -29,8 +29,16 @@
# Restore sys.path[0].
sys.path.insert(0, save_path_0)
+
+this_program = sys.argv[0]
+info = " For more information: " + this_program + ' -h'
+if len(sys.argv) == 1:
+ print (info)
+ sys.exit(1)
+
+
parser = argparse.ArgumentParser(
- usage='%(prog)s [OPTIONS]',
+ usage=info,
description="%(prog)s uses a robot framework API to extract test result\
data from output.xml generated by robot tests. For more information on the\
Robot Framework API, see\
@@ -41,27 +49,41 @@
parser.add_argument(
'--source',
'-s',
- help='The output.xml robot test result file path.')
+ help='The output.xml robot test result file path. This parameter is \
+ required.')
parser.add_argument(
'--dest',
'-d',
- help='The directory path where the generated .csv files will go.')
+ help='The directory path where the generated .csv files will go. This \
+ parameter is required.')
parser.add_argument(
'--version_id',
help='Driver version of openbmc firmware which was used during test,\
- e.g. "v2.1-215-g6e7eacb".')
+ e.g. "v2.1-215-g6e7eacb". This parameter is required.')
parser.add_argument(
'--platform',
help='OpenBMC platform which was used during test,\
- e.g. "Witherspoon".')
+ e.g. "Witherspoon". This parameter is required.')
parser.add_argument(
'--level',
help='OpenBMC release level which was used during test,\
- e.g. "Master".')
+ e.g. "Master", "OBMC920". This parameter is required.')
+
+parser.add_argument(
+ '--test_phase',
+ help='Name of testing phase, e.g. "DVT", "SVT", etc.\
+ This parameter is optional.',
+ default="FVT")
+
+parser.add_argument(
+ '--processor',
+ help='Name of processor, e.g. "P9". This parameter is optional.',
+ default="OPENPOWER")
+
# Populate stock_list with options we want.
stock_list = [("test_mode", 0), ("quiet", 0), ("debug", 0)]
@@ -116,7 +138,8 @@
return True
-def parse_output_xml(xml_file_path, csv_dir_path, version_id, platform, level):
+def parse_output_xml(xml_file_path, csv_dir_path, version_id, platform, level,
+ test_phase, processor):
r"""
Parse the robot-generated output.xml file and extract various test
output data. Put the extracted information into a csv file in the "dest"
@@ -165,14 +188,14 @@
# Default Test data
l_subsys = 'OPENBMC'
- l_test_type = 'FTC'
+ l_test_type = test_phase
l_pse_rel = 'Master'
if level:
l_pse_rel = level
l_env = 'HW'
- l_proc = 'P9'
+ l_proc = processor
l_platform_type = ""
l_func_area = ""
@@ -308,7 +331,8 @@
qprint_pgm_header()
- parse_output_xml(source, dest, version_id, platform, level)
+ parse_output_xml(source, dest, version_id, platform, level,
+ test_phase, processor)
return True