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

Function ReadManifest

tensorflow/lite/testing/generated_examples_zip_test.cc:216–237  ·  view source on GitHub ↗

Read the manifest.txt out of the unarchived archive file. Specifically `original_file` is the original zip file for error messages. `dir` is the temporary directory where the archive file has been unarchived and `test_paths` is the list of test prefixes that were in the manifest. Note, it is an error for a manifest to contain no tests.

Source from the content-addressed store, hash-verified

214// `test_paths` is the list of test prefixes that were in the manifest.
215// Note, it is an error for a manifest to contain no tests.
216tensorflow::Status ReadManifest(const string& original_file, const string& dir,
217 std::vector<string>* test_paths) {
218 // Read the newline delimited list of entries in the manifest.
219 std::ifstream manifest_fp(dir + "/manifest.txt");
220 string manifest((std::istreambuf_iterator<char>(manifest_fp)),
221 std::istreambuf_iterator<char>());
222 size_t pos = 0;
223 int added = 0;
224 while (true) {
225 size_t end_pos = manifest.find("\n", pos);
226 if (end_pos == string::npos) break;
227 string filename = manifest.substr(pos, end_pos - pos);
228 test_paths->push_back(dir + "/" + filename);
229 pos = end_pos + 1;
230 added += 1;
231 }
232 if (!added) {
233 string message = "Test had no examples: " + original_file;
234 return tensorflow::Status(tensorflow::error::UNKNOWN, message);
235 }
236 return tensorflow::Status::OK();
237}
238
239// Get a list of tests from either zip or tar file
240std::vector<string> UnarchiveAndFindTestNames(const string& zip_file,

Callers 1

Calls 3

StatusClass · 0.50
findMethod · 0.45
push_backMethod · 0.45

Tested by

no test coverage detected