From 02ea8acbfd0f69b0457d464df4c585cba22b46f5 Mon Sep 17 00:00:00 2001 From: Carles Fernandez Date: Fri, 11 Aug 2017 13:11:38 +0200 Subject: [PATCH] Always initialize elapsed_seconds It was causing warnings in GCC. Some code style applied. --- src/algorithms/PVT/libs/geojson_printer.cc | 5 +- src/main/main.cc | 4 +- src/tests/system-tests/position_test.cc | 1 + src/tests/system-tests/ttff_gps_l1.cc | 19 +++---- ...8ms_ambiguous_acquisition_gsoc2013_test.cc | 13 ++++- ...cps_ambiguous_acquisition_gsoc2013_test.cc | 4 +- ...e1_pcps_ambiguous_acquisition_gsoc_test.cc | 10 +++- ...ileo_e1_pcps_ambiguous_acquisition_test.cc | 4 +- ...wsr_ambiguous_acquisition_gsoc2013_test.cc | 14 ++++- ...ync_ambiguous_acquisition_gsoc2014_test.cc | 4 +- ...ong_ambiguous_acquisition_gsoc2013_test.cc | 4 +- ...cps_acquisition_gsoc2014_gensource_test.cc | 5 +- ...ps_l1_ca_pcps_acquisition_gsoc2013_test.cc | 13 ++++- .../gps_l1_ca_pcps_acquisition_test.cc | 4 +- .../gps_l1_ca_pcps_acquisition_test_fpga.cc | 56 ++++++++----------- ...s_multithread_acquisition_gsoc2013_test.cc | 13 ++++- ...a_pcps_opencl_acquisition_gsoc2013_test.cc | 15 ++++- ...cps_quicksync_acquisition_gsoc2014_test.cc | 15 ++--- ..._ca_pcps_tong_acquisition_gsoc2013_test.cc | 16 +++++- .../gps_l2_m_pcps_acquisition_test.cc | 8 +-- .../filter/fir_filter_test.cc | 10 ++-- .../observables/hybrid_observables_test.cc | 2 +- .../direct_resampler_conditioner_cc_test.cc | 2 +- .../gps_l1_ca_telemetry_decoder_test.cc | 2 +- .../tracking/cpu_multicorrelator_test.cc | 16 +++--- .../galileo_e1_dll_pll_veml_tracking_test.cc | 7 +-- .../tracking/galileo_e5a_tracking_test.cc | 3 +- .../gps_l1_ca_dll_pll_tracking_test.cc | 16 +++--- .../gps_l1_ca_dll_pll_tracking_test_fpga.cc | 2 +- .../gps_l2_m_dll_pll_tracking_test.cc | 7 ++- .../tracking/gpu_multicorrelator_test.cc | 2 +- 31 files changed, 170 insertions(+), 126 deletions(-) diff --git a/src/algorithms/PVT/libs/geojson_printer.cc b/src/algorithms/PVT/libs/geojson_printer.cc index b86d01a8e..cf4599b85 100644 --- a/src/algorithms/PVT/libs/geojson_printer.cc +++ b/src/algorithms/PVT/libs/geojson_printer.cc @@ -42,7 +42,6 @@ GeoJSON_Printer::GeoJSON_Printer() } - GeoJSON_Printer::~GeoJSON_Printer () { GeoJSON_Printer::close_file(); @@ -51,7 +50,7 @@ GeoJSON_Printer::~GeoJSON_Printer () bool GeoJSON_Printer::set_headers(std::string filename, bool time_tag_name) { - boost::posix_time::ptime pt = boost::posix_time::second_clock::local_time(); //::local_sec_clock::local_time(zone); + boost::posix_time::ptime pt = boost::posix_time::second_clock::local_time(); tm timeinfo = boost::posix_time::to_tm(pt); if (time_tag_name) @@ -129,7 +128,6 @@ bool GeoJSON_Printer::set_headers(std::string filename, bool time_tag_name) } - bool GeoJSON_Printer::print_position(const std::shared_ptr& position, bool print_average_values) { double latitude; @@ -172,7 +170,6 @@ bool GeoJSON_Printer::print_position(const std::shared_ptr& positi } - bool GeoJSON_Printer::close_file() { if (geojson_file.is_open()) diff --git a/src/main/main.cc b/src/main/main.cc index 5b5d2dc07..cd552bd71 100644 --- a/src/main/main.cc +++ b/src/main/main.cc @@ -155,8 +155,8 @@ int main(int argc, char** argv) end = std::chrono::system_clock::now(); std::chrono::duration elapsed_seconds = end - start; - std::cout << "Total GNSS-SDR run time " - << elapsed_seconds.count() + std::cout << "Total GNSS-SDR run time: " + << elapsed_seconds.count() << " [seconds]" << std::endl; google::ShutDownCommandLineFlags(); diff --git a/src/tests/system-tests/position_test.cc b/src/tests/system-tests/position_test.cc index 4c6a04970..51182b8d7 100644 --- a/src/tests/system-tests/position_test.cc +++ b/src/tests/system-tests/position_test.cc @@ -29,6 +29,7 @@ * ------------------------------------------------------------------------- */ +#include #include #include #include diff --git a/src/tests/system-tests/ttff_gps_l1.cc b/src/tests/system-tests/ttff_gps_l1.cc index 0b55a6d66..82dd6497b 100644 --- a/src/tests/system-tests/ttff_gps_l1.cc +++ b/src/tests/system-tests/ttff_gps_l1.cc @@ -42,6 +42,7 @@ #include #include #include +#include #include #include #include @@ -301,40 +302,38 @@ void TfttGpsL1CATest::print_TTFF_report(const std::vector & ttff_v, std: std::string filename = "ttff_report"; std::string filename_; - time_t rawtime; - struct tm * timeinfo; - time ( &rawtime ); - timeinfo = localtime ( &rawtime ); + boost::posix_time::ptime pt = boost::posix_time::second_clock::local_time(); + tm timeinfo = boost::posix_time::to_tm(pt); std::stringstream strm0; - const int year = timeinfo->tm_year - 100; + const int year = timeinfo.tm_year - 100; strm0 << year; - const int month = timeinfo->tm_mon + 1; + const int month = timeinfo.tm_mon + 1; if(month < 10) { strm0 << "0"; } strm0 << month; - const int day = timeinfo->tm_mday; + const int day = timeinfo.tm_mday; if(day < 10) { strm0 << "0"; } strm0 << day << "_"; - const int hour = timeinfo->tm_hour; + const int hour = timeinfo.tm_hour; if(hour < 10) { strm0 << "0"; } strm0 << hour; - const int min = timeinfo->tm_min; + const int min = timeinfo.tm_min; if(min < 10) { strm0 << "0"; } strm0 << min; - const int sec = timeinfo->tm_sec; + const int sec = timeinfo.tm_sec; if(sec < 10) { strm0 << "0"; diff --git a/src/tests/unit-tests/signal-processing-blocks/acquisition/galileo_e1_pcps_8ms_ambiguous_acquisition_gsoc2013_test.cc b/src/tests/unit-tests/signal-processing-blocks/acquisition/galileo_e1_pcps_8ms_ambiguous_acquisition_gsoc2013_test.cc index 747924049..fafa14140 100644 --- a/src/tests/unit-tests/signal-processing-blocks/acquisition/galileo_e1_pcps_8ms_ambiguous_acquisition_gsoc2013_test.cc +++ b/src/tests/unit-tests/signal-processing-blocks/acquisition/galileo_e1_pcps_8ms_ambiguous_acquisition_gsoc2013_test.cc @@ -165,6 +165,7 @@ protected: double Pfa_a; }; + void GalileoE1Pcps8msAmbiguousAcquisitionGSoC2013Test::init() { message = 0; @@ -180,6 +181,7 @@ void GalileoE1Pcps8msAmbiguousAcquisitionGSoC2013Test::init() Pfa_a = 0; } + void GalileoE1Pcps8msAmbiguousAcquisitionGSoC2013Test::config_1() { gnss_synchro.Channel_ID = 0; @@ -247,6 +249,7 @@ void GalileoE1Pcps8msAmbiguousAcquisitionGSoC2013Test::config_1() config->set_property("Acquisition.dump", "false"); } + void GalileoE1Pcps8msAmbiguousAcquisitionGSoC2013Test::config_2() { gnss_synchro.Channel_ID = 0; @@ -332,12 +335,14 @@ void GalileoE1Pcps8msAmbiguousAcquisitionGSoC2013Test::config_2() config->set_property("Acquisition.dump", "false"); } + void GalileoE1Pcps8msAmbiguousAcquisitionGSoC2013Test::start_queue() { stop = false; ch_thread = boost::thread(&GalileoE1Pcps8msAmbiguousAcquisitionGSoC2013Test::wait_message, this); } + void GalileoE1Pcps8msAmbiguousAcquisitionGSoC2013Test::wait_message() { std::chrono::time_point start, end; @@ -366,6 +371,7 @@ void GalileoE1Pcps8msAmbiguousAcquisitionGSoC2013Test::wait_message() } } + void GalileoE1Pcps8msAmbiguousAcquisitionGSoC2013Test::process_message() { if (message == 1) @@ -405,22 +411,25 @@ void GalileoE1Pcps8msAmbiguousAcquisitionGSoC2013Test::process_message() } } + void GalileoE1Pcps8msAmbiguousAcquisitionGSoC2013Test::stop_queue() { stop = true; } + TEST_F(GalileoE1Pcps8msAmbiguousAcquisitionGSoC2013Test, Instantiate) { config_1(); std::shared_ptr acq_ = factory->GetBlock(config, "Acquisition", "Galileo_E1_PCPS_8ms_Ambiguous_Acquisition", 1, 1); } + TEST_F(GalileoE1Pcps8msAmbiguousAcquisitionGSoC2013Test, ConnectAndRun) { int nsamples = floor(fs_in*integration_time_ms*1e-3); std::chrono::time_point start, end; - std::chrono::duration elapsed_seconds; + std::chrono::duration elapsed_seconds(0); config_1(); queue = gr::msg_queue::make(0); @@ -469,6 +478,7 @@ TEST_F(GalileoE1Pcps8msAmbiguousAcquisitionGSoC2013Test, ConnectAndRun) std::cout << "Processed " << nsamples << " samples in " << elapsed_seconds.count() * 1e6 << " microseconds" << std::endl; } + TEST_F(GalileoE1Pcps8msAmbiguousAcquisitionGSoC2013Test, ValidationOfResults) { config_1(); @@ -558,6 +568,7 @@ TEST_F(GalileoE1Pcps8msAmbiguousAcquisitionGSoC2013Test, ValidationOfResults) } } + TEST_F(GalileoE1Pcps8msAmbiguousAcquisitionGSoC2013Test, ValidationOfResultsProbabilities) { config_2(); diff --git a/src/tests/unit-tests/signal-processing-blocks/acquisition/galileo_e1_pcps_ambiguous_acquisition_gsoc2013_test.cc b/src/tests/unit-tests/signal-processing-blocks/acquisition/galileo_e1_pcps_ambiguous_acquisition_gsoc2013_test.cc index b77bb94c5..77101bfc5 100644 --- a/src/tests/unit-tests/signal-processing-blocks/acquisition/galileo_e1_pcps_ambiguous_acquisition_gsoc2013_test.cc +++ b/src/tests/unit-tests/signal-processing-blocks/acquisition/galileo_e1_pcps_ambiguous_acquisition_gsoc2013_test.cc @@ -355,7 +355,7 @@ void GalileoE1PcpsAmbiguousAcquisitionGSoC2013Test::start_queue() void GalileoE1PcpsAmbiguousAcquisitionGSoC2013Test::wait_message() { std::chrono::time_point start, end; - std::chrono::duration elapsed_seconds; + std::chrono::duration elapsed_seconds(0); while (!stop) { @@ -433,7 +433,7 @@ TEST_F(GalileoE1PcpsAmbiguousAcquisitionGSoC2013Test, ConnectAndRun) { int nsamples = floor(fs_in*integration_time_ms*1e-3); std::chrono::time_point start, end; - std::chrono::duration elapsed_seconds; + std::chrono::duration elapsed_seconds(0); top_block = gr::make_top_block("Acquisition test"); queue = gr::msg_queue::make(0); config_1(); diff --git a/src/tests/unit-tests/signal-processing-blocks/acquisition/galileo_e1_pcps_ambiguous_acquisition_gsoc_test.cc b/src/tests/unit-tests/signal-processing-blocks/acquisition/galileo_e1_pcps_ambiguous_acquisition_gsoc_test.cc index f5a428bbf..0bda37561 100644 --- a/src/tests/unit-tests/signal-processing-blocks/acquisition/galileo_e1_pcps_ambiguous_acquisition_gsoc_test.cc +++ b/src/tests/unit-tests/signal-processing-blocks/acquisition/galileo_e1_pcps_ambiguous_acquisition_gsoc_test.cc @@ -149,6 +149,7 @@ protected: boost::thread ch_thread; }; + void GalileoE1PcpsAmbiguousAcquisitionGSoCTest::init() { gnss_synchro.Channel_ID = 0; @@ -170,6 +171,7 @@ void GalileoE1PcpsAmbiguousAcquisitionGSoCTest::init() config->set_property("Acquisition0.cboc", "true"); } + void GalileoE1PcpsAmbiguousAcquisitionGSoCTest::start_queue() { ch_thread = boost::thread(&GalileoE1PcpsAmbiguousAcquisitionGSoCTest::wait_message, this); @@ -193,13 +195,13 @@ void GalileoE1PcpsAmbiguousAcquisitionGSoCTest::wait_message() } } + void GalileoE1PcpsAmbiguousAcquisitionGSoCTest::stop_queue() { stop = true; } - TEST_F(GalileoE1PcpsAmbiguousAcquisitionGSoCTest, Instantiate) { init(); @@ -208,12 +210,13 @@ TEST_F(GalileoE1PcpsAmbiguousAcquisitionGSoCTest, Instantiate) EXPECT_STREQ("Galileo_E1_PCPS_Ambiguous_Acquisition", acquisition->implementation().c_str()); } + TEST_F(GalileoE1PcpsAmbiguousAcquisitionGSoCTest, ConnectAndRun) { int fs_in = 4000000; int nsamples = 4*fs_in; std::chrono::time_point start, end; - std::chrono::duration elapsed_seconds; + std::chrono::duration elapsed_seconds(0); queue = gr::msg_queue::make(0); top_block = gr::make_top_block("Acquisition test"); @@ -240,10 +243,11 @@ TEST_F(GalileoE1PcpsAmbiguousAcquisitionGSoCTest, ConnectAndRun) std::cout << "Processed " << nsamples << " samples in " << elapsed_seconds.count() * 1e6 << " microseconds" << std::endl; } + TEST_F(GalileoE1PcpsAmbiguousAcquisitionGSoCTest, ValidationOfResults) { std::chrono::time_point start, end; - std::chrono::duration elapsed_seconds; + std::chrono::duration elapsed_seconds(0); queue = gr::msg_queue::make(0); top_block = gr::make_top_block("Acquisition test"); diff --git a/src/tests/unit-tests/signal-processing-blocks/acquisition/galileo_e1_pcps_ambiguous_acquisition_test.cc b/src/tests/unit-tests/signal-processing-blocks/acquisition/galileo_e1_pcps_ambiguous_acquisition_test.cc index 10f4dc7d3..1f04c7199 100644 --- a/src/tests/unit-tests/signal-processing-blocks/acquisition/galileo_e1_pcps_ambiguous_acquisition_test.cc +++ b/src/tests/unit-tests/signal-processing-blocks/acquisition/galileo_e1_pcps_ambiguous_acquisition_test.cc @@ -166,7 +166,7 @@ TEST_F(GalileoE1PcpsAmbiguousAcquisitionTest, ConnectAndRun) int fs_in = 4000000; int nsamples = 4*fs_in; std::chrono::time_point start, end; - std::chrono::duration elapsed_seconds; + std::chrono::duration elapsed_seconds(0); top_block = gr::make_top_block("Acquisition test"); gr::msg_queue::sptr queue = gr::msg_queue::make(0); init(); @@ -196,7 +196,7 @@ TEST_F(GalileoE1PcpsAmbiguousAcquisitionTest, ConnectAndRun) TEST_F(GalileoE1PcpsAmbiguousAcquisitionTest, ValidationOfResults) { std::chrono::time_point start, end; - std::chrono::duration elapsed_seconds; + std::chrono::duration elapsed_seconds(0); double expected_delay_samples = 2920; //18250; double expected_doppler_hz = -632; diff --git a/src/tests/unit-tests/signal-processing-blocks/acquisition/galileo_e1_pcps_cccwsr_ambiguous_acquisition_gsoc2013_test.cc b/src/tests/unit-tests/signal-processing-blocks/acquisition/galileo_e1_pcps_cccwsr_ambiguous_acquisition_gsoc2013_test.cc index e04dc7050..02d78b9e9 100644 --- a/src/tests/unit-tests/signal-processing-blocks/acquisition/galileo_e1_pcps_cccwsr_ambiguous_acquisition_gsoc2013_test.cc +++ b/src/tests/unit-tests/signal-processing-blocks/acquisition/galileo_e1_pcps_cccwsr_ambiguous_acquisition_gsoc2013_test.cc @@ -167,6 +167,7 @@ protected: double Pfa_a; }; + void GalileoE1PcpsCccwsrAmbiguousAcquisitionTest::init() { message = 0; @@ -182,6 +183,7 @@ void GalileoE1PcpsCccwsrAmbiguousAcquisitionTest::init() Pfa_a = 0; } + void GalileoE1PcpsCccwsrAmbiguousAcquisitionTest::config_1() { gnss_synchro.Channel_ID = 0; @@ -252,6 +254,7 @@ void GalileoE1PcpsCccwsrAmbiguousAcquisitionTest::config_1() config->set_property("Acquisition.dump", "false"); } + void GalileoE1PcpsCccwsrAmbiguousAcquisitionTest::config_2() { gnss_synchro.Channel_ID = 0; @@ -340,6 +343,7 @@ void GalileoE1PcpsCccwsrAmbiguousAcquisitionTest::config_2() config->set_property("Acquisition.dump", "false"); } + void GalileoE1PcpsCccwsrAmbiguousAcquisitionTest::start_queue() { stop = false; @@ -350,7 +354,7 @@ void GalileoE1PcpsCccwsrAmbiguousAcquisitionTest::start_queue() void GalileoE1PcpsCccwsrAmbiguousAcquisitionTest::wait_message() { std::chrono::time_point start, end; - std::chrono::duration elapsed_seconds; + std::chrono::duration elapsed_seconds(0); while (!stop) { @@ -369,6 +373,7 @@ void GalileoE1PcpsCccwsrAmbiguousAcquisitionTest::wait_message() } } + void GalileoE1PcpsCccwsrAmbiguousAcquisitionTest::process_message() { if (message == 1) @@ -410,11 +415,13 @@ void GalileoE1PcpsCccwsrAmbiguousAcquisitionTest::process_message() } } + void GalileoE1PcpsCccwsrAmbiguousAcquisitionTest::stop_queue() { stop = true; } + TEST_F(GalileoE1PcpsCccwsrAmbiguousAcquisitionTest, Instantiate) { config_1(); @@ -422,11 +429,12 @@ TEST_F(GalileoE1PcpsCccwsrAmbiguousAcquisitionTest, Instantiate) acquisition = std::dynamic_pointer_cast(acq_); } + TEST_F(GalileoE1PcpsCccwsrAmbiguousAcquisitionTest, ConnectAndRun) { int nsamples = floor(fs_in*integration_time_ms*1e-3); std::chrono::time_point start, end; - std::chrono::duration elapsed_seconds; + std::chrono::duration elapsed_seconds(0); config_1(); top_block = gr::make_top_block("Acquisition test"); @@ -455,6 +463,7 @@ TEST_F(GalileoE1PcpsCccwsrAmbiguousAcquisitionTest, ConnectAndRun) std::cout << "Processed " << nsamples << " samples in " << elapsed_seconds.count() * 1e6 << " microseconds" << std::endl; } + TEST_F(GalileoE1PcpsCccwsrAmbiguousAcquisitionTest, ValidationOfResults) { config_1(); @@ -553,6 +562,7 @@ TEST_F(GalileoE1PcpsCccwsrAmbiguousAcquisitionTest, ValidationOfResults) } } + TEST_F(GalileoE1PcpsCccwsrAmbiguousAcquisitionTest, ValidationOfResultsProbabilities) { config_2(); diff --git a/src/tests/unit-tests/signal-processing-blocks/acquisition/galileo_e1_pcps_quicksync_ambiguous_acquisition_gsoc2014_test.cc b/src/tests/unit-tests/signal-processing-blocks/acquisition/galileo_e1_pcps_quicksync_ambiguous_acquisition_gsoc2014_test.cc index 5ea5c53f0..e22f22f9c 100644 --- a/src/tests/unit-tests/signal-processing-blocks/acquisition/galileo_e1_pcps_quicksync_ambiguous_acquisition_gsoc2014_test.cc +++ b/src/tests/unit-tests/signal-processing-blocks/acquisition/galileo_e1_pcps_quicksync_ambiguous_acquisition_gsoc2014_test.cc @@ -467,7 +467,7 @@ void GalileoE1PcpsQuickSyncAmbiguousAcquisitionGSoC2014Test::start_queue() void GalileoE1PcpsQuickSyncAmbiguousAcquisitionGSoC2014Test::wait_message() { std::chrono::time_point begin, end; - std::chrono::duration elapsed_seconds; + std::chrono::duration elapsed_seconds(0); while (!stop) { @@ -557,7 +557,7 @@ TEST_F(GalileoE1PcpsQuickSyncAmbiguousAcquisitionGSoC2014Test, ConnectAndRun) LOG(INFO) << "**Start connect and run test"; int nsamples = floor(fs_in*integration_time_ms*1e-3); std::chrono::time_point begin, end; - std::chrono::duration elapsed_seconds; + std::chrono::duration elapsed_seconds(0); top_block = gr::make_top_block("Acquisition test"); queue = gr::msg_queue::make(0); diff --git a/src/tests/unit-tests/signal-processing-blocks/acquisition/galileo_e1_pcps_tong_ambiguous_acquisition_gsoc2013_test.cc b/src/tests/unit-tests/signal-processing-blocks/acquisition/galileo_e1_pcps_tong_ambiguous_acquisition_gsoc2013_test.cc index 9d262370d..bf3ce39f1 100644 --- a/src/tests/unit-tests/signal-processing-blocks/acquisition/galileo_e1_pcps_tong_ambiguous_acquisition_gsoc2013_test.cc +++ b/src/tests/unit-tests/signal-processing-blocks/acquisition/galileo_e1_pcps_tong_ambiguous_acquisition_gsoc2013_test.cc @@ -360,7 +360,7 @@ void GalileoE1PcpsTongAmbiguousAcquisitionGSoC2013Test::start_queue() void GalileoE1PcpsTongAmbiguousAcquisitionGSoC2013Test::wait_message() { std::chrono::time_point start, end; - std::chrono::duration elapsed_seconds; + std::chrono::duration elapsed_seconds(0); while (!stop) { @@ -440,7 +440,7 @@ TEST_F(GalileoE1PcpsTongAmbiguousAcquisitionGSoC2013Test, ConnectAndRun) { int nsamples = floor(fs_in*integration_time_ms*1e-3); std::chrono::time_point start, end; - std::chrono::duration elapsed_seconds; + std::chrono::duration elapsed_seconds(0); top_block = gr::make_top_block("Acquisition test"); queue = gr::msg_queue::make(0); config_1(); diff --git a/src/tests/unit-tests/signal-processing-blocks/acquisition/galileo_e5a_pcps_acquisition_gsoc2014_gensource_test.cc b/src/tests/unit-tests/signal-processing-blocks/acquisition/galileo_e5a_pcps_acquisition_gsoc2014_gensource_test.cc index 1c2c4ea62..533880d70 100644 --- a/src/tests/unit-tests/signal-processing-blocks/acquisition/galileo_e5a_pcps_acquisition_gsoc2014_gensource_test.cc +++ b/src/tests/unit-tests/signal-processing-blocks/acquisition/galileo_e5a_pcps_acquisition_gsoc2014_gensource_test.cc @@ -476,7 +476,7 @@ void GalileoE5aPcpsAcquisitionGSoC2014GensourceTest::start_queue() void GalileoE5aPcpsAcquisitionGSoC2014GensourceTest::wait_message() { std::chrono::time_point start, end; - std::chrono::duration elapsed_seconds; + std::chrono::duration elapsed_seconds(0); while (!stop) { @@ -581,7 +581,7 @@ TEST_F(GalileoE5aPcpsAcquisitionGSoC2014GensourceTest, ConnectAndRun) //int nsamples = floor(5*fs_in*integration_time_ms*1e-3); int nsamples = 21000*3; std::chrono::time_point start, end; - std::chrono::duration elapsed_seconds; + std::chrono::duration elapsed_seconds(0); acquisition = std::make_shared(config.get(), "Acquisition", 1, 1); boost::shared_ptr msg_rx = GalileoE5aPcpsAcquisitionGSoC2014GensourceTest_msg_rx_make(channel_internal_queue); queue = gr::msg_queue::make(0); @@ -761,7 +761,6 @@ TEST_F(GalileoE5aPcpsAcquisitionGSoC2014GensourceTest, ValidationOfSIM) //std::cout << gnss_synchro.Acq_delay_samples << "acq delay" <set_property("Acquisition.dump", "false"); } + void GpsL1CaPcpsAcquisitionGSoC2013Test::config_2() { gnss_synchro.Channel_ID = 0; @@ -344,16 +345,18 @@ void GpsL1CaPcpsAcquisitionGSoC2013Test::config_2() config->set_property("Acquisition.dump", "false"); } + void GpsL1CaPcpsAcquisitionGSoC2013Test::start_queue() { stop = false; ch_thread = boost::thread(&GpsL1CaPcpsAcquisitionGSoC2013Test::wait_message, this); } + void GpsL1CaPcpsAcquisitionGSoC2013Test::wait_message() { std::chrono::time_point start, end; - std::chrono::duration elapsed_seconds; + std::chrono::duration elapsed_seconds(0); while (!stop) { @@ -372,6 +375,7 @@ void GpsL1CaPcpsAcquisitionGSoC2013Test::wait_message() } } + void GpsL1CaPcpsAcquisitionGSoC2013Test::process_message() { if (message == 1) @@ -411,11 +415,13 @@ void GpsL1CaPcpsAcquisitionGSoC2013Test::process_message() } } + void GpsL1CaPcpsAcquisitionGSoC2013Test::stop_queue() { stop = true; } + TEST_F(GpsL1CaPcpsAcquisitionGSoC2013Test, Instantiate) { config_1(); @@ -423,11 +429,12 @@ TEST_F(GpsL1CaPcpsAcquisitionGSoC2013Test, Instantiate) delete acquisition; } + TEST_F(GpsL1CaPcpsAcquisitionGSoC2013Test, ConnectAndRun) { int nsamples = floor(fs_in*integration_time_ms*1e-3); std::chrono::time_point start, end; - std::chrono::duration elapsed_seconds; + std::chrono::duration elapsed_seconds(0); queue = gr::msg_queue::make(0); top_block = gr::make_top_block("Acquisition test"); @@ -456,6 +463,7 @@ TEST_F(GpsL1CaPcpsAcquisitionGSoC2013Test, ConnectAndRun) delete acquisition; } + TEST_F(GpsL1CaPcpsAcquisitionGSoC2013Test, ValidationOfResults) { config_1(); @@ -552,6 +560,7 @@ TEST_F(GpsL1CaPcpsAcquisitionGSoC2013Test, ValidationOfResults) delete acquisition; } + TEST_F(GpsL1CaPcpsAcquisitionGSoC2013Test, ValidationOfResultsProbabilities) { config_2(); diff --git a/src/tests/unit-tests/signal-processing-blocks/acquisition/gps_l1_ca_pcps_acquisition_test.cc b/src/tests/unit-tests/signal-processing-blocks/acquisition/gps_l1_ca_pcps_acquisition_test.cc index 65dcdb31b..be321f797 100644 --- a/src/tests/unit-tests/signal-processing-blocks/acquisition/gps_l1_ca_pcps_acquisition_test.cc +++ b/src/tests/unit-tests/signal-processing-blocks/acquisition/gps_l1_ca_pcps_acquisition_test.cc @@ -163,7 +163,7 @@ TEST_F(GpsL1CaPcpsAcquisitionTest, ConnectAndRun) int fs_in = 4000000; int nsamples = 4000; std::chrono::time_point start, end; - std::chrono::duration elapsed_seconds; + std::chrono::duration elapsed_seconds(0); gr::msg_queue::sptr queue = gr::msg_queue::make(0); top_block = gr::make_top_block("Acquisition test"); @@ -195,7 +195,7 @@ TEST_F(GpsL1CaPcpsAcquisitionTest, ConnectAndRun) TEST_F(GpsL1CaPcpsAcquisitionTest, ValidationOfResults) { std::chrono::time_point start, end; - std::chrono::duration elapsed_seconds; + std::chrono::duration elapsed_seconds(0); top_block = gr::make_top_block("Acquisition test"); double expected_delay_samples = 524; diff --git a/src/tests/unit-tests/signal-processing-blocks/acquisition/gps_l1_ca_pcps_acquisition_test_fpga.cc b/src/tests/unit-tests/signal-processing-blocks/acquisition/gps_l1_ca_pcps_acquisition_test_fpga.cc index 7a3e0fa9c..b358d2642 100644 --- a/src/tests/unit-tests/signal-processing-blocks/acquisition/gps_l1_ca_pcps_acquisition_test_fpga.cc +++ b/src/tests/unit-tests/signal-processing-blocks/acquisition/gps_l1_ca_pcps_acquisition_test_fpga.cc @@ -51,18 +51,17 @@ #include -#define DMA_ACQ_TRANSFER_SIZE 2046 // DMA transfer size for the acquisition -#define RX_SIGNAL_MAX_VALUE 127 // 2^7 - 1 for 8-bit signed values -#define NTIMES_CYCLE_THROUGH_RX_SAMPLES_FILE 50 // number of times we cycle through the file containing the received samples -#define ONE_SECOND 1000000 // one second in microseconds -#define FLOAT_SIZE (sizeof(float)) // size of the float variable in characters +#define DMA_ACQ_TRANSFER_SIZE 2046 // DMA transfer size for the acquisition +#define RX_SIGNAL_MAX_VALUE 127 // 2^7 - 1 for 8-bit signed values +#define NTIMES_CYCLE_THROUGH_RX_SAMPLES_FILE 50 // number of times we cycle through the file containing the received samples +#define ONE_SECOND 1000000 // one second in microseconds +#define FLOAT_SIZE (sizeof(float)) // size of the float variable in characters // thread that reads the file containing the received samples, scales the samples to the dynamic range of the fixed point values, sends // the samples to the DMA and finally it stops the top block void thread_acquisition_send_rx_samples(gr::top_block_sptr top_block, const char * file_name) { - FILE *rx_signal_file; // file descriptor int file_length; // length of the file containing the received samples int dma_descr; // DMA descriptor @@ -106,7 +105,6 @@ void thread_acquisition_send_rx_samples(gr::top_block_sptr top_block, { max = (pointer_float[0]); } - } // go back to the beginning of the file containing the received samples @@ -132,26 +130,20 @@ void thread_acquisition_send_rx_samples(gr::top_block_sptr top_block, for (int k = 0; k < NTIMES_CYCLE_THROUGH_RX_SAMPLES_FILE; k++) { - fseek(rx_signal_file, 0, SEEK_SET); int transfer_size; int num_transferred_samples = 0; while (num_transferred_samples < (int) (file_length / FLOAT_SIZE)) { - if (((file_length / FLOAT_SIZE) - num_transferred_samples) - > DMA_ACQ_TRANSFER_SIZE) + if (((file_length / FLOAT_SIZE) - num_transferred_samples) > DMA_ACQ_TRANSFER_SIZE) { - transfer_size = DMA_ACQ_TRANSFER_SIZE; - num_transferred_samples = num_transferred_samples - + DMA_ACQ_TRANSFER_SIZE; - + num_transferred_samples = num_transferred_samples + DMA_ACQ_TRANSFER_SIZE; } else { - transfer_size = file_length / FLOAT_SIZE - - num_transferred_samples; + transfer_size = file_length / FLOAT_SIZE - num_transferred_samples; num_transferred_samples = file_length / FLOAT_SIZE; } @@ -160,16 +152,12 @@ void thread_acquisition_send_rx_samples(gr::top_block_sptr top_block, fread(buffer_float, FLOAT_SIZE, 1, rx_signal_file); // specify (float) (int) for a quantization maximizing the dynamic range - buffer_DMA[t] = (signed char) ((pointer_float[0] - * (RX_SIGNAL_MAX_VALUE - 1)) / max); - + buffer_DMA[t] = (signed char) ((pointer_float[0] * (RX_SIGNAL_MAX_VALUE - 1)) / max); } //send_acquisition_gps_input_samples(buffer_DMA, transfer_size, dma_descr); - assert( - transfer_size == write(dma_descr, &buffer_DMA[0], transfer_size)); + assert(transfer_size == write(dma_descr, &buffer_DMA[0], transfer_size)); } - } fclose(rx_signal_file); free(buffer_float); @@ -179,9 +167,9 @@ void thread_acquisition_send_rx_samples(gr::top_block_sptr top_block, // when all the samples are sent stop the top block top_block->stop(); - } + // ######## GNURADIO BLOCK MESSAGE RECEVER ######### class GpsL1CaPcpsAcquisitionTestFpga_msg_rx; @@ -200,12 +188,14 @@ public: ~GpsL1CaPcpsAcquisitionTestFpga_msg_rx(); //!< Default destructor }; + GpsL1CaPcpsAcquisitionTest_msg_fpga_rx_sptr GpsL1CaPcpsAcquisitionTestFpga_msg_rx_make() { return GpsL1CaPcpsAcquisitionTest_msg_fpga_rx_sptr( new GpsL1CaPcpsAcquisitionTestFpga_msg_rx()); } + void GpsL1CaPcpsAcquisitionTestFpga_msg_rx::msg_handler_events(pmt::pmt_t msg) { try @@ -220,6 +210,7 @@ void GpsL1CaPcpsAcquisitionTestFpga_msg_rx::msg_handler_events(pmt::pmt_t msg) } } + GpsL1CaPcpsAcquisitionTestFpga_msg_rx::GpsL1CaPcpsAcquisitionTestFpga_msg_rx() : gr::block("GpsL1CaPcpsAcquisitionTestFpga_msg_rx", gr::io_signature::make(0, 0, 0), @@ -227,15 +218,14 @@ GpsL1CaPcpsAcquisitionTestFpga_msg_rx::GpsL1CaPcpsAcquisitionTestFpga_msg_rx() : { this->message_port_register_in(pmt::mp("events")); this->set_msg_handler(pmt::mp("events"), - boost::bind( - &GpsL1CaPcpsAcquisitionTestFpga_msg_rx::msg_handler_events, - this, _1)); + boost::bind( &GpsL1CaPcpsAcquisitionTestFpga_msg_rx::msg_handler_events, this, _1)); rx_message = 0; } + GpsL1CaPcpsAcquisitionTestFpga_msg_rx::~GpsL1CaPcpsAcquisitionTestFpga_msg_rx() -{ -} +{} + class GpsL1CaPcpsAcquisitionTestFpga : public ::testing::Test { @@ -249,8 +239,7 @@ protected: } ~GpsL1CaPcpsAcquisitionTestFpga() - { - } + {} void init(); @@ -261,6 +250,7 @@ protected: size_t item_size; }; + void GpsL1CaPcpsAcquisitionTestFpga::init() { gnss_synchro.Channel_ID = 0; @@ -282,7 +272,6 @@ void GpsL1CaPcpsAcquisitionTestFpga::init() config->set_property("Acquisition.pfa", "0.0"); config->set_property("Acquisition.select_queue_Fpga", "0"); config->set_property("Acquisition.devicename", "/dev/uio0"); - } @@ -290,15 +279,14 @@ TEST_F(GpsL1CaPcpsAcquisitionTestFpga, Instantiate) { init(); boost::shared_ptr acquisition = - boost::make_shared(config.get(), - "Acquisition", 0, 1); + boost::make_shared(config.get(), "Acquisition", 0, 1); } TEST_F(GpsL1CaPcpsAcquisitionTestFpga, ValidationOfResults) { std::chrono::time_point start, end; - std::chrono::duration elapsed_seconds; + std::chrono::duration elapsed_seconds(0); top_block = gr::make_top_block("Acquisition test"); double expected_delay_samples = 524; diff --git a/src/tests/unit-tests/signal-processing-blocks/acquisition/gps_l1_ca_pcps_multithread_acquisition_gsoc2013_test.cc b/src/tests/unit-tests/signal-processing-blocks/acquisition/gps_l1_ca_pcps_multithread_acquisition_gsoc2013_test.cc index 9b3cbe1b7..4931cd46d 100644 --- a/src/tests/unit-tests/signal-processing-blocks/acquisition/gps_l1_ca_pcps_multithread_acquisition_gsoc2013_test.cc +++ b/src/tests/unit-tests/signal-processing-blocks/acquisition/gps_l1_ca_pcps_multithread_acquisition_gsoc2013_test.cc @@ -284,16 +284,18 @@ void GpsL1CaPcpsMultithreadAcquisitionGSoC2013Test::config_2() config->set_property("Acquisition.dump", "false"); } + void GpsL1CaPcpsMultithreadAcquisitionGSoC2013Test::start_queue() { stop = false; ch_thread = boost::thread(&GpsL1CaPcpsMultithreadAcquisitionGSoC2013Test::wait_message, this); } + void GpsL1CaPcpsMultithreadAcquisitionGSoC2013Test::wait_message() { std::chrono::time_point start, end; - std::chrono::duration elapsed_seconds; + std::chrono::duration elapsed_seconds(0); while (!stop) { @@ -312,6 +314,7 @@ void GpsL1CaPcpsMultithreadAcquisitionGSoC2013Test::wait_message() } } + void GpsL1CaPcpsMultithreadAcquisitionGSoC2013Test::process_message() { if (message == 1) @@ -353,22 +356,25 @@ void GpsL1CaPcpsMultithreadAcquisitionGSoC2013Test::process_message() } } + void GpsL1CaPcpsMultithreadAcquisitionGSoC2013Test::stop_queue() { stop = true; } + TEST_F(GpsL1CaPcpsMultithreadAcquisitionGSoC2013Test, Instantiate) { config_1(); acquisition = std::make_shared(config.get(), "Acquisition", 1, 1); } + TEST_F(GpsL1CaPcpsMultithreadAcquisitionGSoC2013Test, ConnectAndRun) { int nsamples = floor(fs_in*integration_time_ms*1e-3); std::chrono::time_point start, end; - std::chrono::duration elapsed_seconds; + std::chrono::duration elapsed_seconds(0); queue = gr::msg_queue::make(0); top_block = gr::make_top_block("Acquisition test"); @@ -393,6 +399,7 @@ TEST_F(GpsL1CaPcpsMultithreadAcquisitionGSoC2013Test, ConnectAndRun) std::cout << "Processed " << nsamples << " samples in " << elapsed_seconds.count() * 1e6 << " microseconds" << std::endl; } + TEST_F(GpsL1CaPcpsMultithreadAcquisitionGSoC2013Test, ValidationOfResults) { config_1(); @@ -475,6 +482,7 @@ TEST_F(GpsL1CaPcpsMultithreadAcquisitionGSoC2013Test, ValidationOfResults) } } + TEST_F(GpsL1CaPcpsMultithreadAcquisitionGSoC2013Test, ValidationOfResultsProbabilities) { config_2(); @@ -555,5 +563,4 @@ TEST_F(GpsL1CaPcpsMultithreadAcquisitionGSoC2013Test, ValidationOfResultsProbabi // std::cout << "Mean acq time = " << mean_acq_time_us << " microseconds." << std::endl; } } - } diff --git a/src/tests/unit-tests/signal-processing-blocks/acquisition/gps_l1_ca_pcps_opencl_acquisition_gsoc2013_test.cc b/src/tests/unit-tests/signal-processing-blocks/acquisition/gps_l1_ca_pcps_opencl_acquisition_gsoc2013_test.cc index f1e52e366..4e2142a3e 100644 --- a/src/tests/unit-tests/signal-processing-blocks/acquisition/gps_l1_ca_pcps_opencl_acquisition_gsoc2013_test.cc +++ b/src/tests/unit-tests/signal-processing-blocks/acquisition/gps_l1_ca_pcps_opencl_acquisition_gsoc2013_test.cc @@ -167,6 +167,7 @@ protected: double Pfa_a; }; + void GpsL1CaPcpsOpenClAcquisitionGSoC2013Test::init() { message = 0; @@ -182,6 +183,7 @@ void GpsL1CaPcpsOpenClAcquisitionGSoC2013Test::init() Pfa_a = 0; } + void GpsL1CaPcpsOpenClAcquisitionGSoC2013Test::config_1() { gnss_synchro.Channel_ID = 0; @@ -251,6 +253,7 @@ void GpsL1CaPcpsOpenClAcquisitionGSoC2013Test::config_1() config->set_property("Acquisition.dump", "false"); } + void GpsL1CaPcpsOpenClAcquisitionGSoC2013Test::config_2() { gnss_synchro.Channel_ID = 0; @@ -338,16 +341,18 @@ void GpsL1CaPcpsOpenClAcquisitionGSoC2013Test::config_2() config->set_property("Acquisition.dump", "false"); } + void GpsL1CaPcpsOpenClAcquisitionGSoC2013Test::start_queue() { stop = false; ch_thread = boost::thread(&GpsL1CaPcpsOpenClAcquisitionGSoC2013Test::wait_message, this); } + void GpsL1CaPcpsOpenClAcquisitionGSoC2013Test::wait_message() { std::chrono::time_point start, end; - std::chrono::duration elapsed_seconds; + std::chrono::duration elapsed_seconds(0); while (!stop) { @@ -366,6 +371,7 @@ void GpsL1CaPcpsOpenClAcquisitionGSoC2013Test::wait_message() } } + void GpsL1CaPcpsOpenClAcquisitionGSoC2013Test::process_message() { if (message == 1) @@ -407,22 +413,25 @@ void GpsL1CaPcpsOpenClAcquisitionGSoC2013Test::process_message() } } + void GpsL1CaPcpsOpenClAcquisitionGSoC2013Test::stop_queue() { stop = true; } + TEST_F(GpsL1CaPcpsOpenClAcquisitionGSoC2013Test, Instantiate) { config_1(); acquisition = std::make_shared(config.get(), "Acquisition", 1, 1); } + TEST_F(GpsL1CaPcpsOpenClAcquisitionGSoC2013Test, ConnectAndRun) { int nsamples = floor(fs_in*integration_time_ms*1e-3); std::chrono::time_point start, end; - std::chrono::duration elapsed_seconds; + std::chrono::duration elapsed_seconds(0); config_1(); acquisition = std::make_shared(config.get(), "Acquisition", 1, 1); @@ -447,6 +456,7 @@ TEST_F(GpsL1CaPcpsOpenClAcquisitionGSoC2013Test, ConnectAndRun) std::cout << "Processed " << nsamples << " samples in " << elapsed_seconds.count() * 1e6 << " microseconds" << std::endl; } + TEST_F(GpsL1CaPcpsOpenClAcquisitionGSoC2013Test, ValidationOfResults) { config_1(); @@ -529,6 +539,7 @@ TEST_F(GpsL1CaPcpsOpenClAcquisitionGSoC2013Test, ValidationOfResults) } } + TEST_F(GpsL1CaPcpsOpenClAcquisitionGSoC2013Test, ValidationOfResultsProbabilities) { config_2(); diff --git a/src/tests/unit-tests/signal-processing-blocks/acquisition/gps_l1_ca_pcps_quicksync_acquisition_gsoc2014_test.cc b/src/tests/unit-tests/signal-processing-blocks/acquisition/gps_l1_ca_pcps_quicksync_acquisition_gsoc2014_test.cc index dee476e60..f5c7eea1f 100644 --- a/src/tests/unit-tests/signal-processing-blocks/acquisition/gps_l1_ca_pcps_quicksync_acquisition_gsoc2014_test.cc +++ b/src/tests/unit-tests/signal-processing-blocks/acquisition/gps_l1_ca_pcps_quicksync_acquisition_gsoc2014_test.cc @@ -108,14 +108,13 @@ GpsL1CaPcpsQuickSyncAcquisitionGSoC2014Test_msg_rx::GpsL1CaPcpsQuickSyncAcquisit rx_message = 0; } + GpsL1CaPcpsQuickSyncAcquisitionGSoC2014Test_msg_rx::~GpsL1CaPcpsQuickSyncAcquisitionGSoC2014Test_msg_rx() {} // ########################################################### - - class GpsL1CaPcpsQuickSyncAcquisitionGSoC2014Test: public ::testing::Test { protected: @@ -361,6 +360,7 @@ void GpsL1CaPcpsQuickSyncAcquisitionGSoC2014Test::config_2() config->set_property("Acquisition.dump", "false"); } + void GpsL1CaPcpsQuickSyncAcquisitionGSoC2014Test::config_3() { gnss_synchro.Channel_ID = 0; @@ -463,7 +463,7 @@ void GpsL1CaPcpsQuickSyncAcquisitionGSoC2014Test::start_queue() void GpsL1CaPcpsQuickSyncAcquisitionGSoC2014Test::wait_message() { std::chrono::time_point start, end; - std::chrono::duration elapsed_seconds; + std::chrono::duration elapsed_seconds(0); while (!stop) { @@ -482,9 +482,9 @@ void GpsL1CaPcpsQuickSyncAcquisitionGSoC2014Test::wait_message() } } + void GpsL1CaPcpsQuickSyncAcquisitionGSoC2014Test::process_message() { - if (message == 1) { detection_counter++; @@ -540,11 +540,12 @@ TEST_F(GpsL1CaPcpsQuickSyncAcquisitionGSoC2014Test, Instantiate) acquisition = std::make_shared(config.get(), "Acquisition", 1, 1); } + TEST_F(GpsL1CaPcpsQuickSyncAcquisitionGSoC2014Test, ConnectAndRun) { int nsamples = floor(fs_in * integration_time_ms * 1e-3); std::chrono::time_point start, end; - std::chrono::duration elapsed_seconds; + std::chrono::duration elapsed_seconds(0); top_block = gr::make_top_block("Acquisition test"); queue = gr::msg_queue::make(0); boost::shared_ptr msg_rx = GpsL1CaPcpsAcquisitionGSoC2013Test_msg_rx_make(channel_internal_queue); @@ -569,11 +570,9 @@ TEST_F(GpsL1CaPcpsQuickSyncAcquisitionGSoC2014Test, ConnectAndRun) }) << "Failure running the top_block."<< std::endl; std::cout << "Processed " << nsamples << " samples in " << elapsed_seconds.count() * 1e6 << " microseconds" << std::endl; - } - TEST_F(GpsL1CaPcpsQuickSyncAcquisitionGSoC2014Test, ValidationOfResults) { config_1(); @@ -652,11 +651,9 @@ TEST_F(GpsL1CaPcpsQuickSyncAcquisitionGSoC2014Test, ValidationOfResults) EXPECT_EQ(1, message) << "Acquisition failure. Expected message: 1=ACQ SUCCESS."; if (message == 1) { - EXPECT_EQ((unsigned int)1, correct_estimation_counter) << "Acquisition failure. Incorrect parameters estimation."; } - } else if (i == 1) { diff --git a/src/tests/unit-tests/signal-processing-blocks/acquisition/gps_l1_ca_pcps_tong_acquisition_gsoc2013_test.cc b/src/tests/unit-tests/signal-processing-blocks/acquisition/gps_l1_ca_pcps_tong_acquisition_gsoc2013_test.cc index 1a9d9cab7..24567e9f1 100644 --- a/src/tests/unit-tests/signal-processing-blocks/acquisition/gps_l1_ca_pcps_tong_acquisition_gsoc2013_test.cc +++ b/src/tests/unit-tests/signal-processing-blocks/acquisition/gps_l1_ca_pcps_tong_acquisition_gsoc2013_test.cc @@ -167,6 +167,7 @@ protected: double Pfa_a = 0.0; }; + void GpsL1CaPcpsTongAcquisitionGSoC2013Test::init() { message = 0; @@ -182,6 +183,7 @@ void GpsL1CaPcpsTongAcquisitionGSoC2013Test::init() Pfa_a = 0; } + void GpsL1CaPcpsTongAcquisitionGSoC2013Test::config_1() { gnss_synchro.Channel_ID = 0; @@ -251,6 +253,7 @@ void GpsL1CaPcpsTongAcquisitionGSoC2013Test::config_1() config->set_property("Acquisition.dump", "false"); } + void GpsL1CaPcpsTongAcquisitionGSoC2013Test::config_2() { gnss_synchro.Channel_ID = 0; @@ -338,16 +341,18 @@ void GpsL1CaPcpsTongAcquisitionGSoC2013Test::config_2() config->set_property("Acquisition.dump", "false"); } + void GpsL1CaPcpsTongAcquisitionGSoC2013Test::start_queue() { stop = false; ch_thread = boost::thread(&GpsL1CaPcpsTongAcquisitionGSoC2013Test::wait_message, this); } + void GpsL1CaPcpsTongAcquisitionGSoC2013Test::wait_message() { std::chrono::time_point start, end; - std::chrono::duration elapsed_seconds; + std::chrono::duration elapsed_seconds(0); while (!stop) { @@ -365,6 +370,7 @@ void GpsL1CaPcpsTongAcquisitionGSoC2013Test::wait_message() } } + void GpsL1CaPcpsTongAcquisitionGSoC2013Test::process_message() { if (message == 1) @@ -406,22 +412,25 @@ void GpsL1CaPcpsTongAcquisitionGSoC2013Test::process_message() } } + void GpsL1CaPcpsTongAcquisitionGSoC2013Test::stop_queue() { stop = true; } + TEST_F(GpsL1CaPcpsTongAcquisitionGSoC2013Test, Instantiate) { config_1(); acquisition = std::make_shared(config.get(), "Acquisition", 1, 1); } + TEST_F(GpsL1CaPcpsTongAcquisitionGSoC2013Test, ConnectAndRun) { int nsamples = floor(fs_in*integration_time_ms*1e-3); std::chrono::time_point start, end; - std::chrono::duration elapsed_seconds; + std::chrono::duration elapsed_seconds(0); top_block = gr::make_top_block("Acquisition test"); queue = gr::msg_queue::make(0); @@ -448,6 +457,7 @@ TEST_F(GpsL1CaPcpsTongAcquisitionGSoC2013Test, ConnectAndRun) std::cout << "Processed " << nsamples << " samples in " << elapsed_seconds.count() * 1e6 << " microseconds" << std::endl; } + TEST_F(GpsL1CaPcpsTongAcquisitionGSoC2013Test, ValidationOfResults) { config_1(); @@ -526,7 +536,6 @@ TEST_F(GpsL1CaPcpsTongAcquisitionGSoC2013Test, ValidationOfResults) { EXPECT_EQ((unsigned int)1, correct_estimation_counter) << "Acquisition failure. Incorrect parameters estimation."; } - } else if (i == 1) { @@ -537,6 +546,7 @@ TEST_F(GpsL1CaPcpsTongAcquisitionGSoC2013Test, ValidationOfResults) } } + TEST_F(GpsL1CaPcpsTongAcquisitionGSoC2013Test, ValidationOfResultsProbabilities) { config_2(); diff --git a/src/tests/unit-tests/signal-processing-blocks/acquisition/gps_l2_m_pcps_acquisition_test.cc b/src/tests/unit-tests/signal-processing-blocks/acquisition/gps_l2_m_pcps_acquisition_test.cc index 360af9ba3..e5cf12427 100644 --- a/src/tests/unit-tests/signal-processing-blocks/acquisition/gps_l2_m_pcps_acquisition_test.cc +++ b/src/tests/unit-tests/signal-processing-blocks/acquisition/gps_l2_m_pcps_acquisition_test.cc @@ -167,10 +167,11 @@ TEST_F(GpsL2MPcpsAcquisitionTest, Instantiate) std::shared_ptr acquisition = std::make_shared(config.get(), "Acquisition", 1, 1); } + TEST_F(GpsL2MPcpsAcquisitionTest, ConnectAndRun) { std::chrono::time_point start, end; - std::chrono::duration elapsed_seconds; + std::chrono::duration elapsed_seconds(0); top_block = gr::make_top_block("Acquisition test"); queue = gr::msg_queue::make(0); @@ -197,10 +198,11 @@ TEST_F(GpsL2MPcpsAcquisitionTest, ConnectAndRun) std::cout << "Processed " << nsamples << " samples in " << elapsed_seconds.count() * 1e6 << " microseconds" << std::endl; } + TEST_F(GpsL2MPcpsAcquisitionTest, ValidationOfResults) { std::chrono::time_point start, end; - std::chrono::duration elapsed_seconds; + std::chrono::duration elapsed_seconds(0); top_block = gr::make_top_block("Acquisition test"); queue = gr::msg_queue::make(0); double expected_delay_samples = 1;//2004; @@ -250,7 +252,6 @@ TEST_F(GpsL2MPcpsAcquisitionTest, ValidationOfResults) top_block->msg_connect(acquisition->get_right_block(), pmt::mp("events"), msg_rx, pmt::mp("events")); }) << "Failure connecting the blocks of acquisition test." << std::endl; - ASSERT_NO_THROW( { acquisition->set_local_code(); acquisition->set_state(1); // Ensure that acquisition starts at the first sample @@ -278,5 +279,4 @@ TEST_F(GpsL2MPcpsAcquisitionTest, ValidationOfResults) EXPECT_LE(doppler_error_hz, 200) << "Doppler error exceeds the expected value: 666 Hz = 2/(3*integration period)"; EXPECT_LT(delay_error_chips, 0.5) << "Delay error exceeds the expected value: 0.5 chips"; - } diff --git a/src/tests/unit-tests/signal-processing-blocks/filter/fir_filter_test.cc b/src/tests/unit-tests/signal-processing-blocks/filter/fir_filter_test.cc index 0283dc769..baa3feea0 100644 --- a/src/tests/unit-tests/signal-processing-blocks/filter/fir_filter_test.cc +++ b/src/tests/unit-tests/signal-processing-blocks/filter/fir_filter_test.cc @@ -176,7 +176,7 @@ TEST_F(FirFilterTest, ConnectAndRun) { int fs_in = 4000000; std::chrono::time_point start, end; - std::chrono::duration elapsed_seconds; + std::chrono::duration elapsed_seconds(0); top_block = gr::make_top_block("Fir filter test"); init(); @@ -207,7 +207,7 @@ TEST_F(FirFilterTest, ConnectAndRun) TEST_F(FirFilterTest, ConnectAndRunGrcomplex) { std::chrono::time_point start, end; - std::chrono::duration elapsed_seconds; + std::chrono::duration elapsed_seconds(0); top_block = gr::make_top_block("Fir filter test"); init(); @@ -248,7 +248,7 @@ TEST_F(FirFilterTest, ConnectAndRunGrcomplex) TEST_F(FirFilterTest, ConnectAndRunCshorts) { std::chrono::time_point start, end; - std::chrono::duration elapsed_seconds; + std::chrono::duration elapsed_seconds(0); top_block = gr::make_top_block("Fir filter test"); init(); @@ -293,7 +293,7 @@ TEST_F(FirFilterTest, ConnectAndRunCshorts) TEST_F(FirFilterTest, ConnectAndRunCbytes) { std::chrono::time_point start, end; - std::chrono::duration elapsed_seconds; + std::chrono::duration elapsed_seconds(0); top_block = gr::make_top_block("Fir filter test"); init(); @@ -337,7 +337,7 @@ TEST_F(FirFilterTest, ConnectAndRunCbytes) TEST_F(FirFilterTest, ConnectAndRunCbyteGrcomplex) { std::chrono::time_point start, end; - std::chrono::duration elapsed_seconds; + std::chrono::duration elapsed_seconds(0); top_block = gr::make_top_block("Fir filter test"); init(); diff --git a/src/tests/unit-tests/signal-processing-blocks/observables/hybrid_observables_test.cc b/src/tests/unit-tests/signal-processing-blocks/observables/hybrid_observables_test.cc index 0bb5a8e63..07c897d3c 100644 --- a/src/tests/unit-tests/signal-processing-blocks/observables/hybrid_observables_test.cc +++ b/src/tests/unit-tests/signal-processing-blocks/observables/hybrid_observables_test.cc @@ -450,7 +450,7 @@ TEST_F(HybridObservablesTest, ValidationOfResults) } std::chrono::time_point start, end; - std::chrono::duration elapsed_seconds; + std::chrono::duration elapsed_seconds(0); configure_receiver(); diff --git a/src/tests/unit-tests/signal-processing-blocks/resampler/direct_resampler_conditioner_cc_test.cc b/src/tests/unit-tests/signal-processing-blocks/resampler/direct_resampler_conditioner_cc_test.cc index bb3e501c3..fc05039d0 100644 --- a/src/tests/unit-tests/signal-processing-blocks/resampler/direct_resampler_conditioner_cc_test.cc +++ b/src/tests/unit-tests/signal-processing-blocks/resampler/direct_resampler_conditioner_cc_test.cc @@ -48,7 +48,7 @@ TEST(DirectResamplerConditionerCcTest, InstantiationAndRunTest) double fs_in = 8000000.0; // Input sampling frequency in Hz double fs_out = 4000000.0; // sampling freuqncy of the resampled signal in Hz std::chrono::time_point start, end; - std::chrono::duration elapsed_seconds; + std::chrono::duration elapsed_seconds(0); int nsamples = 1000000; //Number of samples to be computed gr::msg_queue::sptr queue = gr::msg_queue::make(0); gr::top_block_sptr top_block = gr::make_top_block("direct_resampler_conditioner_cc_test"); diff --git a/src/tests/unit-tests/signal-processing-blocks/telemetry_decoder/gps_l1_ca_telemetry_decoder_test.cc b/src/tests/unit-tests/signal-processing-blocks/telemetry_decoder/gps_l1_ca_telemetry_decoder_test.cc index 9e863f97a..be32eb037 100644 --- a/src/tests/unit-tests/signal-processing-blocks/telemetry_decoder/gps_l1_ca_telemetry_decoder_test.cc +++ b/src/tests/unit-tests/signal-processing-blocks/telemetry_decoder/gps_l1_ca_telemetry_decoder_test.cc @@ -342,7 +342,7 @@ TEST_F(GpsL1CATelemetryDecoderTest, ValidationOfResults) } std::chrono::time_point start, end; - std::chrono::duration elapsed_seconds; + std::chrono::duration elapsed_seconds(0); configure_receiver(); diff --git a/src/tests/unit-tests/signal-processing-blocks/tracking/cpu_multicorrelator_test.cc b/src/tests/unit-tests/signal-processing-blocks/tracking/cpu_multicorrelator_test.cc index 60f3525a8..11ea1ca58 100644 --- a/src/tests/unit-tests/signal-processing-blocks/tracking/cpu_multicorrelator_test.cc +++ b/src/tests/unit-tests/signal-processing-blocks/tracking/cpu_multicorrelator_test.cc @@ -50,20 +50,20 @@ void run_correlator_cpu(cpu_multicorrelator* correlator, int correlation_size) { for(int k = 0; k < FLAGS_cpu_multicorrelator_iterations_test; k++) - { - correlator->Carrier_wipeoff_multicorrelator_resampler(d_rem_carrier_phase_rad, - d_carrier_phase_step_rad, - d_code_phase_step_chips, - d_rem_code_phase_chips, - correlation_size); - } + { + correlator->Carrier_wipeoff_multicorrelator_resampler(d_rem_carrier_phase_rad, + d_carrier_phase_step_rad, + d_code_phase_step_chips, + d_rem_code_phase_chips, + correlation_size); + } } TEST(CpuMulticorrelatorTest, MeasureExecutionTime) { std::chrono::time_point start, end; - std::chrono::duration elapsed_seconds; + std::chrono::duration elapsed_seconds(0); int max_threads = FLAGS_cpu_multicorrelator_max_threads_test; std::vector thread_pool; cpu_multicorrelator* correlator_pool[max_threads]; diff --git a/src/tests/unit-tests/signal-processing-blocks/tracking/galileo_e1_dll_pll_veml_tracking_test.cc b/src/tests/unit-tests/signal-processing-blocks/tracking/galileo_e1_dll_pll_veml_tracking_test.cc index d06201cc4..48659a576 100644 --- a/src/tests/unit-tests/signal-processing-blocks/tracking/galileo_e1_dll_pll_veml_tracking_test.cc +++ b/src/tests/unit-tests/signal-processing-blocks/tracking/galileo_e1_dll_pll_veml_tracking_test.cc @@ -98,10 +98,8 @@ void GalileoE1DllPllVemlTrackingInternalTest::init() } - TEST_F(GalileoE1DllPllVemlTrackingInternalTest, Instantiate) { - init(); auto tracking = factory->GetBlock(config, "Tracking", "Galileo_E1_DLL_PLL_VEML_Tracking", 1, 1); EXPECT_STREQ("Galileo_E1_DLL_PLL_VEML_Tracking", tracking->implementation().c_str()); @@ -113,7 +111,7 @@ TEST_F(GalileoE1DllPllVemlTrackingInternalTest, ConnectAndRun) int fs_in = 8000000; int nsamples = 40000000; std::chrono::time_point start, end; - std::chrono::duration elapsed_seconds; + std::chrono::duration elapsed_seconds(0); init(); queue = gr::msg_queue::make(0); top_block = gr::make_top_block("Tracking test"); @@ -154,11 +152,10 @@ TEST_F(GalileoE1DllPllVemlTrackingInternalTest, ConnectAndRun) } - TEST_F(GalileoE1DllPllVemlTrackingInternalTest, ValidationOfResults) { std::chrono::time_point start, end; - std::chrono::duration elapsed_seconds; + std::chrono::duration elapsed_seconds(0); // int num_samples = 40000000; // 4 Msps // unsigned int skiphead_sps = 24000000; // 4 Msps int num_samples = 80000000; // 8 Msps diff --git a/src/tests/unit-tests/signal-processing-blocks/tracking/galileo_e5a_tracking_test.cc b/src/tests/unit-tests/signal-processing-blocks/tracking/galileo_e5a_tracking_test.cc index 3a9f31032..063d57b37 100644 --- a/src/tests/unit-tests/signal-processing-blocks/tracking/galileo_e5a_tracking_test.cc +++ b/src/tests/unit-tests/signal-processing-blocks/tracking/galileo_e5a_tracking_test.cc @@ -99,10 +99,11 @@ void GalileoE5aTrackingTest::init() config->set_property("Tracking_Galileo.ti_ms", "1"); } + TEST_F(GalileoE5aTrackingTest, ValidationOfResults) { std::chrono::time_point start, end; - std::chrono::duration elapsed_seconds; + std::chrono::duration elapsed_seconds(0); int fs_in = 32000000; int nsamples = 32000000*5; init(); diff --git a/src/tests/unit-tests/signal-processing-blocks/tracking/gps_l1_ca_dll_pll_tracking_test.cc b/src/tests/unit-tests/signal-processing-blocks/tracking/gps_l1_ca_dll_pll_tracking_test.cc index 8b1ad2e18..e0692ff4a 100644 --- a/src/tests/unit-tests/signal-processing-blocks/tracking/gps_l1_ca_dll_pll_tracking_test.cc +++ b/src/tests/unit-tests/signal-processing-blocks/tracking/gps_l1_ca_dll_pll_tracking_test.cc @@ -31,7 +31,6 @@ */ -#include #include #include #include @@ -75,11 +74,13 @@ public: ~GpsL1CADllPllTrackingTest_msg_rx(); //!< Default destructor }; + GpsL1CADllPllTrackingTest_msg_rx_sptr GpsL1CADllPllTrackingTest_msg_rx_make() { return GpsL1CADllPllTrackingTest_msg_rx_sptr(new GpsL1CADllPllTrackingTest_msg_rx()); } + void GpsL1CADllPllTrackingTest_msg_rx::msg_handler_events(pmt::pmt_t msg) { try @@ -94,6 +95,7 @@ void GpsL1CADllPllTrackingTest_msg_rx::msg_handler_events(pmt::pmt_t msg) } } + GpsL1CADllPllTrackingTest_msg_rx::GpsL1CADllPllTrackingTest_msg_rx() : gr::block("GpsL1CADllPllTrackingTest_msg_rx", gr::io_signature::make(0, 0, 0), gr::io_signature::make(0, 0, 0)) { @@ -102,16 +104,15 @@ GpsL1CADllPllTrackingTest_msg_rx::GpsL1CADllPllTrackingTest_msg_rx() : rx_message = 0; } + GpsL1CADllPllTrackingTest_msg_rx::~GpsL1CADllPllTrackingTest_msg_rx() {} // ########################################################### - class GpsL1CADllPllTrackingTest: public ::testing::Test { - public: std::string generator_binary; std::string p1; @@ -352,10 +353,10 @@ TEST_F(GpsL1CADllPllTrackingTest, ValidationOfResults) configure_generator(); // Generate signal raw signal samples and observations RINEX file - if (FLAGS_disable_generator==false) - { - generate_signal(); - } + if (FLAGS_disable_generator == false) + { + generate_signal(); + } struct timeval tv; long long int begin = 0; @@ -425,7 +426,6 @@ TEST_F(GpsL1CADllPllTrackingTest, ValidationOfResults) tracking->start_tracking(); - EXPECT_NO_THROW( { gettimeofday(&tv, NULL); begin = tv.tv_sec * 1000000 + tv.tv_usec; diff --git a/src/tests/unit-tests/signal-processing-blocks/tracking/gps_l1_ca_dll_pll_tracking_test_fpga.cc b/src/tests/unit-tests/signal-processing-blocks/tracking/gps_l1_ca_dll_pll_tracking_test_fpga.cc index b16e46783..124d35429 100644 --- a/src/tests/unit-tests/signal-processing-blocks/tracking/gps_l1_ca_dll_pll_tracking_test_fpga.cc +++ b/src/tests/unit-tests/signal-processing-blocks/tracking/gps_l1_ca_dll_pll_tracking_test_fpga.cc @@ -448,7 +448,7 @@ TEST_F(GpsL1CADllPllTrackingTestFpga, ValidationOfResultsFpga) //generate_signal(); std::chrono::time_point start, end; - std::chrono::duration elapsed_seconds; + std::chrono::duration elapsed_seconds(0); configure_receiver(); diff --git a/src/tests/unit-tests/signal-processing-blocks/tracking/gps_l2_m_dll_pll_tracking_test.cc b/src/tests/unit-tests/signal-processing-blocks/tracking/gps_l2_m_dll_pll_tracking_test.cc index a166b75f5..7dca5c13a 100644 --- a/src/tests/unit-tests/signal-processing-blocks/tracking/gps_l2_m_dll_pll_tracking_test.cc +++ b/src/tests/unit-tests/signal-processing-blocks/tracking/gps_l2_m_dll_pll_tracking_test.cc @@ -70,11 +70,13 @@ public: }; + GpsL2MDllPllTrackingTest_msg_rx_sptr GpsL2MDllPllTrackingTest_msg_rx_make() { return GpsL2MDllPllTrackingTest_msg_rx_sptr(new GpsL2MDllPllTrackingTest_msg_rx()); } + void GpsL2MDllPllTrackingTest_msg_rx::msg_handler_events(pmt::pmt_t msg) { try @@ -89,6 +91,7 @@ void GpsL2MDllPllTrackingTest_msg_rx::msg_handler_events(pmt::pmt_t msg) } } + GpsL2MDllPllTrackingTest_msg_rx::GpsL2MDllPllTrackingTest_msg_rx() : gr::block("GpsL2MDllPllTrackingTest_msg_rx", gr::io_signature::make(0, 0, 0), gr::io_signature::make(0, 0, 0)) { @@ -97,13 +100,13 @@ GpsL2MDllPllTrackingTest_msg_rx::GpsL2MDllPllTrackingTest_msg_rx() : rx_message = 0; } + GpsL2MDllPllTrackingTest_msg_rx::~GpsL2MDllPllTrackingTest_msg_rx() {} // ########################################################### - class GpsL2MDllPllTrackingTest: public ::testing::Test { protected: @@ -152,7 +155,7 @@ void GpsL2MDllPllTrackingTest::init() TEST_F(GpsL2MDllPllTrackingTest, ValidationOfResults) { std::chrono::time_point start, end; - std::chrono::duration elapsed_seconds; + std::chrono::duration elapsed_seconds(0); int fs_in = 5000000; int nsamples = fs_in*9; diff --git a/src/tests/unit-tests/signal-processing-blocks/tracking/gpu_multicorrelator_test.cc b/src/tests/unit-tests/signal-processing-blocks/tracking/gpu_multicorrelator_test.cc index 42b2a18f3..432dcaa45 100644 --- a/src/tests/unit-tests/signal-processing-blocks/tracking/gpu_multicorrelator_test.cc +++ b/src/tests/unit-tests/signal-processing-blocks/tracking/gpu_multicorrelator_test.cc @@ -66,7 +66,7 @@ void run_correlator_gpu(cuda_multicorrelator* correlator, TEST(GpuMulticorrelatorTest, MeasureExecutionTime) { std::chrono::time_point start, end; - std::chrono::duration elapsed_seconds; + std::chrono::duration elapsed_seconds(0); int max_threads = FLAGS_gpu_multicorrelator_max_threads_test; std::vector thread_pool; cuda_multicorrelator* correlator_pool[max_threads];