MCPcopy Create free account
hub / github.com/DeepRec-AI/DeepRec / VersionTest

Function VersionTest

tensorflow/core/util/tensor_slice_reader_test.cc:581–606  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

579}
580
581static void VersionTest(const VersionDef& versions, const string& error) {
582 const string path = io::JoinPath(testing::TmpDir(), "checkpoint");
583
584 {
585 // Prepare an empty checkpoint with some version information
586 SavedTensorSlices sts;
587 *sts.mutable_meta()->mutable_versions() = versions;
588 string contents;
589 EXPECT_TRUE(sts.SerializeToString(&contents));
590
591 // Write it to disk
592 TensorSliceWriter::Builder* builder;
593 TF_ASSERT_OK(CreateTableTensorSliceBuilder(path, &builder));
594 builder->Add(kSavedTensorSlicesKey, contents);
595 int64 file_size;
596 TF_EXPECT_OK(builder->Finish(&file_size));
597 delete builder;
598 }
599
600 // Read it back in and verify that we get the expected error
601 TensorSliceReader reader(path, OpenTableTensorSliceReader);
602 EXPECT_TRUE(reader.status().code() == error::INVALID_ARGUMENT &&
603 absl::StartsWith(reader.status().error_message(), error))
604 << "Expected error starting with '" << errors::InvalidArgument(error)
605 << "', got '" << reader.status() << "'";
606}
607
608TEST(CheckpointVersionTest, MinConsumer) {
609 VersionDef versions;

Callers 1

TESTFunction · 0.70

Calls 10

TmpDirFunction · 0.85
StartsWithFunction · 0.85
InvalidArgumentFunction · 0.85
JoinPathFunction · 0.50
SerializeToStringMethod · 0.45
AddMethod · 0.45
FinishMethod · 0.45
codeMethod · 0.45
statusMethod · 0.45

Tested by

no test coverage detected