1
0
mirror of https://github.com/gnss-sdr/gnss-sdr synced 2024-09-29 15:30:52 +00:00

Fix test when building with clang 8.0.0

This commit is contained in:
Carles Fernandez 2017-04-07 17:02:55 +02:00
parent 80f985789b
commit 14415c1316

View File

@ -33,10 +33,12 @@
#include <exception>
#include <iostream>
#include <cstring>
#include <chrono>
#include <numeric>
#include <stdio.h>
#include <stdlib.h>
#include <sys/wait.h>
#include <thread>
#include <unistd.h>
#include <gflags/gflags.h>
#include <glog/logging.h>
@ -57,6 +59,7 @@
concurrent_queue<Gps_Acq_Assist> global_gps_acq_assist_queue;
concurrent_map<Gps_Acq_Assist> 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<double> & vec);
std::shared_ptr<InMemoryConfiguration> 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