| 130 | } |
| 131 | |
| 132 | TEST_F(BuildXlaOpsTest, ControlDepsPreserved) { |
| 133 | const char* kXlaDeviceName = "/job:worker/replica:0/task:0/device:XLA_CPU:0"; |
| 134 | Scope root = Scope::NewRootScope().WithDevice(kXlaDeviceName).ExitOnError(); |
| 135 | |
| 136 | FunctionDefLibrary fdef_lib = |
| 137 | CreateFunctionDefLibWithConstFunction("cluster_0"); |
| 138 | TF_ASSERT_OK(root.graph()->AddFunctionLibrary(fdef_lib)); |
| 139 | Node* call; |
| 140 | TF_ASSERT_OK(MakeXlaCompiledKernel(root.graph(), "cluster_0", "C", &call)); |
| 141 | call->set_requested_device(kXlaDeviceName); |
| 142 | Node* write_op = MakeWrite(root, "write"); |
| 143 | root.graph()->AddControlEdge(call, write_op); |
| 144 | |
| 145 | std::unique_ptr<Graph> graph; |
| 146 | TF_ASSERT_OK(BuildXlaOps(root, fdef_lib, &graph)); |
| 147 | |
| 148 | Node* write_op_new = FindNodeByName(graph.get(), write_op->name()); |
| 149 | ASSERT_NE(write_op_new, nullptr); |
| 150 | EXPECT_THAT(write_op_new, NodeWith(CtrlDeps(NodeWith(Op("_XlaRun"))))); |
| 151 | } |
| 152 | |
| 153 | TEST_F(BuildXlaOpsTest, CleanFailureOnBogusAttr) { |
| 154 | Scope root = Scope::NewRootScope().ExitOnError(); |
nothing calls this directly
no test coverage detected