Commit 5c89ff4b authored by Vincent Stehlé's avatar Vincent Stehlé
Browse files

Parser.py: add an option to dump a yaml



Now that we are using yaml to load configurations, we might as well dump
our test data in yaml, too. This helps writing the configuration rules.
Signed-off-by: Vincent Stehlé's avatarVincent Stehlé <vincent.stehle@arm.com>
parent 9ae846ea
......@@ -337,6 +337,15 @@ def gen_json(cross_check, filename):
json.dump(cross_check, jsonfile, sort_keys=True, indent=2)
# Generate yaml
def gen_yaml(cross_check, filename):
assert('yaml' in sys.modules)
logging.debug(f'Generate {filename}')
with open(filename, 'w') as yamlfile:
yaml.dump(cross_check, yamlfile)
# Combine or two databases db1 and db2 coming from ekl and seq files
# respectively into a single cross_check database
# Tests in db1, which were not meant to be run according to db2 have their
......@@ -439,6 +448,7 @@ def main():
if 'yaml' in sys.modules:
parser.add_argument(
'--config', help='Input .yaml configuration filename')
parser.add_argument('--yaml', help='Output .yaml filename')
args = parser.parse_args()
......@@ -531,6 +541,10 @@ def main():
if args.json is not None:
gen_json(cross_check, args.json)
# Generate yaml if requested
if 'yaml' in args and args.yaml is not None:
gen_yaml(cross_check, args.yaml)
#command line argument 3&4, key are to support a key & value search.
#these will be displayed in CLI
if args.find_key is not None and args.find_value is not None:
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment