-
Notifications
You must be signed in to change notification settings - Fork 390
Add support for a prerequisite tag in COMPASS #559
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -147,7 +147,7 @@ def process_test_setup(test_tag, config_file, work_dir, model_runtime, | |
| # }}} | ||
|
|
||
|
|
||
| def process_test_clean(test_tag, work_dir, suite_script): # {{{ | ||
| def process_test_clean(test_tag, work_dir): # {{{ | ||
| dev_null = open('/dev/null', 'a') | ||
|
|
||
| # Process test attributes | ||
|
|
@@ -304,15 +304,13 @@ def clean_suite(suite_tag, work_dir): # {{{ | |
| for child in suite_tag: | ||
| # Process <test> children within the <regression_suite> | ||
| if child.tag == 'test': | ||
| process_test_clean(child, work_dir, regression_script) | ||
| process_test_clean(child, work_dir) | ||
| # }}} | ||
|
|
||
|
|
||
| def summarize_suite(suite_tag): # {{{ | ||
| def get_test_case_procs(suite_tag): # {{{ | ||
|
|
||
| max_procs = 1 | ||
| max_threads = 1 | ||
| max_cores = 1 | ||
| testcases = {} | ||
|
|
||
| for child in suite_tag: | ||
| if child.tag == 'test': | ||
|
|
@@ -367,9 +365,36 @@ def summarize_suite(suite_tag): # {{{ | |
| name = case.attrib['name'] | ||
| cases.append(name) | ||
|
|
||
| prereqs = list() | ||
| for config_prereq in config_root.iter('prerequisite'): | ||
| prereq = dict() | ||
| for tag in ['core', 'configuration', 'resolution', 'test']: | ||
| prereq[tag] = config_prereq.attrib[tag] | ||
|
|
||
| # Make sure the prerequisite is already in the test suite | ||
| found = False | ||
| for other_name, other_test in testcases.items(): | ||
| match = [prereq[tag] == other_test[tag] for tag in | ||
| ['core', 'configuration', 'resolution', 'test']] | ||
| if all(match): | ||
| found = True | ||
| prereq['name'] = other_name | ||
| break | ||
|
|
||
| if not found: | ||
| raise ValueError( | ||
| 'Prerequisite of {} does not precede it in the test ' | ||
| 'suite: {} {} {} {}'.format( | ||
| test_name, prereq['core'], prereq['configuration'], | ||
| prereq['resolution'], prereq['test'])) | ||
|
|
||
| prereqs.append(prereq) | ||
|
|
||
| del config_root | ||
| del config_tree | ||
|
|
||
| procs = 1 | ||
| threads = 1 | ||
| # Loop over all files in test_path that have the .xml extension. | ||
| for file in os.listdir('{}'.format(test_path)): | ||
| if fnmatch.fnmatch(file, '*.xml'): | ||
|
|
@@ -395,19 +420,33 @@ def summarize_suite(suite_tag): # {{{ | |
| except (KeyError, ValueError): | ||
| threads = 1 | ||
|
|
||
| cores = threads * procs | ||
| del config_root | ||
| del config_tree | ||
| testcases[test_name] = {'core': test_core, | ||
| 'configuration': test_configuration, | ||
| 'resolution': test_resolution, | ||
| 'test': test_test, | ||
| 'path': test_path, | ||
| 'procs': procs, | ||
| 'threads': threads, | ||
| 'prereqs': prereqs} | ||
|
|
||
| if procs > max_procs: | ||
| max_procs = procs | ||
| return testcases # }}} | ||
|
|
||
| if threads > max_threads: | ||
| max_threads = threads | ||
|
|
||
| if cores > max_cores: | ||
| max_cores = cores | ||
| def summarize_suite(testcases): # {{{ | ||
|
|
||
| del config_root | ||
| del config_tree | ||
| max_procs = 1 | ||
| max_threads = 1 | ||
| max_cores = 1 | ||
| for name in testcases: | ||
| procs = testcases[name]['procs'] | ||
| threads = testcases[name]['threads'] | ||
| cores = threads * procs | ||
|
|
||
| max_procs = max(max_procs, procs) | ||
| max_threads = max(max_threads, threads) | ||
| max_cores = max(max_cores, cores) | ||
|
|
||
| print("\n") | ||
| print(" Summary of test cases:") | ||
|
|
@@ -417,7 +456,7 @@ def summarize_suite(suite_tag): # {{{ | |
| # }}} | ||
|
|
||
|
|
||
| if __name__ == "__main__": | ||
| def main (): # {{{ | ||
|
Comment on lines
-420
to
+459
Collaborator
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Making |
||
| # Define and process input arguments | ||
| parser = argparse.ArgumentParser( | ||
| description=__doc__, formatter_class=argparse.RawTextHelpFormatter) | ||
|
|
@@ -495,14 +534,15 @@ def summarize_suite(suite_tag): # {{{ | |
| if args.setup: | ||
| print("\n") | ||
| print("Setting Up Test Cases:") | ||
| testcases = get_test_case_procs(suite_root) | ||
| setup_suite(suite_root, args.work_dir, args.model_runtime, | ||
| args.config_file, args.baseline_dir, args.verbose) | ||
| summarize_suite(suite_root) | ||
| summarize_suite(testcases) | ||
|
Comment on lines
+537
to
+540
Collaborator
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The changes require doing the parsing that was previously in |
||
| if args.verbose: | ||
| cmd = ['cat', | ||
| args.work_dir + '/manage_regression_suite.py.out'] | ||
| print('\nCase setup output:') | ||
| print(subprocess.check_output(cmd)) | ||
| print(subprocess.check_output(cmd).decode('utf-8')) | ||
|
Collaborator
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This looks like garbage in python 3 without the decode |
||
| write_history = True | ||
|
|
||
| # Write the history of this command to the command_history file, for | ||
|
|
@@ -533,5 +573,10 @@ def summarize_suite(suite_tag): # {{{ | |
| history_file.write('**************************************************' | ||
| '*********************\n') | ||
| history_file.close() | ||
| # }}} | ||
|
|
||
|
|
||
| if __name__ == "__main__": | ||
| main() | ||
|
|
||
| # vim: foldmethod=marker ai ts=4 sts=4 et sw=4 ft=python | ||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is just clean-up of an unused argument