| 47 | }; |
| 48 | |
| 49 | TEST_F(DeallocationTest, DeallocateScalar) { |
| 50 | XlaBuilder builder(TestName()); |
| 51 | ConstantR0<float>(&builder, 42.0); |
| 52 | auto global_data = ExecuteAndCheckTransfer(&builder, {}); |
| 53 | |
| 54 | // A result can be transferred an arbitrary number of times. Add an extra |
| 55 | // transfer here so we're not just testing that a second call to Transfer |
| 56 | // fails. |
| 57 | ASSERT_IS_OK(client_->Transfer(*global_data).status()); |
| 58 | |
| 59 | ASSERT_IS_OK(client_->Unregister(*global_data)); |
| 60 | |
| 61 | auto transfer_status = client_->Transfer(*global_data); |
| 62 | ASSERT_FALSE(transfer_status.ok()); |
| 63 | ASSERT_THAT(transfer_status.status().error_message(), |
| 64 | HasSubstr("was previously deallocated")); |
| 65 | } |
| 66 | |
| 67 | TEST_F(DeallocationTest, DeallocateVector) { |
| 68 | XlaBuilder builder(TestName()); |