From 2ad85aa4db2d0d6ea71e53c0fed3c7081847c55c Mon Sep 17 00:00:00 2001 From: Mark Heffernan Date: Tue, 12 Sep 2017 12:50:25 -0700 Subject: [PATCH] Use xla/tests:xla_internal_test_main for all tests under tf/compiler/xla and remove any main() definitions in tests. This enables use of flags in all tests. PiperOrigin-RevId: 168424796 --- tensorflow/compiler/xla/service/BUILD | 46 ++++++++++++++++--- .../xla/service/algebraic_simplifier_test.cc | 4 -- .../xla/service/batchnorm_rewriter_test.cc | 4 -- .../xla/service/buffer_assignment_test.cc | 4 -- .../xla/service/buffer_liveness_test.cc | 4 -- .../compiler/xla/service/call_graph_test.cc | 4 -- .../compiler/xla/service/call_inliner_test.cc | 4 -- .../xla/service/copy_insertion_test.cc | 4 -- tensorflow/compiler/xla/service/cpu/BUILD | 8 ++-- .../service/cpu/conv_canonicalization_test.cc | 4 -- .../cpu/cpu_instruction_fusion_test.cc | 4 -- .../xla/service/flatten_call_graph_test.cc | 4 -- tensorflow/compiler/xla/service/gpu/BUILD | 7 +++ .../service/gpu/convolution_folding_test.cc | 4 -- .../xla/service/gpu/fusion_merger_test.cc | 4 -- .../xla/service/gpu/hlo_schedule_test.cc | 4 -- .../service/gpu/instruction_fusion_test.cc | 4 -- .../xla/service/gpu/layout_assignment_test.cc | 4 -- .../xla/service/gpu/llvm_gpu_backend/BUILD | 2 +- .../xla/service/gpu/stream_assignment_test.cc | 4 -- .../xla/service/gpu/while_transformer_test.cc | 4 -- .../xla/service/heap_simulator_test.cc | 4 -- .../xla/service/hlo_alias_analysis_test.cc | 4 -- .../xla/service/hlo_computation_test.cc | 4 -- .../xla/service/hlo_constant_folding_test.cc | 4 -- .../xla/service/hlo_cost_analysis_test.cc | 4 -- .../compiler/xla/service/hlo_cse_test.cc | 4 -- .../xla/service/hlo_dataflow_analysis_test.cc | 4 -- .../compiler/xla/service/hlo_dce_test.cc | 4 -- .../xla/service/hlo_evaluator_test.cc | 4 -- .../xla/service/hlo_instruction_test.cc | 4 -- .../compiler/xla/service/hlo_module_test.cc | 4 -- .../compiler/xla/service/hlo_ordering_test.cc | 4 -- .../xla/service/hlo_rematerialization_test.cc | 4 -- .../xla/service/hlo_scheduling_test.cc | 4 -- .../hlo_subcomputation_unification_test.cc | 4 -- .../xla/service/hlo_tfgraph_builder_test.cc | 4 -- .../compiler/xla/service/inliner_test.cc | 4 -- .../xla/service/instruction_fusion_test.cc | 4 -- .../xla/service/layout_assignment_test.cc | 4 -- .../xla/service/liveness_util_test.cc | 4 -- .../reduce_precision_insertion_test.cc | 4 -- .../xla/service/reshape_mover_test.cc | 4 -- .../xla/service/transpose_folding_test.cc | 4 -- .../service/tuple_points_to_analysis_test.cc | 4 -- .../compiler/xla/tests/hlo_test_base.cc | 17 ------- tensorflow/compiler/xla/tests/hlo_test_base.h | 5 -- 47 files changed, 53 insertions(+), 196 deletions(-) diff --git a/tensorflow/compiler/xla/service/BUILD b/tensorflow/compiler/xla/service/BUILD index 2773f8ec5ec..d68883169a9 100644 --- a/tensorflow/compiler/xla/service/BUILD +++ b/tensorflow/compiler/xla/service/BUILD @@ -64,7 +64,7 @@ cc_test( "//tensorflow/compiler/xla:test_helpers", "//tensorflow/compiler/xla:types", "//tensorflow/compiler/xla:xla_data_proto", - "//tensorflow/core:test_main", + "//tensorflow/compiler/xla/tests:xla_internal_test_main", ], ) @@ -76,7 +76,7 @@ cc_test( ":hlo", "//tensorflow/compiler/xla:test", "//tensorflow/compiler/xla:types", - "//tensorflow/core:test_main", + "//tensorflow/compiler/xla/tests:xla_internal_test_main", ], ) @@ -120,6 +120,7 @@ cc_test( "//tensorflow/compiler/xla/client:computation_builder", "//tensorflow/compiler/xla/tests:hlo_test_base", "//tensorflow/compiler/xla/tests:literal_test_util", + "//tensorflow/compiler/xla/tests:xla_internal_test_main", "//tensorflow/core:lib", ], ) @@ -184,7 +185,7 @@ cc_test( "//tensorflow/compiler/xla:test", "//tensorflow/compiler/xla:test_helpers", "//tensorflow/compiler/xla/tests:hlo_test_base", - "//tensorflow/core:test_main", + "//tensorflow/compiler/xla/tests:xla_internal_test_main", ], ) @@ -196,7 +197,7 @@ cc_library( deps = [ ":hlo", "//tensorflow/compiler/xla:test", - "//tensorflow/core:test_main", + "//tensorflow/compiler/xla/tests:xla_internal_test_main", ], ) @@ -207,6 +208,7 @@ cc_test( deps = [ ":hlo_matchers", "//tensorflow/compiler/xla:shape_util", + "//tensorflow/compiler/xla/tests:xla_internal_test_main", ], ) @@ -234,6 +236,7 @@ cc_test( "//tensorflow/compiler/xla:test_helpers", "//tensorflow/compiler/xla:util", "//tensorflow/compiler/xla/tests:hlo_test_base", + "//tensorflow/compiler/xla/tests:xla_internal_test_main", ], ) @@ -264,6 +267,7 @@ cc_test( "//tensorflow/compiler/xla:xla_data_proto", "//tensorflow/compiler/xla/service:hlo", "//tensorflow/compiler/xla/tests:hlo_test_base", + "//tensorflow/compiler/xla/tests:xla_internal_test_main", "//tensorflow/core:test", ], ) @@ -310,6 +314,7 @@ cc_test( "//tensorflow/compiler/xla:util", "//tensorflow/compiler/xla:xla_data_proto", "//tensorflow/compiler/xla/tests:hlo_test_base", + "//tensorflow/compiler/xla/tests:xla_internal_test_main", "//tensorflow/core:lib", "//tensorflow/core:test", ], @@ -331,6 +336,7 @@ cc_test( "//tensorflow/compiler/xla:xla_data_proto", "//tensorflow/compiler/xla/service:hlo", "//tensorflow/compiler/xla/tests:hlo_test_base", + "//tensorflow/compiler/xla/tests:xla_internal_test_main", "//tensorflow/core:test", ], ) @@ -370,6 +376,7 @@ cc_test( "//tensorflow/compiler/xla:test_helpers", "//tensorflow/compiler/xla:xla_data_proto", "//tensorflow/compiler/xla/service:hlo", + "//tensorflow/compiler/xla/tests:xla_internal_test_main", "//tensorflow/core:test", ], ) @@ -730,6 +737,7 @@ cc_test( ":liveness_util", ":tuple_points_to_analysis", "//tensorflow/compiler/xla/tests:hlo_test_base", + "//tensorflow/compiler/xla/tests:xla_internal_test_main", ], ) @@ -768,6 +776,7 @@ cc_test( "//tensorflow/compiler/xla:util", "//tensorflow/compiler/xla:xla_data_proto", "//tensorflow/compiler/xla/tests:hlo_test_base", + "//tensorflow/compiler/xla/tests:xla_internal_test_main", ], ) @@ -819,6 +828,7 @@ cc_test( "//tensorflow/compiler/xla:util", "//tensorflow/compiler/xla:xla_data_proto", "//tensorflow/compiler/xla/tests:hlo_test_base", + "//tensorflow/compiler/xla/tests:xla_internal_test_main", "//tensorflow/core:lib", ], ) @@ -855,6 +865,7 @@ cc_test( "//tensorflow/compiler/xla:types", "//tensorflow/compiler/xla:xla_data_proto", "//tensorflow/compiler/xla/tests:hlo_test_base", + "//tensorflow/compiler/xla/tests:xla_internal_test_main", ], ) @@ -888,6 +899,7 @@ cc_test( "//tensorflow/compiler/xla:literal_util", "//tensorflow/compiler/xla:status_macros", "//tensorflow/compiler/xla/tests:hlo_test_base", + "//tensorflow/compiler/xla/tests:xla_internal_test_main", "//tensorflow/core:lib", ], ) @@ -923,6 +935,7 @@ cc_test( "//tensorflow/compiler/xla:types", "//tensorflow/compiler/xla:xla_data_proto", "//tensorflow/compiler/xla/tests:hlo_test_base", + "//tensorflow/compiler/xla/tests:xla_internal_test_main", ], ) @@ -957,6 +970,7 @@ cc_test( ":hlo_matchers", ":instruction_fusion", "//tensorflow/compiler/xla/tests:hlo_test_base", + "//tensorflow/compiler/xla/tests:xla_internal_test_main", ], ) @@ -996,6 +1010,7 @@ cc_test( "//tensorflow/compiler/xla:util", "//tensorflow/compiler/xla:xla_data_proto", "//tensorflow/compiler/xla/tests:hlo_test_base", + "//tensorflow/compiler/xla/tests:xla_internal_test_main", "//tensorflow/core:lib", ], ) @@ -1036,6 +1051,7 @@ cc_test( "//tensorflow/compiler/xla:util", "//tensorflow/compiler/xla:xla_data_proto", "//tensorflow/compiler/xla/tests:hlo_test_base", + "//tensorflow/compiler/xla/tests:xla_internal_test_main", "//tensorflow/core:lib", ], ) @@ -1070,6 +1086,7 @@ cc_test( "//tensorflow/compiler/xla:util", "//tensorflow/compiler/xla:xla_data_proto", "//tensorflow/compiler/xla/tests:hlo_test_base", + "//tensorflow/compiler/xla/tests:xla_internal_test_main", "//tensorflow/core:lib", ], ) @@ -1103,6 +1120,7 @@ cc_test( "//tensorflow/compiler/xla:xla_data_proto", "//tensorflow/compiler/xla/tests:hlo_test_base", "//tensorflow/compiler/xla/tests:literal_test_util", + "//tensorflow/compiler/xla/tests:xla_internal_test_main", ], ) @@ -1212,9 +1230,9 @@ cc_test( "//tensorflow/compiler/xla:types", "//tensorflow/compiler/xla:xla_data_proto", "//tensorflow/compiler/xla/tests:literal_test_util", + "//tensorflow/compiler/xla/tests:xla_internal_test_main", "//tensorflow/core:lib", "//tensorflow/core:stream_executor_no_cuda", - "//tensorflow/core:test_main", ], ) @@ -1255,6 +1273,7 @@ cc_test( "//tensorflow/compiler/xla/client:local_client", "//tensorflow/compiler/xla/client:padding", "//tensorflow/compiler/xla/tests:hlo_test_base", + "//tensorflow/compiler/xla/tests:xla_internal_test_main", "//tensorflow/core:lib", ], ) @@ -1286,6 +1305,7 @@ cc_test( "//tensorflow/compiler/xla:test", "//tensorflow/compiler/xla:test_helpers", "//tensorflow/compiler/xla/tests:hlo_test_base", + "//tensorflow/compiler/xla/tests:xla_internal_test_main", ], ) @@ -1316,6 +1336,7 @@ cc_test( "//tensorflow/compiler/xla:util", "//tensorflow/compiler/xla:xla_data_proto", "//tensorflow/compiler/xla/tests:hlo_test_base", + "//tensorflow/compiler/xla/tests:xla_internal_test_main", "//tensorflow/core:lib", ], ) @@ -1388,6 +1409,7 @@ cc_test( "//tensorflow/compiler/xla:test_helpers", "//tensorflow/compiler/xla:xla_data_proto", "//tensorflow/compiler/xla/tests:hlo_test_base", + "//tensorflow/compiler/xla/tests:xla_internal_test_main", "//tensorflow/core:lib", "//tensorflow/core:test", ], @@ -1444,6 +1466,7 @@ cc_test( "//tensorflow/compiler/xla:test_helpers", "//tensorflow/compiler/xla:xla_data_proto", "//tensorflow/compiler/xla/tests:hlo_test_base", + "//tensorflow/compiler/xla/tests:xla_internal_test_main", "//tensorflow/core:lib", "//tensorflow/core:test", ], @@ -1496,6 +1519,7 @@ cc_test( "//tensorflow/compiler/xla:test_helpers", "//tensorflow/compiler/xla:xla_data_proto", "//tensorflow/compiler/xla/tests:hlo_test_base", + "//tensorflow/compiler/xla/tests:xla_internal_test_main", "//tensorflow/core:lib", "//tensorflow/core:test", ], @@ -1575,6 +1599,7 @@ cc_test( "//tensorflow/compiler/xla:test_helpers", "//tensorflow/compiler/xla:xla_data_proto", "//tensorflow/compiler/xla/tests:hlo_test_base", + "//tensorflow/compiler/xla/tests:xla_internal_test_main", ], ) @@ -1643,6 +1668,7 @@ cc_test( "//tensorflow/compiler/xla:types", "//tensorflow/compiler/xla:xla_data_proto", "//tensorflow/compiler/xla/tests:hlo_test_base", + "//tensorflow/compiler/xla/tests:xla_internal_test_main", ], ) @@ -1661,6 +1687,7 @@ cc_test( "//tensorflow/compiler/xla/tests:hlo_test_base", "//tensorflow/compiler/xla/tests:literal_test_util", "//tensorflow/compiler/xla/tests:test_utils", + "//tensorflow/compiler/xla/tests:xla_internal_test_main", "//tensorflow/core:lib", "//tensorflow/core:test", ], @@ -1685,6 +1712,7 @@ cc_test( "//tensorflow/compiler/xla:xla_data_proto", "//tensorflow/compiler/xla/tests:hlo_test_base", "//tensorflow/compiler/xla/tests:test_utils", + "//tensorflow/compiler/xla/tests:xla_internal_test_main", "//tensorflow/core:lib", ], ) @@ -1755,6 +1783,7 @@ cc_test( "//tensorflow/compiler/xla/tests:hlo_test_base", "//tensorflow/compiler/xla/tests:literal_test_util", "//tensorflow/compiler/xla/tests:test_utils", + "//tensorflow/compiler/xla/tests:xla_internal_test_main", "//tensorflow/core:lib", ], ) @@ -1790,6 +1819,7 @@ cc_test( "//tensorflow/compiler/xla:types", "//tensorflow/compiler/xla/tests:hlo_test_base", "//tensorflow/compiler/xla/tests:literal_test_util", + "//tensorflow/compiler/xla/tests:xla_internal_test_main", ], ) @@ -1878,6 +1908,7 @@ cc_test( "//tensorflow/compiler/xla:shape_util", "//tensorflow/compiler/xla/tests:hlo_test_base", "//tensorflow/compiler/xla/tests:test_utils", + "//tensorflow/compiler/xla/tests:xla_internal_test_main", ], ) @@ -1904,6 +1935,7 @@ cc_test( ":hlo_tfgraph_builder", "//tensorflow/compiler/xla/client:computation_builder", "//tensorflow/compiler/xla/tests:hlo_test_base", + "//tensorflow/compiler/xla/tests:xla_internal_test_main", "//tensorflow/core:protos_all_cc", ], ) @@ -1960,6 +1992,7 @@ cc_test( "//tensorflow/compiler/xla/client:computation_builder", "//tensorflow/compiler/xla/service/gpu:ir_emission_utils", "//tensorflow/compiler/xla/tests:hlo_test_base", + "//tensorflow/compiler/xla/tests:xla_internal_test_main", "//tensorflow/core:lib", ], ) @@ -1980,7 +2013,7 @@ cc_test( deps = [ ":pool", "//tensorflow/compiler/xla:test_helpers", - "//tensorflow/core:test_main", + "//tensorflow/compiler/xla/tests:xla_internal_test_main", ], ) @@ -2023,6 +2056,7 @@ cc_test( "//tensorflow/compiler/xla:test_helpers", "//tensorflow/compiler/xla:xla_data_proto", "//tensorflow/compiler/xla/tests:hlo_test_base", + "//tensorflow/compiler/xla/tests:xla_internal_test_main", ], ) diff --git a/tensorflow/compiler/xla/service/algebraic_simplifier_test.cc b/tensorflow/compiler/xla/service/algebraic_simplifier_test.cc index c442e2d0bc9..f968ec693f5 100644 --- a/tensorflow/compiler/xla/service/algebraic_simplifier_test.cc +++ b/tensorflow/compiler/xla/service/algebraic_simplifier_test.cc @@ -2011,7 +2011,3 @@ TEST_F(AlgebraicSimplifierTest, ConstantTupleBecomesTupleOfConstants) { } // namespace } // namespace xla - -int main(int argc, char** argv) { - return xla::ParseDebugOptionsFlagsAndRunTests(argc, argv); -} diff --git a/tensorflow/compiler/xla/service/batchnorm_rewriter_test.cc b/tensorflow/compiler/xla/service/batchnorm_rewriter_test.cc index 07775623e75..590f79aee51 100644 --- a/tensorflow/compiler/xla/service/batchnorm_rewriter_test.cc +++ b/tensorflow/compiler/xla/service/batchnorm_rewriter_test.cc @@ -116,7 +116,3 @@ TEST_F(BatchNormRewriterTest, BatchNormGrad) { } // namespace } // namespace xla - -int main(int argc, char** argv) { - return xla::ParseDebugOptionsFlagsAndRunTests(argc, argv); -} diff --git a/tensorflow/compiler/xla/service/buffer_assignment_test.cc b/tensorflow/compiler/xla/service/buffer_assignment_test.cc index f2e922672b2..952781df12c 100644 --- a/tensorflow/compiler/xla/service/buffer_assignment_test.cc +++ b/tensorflow/compiler/xla/service/buffer_assignment_test.cc @@ -1766,7 +1766,3 @@ TEST_F(WhileBufferAssignmentTest, DISABLED_TwoWhiles) { } // namespace } // namespace xla - -int main(int argc, char** argv) { - return xla::ParseDebugOptionsFlagsAndRunTests(argc, argv); -} diff --git a/tensorflow/compiler/xla/service/buffer_liveness_test.cc b/tensorflow/compiler/xla/service/buffer_liveness_test.cc index 7a102d65ce3..56600b58380 100644 --- a/tensorflow/compiler/xla/service/buffer_liveness_test.cc +++ b/tensorflow/compiler/xla/service/buffer_liveness_test.cc @@ -784,7 +784,3 @@ TEST_F(DynamicUpdateSliceLivenessTest, WithInterference) { } // namespace } // namespace xla - -int main(int argc, char** argv) { - return xla::ParseDebugOptionsFlagsAndRunTests(argc, argv); -} diff --git a/tensorflow/compiler/xla/service/call_graph_test.cc b/tensorflow/compiler/xla/service/call_graph_test.cc index 4243d37a77e..0395ea8c8b5 100644 --- a/tensorflow/compiler/xla/service/call_graph_test.cc +++ b/tensorflow/compiler/xla/service/call_graph_test.cc @@ -497,7 +497,3 @@ TEST_F(CallGraphTest, VisitWithError) { } // namespace } // namespace xla - -int main(int argc, char** argv) { - return xla::ParseDebugOptionsFlagsAndRunTests(argc, argv); -} diff --git a/tensorflow/compiler/xla/service/call_inliner_test.cc b/tensorflow/compiler/xla/service/call_inliner_test.cc index 31d3118f954..f3e7407c544 100644 --- a/tensorflow/compiler/xla/service/call_inliner_test.cc +++ b/tensorflow/compiler/xla/service/call_inliner_test.cc @@ -117,7 +117,3 @@ TEST_F(CallInlinerTest, CallsWithinWhileBodiesAreInlined) { } // namespace } // namespace xla - -int main(int argc, char** argv) { - return xla::ParseDebugOptionsFlagsAndRunTests(argc, argv); -} diff --git a/tensorflow/compiler/xla/service/copy_insertion_test.cc b/tensorflow/compiler/xla/service/copy_insertion_test.cc index daaf8d10bb8..a2eacc5c7da 100644 --- a/tensorflow/compiler/xla/service/copy_insertion_test.cc +++ b/tensorflow/compiler/xla/service/copy_insertion_test.cc @@ -1121,7 +1121,3 @@ TEST_F(WhileCopyInsertionTest, InitPointsToNonDistinctUsedByTwoWhileLoops) { } // namespace } // namespace xla - -int main(int argc, char** argv) { - return xla::ParseDebugOptionsFlagsAndRunTests(argc, argv); -} diff --git a/tensorflow/compiler/xla/service/cpu/BUILD b/tensorflow/compiler/xla/service/cpu/BUILD index ecbe8fdadf1..b24e55980b5 100644 --- a/tensorflow/compiler/xla/service/cpu/BUILD +++ b/tensorflow/compiler/xla/service/cpu/BUILD @@ -461,10 +461,10 @@ cc_test( "//tensorflow/compiler/xla:types", "//tensorflow/compiler/xla:util", "//tensorflow/compiler/xla/client:local_client", + "//tensorflow/compiler/xla/tests:xla_internal_test_main", "//tensorflow/core:core_cpu_internal", "//tensorflow/core:lib", "//tensorflow/core:test", - "//tensorflow/core:test_main", "//third_party/eigen3", ], ) @@ -478,6 +478,7 @@ cc_test( "//tensorflow/compiler/xla/service:hlo_matchers", "//tensorflow/compiler/xla/service:transpose_folding", "//tensorflow/compiler/xla/tests:hlo_test_base", + "//tensorflow/compiler/xla/tests:xla_internal_test_main", "//tensorflow/core:lib", ], ) @@ -489,9 +490,9 @@ cc_test( deps = [ ":cpu_runtime", "//tensorflow/compiler/xla:shape_util", + "//tensorflow/compiler/xla/tests:xla_internal_test_main", "//tensorflow/core:lib", "//tensorflow/core:test", - "//tensorflow/core:test_main", ], ) @@ -590,6 +591,7 @@ cc_test( "//tensorflow/compiler/xla:util", "//tensorflow/compiler/xla/service:hlo", "//tensorflow/compiler/xla/tests:hlo_test_base", + "//tensorflow/compiler/xla/tests:xla_internal_test_main", ], ) @@ -610,7 +612,7 @@ cc_test( "//tensorflow/compiler/xla:test_helpers", "//tensorflow/compiler/xla:util", "//tensorflow/compiler/xla/tests:hlo_test_base", - "//tensorflow/core:test_main", + "//tensorflow/compiler/xla/tests:xla_internal_test_main", ], ) diff --git a/tensorflow/compiler/xla/service/cpu/conv_canonicalization_test.cc b/tensorflow/compiler/xla/service/cpu/conv_canonicalization_test.cc index ec992f15e63..9e8b785f305 100644 --- a/tensorflow/compiler/xla/service/cpu/conv_canonicalization_test.cc +++ b/tensorflow/compiler/xla/service/cpu/conv_canonicalization_test.cc @@ -144,7 +144,3 @@ TEST_F(ConvCanonicalizationTest, CanonicalStaysTheSame) { } // namespace cpu } // namespace xla - -int main(int argc, char** argv) { - return xla::ParseDebugOptionsFlagsAndRunTests(argc, argv); -} diff --git a/tensorflow/compiler/xla/service/cpu/cpu_instruction_fusion_test.cc b/tensorflow/compiler/xla/service/cpu/cpu_instruction_fusion_test.cc index 75a665c2228..0fc62281a08 100644 --- a/tensorflow/compiler/xla/service/cpu/cpu_instruction_fusion_test.cc +++ b/tensorflow/compiler/xla/service/cpu/cpu_instruction_fusion_test.cc @@ -405,7 +405,3 @@ TEST_F(OpcodeFusionTest, Exponential_Transpose_Negate) { } // namespace } // namespace cpu } // namespace xla - -int main(int argc, char** argv) { - return xla::ParseDebugOptionsFlagsAndRunTests(argc, argv); -} diff --git a/tensorflow/compiler/xla/service/flatten_call_graph_test.cc b/tensorflow/compiler/xla/service/flatten_call_graph_test.cc index 12a6794ac17..bae12276597 100644 --- a/tensorflow/compiler/xla/service/flatten_call_graph_test.cc +++ b/tensorflow/compiler/xla/service/flatten_call_graph_test.cc @@ -225,7 +225,3 @@ TEST_F(FlattenCallGraphTest, FlattenCalls) { } // namespace } // namespace xla - -int main(int argc, char** argv) { - return xla::ParseDebugOptionsFlagsAndRunTests(argc, argv); -} diff --git a/tensorflow/compiler/xla/service/gpu/BUILD b/tensorflow/compiler/xla/service/gpu/BUILD index 28cc43bb5ae..9e373eaab89 100644 --- a/tensorflow/compiler/xla/service/gpu/BUILD +++ b/tensorflow/compiler/xla/service/gpu/BUILD @@ -86,6 +86,7 @@ cc_test( "//tensorflow/compiler/xla:types", "//tensorflow/compiler/xla/service:hlo", "//tensorflow/compiler/xla/tests:hlo_test_base", + "//tensorflow/compiler/xla/tests:xla_internal_test_main", "//tensorflow/core:lib", ], ) @@ -312,6 +313,7 @@ cc_test( "//tensorflow/compiler/xla/service:hlo", "//tensorflow/compiler/xla/service:shape_inference", "//tensorflow/compiler/xla/tests:hlo_test_base", + "//tensorflow/compiler/xla/tests:xla_internal_test_main", "//tensorflow/core:test", ], ) @@ -335,6 +337,7 @@ cc_test( deps = [ ":instruction_fusion", "//tensorflow/compiler/xla/tests:hlo_test_base", + "//tensorflow/compiler/xla/tests:xla_internal_test_main", ], ) @@ -376,6 +379,7 @@ cc_test( ":instruction_fusion", "//tensorflow/compiler/xla:test_helpers", "//tensorflow/compiler/xla/tests:hlo_test_base", + "//tensorflow/compiler/xla/tests:xla_internal_test_main", ], ) @@ -487,6 +491,7 @@ cc_test( "//tensorflow/compiler/xla/service:computation_layout", "//tensorflow/compiler/xla/service:hlo", "//tensorflow/compiler/xla/tests:hlo_test_base", + "//tensorflow/compiler/xla/tests:xla_internal_test_main", ], ) @@ -519,6 +524,7 @@ cc_test( "//tensorflow/compiler/xla:types", "//tensorflow/compiler/xla/service:hlo", "//tensorflow/compiler/xla/tests:hlo_test_base", + "//tensorflow/compiler/xla/tests:xla_internal_test_main", ], ) @@ -548,6 +554,7 @@ cc_test( "//tensorflow/compiler/xla:test_helpers", "//tensorflow/compiler/xla/service:copy_insertion", "//tensorflow/compiler/xla/tests:hlo_test_base", + "//tensorflow/compiler/xla/tests:xla_internal_test_main", ], ) diff --git a/tensorflow/compiler/xla/service/gpu/convolution_folding_test.cc b/tensorflow/compiler/xla/service/gpu/convolution_folding_test.cc index ba9c70ded36..6699c8f3c4a 100644 --- a/tensorflow/compiler/xla/service/gpu/convolution_folding_test.cc +++ b/tensorflow/compiler/xla/service/gpu/convolution_folding_test.cc @@ -550,7 +550,3 @@ TEST_F(ConvolutionFoldingTest, } // namespace gpu } // namespace xla - -int main(int argc, char** argv) { - return xla::ParseDebugOptionsFlagsAndRunTests(argc, argv); -} diff --git a/tensorflow/compiler/xla/service/gpu/fusion_merger_test.cc b/tensorflow/compiler/xla/service/gpu/fusion_merger_test.cc index 242c32936d3..e68201417ba 100644 --- a/tensorflow/compiler/xla/service/gpu/fusion_merger_test.cc +++ b/tensorflow/compiler/xla/service/gpu/fusion_merger_test.cc @@ -462,7 +462,3 @@ TEST_F(FusionMergerTest, BytesTransferredThresholdNotExeceeded) { } // namespace } // namespace gpu } // namespace xla - -int main(int argc, char** argv) { - return xla::ParseDebugOptionsFlagsAndRunTests(argc, argv); -} diff --git a/tensorflow/compiler/xla/service/gpu/hlo_schedule_test.cc b/tensorflow/compiler/xla/service/gpu/hlo_schedule_test.cc index 118ef18c44b..ece9fa04dce 100644 --- a/tensorflow/compiler/xla/service/gpu/hlo_schedule_test.cc +++ b/tensorflow/compiler/xla/service/gpu/hlo_schedule_test.cc @@ -393,7 +393,3 @@ TEST_F(HloScheduleTest, LatticeMatMul) { } // namespace gpu } // namespace xla - -int main(int argc, char** argv) { - return xla::ParseDebugOptionsFlagsAndRunTests(argc, argv); -} diff --git a/tensorflow/compiler/xla/service/gpu/instruction_fusion_test.cc b/tensorflow/compiler/xla/service/gpu/instruction_fusion_test.cc index 896f6ea8425..bd21549f94e 100644 --- a/tensorflow/compiler/xla/service/gpu/instruction_fusion_test.cc +++ b/tensorflow/compiler/xla/service/gpu/instruction_fusion_test.cc @@ -123,7 +123,3 @@ TEST_F(InstructionFusionTest, GetTupleElementFused) { } // namespace gpu } // namespace xla - -int main(int argc, char** argv) { - return xla::ParseDebugOptionsFlagsAndRunTests(argc, argv); -} diff --git a/tensorflow/compiler/xla/service/gpu/layout_assignment_test.cc b/tensorflow/compiler/xla/service/gpu/layout_assignment_test.cc index fa258b6e567..ac206b89d32 100644 --- a/tensorflow/compiler/xla/service/gpu/layout_assignment_test.cc +++ b/tensorflow/compiler/xla/service/gpu/layout_assignment_test.cc @@ -83,7 +83,3 @@ TEST_F(LayoutAssignmentTest, Elementwise) { } // namespace } // namespace gpu } // namespace xla - -int main(int argc, char** argv) { - return xla::ParseDebugOptionsFlagsAndRunTests(argc, argv); -} diff --git a/tensorflow/compiler/xla/service/gpu/llvm_gpu_backend/BUILD b/tensorflow/compiler/xla/service/gpu/llvm_gpu_backend/BUILD index 876f14f5c44..34f5ef54459 100644 --- a/tensorflow/compiler/xla/service/gpu/llvm_gpu_backend/BUILD +++ b/tensorflow/compiler/xla/service/gpu/llvm_gpu_backend/BUILD @@ -59,9 +59,9 @@ cc_test( deps = [ ":llvm_gpu_backend", "//tensorflow/compiler/xla:types", + "//tensorflow/compiler/xla/tests:xla_internal_test_main", "//tensorflow/core:lib", "//tensorflow/core:test", - "//tensorflow/core:test_main", "@llvm//:core", "@llvm//:support", ], diff --git a/tensorflow/compiler/xla/service/gpu/stream_assignment_test.cc b/tensorflow/compiler/xla/service/gpu/stream_assignment_test.cc index a5230b3e8e9..8c98956f1a9 100644 --- a/tensorflow/compiler/xla/service/gpu/stream_assignment_test.cc +++ b/tensorflow/compiler/xla/service/gpu/stream_assignment_test.cc @@ -131,7 +131,3 @@ TEST_F(StreamAssignmentTest, LatticeMatMul) { } // namespace gpu } // namespace xla - -int main(int argc, char** argv) { - return xla::ParseDebugOptionsFlagsAndRunTests(argc, argv); -} diff --git a/tensorflow/compiler/xla/service/gpu/while_transformer_test.cc b/tensorflow/compiler/xla/service/gpu/while_transformer_test.cc index 51d38f84212..44188473d39 100644 --- a/tensorflow/compiler/xla/service/gpu/while_transformer_test.cc +++ b/tensorflow/compiler/xla/service/gpu/while_transformer_test.cc @@ -194,7 +194,3 @@ TEST_F(WhileTransformerTest, InvalidLoopIncrement) { } // namespace } // namespace xla - -int main(int argc, char** argv) { - return xla::ParseDebugOptionsFlagsAndRunTests(argc, argv); -} diff --git a/tensorflow/compiler/xla/service/heap_simulator_test.cc b/tensorflow/compiler/xla/service/heap_simulator_test.cc index 52b3994f1f9..17b926c8748 100644 --- a/tensorflow/compiler/xla/service/heap_simulator_test.cc +++ b/tensorflow/compiler/xla/service/heap_simulator_test.cc @@ -847,7 +847,3 @@ TEST_F(LazyBestFitHeapTest, Alignment) { } // namespace } // namespace xla - -int main(int argc, char** argv) { - return xla::ParseDebugOptionsFlagsAndRunTests(argc, argv); -} diff --git a/tensorflow/compiler/xla/service/hlo_alias_analysis_test.cc b/tensorflow/compiler/xla/service/hlo_alias_analysis_test.cc index d898e75f94b..e7ff9e7cf31 100644 --- a/tensorflow/compiler/xla/service/hlo_alias_analysis_test.cc +++ b/tensorflow/compiler/xla/service/hlo_alias_analysis_test.cc @@ -820,7 +820,3 @@ TEST_F(HloAliasAnalysisTest, Bitcast) { } // namespace } // namespace xla - -int main(int argc, char** argv) { - return xla::ParseDebugOptionsFlagsAndRunTests(argc, argv); -} diff --git a/tensorflow/compiler/xla/service/hlo_computation_test.cc b/tensorflow/compiler/xla/service/hlo_computation_test.cc index abd99e64dfc..ccab7bf3486 100644 --- a/tensorflow/compiler/xla/service/hlo_computation_test.cc +++ b/tensorflow/compiler/xla/service/hlo_computation_test.cc @@ -553,7 +553,3 @@ TEST_F(HloComputationTest, Reachability) { } // namespace } // namespace xla - -int main(int argc, char** argv) { - return xla::ParseDebugOptionsFlagsAndRunTests(argc, argv); -} diff --git a/tensorflow/compiler/xla/service/hlo_constant_folding_test.cc b/tensorflow/compiler/xla/service/hlo_constant_folding_test.cc index 3ae499d5e0c..7b552ee5b17 100644 --- a/tensorflow/compiler/xla/service/hlo_constant_folding_test.cc +++ b/tensorflow/compiler/xla/service/hlo_constant_folding_test.cc @@ -204,7 +204,3 @@ TEST_F(HloConstantFoldingTest, TransposeConstantFold) { } // namespace } // namespace xla - -int main(int argc, char** argv) { - return xla::ParseDebugOptionsFlagsAndRunTests(argc, argv); -} diff --git a/tensorflow/compiler/xla/service/hlo_cost_analysis_test.cc b/tensorflow/compiler/xla/service/hlo_cost_analysis_test.cc index b7d4cb4cba2..0a288a77ada 100644 --- a/tensorflow/compiler/xla/service/hlo_cost_analysis_test.cc +++ b/tensorflow/compiler/xla/service/hlo_cost_analysis_test.cc @@ -442,7 +442,3 @@ TEST_F(HloCostAnalysisTest, TupleCost) { } // namespace } // namespace xla - -int main(int argc, char** argv) { - return xla::ParseDebugOptionsFlagsAndRunTests(argc, argv); -} diff --git a/tensorflow/compiler/xla/service/hlo_cse_test.cc b/tensorflow/compiler/xla/service/hlo_cse_test.cc index 8b0b9c8bbd0..bda1f120fd5 100644 --- a/tensorflow/compiler/xla/service/hlo_cse_test.cc +++ b/tensorflow/compiler/xla/service/hlo_cse_test.cc @@ -435,7 +435,3 @@ TEST_F(HloCseTest, DISABLED_DoNotCombineCallsToImpureFunctions) { } // namespace } // namespace xla - -int main(int argc, char** argv) { - return xla::ParseDebugOptionsFlagsAndRunTests(argc, argv); -} diff --git a/tensorflow/compiler/xla/service/hlo_dataflow_analysis_test.cc b/tensorflow/compiler/xla/service/hlo_dataflow_analysis_test.cc index da4505f8339..4939335e2f8 100644 --- a/tensorflow/compiler/xla/service/hlo_dataflow_analysis_test.cc +++ b/tensorflow/compiler/xla/service/hlo_dataflow_analysis_test.cc @@ -1490,7 +1490,3 @@ INSTANTIATE_TEST_CASE_P(HloDataflowAnalysisInstantiation, } // namespace } // namespace xla - -int main(int argc, char** argv) { - return xla::ParseDebugOptionsFlagsAndRunTests(argc, argv); -} diff --git a/tensorflow/compiler/xla/service/hlo_dce_test.cc b/tensorflow/compiler/xla/service/hlo_dce_test.cc index 7354ef40437..8fdc2fe2c51 100644 --- a/tensorflow/compiler/xla/service/hlo_dce_test.cc +++ b/tensorflow/compiler/xla/service/hlo_dce_test.cc @@ -304,7 +304,3 @@ TEST_F(HloDceTest, CalledComputationWithNestedSideEffect) { } // namespace } // namespace xla - -int main(int argc, char** argv) { - return xla::ParseDebugOptionsFlagsAndRunTests(argc, argv); -} diff --git a/tensorflow/compiler/xla/service/hlo_evaluator_test.cc b/tensorflow/compiler/xla/service/hlo_evaluator_test.cc index b04bef7652e..9205f5dc4e8 100644 --- a/tensorflow/compiler/xla/service/hlo_evaluator_test.cc +++ b/tensorflow/compiler/xla/service/hlo_evaluator_test.cc @@ -1598,7 +1598,3 @@ TEST_F(HloEvaluatorTest, Reverse) { } // namespace } // namespace xla - -int main(int argc, char** argv) { - return xla::ParseDebugOptionsFlagsAndRunTests(argc, argv); -} diff --git a/tensorflow/compiler/xla/service/hlo_instruction_test.cc b/tensorflow/compiler/xla/service/hlo_instruction_test.cc index 2e1eeee36b5..3601d5cdbe6 100644 --- a/tensorflow/compiler/xla/service/hlo_instruction_test.cc +++ b/tensorflow/compiler/xla/service/hlo_instruction_test.cc @@ -1194,7 +1194,3 @@ TEST_F(HloInstructionTest, Stringification) { } // namespace } // namespace xla - -int main(int argc, char** argv) { - return xla::ParseDebugOptionsFlagsAndRunTests(argc, argv); -} diff --git a/tensorflow/compiler/xla/service/hlo_module_test.cc b/tensorflow/compiler/xla/service/hlo_module_test.cc index 56dc5632035..20eef2f7d53 100644 --- a/tensorflow/compiler/xla/service/hlo_module_test.cc +++ b/tensorflow/compiler/xla/service/hlo_module_test.cc @@ -128,7 +128,3 @@ TEST_F(HloModuleTest, DiamondComputationsPostOrder) { } // namespace } // namespace xla - -int main(int argc, char** argv) { - return xla::ParseDebugOptionsFlagsAndRunTests(argc, argv); -} diff --git a/tensorflow/compiler/xla/service/hlo_ordering_test.cc b/tensorflow/compiler/xla/service/hlo_ordering_test.cc index c95e44bd5d9..dbd63eceede 100644 --- a/tensorflow/compiler/xla/service/hlo_ordering_test.cc +++ b/tensorflow/compiler/xla/service/hlo_ordering_test.cc @@ -309,7 +309,3 @@ TEST_F(HloOrderingTest, ValuesInWhileComputations) { } // namespace } // namespace xla - -int main(int argc, char** argv) { - return xla::ParseDebugOptionsFlagsAndRunTests(argc, argv); -} diff --git a/tensorflow/compiler/xla/service/hlo_rematerialization_test.cc b/tensorflow/compiler/xla/service/hlo_rematerialization_test.cc index 2358969f38e..7dc42ae7972 100644 --- a/tensorflow/compiler/xla/service/hlo_rematerialization_test.cc +++ b/tensorflow/compiler/xla/service/hlo_rematerialization_test.cc @@ -525,7 +525,3 @@ INSTANTIATE_TEST_CASE_P(IndirectUseTestInstantiation, IndirectUseTest, } // namespace } // namespace xla - -int main(int argc, char** argv) { - return xla::ParseDebugOptionsFlagsAndRunTests(argc, argv); -} diff --git a/tensorflow/compiler/xla/service/hlo_scheduling_test.cc b/tensorflow/compiler/xla/service/hlo_scheduling_test.cc index d09d22ee406..7fb338e7042 100644 --- a/tensorflow/compiler/xla/service/hlo_scheduling_test.cc +++ b/tensorflow/compiler/xla/service/hlo_scheduling_test.cc @@ -91,7 +91,3 @@ TEST_F(MinimumMemoryForSequenceTest, MultiComputation) { } // namespace } // namespace xla - -int main(int argc, char** argv) { - return xla::ParseDebugOptionsFlagsAndRunTests(argc, argv); -} diff --git a/tensorflow/compiler/xla/service/hlo_subcomputation_unification_test.cc b/tensorflow/compiler/xla/service/hlo_subcomputation_unification_test.cc index e3d287d4c91..33b3634cfc1 100644 --- a/tensorflow/compiler/xla/service/hlo_subcomputation_unification_test.cc +++ b/tensorflow/compiler/xla/service/hlo_subcomputation_unification_test.cc @@ -206,7 +206,3 @@ TEST_F(HloSubcomputationUnificationTest, TwoIdenticalComputations) { } } // namespace xla - -int main(int argc, char** argv) { - return xla::ParseDebugOptionsFlagsAndRunTests(argc, argv); -} diff --git a/tensorflow/compiler/xla/service/hlo_tfgraph_builder_test.cc b/tensorflow/compiler/xla/service/hlo_tfgraph_builder_test.cc index 8e9d93e367e..f8d98f06785 100644 --- a/tensorflow/compiler/xla/service/hlo_tfgraph_builder_test.cc +++ b/tensorflow/compiler/xla/service/hlo_tfgraph_builder_test.cc @@ -182,7 +182,3 @@ TEST_F(HloTfGraphBuilderTest, EmbeddedComputationsDiamond) { } // namespace } // namespace hlo_graph_dumper } // namespace xla - -int main(int argc, char **argv) { - return xla::ParseDebugOptionsFlagsAndRunTests(argc, argv); -} diff --git a/tensorflow/compiler/xla/service/inliner_test.cc b/tensorflow/compiler/xla/service/inliner_test.cc index 84bfbb30c30..9d845c55456 100644 --- a/tensorflow/compiler/xla/service/inliner_test.cc +++ b/tensorflow/compiler/xla/service/inliner_test.cc @@ -110,7 +110,3 @@ TEST_F(InlinerTest, MapConstant) { } // namespace } // namespace xla - -int main(int argc, char** argv) { - return xla::ParseDebugOptionsFlagsAndRunTests(argc, argv); -} diff --git a/tensorflow/compiler/xla/service/instruction_fusion_test.cc b/tensorflow/compiler/xla/service/instruction_fusion_test.cc index b3e0007dcc2..c7f45e7ab07 100644 --- a/tensorflow/compiler/xla/service/instruction_fusion_test.cc +++ b/tensorflow/compiler/xla/service/instruction_fusion_test.cc @@ -220,7 +220,3 @@ TEST_F(InstructionFusionTest, AllowEffectiveUnaryDuplication) { } } // namespace xla - -int main(int argc, char** argv) { - return xla::ParseDebugOptionsFlagsAndRunTests(argc, argv); -} diff --git a/tensorflow/compiler/xla/service/layout_assignment_test.cc b/tensorflow/compiler/xla/service/layout_assignment_test.cc index f69c043f32b..eb240e6eef3 100644 --- a/tensorflow/compiler/xla/service/layout_assignment_test.cc +++ b/tensorflow/compiler/xla/service/layout_assignment_test.cc @@ -589,7 +589,3 @@ TEST_F(LayoutAssignmentTest, TransposeToBitcastToUser) { } } // namespace } // namespace xla - -int main(int argc, char** argv) { - return xla::ParseDebugOptionsFlagsAndRunTests(argc, argv); -} diff --git a/tensorflow/compiler/xla/service/liveness_util_test.cc b/tensorflow/compiler/xla/service/liveness_util_test.cc index 6a4fde87614..d89dab4a82c 100644 --- a/tensorflow/compiler/xla/service/liveness_util_test.cc +++ b/tensorflow/compiler/xla/service/liveness_util_test.cc @@ -366,7 +366,3 @@ TEST_F(CanShareOperandBufferWithUserTest, WhileCanShare) { } // namespace } // namespace xla - -int main(int argc, char** argv) { - return xla::ParseDebugOptionsFlagsAndRunTests(argc, argv); -} diff --git a/tensorflow/compiler/xla/service/reduce_precision_insertion_test.cc b/tensorflow/compiler/xla/service/reduce_precision_insertion_test.cc index 064020896e7..a62560be599 100644 --- a/tensorflow/compiler/xla/service/reduce_precision_insertion_test.cc +++ b/tensorflow/compiler/xla/service/reduce_precision_insertion_test.cc @@ -549,7 +549,3 @@ TEST_F(ReducePrecisionInsertionTest, MakeFilterFunctionWithSubstrings) { } } // namespace xla - -int main(int argc, char** argv) { - return xla::ParseDebugOptionsFlagsAndRunTests(argc, argv); -} diff --git a/tensorflow/compiler/xla/service/reshape_mover_test.cc b/tensorflow/compiler/xla/service/reshape_mover_test.cc index 1589d52a256..a81d3f4eb34 100644 --- a/tensorflow/compiler/xla/service/reshape_mover_test.cc +++ b/tensorflow/compiler/xla/service/reshape_mover_test.cc @@ -534,7 +534,3 @@ TEST_F(ReshapeMoverTest, MultiplePasses) { } // namespace } // namespace xla - -int main(int argc, char** argv) { - return xla::ParseDebugOptionsFlagsAndRunTests(argc, argv); -} diff --git a/tensorflow/compiler/xla/service/transpose_folding_test.cc b/tensorflow/compiler/xla/service/transpose_folding_test.cc index 4381590a646..a5be4ab7ed4 100644 --- a/tensorflow/compiler/xla/service/transpose_folding_test.cc +++ b/tensorflow/compiler/xla/service/transpose_folding_test.cc @@ -369,7 +369,3 @@ TEST_F(TransposeFoldingTest, FoldConvTransposeLhs) { } // namespace } // namespace xla - -int main(int argc, char** argv) { - return xla::ParseDebugOptionsFlagsAndRunTests(argc, argv); -} diff --git a/tensorflow/compiler/xla/service/tuple_points_to_analysis_test.cc b/tensorflow/compiler/xla/service/tuple_points_to_analysis_test.cc index 5a23553d4ec..dfa94db5dbb 100644 --- a/tensorflow/compiler/xla/service/tuple_points_to_analysis_test.cc +++ b/tensorflow/compiler/xla/service/tuple_points_to_analysis_test.cc @@ -763,7 +763,3 @@ TEST_F(FusionPointsToAnalysisTest, FusionParam0TwoUsers) { } // namespace } // namespace xla - -int main(int argc, char** argv) { - return xla::ParseDebugOptionsFlagsAndRunTests(argc, argv); -} diff --git a/tensorflow/compiler/xla/tests/hlo_test_base.cc b/tensorflow/compiler/xla/tests/hlo_test_base.cc index 8149e2b7cc7..cc321515491 100644 --- a/tensorflow/compiler/xla/tests/hlo_test_base.cc +++ b/tensorflow/compiler/xla/tests/hlo_test_base.cc @@ -173,21 +173,4 @@ string HloTestBase::TestName() { return ::testing::UnitTest::GetInstance()->current_test_info()->name(); } -int ParseDebugOptionsFlagsAndRunTests(int argc, char** argv) { - std::vector flag_list; - xla::legacy_flags::AppendDebugOptionsFlags(&flag_list); - xla::string usage = tensorflow::Flags::Usage(argv[0], flag_list); - const bool parse_result = tensorflow::Flags::Parse(&argc, argv, flag_list); - if (!parse_result) { - LOG(ERROR) << "\n" << usage; - return 2; - } - ::testing::InitGoogleTest(&argc, argv); - if (argc > 1) { - LOG(ERROR) << "Unknown argument " << argv[1] << "\n" << usage; - return 2; - } - return RUN_ALL_TESTS(); -} - } // namespace xla diff --git a/tensorflow/compiler/xla/tests/hlo_test_base.h b/tensorflow/compiler/xla/tests/hlo_test_base.h index 7f3d163290a..b3ab4819b3f 100644 --- a/tensorflow/compiler/xla/tests/hlo_test_base.h +++ b/tensorflow/compiler/xla/tests/hlo_test_base.h @@ -113,11 +113,6 @@ class HloTestBase : public ::testing::Test { std::unique_ptr thread_pool_wrapper_; }; -// Convenience function that parses XLA debug options flags from argc/argv, -// calls InitGoogleTest and then calls and returns RUN_ALL_TESTS. Intended to be -// invoked from a test main() function. -int ParseDebugOptionsFlagsAndRunTests(int argc, char** argv); - } // namespace xla #endif // TENSORFLOW_COMPILER_XLA_TESTS_HLO_TEST_BASE_H_