def main(unused_args): name = FLAGS.name test_name = FLAGS.test_name test_args = FLAGS.test_args benchmark_type = FLAGS.benchmark_type test_results, _ = run_and_gather_logs_lib.run_and_gather_logs( name, test_name=test_name, test_args=test_args, benchmark_type=benchmark_type) # Additional bits we receive from bazel test_results.build_configuration.CopyFrom(gather_build_configuration()) if not FLAGS.test_log_output_dir: print(text_format.MessageToString(test_results)) return if FLAGS.test_log_output_filename: file_name = FLAGS.test_log_output_filename else: file_name = (name.strip("/").translate(maketrans("/:", "__")) + time.strftime("%Y%m%d%H%M%S", time.gmtime())) if FLAGS.test_log_output_use_tmpdir: tmpdir = test.get_temp_dir() output_path = os.path.join(tmpdir, FLAGS.test_log_output_dir, file_name) else: output_path = os.path.join(os.path.abspath(FLAGS.test_log_output_dir), file_name) json_test_results = json_format.MessageToJson(test_results) gfile.GFile(output_path + ".json", "w").write(json_test_results) tf_logging.info("Test results written to: %s" % output_path)
def main(unused_args): name = FLAGS.name test_name = FLAGS.test_name test_args = FLAGS.test_args benchmark_type = FLAGS.benchmark_type test_results, _ = run_and_gather_logs_lib.run_and_gather_logs( name, test_name=test_name, test_args=test_args, benchmark_type=benchmark_type) # Additional bits we receive from bazel test_results.build_configuration.CopyFrom(gather_build_configuration()) if not FLAGS.test_log_output_dir: print(text_format.MessageToString(test_results)) return if FLAGS.test_log_output_filename: file_name = FLAGS.test_log_output_filename else: file_name = (name.strip("/").translate(maketrans("/:", "__")) + time.strftime("%Y%m%d%H%M%S", time.gmtime())) if FLAGS.test_log_output_use_tmpdir: tmpdir = test.get_temp_dir() output_path = os.path.join(tmpdir, FLAGS.test_log_output_dir, file_name) else: output_path = os.path.join( os.path.abspath(FLAGS.test_log_output_dir), file_name) json_test_results = json_format.MessageToJson(test_results) gfile.GFile(output_path + ".json", "w").write(json_test_results) tf_logging.info("Test results written to: %s" % output_path)
def main(unused_args): name = FLAGS.name test_name = FLAGS.test_name test_args = FLAGS.test_args test_results, _ = run_and_gather_logs_lib.run_and_gather_logs( name, test_name, test_args) # Additional bits we receive from bazel test_results.build_configuration.CopyFrom(gather_build_configuration()) serialized_test_results = text_format.MessageToString(test_results) if not FLAGS.test_log_output: print(serialized_test_results) return if FLAGS.test_log_output_use_tmpdir: tmpdir = test.get_temp_dir() output_path = os.path.join(tmpdir, FLAGS.test_log_output) else: output_path = os.path.abspath(FLAGS.test_log_output) gfile.GFile(output_path, "w").write(serialized_test_results) # Also write test results in JSON, used by the datastore uploader. json_test_results = json_format.MessageToJson(test_results) gfile.GFile(output_path + ".json", "w").write(json_test_results) tf_logging.info("Test results written to: %s" % output_path)
def main(unused_args): test_name = FLAGS.test_name test_args = FLAGS.test_args test_results, _ = run_and_gather_logs_lib.run_and_gather_logs( test_name, test_args) serialized_test_results = text_format.MessageToString(test_results) if not FLAGS.test_log_output: print(serialized_test_results) return if FLAGS.test_log_output_use_tmpdir: tmpdir = tf.test.get_temp_dir() output_path = os.path.join(tmpdir, FLAGS.test_log_output) else: output_path = os.path.abspath(FLAGS.test_log_output) tf.gfile.GFile(output_path, "w").write(serialized_test_results) print("Test results written to: %s" % output_path)
def main(unused_args): test_name = FLAGS.test_name test_args = FLAGS.test_args test_results, _ = run_and_gather_logs_lib.run_and_gather_logs( test_name, test_args) # Additional bits we receive from bazel test_results.build_configuration.CopyFrom(gather_build_configuration()) serialized_test_results = text_format.MessageToString(test_results) if not FLAGS.test_log_output: print(serialized_test_results) return if FLAGS.test_log_output_use_tmpdir: tmpdir = tf.test.get_temp_dir() output_path = os.path.join(tmpdir, FLAGS.test_log_output) else: output_path = os.path.abspath(FLAGS.test_log_output) tf.gfile.GFile(output_path, "w").write(serialized_test_results) tf.logging.info("Test results written to: %s" % output_path)