From 14415c13162d0867b4b21498e3db4daf97327a94 Mon Sep 17 00:00:00 2001 From: Carles Fernandez Date: Fri, 7 Apr 2017 17:02:55 +0200 Subject: [PATCH] Fix test when building with clang 8.0.0 --- .../system-tests/obs_gps_l1_system_test.cc | 20 +++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/src/tests/system-tests/obs_gps_l1_system_test.cc b/src/tests/system-tests/obs_gps_l1_system_test.cc index 4eff21d75..5a19f45d5 100644 --- a/src/tests/system-tests/obs_gps_l1_system_test.cc +++ b/src/tests/system-tests/obs_gps_l1_system_test.cc @@ -33,10 +33,12 @@ #include #include #include +#include #include #include #include #include +#include #include #include #include @@ -57,6 +59,7 @@ concurrent_queue global_gps_acq_assist_queue; concurrent_map global_gps_acq_assist_map; + class Obs_Gps_L1_System_Test: public ::testing::Test { public: @@ -71,7 +74,7 @@ public: std::string filename_rinex_obs = FLAGS_filename_rinex_obs; std::string filename_raw_data = FLAGS_filename_raw_data; - + std::string generated_rinex_obs; int configure_generator(); int generate_signal(); int configure_receiver(); @@ -82,7 +85,6 @@ public: double compute_stdev(const std::vector & vec); std::shared_ptr config; - std::string generated_rinex_obs; }; @@ -341,6 +343,7 @@ int Obs_Gps_L1_System_Test::run_receiver() std::cout << "STD exception: " << ex.what(); } // Get the name of the RINEX obs file generated by the receiver + std::this_thread::sleep_for(std::chrono::milliseconds(2000)); FILE *fp; std::string argum2 = std::string("/bin/ls *O | grep GSDR | tail -1"); char buffer[1035]; @@ -350,15 +353,12 @@ int Obs_Gps_L1_System_Test::run_receiver() std::cout << "Failed to run command: " << argum2 << std::endl; return -1; } - char * without_trailing = (char*)"0"; while (fgets(buffer, sizeof(buffer), fp) != NULL) { std::string aux = std::string(buffer); - without_trailing = strtok(&aux[0], "\n"); + Obs_Gps_L1_System_Test::generated_rinex_obs = aux.erase(aux.length() - 1, 1); } - generated_rinex_obs = std::string(without_trailing); pclose(fp); - return 0; } @@ -436,7 +436,7 @@ void Obs_Gps_L1_System_Test::check_results() try { - std::string arg2_gen = std::string("./") + generated_rinex_obs; + std::string arg2_gen = std::string("./") + Obs_Gps_L1_System_Test::generated_rinex_obs; gpstk::Rinex3ObsStream r_meas(arg2_gen); r_meas.exceptions(std::ios::failbit); gpstk::Rinex3ObsData r_meas_data; @@ -685,9 +685,9 @@ TEST_F(Obs_Gps_L1_System_Test, Observables_system_test) // Run the receiver EXPECT_EQ( run_receiver(), 0) << "Problem executing the software-defined signal generator"; - std::cout << "Validating RINEX obs file obtained by GNSS-SDR: " << generated_rinex_obs << " ..." << std::endl; - is_gen_rinex_obs_valid = check_valid_rinex_obs( "./" + generated_rinex_obs); - EXPECT_EQ(true, is_gen_rinex_obs_valid) << "The RINEX observation file " << generated_rinex_obs << ", generated by GNSS-SDR, is not well formed."; + std::cout << "Validating RINEX obs file obtained by GNSS-SDR: " << Obs_Gps_L1_System_Test::generated_rinex_obs << " ..." << std::endl; + is_gen_rinex_obs_valid = check_valid_rinex_obs( "./" + Obs_Gps_L1_System_Test::generated_rinex_obs); + EXPECT_EQ(true, is_gen_rinex_obs_valid) << "The RINEX observation file " << Obs_Gps_L1_System_Test::generated_rinex_obs << ", generated by GNSS-SDR, is not well formed."; std::cout << "The file is valid." << std::endl; // Check results