diff --git a/src/tests/common-files/gnuplot_i.h b/src/tests/common-files/gnuplot_i.h index 67e6fb1f8..afafef972 100644 --- a/src/tests/common-files/gnuplot_i.h +++ b/src/tests/common-files/gnuplot_i.h @@ -47,7 +47,7 @@ #ifndef GNSS_SDR_GNUPLOT_I_H_ #define GNSS_SDR_GNUPLOT_I_H_ - +#include #include #include #include @@ -61,6 +61,7 @@ #include // for std::list #include +DEFINE_bool(show_plots, true, "Show plots on screen. Disable for non-interactive testing."); #if defined(WIN32) || defined(_WIN32) || defined(__WIN32__) || defined(__TOS_WIN__) //defined for 32 and 64-bit environments @@ -2089,19 +2090,19 @@ std::string Gnuplot::create_tmpfile(std::ofstream &tmp) throw GnuplotException(except.str()); } -// int mkstemp(char *name); -// shall replace the contents of the string pointed to by "name" by a unique -// filename, and return a file descriptor for the file open for reading and -// writing. Otherwise, -1 shall be returned if no suitable file could be -// created. The string in template should look like a filename with six -// trailing 'X' s; mkstemp() replaces each 'X' with a character from the -// portable filename character set. The characters are chosen such that the -// resulting name does not duplicate the name of an existing file at the -// time of a call to mkstemp() + // int mkstemp(char *name); + // shall replace the contents of the string pointed to by "name" by a unique + // filename, and return a file descriptor for the file open for reading and + // writing. Otherwise, -1 shall be returned if no suitable file could be + // created. The string in template should look like a filename with six + // trailing 'X' s; mkstemp() replaces each 'X' with a character from the + // portable filename character set. The characters are chosen such that the + // resulting name does not duplicate the name of an existing file at the + // time of a call to mkstemp() -// -// open temporary files for output -// + // + // open temporary files for output + // #if defined(WIN32) || defined(_WIN32) || defined(__WIN32__) || defined(__TOS_WIN__) if (_mktemp(name) == NULL) diff --git a/src/tests/system-tests/obs_system_test.cc b/src/tests/system-tests/obs_system_test.cc index 2ce3bea48..391c2a969 100644 --- a/src/tests/system-tests/obs_system_test.cc +++ b/src/tests/system-tests/obs_system_test.cc @@ -620,7 +620,7 @@ void ObsSystemTest::compute_pseudorange_error( } g1.savetops("Pseudorange_error_" + signal_name); g1.savetopdf("Pseudorange_error_" + signal_name, 18); - g1.showonscreen(); // window output + if (FLAGS_show_plots) g1.showonscreen(); // window output } catch (const GnuplotException& ge) { @@ -711,7 +711,7 @@ void ObsSystemTest::compute_carrierphase_error( } g1.savetops("Carrier_phase_error_" + signal_name); g1.savetopdf("Carrier_phase_error_" + signal_name, 18); - g1.showonscreen(); // window output + if (FLAGS_show_plots) g1.showonscreen(); // window output } catch (const GnuplotException& ge) { @@ -802,7 +802,7 @@ void ObsSystemTest::compute_doppler_error( } g1.savetops("Doppler_error_" + signal_name); g1.savetopdf("Doppler_error_" + signal_name, 18); - g1.showonscreen(); // window output + if (FLAGS_show_plots) g1.showonscreen(); // window output } catch (const GnuplotException& ge) { diff --git a/src/tests/system-tests/position_test.cc b/src/tests/system-tests/position_test.cc index 857b2f489..98a6d0dba 100644 --- a/src/tests/system-tests/position_test.cc +++ b/src/tests/system-tests/position_test.cc @@ -336,7 +336,7 @@ int StaticPositionSystemTest::configure_receiver() config->set_property("Channel.signal", "1C"); // Set Acquisition - config->set_property("Acquisition_1C.implementation", "GPS_L1_CA_PCPS_Tong_Acquisition"); + config->set_property("Acquisition_1C.implementation", "GPS_L1_CA_PCPS_Acquisition"); config->set_property("Acquisition_1C.item_type", "gr_complex"); config->set_property("Acquisition_1C.coherent_integration_time_ms", std::to_string(coherent_integration_time_ms)); config->set_property("Acquisition_1C.threshold", std::to_string(threshold)); @@ -347,6 +347,9 @@ int StaticPositionSystemTest::configure_receiver() config->set_property("Acquisition_1C.tong_init_val", std::to_string(tong_init_val)); config->set_property("Acquisition_1C.tong_max_val", std::to_string(tong_max_val)); config->set_property("Acquisition_1C.tong_max_dwells", std::to_string(tong_max_dwells)); + config->set_property("Acquisition_1C.dump", "false); + config->set_property("Acquisition_1C.dump_filename", "./acquisition"); + config->set_property("Acquisition_1C.dump_channel", "1"); // Set Tracking config->set_property("Tracking_1C.implementation", "GPS_L1_CA_DLL_PLL_Tracking"); @@ -632,7 +635,7 @@ void StaticPositionSystemTest::print_results(const std::vector& east, g1.savetops("Position_test_2D"); g1.savetopdf("Position_test_2D", 18); - g1.showonscreen(); // window output + if (FLAGS_show_plots) g1.showonscreen(); // window output Gnuplot g2("points"); g2.set_title("3D precision"); @@ -653,7 +656,7 @@ void StaticPositionSystemTest::print_results(const std::vector& east, g2.savetops("Position_test_3D"); g2.savetopdf("Position_test_3D"); - g2.showonscreen(); // window output + if (FLAGS_show_plots) g2.showonscreen(); // window output } catch (const GnuplotException& ge) { diff --git a/src/tests/unit-tests/arithmetic/fft_length_test.cc b/src/tests/unit-tests/arithmetic/fft_length_test.cc index 7cf674c24..78961dd2b 100644 --- a/src/tests/unit-tests/arithmetic/fft_length_test.cc +++ b/src/tests/unit-tests/arithmetic/fft_length_test.cc @@ -124,7 +124,7 @@ TEST(FFTLengthTest, MeasureExecutionTime) g1.set_style("points").plot_xy(powers_of_two, execution_times_powers_of_two, "Power of 2"); g1.savetops("FFT_execution_times_extended"); g1.savetopdf("FFT_execution_times_extended", 18); - g1.showonscreen(); // window output + if (FLAGS_show_plots) g1.showonscreen(); // window output Gnuplot g2("linespoints"); g2.set_title("FFT execution times for different lengths (up to 2^{14}=16384)"); @@ -136,7 +136,7 @@ TEST(FFTLengthTest, MeasureExecutionTime) g2.set_style("points").plot_xy(powers_of_two, execution_times_powers_of_two, "Power of 2"); g2.savetops("FFT_execution_times"); g2.savetopdf("FFT_execution_times", 18); - g2.showonscreen(); // window output + if (FLAGS_show_plots) g2.showonscreen(); // window output } catch (const GnuplotException& ge) { 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 522637c9a..d4477ee8d 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 @@ -209,7 +209,7 @@ void GalileoE1PcpsAmbiguousAcquisitionTest::plot_grid() g1.savetops("Galileo_E1_acq_grid"); g1.savetopdf("Galileo_E1_acq_grid"); - g1.showonscreen(); + if (FLAGS_show_plots) g1.showonscreen(); } catch (const GnuplotException& ge) { diff --git a/src/tests/unit-tests/signal-processing-blocks/acquisition/gps_l1_acq_performance_test.cc b/src/tests/unit-tests/signal-processing-blocks/acquisition/gps_l1_acq_performance_test.cc index e85263f31..a92c228b9 100644 --- a/src/tests/unit-tests/signal-processing-blocks/acquisition/gps_l1_acq_performance_test.cc +++ b/src/tests/unit-tests/signal-processing-blocks/acquisition/gps_l1_acq_performance_test.cc @@ -67,7 +67,6 @@ DEFINE_int32(acq_test_fake_PRN, 33, "PRN number of a non-present satellite"); DEFINE_int32(acq_test_iterations, 1, "Number of iterations (same signal, different noise realization)"); DEFINE_bool(plot_acq_test, false, "Plots results with gnuplot, if available"); -DEFINE_bool(show_plots, true, "Show plots on screen. Disable for non-interactive testing."); // ######## GNURADIO BLOCK MESSAGE RECEVER ######### class AcqPerfTest_msg_rx; 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 332dcc0e4..e9ee38210 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 @@ -210,7 +210,7 @@ void GpsL1CaPcpsAcquisitionTest::plot_grid() g1.savetops("GPS_L1_acq_grid"); g1.savetopdf("GPS_L1_acq_grid"); - g1.showonscreen(); + if (FLAGS_show_plots) g1.showonscreen(); } catch (const GnuplotException &ge) { 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 9d6caf0e6..7092fac26 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 @@ -213,7 +213,7 @@ void GpsL2MPcpsAcquisitionTest::plot_grid() g1.savetops("GPS_L2CM_acq_grid"); g1.savetopdf("GPS_L2CM_acq_grid"); - g1.showonscreen(); + if (FLAGS_show_plots) g1.showonscreen(); } catch (const GnuplotException &ge) { diff --git a/src/tests/unit-tests/signal-processing-blocks/tracking/gps_l1_ca_dll_pll_tracking_pull-in_test.cc b/src/tests/unit-tests/signal-processing-blocks/tracking/gps_l1_ca_dll_pll_tracking_pull-in_test.cc index 7a11f3178..4122f54c6 100644 --- a/src/tests/unit-tests/signal-processing-blocks/tracking/gps_l1_ca_dll_pll_tracking_pull-in_test.cc +++ b/src/tests/unit-tests/signal-processing-blocks/tracking/gps_l1_ca_dll_pll_tracking_pull-in_test.cc @@ -482,7 +482,7 @@ TEST_F(GpsL1CADllPllTrackingPullInTest, ValidationOfResults) if (FLAGS_plot_detail_level >= 2) { Gnuplot g1("linespoints"); - g1.showonscreen(); // window output + if (FLAGS_show_plots) g1.showonscreen(); // window output g1.set_title(std::to_string(generator_CN0_values.at(current_cn0_idx)) + " dB-Hz, " + "PLL/DLL BW: " + std::to_string(FLAGS_PLL_bw_hz_start) + "," + std::to_string(FLAGS_DLL_bw_hz_start) + " Hz" + "GPS L1 C/A (PRN #" + std::to_string(FLAGS_test_satellite_PRN) + ")"); g1.set_grid(); g1.set_xlabel("Time [s]"); @@ -496,7 +496,7 @@ TEST_F(GpsL1CADllPllTrackingPullInTest, ValidationOfResults) //g1.savetopdf("Correlators_outputs" + std::to_string(generator_CN0_values.at(current_cn0_idx)), 18); Gnuplot g2("points"); - g2.showonscreen(); // window output + if (FLAGS_show_plots) g2.showonscreen(); // window output g2.set_title(std::to_string(generator_CN0_values.at(current_cn0_idx)) + " dB-Hz Constellation " + "PLL/DLL BW: " + std::to_string(FLAGS_PLL_bw_hz_start) + "," + std::to_string(FLAGS_DLL_bw_hz_start) + " Hz" + "GPS L1 C/A (PRN #" + std::to_string(FLAGS_test_satellite_PRN) + ")"); g2.set_grid(); g2.set_xlabel("Inphase"); @@ -519,7 +519,7 @@ TEST_F(GpsL1CADllPllTrackingPullInTest, ValidationOfResults) g3.set_legend(); //g3.savetops("CN0_output"); //g3.savetopdf("CN0_output", 18); - g3.showonscreen(); // window output + if (FLAGS_show_plots) g3.showonscreen(); // window output } } catch (const GnuplotException& ge) @@ -568,6 +568,6 @@ TEST_F(GpsL1CADllPllTrackingPullInTest, ValidationOfResults) g4.set_legend(); g4.savetops("trk_pull_in_grid_" + std::to_string(static_cast(round(generator_CN0_values.at(current_cn0_idx))))); g4.savetopdf("trk_pull_in_grid_" + std::to_string(static_cast(round(generator_CN0_values.at(current_cn0_idx)))), 12); - g4.showonscreen(); // window output + if (FLAGS_show_plots) g4.showonscreen(); // window output } } 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 0fac7c6d3..523be87a3 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 @@ -795,7 +795,7 @@ TEST_F(GpsL1CADllPllTrackingTest, ValidationOfResults) for (unsigned int current_cn0_idx = 0; current_cn0_idx < generator_CN0_values.size(); current_cn0_idx++) { Gnuplot g1("linespoints"); - g1.showonscreen(); // window output + if (FLAGS_show_plots) g1.showonscreen(); // window output g1.set_title(std::to_string(generator_CN0_values.at(current_cn0_idx)) + " dB-Hz, " + "PLL/DLL BW: " + std::to_string(PLL_wide_bw_values.at(config_idx)) + "," + std::to_string(DLL_wide_bw_values.at(config_idx)) + " Hz" + "GPS L1 C/A (PRN #" + std::to_string(FLAGS_test_satellite_PRN) + ")"); g1.set_grid(); g1.set_xlabel("Time [s]"); @@ -809,7 +809,7 @@ TEST_F(GpsL1CADllPllTrackingTest, ValidationOfResults) g1.savetopdf("Correlators_outputs" + std::to_string(generator_CN0_values.at(current_cn0_idx)), 18); } Gnuplot g2("points"); - g2.showonscreen(); // window output + if (FLAGS_show_plots) g2.showonscreen(); // window output g2.set_multiplot(ceil(static_cast(generator_CN0_values.size()) / 2.0), ceil(static_cast(generator_CN0_values.size()) / 2)); for (unsigned int current_cn0_idx = 0; current_cn0_idx < generator_CN0_values.size(); current_cn0_idx++) @@ -840,7 +840,7 @@ TEST_F(GpsL1CADllPllTrackingTest, ValidationOfResults) g3.set_legend(); g3.savetops("CN0_output"); g3.savetopdf("CN0_output", 18); - g3.showonscreen(); // window output + if (FLAGS_show_plots) g3.showonscreen(); // window output } //PLOT ERROR FIGURES (only if it is used the signal generator) @@ -849,7 +849,7 @@ TEST_F(GpsL1CADllPllTrackingTest, ValidationOfResults) if (FLAGS_plot_detail_level >= 1) { Gnuplot g5("points"); - g5.showonscreen(); // window output + if (FLAGS_show_plots) g5.showonscreen(); // window output g5.set_title("Code delay error, PLL/DLL BW: " + std::to_string(PLL_wide_bw_values.at(config_idx)) + "," + std::to_string(DLL_wide_bw_values.at(config_idx)) + " Hz (PRN #" + std::to_string(FLAGS_test_satellite_PRN) + ")"); g5.set_grid(); g5.set_xlabel("Time [s]"); @@ -874,7 +874,7 @@ TEST_F(GpsL1CADllPllTrackingTest, ValidationOfResults) Gnuplot g6("points"); - g6.showonscreen(); // window output + if (FLAGS_show_plots) g6.showonscreen(); // window output g6.set_title("Accumulated carrier phase error, PLL/DLL BW: " + std::to_string(PLL_wide_bw_values.at(config_idx)) + "," + std::to_string(DLL_wide_bw_values.at(config_idx)) + " Hz (PRN #" + std::to_string(FLAGS_test_satellite_PRN) + ")"); g6.set_grid(); g6.set_xlabel("Time [s]"); @@ -898,7 +898,7 @@ TEST_F(GpsL1CADllPllTrackingTest, ValidationOfResults) g6.savetopdf("Carrier_phase_error_output", 18); Gnuplot g4("points"); - g4.showonscreen(); // window output + if (FLAGS_show_plots) g4.showonscreen(); // window output g4.set_multiplot(ceil(static_cast(generator_CN0_values.size()) / 2.0), ceil(static_cast(generator_CN0_values.size()) / 2)); for (unsigned int current_cn0_idx = 0; current_cn0_idx < generator_CN0_values_sweep_copy.at(config_idx).size(); current_cn0_idx++) @@ -942,7 +942,7 @@ TEST_F(GpsL1CADllPllTrackingTest, ValidationOfResults) //plot metrics Gnuplot g7("linespoints"); - g7.showonscreen(); // window output + if (FLAGS_show_plots) g7.showonscreen(); // window output g7.set_title("Doppler error metrics (PRN #" + std::to_string(FLAGS_test_satellite_PRN) + ")"); g7.set_grid(); g7.set_xlabel("CN0 [dB-Hz]");