From adf1585f5299fe81c853afab8dc8851bd1229a57 Mon Sep 17 00:00:00 2001 From: Andrew Selle Date: Thu, 3 Jan 2019 14:05:20 -0800 Subject: [PATCH 1/2] Disable on mac a flaky test. PiperOrigin-RevId: 227746737 --- tensorflow/lite/kernels/internal/BUILD | 2 ++ 1 file changed, 2 insertions(+) diff --git a/tensorflow/lite/kernels/internal/BUILD b/tensorflow/lite/kernels/internal/BUILD index 69816583f50..f7cf89c7241 100644 --- a/tensorflow/lite/kernels/internal/BUILD +++ b/tensorflow/lite/kernels/internal/BUILD @@ -652,6 +652,8 @@ cc_test( "logsoftmax_quantized_test.cc", ], tags = [ + # TODO(b/122242739): Reenable after fixing the flakiness? + "nomac", "tflite_not_portable", ], deps = [ From 5f40bb17a03436efeeb1408c76592781f8fba5b9 Mon Sep 17 00:00:00 2001 From: Andrew Selle Date: Thu, 3 Jan 2019 13:01:24 -0800 Subject: [PATCH 2/2] Make tests all have their own main so initialization works. PiperOrigin-RevId: 227735303 --- tensorflow/lite/toco/BUILD | 12 ++++++++---- tensorflow/lite/toco/import_tensorflow_test.cc | 7 +++++++ tensorflow/lite/toco/toco_convert_test.cc | 7 +++++++ tensorflow/lite/toco/toco_port_test.cc | 7 +++++++ tensorflow/lite/toco/tooling_util_test.cc | 9 ++++++++- 5 files changed, 37 insertions(+), 5 deletions(-) diff --git a/tensorflow/lite/toco/BUILD b/tensorflow/lite/toco/BUILD index 93d41fcae14..d77234c80a9 100644 --- a/tensorflow/lite/toco/BUILD +++ b/tensorflow/lite/toco/BUILD @@ -348,7 +348,8 @@ tf_cc_test( "//tensorflow/core:lib", "//tensorflow/core:ops", "//tensorflow/core:protos_all_cc", - "@com_google_googletest//:gtest_main", + "//tensorflow/lite/testing:util", + "@com_google_googletest//:gtest", ], ) @@ -387,7 +388,8 @@ tf_cc_test( ":model", ":tooling_util", "//tensorflow/core:lib", - "@com_google_googletest//:gtest_main", + "//tensorflow/lite/testing:util", + "@com_google_googletest//:gtest", ], ) @@ -451,12 +453,13 @@ tf_cc_test( ":toco_port", ":toco_tooling", ":types_proto_cc", - "@com_google_googletest//:gtest_main", + "@com_google_googletest//:gtest", "@com_google_absl//absl/strings", "//tensorflow/core:lib", # We cannot embed the core:ops dependency directly into :toco_tooling as # it can conflict with downstream deps when toco is used as a library. "//tensorflow/core:ops", + "//tensorflow/lite/testing:util", ], ) @@ -468,6 +471,7 @@ tf_cc_test( ], deps = [ ":toco_port", - "@com_google_googletest//:gtest_main", + "//tensorflow/lite/testing:util", + "@com_google_googletest//:gtest", ], ) diff --git a/tensorflow/lite/toco/import_tensorflow_test.cc b/tensorflow/lite/toco/import_tensorflow_test.cc index 0be358b1f7b..88263dc2ed0 100644 --- a/tensorflow/lite/toco/import_tensorflow_test.cc +++ b/tensorflow/lite/toco/import_tensorflow_test.cc @@ -23,6 +23,7 @@ limitations under the License. #include "tensorflow/core/framework/tensor.pb.h" #include "tensorflow/core/framework/tensor_shape.pb.h" #include "tensorflow/core/lib/core/status.h" +#include "tensorflow/lite/testing/util.h" namespace toco { @@ -432,3 +433,9 @@ TEST(ImportTest, UnsupportedOpWithMultipleOutputs) { } // namespace } // namespace toco + +int main(int argc, char** argv) { + ::tflite::LogToStderr(); + ::testing::InitGoogleTest(&argc, argv); + return RUN_ALL_TESTS(); +} diff --git a/tensorflow/lite/toco/toco_convert_test.cc b/tensorflow/lite/toco/toco_convert_test.cc index c3c440db943..3730c53ae1b 100644 --- a/tensorflow/lite/toco/toco_convert_test.cc +++ b/tensorflow/lite/toco/toco_convert_test.cc @@ -15,6 +15,7 @@ limitations under the License. #include "tensorflow/lite/toco/toco_convert.h" #include #include +#include "tensorflow/lite/testing/util.h" namespace toco { namespace { @@ -171,3 +172,9 @@ TEST(TocoTest, TransientStringTensors) { } // namespace } // namespace toco + +int main(int argc, char** argv) { + ::tflite::LogToStderr(); + ::testing::InitGoogleTest(&argc, argv); + return RUN_ALL_TESTS(); +} diff --git a/tensorflow/lite/toco/toco_port_test.cc b/tensorflow/lite/toco/toco_port_test.cc index f5fbb4caeb2..d80d423ed74 100644 --- a/tensorflow/lite/toco/toco_port_test.cc +++ b/tensorflow/lite/toco/toco_port_test.cc @@ -13,6 +13,7 @@ See the License for the specific language governing permissions and limitations under the License. ==============================================================================*/ #include "tensorflow/lite/toco/toco_port.h" +#include "tensorflow/lite/testing/util.h" #include "tensorflow/lite/toco/toco_types.h" #include @@ -56,3 +57,9 @@ TEST(TocoPortTest, JoinPath) { } // namespace } // namespace port } // namespace toco + +int main(int argc, char** argv) { + ::tflite::LogToStderr(); + ::testing::InitGoogleTest(&argc, argv); + return RUN_ALL_TESTS(); +} diff --git a/tensorflow/lite/toco/tooling_util_test.cc b/tensorflow/lite/toco/tooling_util_test.cc index 6f1c9c563ad..e44b94b7125 100644 --- a/tensorflow/lite/toco/tooling_util_test.cc +++ b/tensorflow/lite/toco/tooling_util_test.cc @@ -16,9 +16,10 @@ limitations under the License. #include #include +#include "tensorflow/core/lib/core/status.h" +#include "tensorflow/lite/testing/util.h" #include "tensorflow/lite/toco/model.h" #include "tensorflow/lite/toco/tooling_util.h" -#include "tensorflow/core/lib/core/status.h" namespace toco { @@ -203,3 +204,9 @@ TEST(FusedActivationTest, DefaultsToUnfused) { } } // namespace toco + +int main(int argc, char** argv) { + ::tflite::LogToStderr(); + ::testing::InitGoogleTest(&argc, argv); + return RUN_ALL_TESTS(); +}