oqp.utils.oqp_tester

OpenQP Test Runner

This module provides a class for running OpenQP tests
in parallel and generating reports.
It is compatible with CI pipelines.

Author: Konstantin Komarov
Email: constlike@gmail.com
Created: Aug 2024

Classes

OQPTester

Module Contents

class OQPTester(base_test_dir: str = None, output_dir: str = None, total_cpus: int = None, omp_threads: int = None, mpi_manager=None)
A class for running OQP tests and generating reports.

This class can run tests from specified directories:
  - 'openqp --run-tests path_to_folder': Run tests from a specific folder
  - 'openqp --run-tests other': Run tests from the 'other' folder in examples
  - 'openqp --run-tests all': Run the standard suite across examples,
    with documented slow/non-self-contained exclusions
  - '--input-format auto|inp|oqp|both': Select the input syntax to test
Can be used to run all tests in a specific folder.

.. attribute:: base_test_dir

   Base directory for test files.

   :type: str

.. attribute:: output_dir

   Directory for storing test output files.

   :type: str

.. attribute:: max_workers

   Maximum number of parallel workers.

   :type: int

.. attribute:: results

   List to store test results.

   :type: List[Dict[str, Any]]
base_test_dir = None
mpi_manager = None
output_dir = b'.'
total_cpus
omp_threads
max_workers = 1
results: List[Dict[str, Any]] = []
report_file
start_time = None
end_time = None
status = 0
input_format = 'auto'
calculate_max_workers()
log(message: str)
Simple logging function to stdout.
get_git_commit_info()
get_git_branch_info()
run_single_test(input_file: str) Dict[str, Any]
Run a single OpenQP test.

:param input_file: Path to the input file.
:type input_file: str

:returns: Dictionary containing test results.
:rtype: Dict[str, Any]
run_tests(test_path: str = 'all', *, input_format: str = 'auto')
Run OpenQP tests based on the specified test path.

:param test_path: Path to test directory or specific input file.
                  Use 'all' to run all tests in the base directory.
:type test_path: str
:param input_format: ``auto`` (default), ``inp``, ``oqp``, or
                     ``both``.
:type input_format: str
format_time(seconds: float) str
generate_report() str
run(test_path: str = 'all', *, input_format: str = 'auto') str
Run tests and generate a report.

:param test_path: Path to test directory or specific input file.
                  Use 'all' to run all tests in the base directory.
:type test_path: str
:param input_format: ``auto`` (default), ``inp``, ``oqp``, or
                     ``both``.
:type input_format: str

:returns: A formatted string containing the test report.
:rtype: str