(self, directory, git_sha=None, local_changes=None,
info_level=TestInfo.INFO)
| 268 | assert False |
| 269 | |
| 270 | def write_test_results(self, directory, git_sha=None, local_changes=None, |
| 271 | info_level=TestInfo.INFO): |
| 272 | assert self._state is self._STATE.COMPLETE |
| 273 | |
| 274 | assert not os.path.exists(directory) |
| 275 | os.mkdir(directory) |
| 276 | |
| 277 | # Write out version of tools used for test |
| 278 | tools_file = directory + os.sep + 'requirements.txt' |
| 279 | with open(tools_file, "w") as file_handle: |
| 280 | command = ['pip', 'freeze'] |
| 281 | subprocess.check_call(command, stdin=subprocess.PIPE, |
| 282 | stdout=file_handle, |
| 283 | stderr=subprocess.STDOUT) |
| 284 | |
| 285 | # Write out each test result |
| 286 | for test_configuration in self._test_configuration_list: |
| 287 | test_info = test_configuration.test_info |
| 288 | file_path = directory + os.sep + test_info.name + '.txt' |
| 289 | with open(file_path, 'w') as file_handle: |
| 290 | file_handle.write("Test configuration: %s\n" % |
| 291 | test_configuration) |
| 292 | file_handle.write("Board: %s\n" % test_configuration.board) |
| 293 | file_handle.write("Application: %s\n" % |
| 294 | test_configuration.if_firmware) |
| 295 | file_handle.write("Bootloader: %s\n" % |
| 296 | test_configuration.bl_firmware) |
| 297 | file_handle.write("Target: %s\n" % test_configuration.target) |
| 298 | file_handle.write("\n") |
| 299 | test_info.print_msg(info_level, None, log_file=file_handle) |
| 300 | |
| 301 | # Write out summary |
| 302 | summary_file = directory + os.sep + 'summary.txt' |
| 303 | with open(summary_file, "w") as file_handle: |
| 304 | # Overall result |
| 305 | if self.all_tests_pass: |
| 306 | file_handle.write("All tests pass\n\n") |
| 307 | else: |
| 308 | file_handle.write("One or more tests have failed\n\n") |
| 309 | |
| 310 | if git_sha is not None and local_changes is not None: |
| 311 | file_handle.write("Git info for test:\n") |
| 312 | file_handle.write(" Git SHA: %s\n" % git_sha) |
| 313 | file_handle.write(" Local changes: %s\n" % local_changes) |
| 314 | file_handle.write("\n") |
| 315 | |
| 316 | # Results for each test |
| 317 | file_handle.write("Test settings:\n") |
| 318 | file_handle.write(" Load application before test: %s\n" % |
| 319 | self._load_if) |
| 320 | file_handle.write(" Load bootloader before test: %s\n" % |
| 321 | self._load_bl) |
| 322 | file_handle.write(" Run DAPLink specific tests: %s\n" % |
| 323 | self._test_daplink) |
| 324 | file_handle.write(" Run endpoint tests: %s\n" % |
| 325 | self._test_ep) |
| 326 | file_handle.write("\n") |
| 327 |
no test coverage detected