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

Function CompareWithGoldenFile

tensorflow/compiler/aot/codegen_test.cc:140–160  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

138}
139
140static void CompareWithGoldenFile(
141 const string& tensorflow_relative_golden_file_name,
142 const string& expected_contents) {
143 // To update the golden file, flip update_golden to true and run the
144 // following:
145 // bazel test --test_strategy=local \
146 // third_party/tensorflow/compiler/aot:codegen_test
147 const bool update_golden = false;
148 const string golden_file_name = io::JoinPath(
149 testing::TensorFlowSrcRoot(), tensorflow_relative_golden_file_name);
150
151 if (update_golden) {
152 TF_EXPECT_OK(
153 WriteStringToFile(Env::Default(), golden_file_name, expected_contents));
154 }
155
156 string golden_file_contents;
157 TF_ASSERT_OK(ReadFileToString(Env::Default(), golden_file_name,
158 &golden_file_contents));
159 EXPECT_EQ(golden_file_contents, expected_contents);
160}
161
162TEST(CodegenTest, Golden) {
163 // Normally CpuCompiler::CpuCompiler does this, but in this test we've

Callers 1

TESTFunction · 0.85

Calls 5

WriteStringToFileFunction · 0.85
DefaultFunction · 0.85
ReadFileToStringFunction · 0.85
JoinPathFunction · 0.50
TensorFlowSrcRootFunction · 0.50

Tested by

no test coverage detected