aboutsummaryrefslogtreecommitdiffhomepage
path: root/tensorflow/tools/test
diff options
context:
space:
mode:
authorGravatar A. Unique TensorFlower <gardener@tensorflow.org>2016-09-22 13:35:19 -0800
committerGravatar TensorFlower Gardener <gardener@tensorflow.org>2016-09-22 14:46:16 -0700
commit026d85d801363299af7300730fc94d5eff7feb38 (patch)
treea9c43cb406fbc288f9c8a652702fe4dc6aa5ca5e /tensorflow/tools/test
parentadc15a46c56070ef92b890b65b6de0147abeff80 (diff)
Pass benchmark name (path:target_name) to TestResults proto.
Change: 134000963
Diffstat (limited to 'tensorflow/tools/test')
-rw-r--r--tensorflow/tools/test/performance.bzl1
-rw-r--r--tensorflow/tools/test/run_and_gather_logs.py4
-rw-r--r--tensorflow/tools/test/run_and_gather_logs_lib.py11
3 files changed, 12 insertions, 4 deletions
diff --git a/tensorflow/tools/test/performance.bzl b/tensorflow/tools/test/performance.bzl
index 750d20fdca..83dace61e4 100644
--- a/tensorflow/tools/test/performance.bzl
+++ b/tensorflow/tools/test/performance.bzl
@@ -28,6 +28,7 @@ def tf_cc_logged_benchmark(
tags = all_tags,
srcs = ["//tensorflow/tools/test:run_and_gather_logs.py"],
args = [
+ "--name=//%s:%s" % (PACKAGE_NAME, name),
"--test_name=" + target
],
data = [
diff --git a/tensorflow/tools/test/run_and_gather_logs.py b/tensorflow/tools/test/run_and_gather_logs.py
index 42cdf68315..a72dac0abb 100644
--- a/tensorflow/tools/test/run_and_gather_logs.py
+++ b/tensorflow/tools/test/run_and_gather_logs.py
@@ -47,6 +47,7 @@ from tensorflow.tools.test import run_and_gather_logs_lib
FLAGS = tf.app.flags.FLAGS
+tf.app.flags.DEFINE_string("name", "", """Benchmark target identifier.""")
tf.app.flags.DEFINE_string("test_name", "", """Test target to run.""")
tf.app.flags.DEFINE_string(
"test_args", "", """Test arguments, space separated.""")
@@ -73,10 +74,11 @@ def gather_build_configuration():
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(
- test_name, test_args)
+ name, test_name, test_args)
# Additional bits we receive from bazel
test_results.build_configuration.CopyFrom(gather_build_configuration())
diff --git a/tensorflow/tools/test/run_and_gather_logs_lib.py b/tensorflow/tools/test/run_and_gather_logs_lib.py
index 03697ba205..f787eea1ef 100644
--- a/tensorflow/tools/test/run_and_gather_logs_lib.py
+++ b/tensorflow/tools/test/run_and_gather_logs_lib.py
@@ -44,10 +44,12 @@ def get_git_commit_sha():
return os.getenv("GIT_COMMIT")
-def process_test_logs(test_name, test_args, start_time, run_time, log_files):
+def process_test_logs(
+ name, test_name, test_args, start_time, run_time, log_files):
"""Gather test information and put it in a TestResults proto.
Args:
+ name: Benchmark target identifier.
test_name: A unique bazel target, e.g. "//path/to:test"
test_args: A string containing all arguments to run the target with.
@@ -60,6 +62,7 @@ def process_test_logs(test_name, test_args, start_time, run_time, log_files):
"""
results = test_log_pb2.TestResults()
+ results.name = name
results.target = test_name
results.start_time = start_time
results.run_time = run_time
@@ -85,10 +88,11 @@ def process_benchmarks(log_files):
return benchmarks
-def run_and_gather_logs(test_name, test_args):
+def run_and_gather_logs(name, test_name, test_args):
"""Run the bazel test given by test_name. Gather and return the logs.
Args:
+ name: Benchmark target identifier.
test_name: A unique bazel target, e.g. "//path/to:test"
test_args: A string containing all arguments to run the target with.
@@ -138,7 +142,8 @@ def run_and_gather_logs(test_name, test_args):
run_time = time.time() - start_time
log_files = tf.gfile.Glob("{}*".format(test_file_prefix))
- return (process_test_logs(test_name, test_args, start_time=int(start_time),
+ return (process_test_logs(name, test_name, test_args,
+ start_time=int(start_time),
run_time=run_time, log_files=log_files),
mangled_test_name)