diff options
Diffstat (limited to 'tensorflow/core/common_runtime/function_test.cc')
-rw-r--r-- | tensorflow/core/common_runtime/function_test.cc | 27 |
1 files changed, 23 insertions, 4 deletions
diff --git a/tensorflow/core/common_runtime/function_test.cc b/tensorflow/core/common_runtime/function_test.cc index 373fc64007..61b2f0e60f 100644 --- a/tensorflow/core/common_runtime/function_test.cc +++ b/tensorflow/core/common_runtime/function_test.cc @@ -231,8 +231,19 @@ class FunctionLibraryRuntimeTest : public ::testing::Test { return status; } FunctionLibraryRuntime::Options opts; - TF_RETURN_IF_ERROR(Run(flr, handle, opts, args, rets, add_runner)); - return flr->ReleaseHandle(handle); + status = Run(flr, handle, opts, args, rets, add_runner); + if (!status.ok()) return status; + + // Release the handle and try running again. It should not succeed. + status = flr->ReleaseHandle(handle); + if (!status.ok()) return status; + + Status status2 = Run(flr, handle, opts, args, std::move(rets)); + EXPECT_TRUE(errors::IsInvalidArgument(status2)); + EXPECT_TRUE( + str_util::StrContains(status2.error_message(), "remote execution.")); + + return status; } Status Run(FunctionLibraryRuntime* flr, FunctionLibraryRuntime::Handle handle, @@ -293,8 +304,16 @@ class FunctionLibraryRuntimeTest : public ::testing::Test { *rets[i] = retvals[i]; } - // Release the handle. - return flr->ReleaseHandle(handle); + // Release the handle and try running again. It should not succeed. + status = flr->ReleaseHandle(handle); + if (!status.ok()) return status; + + Status status2 = Run(flr, handle, opts, args, std::move(rets)); + EXPECT_TRUE(errors::IsInvalidArgument(status2)); + EXPECT_TRUE( + str_util::StrContains(status2.error_message(), "remote execution.")); + + return status; } std::unique_ptr<Graph> GetFuncBody(FunctionLibraryRuntime* flr, |