The main process of DTS. Runs all build targets in all executions from the main config file.
()
| 23 | |
| 24 | |
| 25 | def run_all() -> None: |
| 26 | """ |
| 27 | The main process of DTS. Runs all build targets in all executions from the main |
| 28 | config file. |
| 29 | """ |
| 30 | global dts_logger |
| 31 | global result |
| 32 | |
| 33 | # check the python version of the server that run dts |
| 34 | check_dts_python_version() |
| 35 | |
| 36 | sut_nodes: dict[str, SutNode] = {} |
| 37 | tg_nodes: dict[str, TGNode] = {} |
| 38 | try: |
| 39 | # for all Execution sections |
| 40 | for execution in CONFIGURATION.executions: |
| 41 | sut_node = sut_nodes.get(execution.system_under_test_node.name) |
| 42 | tg_node = tg_nodes.get(execution.traffic_generator_node.name) |
| 43 | |
| 44 | try: |
| 45 | if not sut_node: |
| 46 | sut_node = SutNode(execution.system_under_test_node) |
| 47 | sut_nodes[sut_node.name] = sut_node |
| 48 | if not tg_node: |
| 49 | tg_node = TGNode(execution.traffic_generator_node) |
| 50 | tg_nodes[tg_node.name] = tg_node |
| 51 | result.update_setup(Result.PASS) |
| 52 | except Exception as e: |
| 53 | failed_node = execution.system_under_test_node.name |
| 54 | if sut_node: |
| 55 | failed_node = execution.traffic_generator_node.name |
| 56 | dts_logger.exception(f"Creation of node {failed_node} failed.") |
| 57 | result.update_setup(Result.FAIL, e) |
| 58 | |
| 59 | else: |
| 60 | _run_execution(sut_node, tg_node, execution, result) |
| 61 | |
| 62 | except Exception as e: |
| 63 | dts_logger.exception("An unexpected error has occurred.") |
| 64 | result.add_error(e) |
| 65 | raise |
| 66 | |
| 67 | finally: |
| 68 | try: |
| 69 | for node in (sut_nodes | tg_nodes).values(): |
| 70 | node.close() |
| 71 | result.update_teardown(Result.PASS) |
| 72 | except Exception as e: |
| 73 | dts_logger.exception("Final cleanup of nodes failed.") |
| 74 | result.update_teardown(Result.ERROR, e) |
| 75 | |
| 76 | # we need to put the sys.exit call outside the finally clause to make sure |
| 77 | # that unexpected exceptions will propagate |
| 78 | # in that case, the error that should be reported is the uncaught exception as |
| 79 | # that is a severe error originating from the framework |
| 80 | # at that point, we'll only have partial results which could be impacted by the |
| 81 | # error causing the uncaught exception, making them uninterpretable |
| 82 | _exit_dts() |
nothing calls this directly
no test coverage detected