(unused_args)
| 65 | |
| 66 | |
| 67 | def main(unused_args): |
| 68 | name = FLAGS.name |
| 69 | test_name = FLAGS.test_name |
| 70 | test_args = FLAGS.test_args |
| 71 | benchmark_type = FLAGS.benchmark_type |
| 72 | test_results, _ = run_and_gather_logs_lib.run_and_gather_logs( |
| 73 | name, test_name=test_name, test_args=test_args, |
| 74 | benchmark_type=benchmark_type) |
| 75 | |
| 76 | # Additional bits we receive from bazel |
| 77 | test_results.build_configuration.CopyFrom(gather_build_configuration()) |
| 78 | |
| 79 | if not FLAGS.test_log_output_dir: |
| 80 | print(text_format.MessageToString(test_results)) |
| 81 | return |
| 82 | |
| 83 | if FLAGS.test_log_output_filename: |
| 84 | file_name = FLAGS.test_log_output_filename |
| 85 | else: |
| 86 | file_name = (name.strip("/").translate(maketrans("/:", "__")) + |
| 87 | time.strftime("%Y%m%d%H%M%S", time.gmtime())) |
| 88 | if FLAGS.test_log_output_use_tmpdir: |
| 89 | tmpdir = test.get_temp_dir() |
| 90 | output_path = os.path.join(tmpdir, FLAGS.test_log_output_dir, file_name) |
| 91 | else: |
| 92 | output_path = os.path.join( |
| 93 | os.path.abspath(FLAGS.test_log_output_dir), file_name) |
| 94 | json_test_results = json_format.MessageToJson(test_results) |
| 95 | gfile.GFile(output_path + ".json", "w").write(json_test_results) |
| 96 | tf_logging.info("Test results written to: %s" % output_path) |
| 97 | |
| 98 | |
| 99 | if __name__ == "__main__": |
nothing calls this directly
no test coverage detected