apollo
apollo copied to clipboard
Need FLAGS_xxx to be set for TEST_F to pass
Describe the bug Using --gtest_filger, it cannot pass some tests
To Reproduce Steps to reproduce the behavior:
your_name@in_dev_docker:/apollo$ bazel-bin/modules/planning/integration_tests/sunnyvale_loop_test --gtest_filter=SunnyvaleLoopTest.qp_path_failure
WARNING: Logging before InitGoogleLogging() is written to STDERR
I0522 16:16:06.084585 17580 class_loader_utility.h:78] [planning] registerclass:PlanningComponent,apollo::cyber::ComponentBase,
I0522 16:16:06.085943 17580 global_data.cc:150] [planning_test] host ip: xxx
Note: Google Test filter = SunnyvaleLoopTest.qp_path_failure
[==========] Running 1 test from 1 test case.
[----------] Global test environment set-up.
[----------] 1 test from SunnyvaleLoopTest
[ RUN ] SunnyvaleLoopTest.qp_path_failure
E0522 16:16:06.090632 17580 planning_test_base.cc:109] [planning_test] Requires FLAGS_test_prediction_file to be set
F0522 16:16:06.090734 17580 planning_test_base.cc:163] Check failed: FeedTestData() Failed to feed test data
*** Check failure stack trace: ***
@ 0x7f8cf6ba7ec0 google::LogMessage::Fail()
@ 0x7f8cf6ba7e07 google::LogMessage::SendToLog()
@ 0x7f8cf6ba77de google::LogMessage::Flush()
@ 0x7f8cf6baa83b google::LogMessageFatal::~LogMessageFatal()
@ 0x7f8d2cf01b4f apollo::planning::PlanningTestBase::SetUp()
@ 0x41f006 apollo::planning::SunnyvaleLoopTest_qp_path_failure_Test::TestBody()
@ 0x7f8cf9a40024 testing::internal::HandleSehExceptionsInMethodIfSupported<>()
@ 0x7f8cf9a3bea0 testing::internal::HandleExceptionsInMethodIfSupported<>()
@ 0x7f8cf9a2c8fb testing::Test::Run()
@ 0x7f8cf9a2d114 testing::TestInfo::Run()
@ 0x7f8cf9a2d75a testing::TestCase::Run()
@ 0x7f8cf9a33f46 testing::internal::UnitTestImpl::RunAllTests()
@ 0x7f8cf9a40dff testing::internal::HandleSehExceptionsInMethodIfSupported<>()
@ 0x7f8cf9a3cb6e testing::internal::HandleExceptionsInMethodIfSupported<>()
@ 0x7f8cf9a32ce2 testing::UnitTest::Run()
@ 0x420cb3 RUN_ALL_TESTS()
@ 0x41f889 main
@ 0x7f8cf473cf45 __libc_start_main
@ 0x41c457 (unknown)
Aborted (core dumped)
Expected behavior
your_name@in_dev_docker:/apollo$ bazel-bin/modules/planning/integration_tests/sunnyvale_loop_test --gtest_filter=SunnyvaleLoopTest.qp_path_failure
WARNING: Logging before InitGoogleLogging() is written to STDERR
I0522 16:15:09.309511 15302 class_loader_utility.h:78] [planning] registerclass:PlanningComponent,apollo::cyber::ComponentBase,
I0522 16:15:09.310784 15302 global_data.cc:150] [planning_test] host ip: xxx
Note: Google Test filter = SunnyvaleLoopTest.qp_path_failure
[==========] Running 1 test from 1 test case.
[----------] Global test environment set-up.
[----------] 1 test from SunnyvaleLoopTest
[ RUN ] SunnyvaleLoopTest.qp_path_failure
[ OK ] SunnyvaleLoopTest.qp_path_failure (1949 ms)
[----------] 1 test from SunnyvaleLoopTest (1949 ms total)
[----------] Global test environment tear-down
[==========] 1 test from 1 test case ran. (1949 ms total)
[ PASSED ] 1 test.
Desktop (please complete the following information):
- OS: Ubuntu 16.04
To fix:
TEST_F(SunnyvaleLoopTest, qp_path_failure) {
// FLAGS_test_prediction_file = "11_prediction.pb.txt"; // Add line like this
std::string seq_num = "12";
FLAGS_reckless_change_lane = true;
FLAGS_test_chassis_file = seq_num + "_chassis.pb.txt";
FLAGS_test_localization_file = seq_num + "_localization.pb.txt";
FLAGS_test_routing_response_file = seq_num + "_routing.pb.txt";
PlanningTestBase::SetUp();
RUN_GOLDEN_TEST(0);
}
@kttnk not really. When it is not set, it will use the current value, which is set by a previous test, "11_predection.pb.txt". So the test actually won't fail.
I'll fix it to make sure it is set for each test though.
https://github.com/ApolloAuto/apollo/pull/9184
I mean if no previous test, that is using gtest_filter, it fail.
Great that you’ll fix it anyway. Thank you.