2012-01-23 00:52:05 +00:00
|
|
|
/*!
|
2020-02-08 00:20:02 +00:00
|
|
|
* \file test_main.cc
|
|
|
|
* \brief This file implements all system tests.
|
|
|
|
* \author Carles Fernandez-Prades, 2012. cfernandez(at)cttc.es
|
|
|
|
*
|
|
|
|
*
|
2020-07-28 14:57:15 +00:00
|
|
|
* -----------------------------------------------------------------------------
|
2020-02-08 00:20:02 +00:00
|
|
|
*
|
2020-12-30 12:35:06 +00:00
|
|
|
* GNSS-SDR is a Global Navigation Satellite System software-defined receiver.
|
2020-02-08 00:20:02 +00:00
|
|
|
* This file is part of GNSS-SDR.
|
|
|
|
*
|
2020-12-30 12:35:06 +00:00
|
|
|
* Copyright (C) 2010-2020 (see AUTHORS file for a list of contributors)
|
2020-02-08 00:20:02 +00:00
|
|
|
* SPDX-License-Identifier: GPL-3.0-or-later
|
|
|
|
*
|
2020-07-28 14:57:15 +00:00
|
|
|
* -----------------------------------------------------------------------------
|
2020-02-08 00:20:02 +00:00
|
|
|
*/
|
2012-01-23 00:52:05 +00:00
|
|
|
|
2013-03-15 18:05:37 +00:00
|
|
|
#include "concurrent_map.h"
|
2018-12-09 21:00:09 +00:00
|
|
|
#include "concurrent_queue.h"
|
2019-03-05 18:31:41 +00:00
|
|
|
#include "gps_acq_assist.h"
|
2018-02-26 02:15:53 +00:00
|
|
|
#include <gtest/gtest.h>
|
2024-04-29 06:27:33 +00:00
|
|
|
#include <fstream>
|
2018-02-26 02:15:53 +00:00
|
|
|
#include <iostream>
|
2024-04-29 06:27:33 +00:00
|
|
|
#include <ostream>
|
|
|
|
#include <string>
|
2018-02-26 02:15:53 +00:00
|
|
|
|
2024-04-29 06:27:33 +00:00
|
|
|
#if USE_GLOG_AND_GFLAGS
|
|
|
|
#include <gflags/gflags.h>
|
|
|
|
#include <glog/logging.h>
|
2020-08-13 18:54:22 +00:00
|
|
|
#if GFLAGS_OLD_NAMESPACE
|
|
|
|
namespace gflags
|
|
|
|
{
|
|
|
|
using namespace google;
|
|
|
|
}
|
2024-04-29 06:27:33 +00:00
|
|
|
DECLARE_string(log_dir);
|
|
|
|
#endif
|
|
|
|
#else
|
|
|
|
#include "gnss_sdr_flags.h"
|
|
|
|
#include <absl/flags/flag.h>
|
|
|
|
#include <absl/flags/parse.h>
|
2024-05-01 10:14:06 +00:00
|
|
|
#include <absl/log/flags.h>
|
2024-04-29 06:27:33 +00:00
|
|
|
#include <absl/log/globals.h>
|
|
|
|
#include <absl/log/initialize.h>
|
|
|
|
#include <absl/log/log.h>
|
|
|
|
#include <absl/log/log_sink.h>
|
|
|
|
#include <absl/log/log_sink_registry.h>
|
|
|
|
|
|
|
|
class TestingLogSink : public absl::LogSink
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
TestingLogSink()
|
|
|
|
{
|
|
|
|
if (!absl::GetFlag(FLAGS_log_dir).empty())
|
|
|
|
{
|
|
|
|
filename = std::string(absl::GetFlag(FLAGS_log_dir) + "/run_tests.log");
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
filename = std::string(GetTempDir() + "/run_tests.log");
|
|
|
|
}
|
|
|
|
logfile.open(filename);
|
|
|
|
}
|
|
|
|
void Send(const absl::LogEntry &entry) override
|
|
|
|
{
|
|
|
|
logfile << entry.text_message_with_prefix_and_newline() << std::flush;
|
|
|
|
}
|
|
|
|
|
|
|
|
private:
|
|
|
|
std::ofstream logfile;
|
|
|
|
std::string filename;
|
|
|
|
};
|
2020-08-13 18:54:22 +00:00
|
|
|
#endif
|
|
|
|
|
2014-03-23 09:45:03 +00:00
|
|
|
|
2018-09-07 12:36:11 +00:00
|
|
|
#if UNIT_TESTING_MINIMAL
|
|
|
|
#include "unit-tests/arithmetic/matio_test.cc"
|
|
|
|
#if EXTRA_TESTS
|
|
|
|
#include "unit-tests/signal-processing-blocks/acquisition/acq_performance_test.cc"
|
|
|
|
#include "unit-tests/signal-processing-blocks/tracking/tracking_pull-in_test.cc"
|
2018-10-08 17:47:39 +00:00
|
|
|
#if FPGA_BLOCKS_TEST
|
2018-09-07 12:36:11 +00:00
|
|
|
#include "unit-tests/signal-processing-blocks/tracking/tracking_pull-in_test_fpga.cc"
|
2019-02-28 20:45:30 +00:00
|
|
|
#endif // FPGA_BLOCKS_TEST
|
2018-09-07 12:36:11 +00:00
|
|
|
#include "unit-tests/signal-processing-blocks/observables/hybrid_observables_test.cc"
|
2019-02-28 20:45:30 +00:00
|
|
|
#endif // EXTRA_TESTS
|
2018-09-07 12:36:11 +00:00
|
|
|
|
2019-03-05 18:31:41 +00:00
|
|
|
#else // UNIT_TESTING_MINIMAL
|
2018-09-07 12:36:11 +00:00
|
|
|
|
2018-12-09 21:00:09 +00:00
|
|
|
#include "unit-tests/arithmetic/matio_test.cc"
|
|
|
|
#include "unit-tests/arithmetic/code_generation_test.cc"
|
2016-09-29 10:26:48 +00:00
|
|
|
#include "unit-tests/arithmetic/complex_carrier_test.cc"
|
|
|
|
#include "unit-tests/arithmetic/conjugate_test.cc"
|
|
|
|
#include "unit-tests/arithmetic/fft_length_test.cc"
|
2017-10-17 12:17:11 +00:00
|
|
|
#include "unit-tests/arithmetic/fft_speed_test.cc"
|
2018-12-09 21:00:09 +00:00
|
|
|
#include "unit-tests/arithmetic/magnitude_squared_test.cc"
|
|
|
|
#include "unit-tests/arithmetic/multiply_test.cc"
|
2020-06-11 10:09:55 +00:00
|
|
|
#include "unit-tests/arithmetic/preamble_correlator_test.cc"
|
2018-12-09 21:00:09 +00:00
|
|
|
#include "unit-tests/control-plane/in_memory_configuration_test.cc"
|
2019-04-20 09:52:00 +00:00
|
|
|
#include "unit-tests/control-plane/protobuf_test.cc"
|
2016-09-29 10:26:48 +00:00
|
|
|
#include "unit-tests/control-plane/string_converter_test.cc"
|
2016-10-10 17:36:41 +00:00
|
|
|
#include "unit-tests/signal-processing-blocks/acquisition/galileo_e1_pcps_8ms_ambiguous_acquisition_gsoc2013_test.cc"
|
2018-12-09 21:00:09 +00:00
|
|
|
#include "unit-tests/signal-processing-blocks/acquisition/galileo_e1_pcps_ambiguous_acquisition_gsoc2013_test.cc"
|
2016-10-10 17:36:41 +00:00
|
|
|
#include "unit-tests/signal-processing-blocks/acquisition/galileo_e1_pcps_cccwsr_ambiguous_acquisition_gsoc2013_test.cc"
|
|
|
|
#include "unit-tests/signal-processing-blocks/acquisition/galileo_e1_pcps_quicksync_ambiguous_acquisition_gsoc2014_test.cc"
|
2018-12-09 21:00:09 +00:00
|
|
|
#include "unit-tests/signal-processing-blocks/acquisition/galileo_e1_pcps_tong_ambiguous_acquisition_gsoc2013_test.cc"
|
2016-10-10 17:36:41 +00:00
|
|
|
#include "unit-tests/signal-processing-blocks/acquisition/galileo_e5a_pcps_acquisition_gsoc2014_gensource_test.cc"
|
2020-06-23 08:54:51 +00:00
|
|
|
#include "unit-tests/signal-processing-blocks/acquisition/galileo_e5b_pcps_acquisition_test.cc"
|
2020-11-07 20:33:26 +00:00
|
|
|
#include "unit-tests/signal-processing-blocks/acquisition/galileo_e6_pcps_acquisition_test.cc"
|
2017-07-10 23:41:38 +00:00
|
|
|
#include "unit-tests/signal-processing-blocks/acquisition/glonass_l1_ca_pcps_acquisition_gsoc2017_test.cc"
|
2018-12-09 21:00:09 +00:00
|
|
|
#include "unit-tests/signal-processing-blocks/acquisition/gps_l1_ca_pcps_acquisition_gsoc2013_test.cc"
|
|
|
|
#include "unit-tests/signal-processing-blocks/acquisition/gps_l1_ca_pcps_quicksync_acquisition_gsoc2014_test.cc"
|
|
|
|
#include "unit-tests/signal-processing-blocks/acquisition/gps_l1_ca_pcps_tong_acquisition_gsoc2013_test.cc"
|
|
|
|
#include "unit-tests/signal-processing-blocks/adapter/adapter_test.cc"
|
|
|
|
#include "unit-tests/signal-processing-blocks/adapter/pass_through_test.cc"
|
2022-12-13 16:35:53 +00:00
|
|
|
#include "unit-tests/signal-processing-blocks/libs/item_type_helpers_test.cc"
|
2024-02-20 14:49:36 +00:00
|
|
|
#include "unit-tests/signal-processing-blocks/osnma/gnss_crypto_test.cc"
|
2024-07-26 16:09:25 +00:00
|
|
|
#include "unit-tests/signal-processing-blocks/osnma/osnma_msg_receiver_test.cc"
|
2023-03-17 09:39:22 +00:00
|
|
|
#include "unit-tests/signal-processing-blocks/pvt/geohash_test.cc"
|
2022-12-13 16:35:53 +00:00
|
|
|
#include "unit-tests/signal-processing-blocks/pvt/nmea_printer_test.cc"
|
|
|
|
#include "unit-tests/signal-processing-blocks/pvt/rinex_printer_test.cc"
|
|
|
|
#include "unit-tests/signal-processing-blocks/pvt/rtcm_printer_test.cc"
|
|
|
|
#include "unit-tests/signal-processing-blocks/pvt/rtcm_test.cc"
|
|
|
|
#include "unit-tests/signal-processing-blocks/pvt/serdes_monitor_pvt_test.cc"
|
|
|
|
#include "unit-tests/signal-processing-blocks/resampler/direct_resampler_conditioner_cc_test.cc"
|
|
|
|
#include "unit-tests/signal-processing-blocks/resampler/mmse_resampler_test.cc"
|
|
|
|
#include "unit-tests/signal-processing-blocks/sources/gnss_sdr_valve_test.cc"
|
|
|
|
#include "unit-tests/signal-processing-blocks/sources/unpack_2bit_samples_test.cc"
|
|
|
|
#include "unit-tests/signal-processing-blocks/telemetry_decoder/galileo_fnav_inav_decoder_test.cc"
|
|
|
|
#include "unit-tests/signal-processing-blocks/tracking/cpu_multicorrelator_real_codes_test.cc"
|
|
|
|
#include "unit-tests/signal-processing-blocks/tracking/cpu_multicorrelator_test.cc"
|
|
|
|
#include "unit-tests/signal-processing-blocks/tracking/discriminator_test.cc"
|
|
|
|
#include "unit-tests/signal-processing-blocks/tracking/galileo_e5a_tracking_test.cc"
|
|
|
|
#include "unit-tests/signal-processing-blocks/tracking/galileo_e5b_dll_pll_tracking_test.cc"
|
|
|
|
#include "unit-tests/signal-processing-blocks/tracking/tracking_loop_filter_test.cc"
|
|
|
|
#include "unit-tests/system-parameters/galileo_e1b_reed_solomon_test.cc"
|
|
|
|
#include "unit-tests/system-parameters/galileo_e6b_reed_solomon_test.cc"
|
2024-09-20 16:54:18 +00:00
|
|
|
#include "unit-tests/system-parameters/galileo_ism_test.cc"
|
2022-12-13 16:35:53 +00:00
|
|
|
#include "unit-tests/system-parameters/glonass_gnav_ephemeris_test.cc"
|
|
|
|
#include "unit-tests/system-parameters/glonass_gnav_nav_message_test.cc"
|
|
|
|
#include "unit-tests/system-parameters/has_decoding_test.cc"
|
|
|
|
|
|
|
|
#ifndef EXCLUDE_TESTS_REQUIRING_BINARIES
|
|
|
|
#include "unit-tests/control-plane/control_thread_test.cc"
|
|
|
|
#include "unit-tests/control-plane/file_configuration_test.cc"
|
|
|
|
#include "unit-tests/control-plane/gnss_block_factory_test.cc"
|
|
|
|
#include "unit-tests/control-plane/gnss_flowgraph_test.cc"
|
|
|
|
#include "unit-tests/signal-processing-blocks/acquisition/galileo_e1_pcps_ambiguous_acquisition_gsoc_test.cc"
|
|
|
|
#include "unit-tests/signal-processing-blocks/acquisition/galileo_e1_pcps_ambiguous_acquisition_test.cc"
|
|
|
|
#include "unit-tests/signal-processing-blocks/acquisition/gps_l1_ca_pcps_acquisition_test.cc"
|
2018-12-09 21:00:09 +00:00
|
|
|
#include "unit-tests/signal-processing-blocks/filter/fir_filter_test.cc"
|
|
|
|
#include "unit-tests/signal-processing-blocks/filter/notch_filter_lite_test.cc"
|
|
|
|
#include "unit-tests/signal-processing-blocks/filter/notch_filter_test.cc"
|
|
|
|
#include "unit-tests/signal-processing-blocks/filter/pulse_blanking_filter_test.cc"
|
|
|
|
#include "unit-tests/signal-processing-blocks/sources/file_signal_source_test.cc"
|
2022-12-13 16:35:53 +00:00
|
|
|
#include "unit-tests/signal-processing-blocks/tracking/galileo_e1_dll_pll_veml_tracking_test.cc"
|
|
|
|
#include "unit-tests/signal-processing-blocks/tracking/glonass_l1_ca_dll_pll_c_aid_tracking_test.cc"
|
|
|
|
#include "unit-tests/signal-processing-blocks/tracking/glonass_l1_ca_dll_pll_tracking_test.cc"
|
|
|
|
#endif
|
2017-10-03 11:47:55 +00:00
|
|
|
|
2016-04-30 09:33:52 +00:00
|
|
|
#if OPENCL_BLOCKS_TEST
|
2016-10-10 17:36:41 +00:00
|
|
|
#include "unit-tests/signal-processing-blocks/acquisition/gps_l1_ca_pcps_opencl_acquisition_gsoc2013_test.cc"
|
2016-04-30 09:33:52 +00:00
|
|
|
#endif
|
2016-06-17 10:48:31 +00:00
|
|
|
|
2018-12-09 21:00:09 +00:00
|
|
|
#include "unit-tests/signal-processing-blocks/tracking/bayesian_estimation_test.cc"
|
2019-06-14 17:16:37 +00:00
|
|
|
#if ARMADILLO_HAVE_MVNRND
|
2019-06-12 18:51:19 +00:00
|
|
|
#include "unit-tests/signal-processing-blocks/tracking/cubature_filter_test.cc"
|
2021-10-08 17:07:11 +00:00
|
|
|
// #include "unit-tests/signal-processing-blocks/tracking/unscented_filter_test.cc"
|
2019-06-14 17:16:37 +00:00
|
|
|
#endif
|
2020-02-07 09:58:33 +00:00
|
|
|
|
2016-06-17 10:48:31 +00:00
|
|
|
#if CUDA_BLOCKS_TEST
|
2017-01-28 15:49:46 +00:00
|
|
|
#include "unit-tests/signal-processing-blocks/tracking/gpu_multicorrelator_test.cc"
|
2016-06-17 10:48:31 +00:00
|
|
|
#endif
|
|
|
|
|
2017-03-13 19:54:25 +00:00
|
|
|
#if FPGA_BLOCKS_TEST
|
2019-12-18 15:23:17 +00:00
|
|
|
#include "unit-tests/signal-processing-blocks/acquisition/galileo_e1_pcps_ambiguous_acquisition_test_fpga.cc"
|
2020-02-07 09:58:33 +00:00
|
|
|
#include "unit-tests/signal-processing-blocks/acquisition/gps_l1_ca_pcps_acquisition_test_fpga.cc"
|
2018-12-09 21:00:09 +00:00
|
|
|
#include "unit-tests/signal-processing-blocks/tracking/gps_l1_ca_dll_pll_tracking_test_fpga.cc"
|
2017-03-13 19:54:25 +00:00
|
|
|
#endif
|
|
|
|
|
2017-01-28 15:49:46 +00:00
|
|
|
#if EXTRA_TESTS
|
2018-07-10 16:43:36 +00:00
|
|
|
#include "unit-tests/signal-processing-blocks/acquisition/acq_performance_test.cc"
|
2019-08-18 23:29:04 +00:00
|
|
|
// #include "unit-tests/signal-processing-blocks/acquisition/beidou_b1i_pcps_acquisition_test.cc"
|
|
|
|
// #include "unit-tests/signal-processing-blocks/acquisition/beidou_b3i_pcps_acquisition_test.cc"
|
2022-12-19 14:09:55 +00:00
|
|
|
#ifndef EXCLUDE_TESTS_REQUIRING_BINARIES
|
2018-12-09 21:00:09 +00:00
|
|
|
#include "unit-tests/signal-processing-blocks/acquisition/glonass_l1_ca_pcps_acquisition_test.cc"
|
|
|
|
#include "unit-tests/signal-processing-blocks/acquisition/gps_l2_m_pcps_acquisition_test.cc"
|
2024-07-26 16:09:25 +00:00
|
|
|
#include "unit-tests/signal-processing-blocks/osnma/osnma_test_vectors.cc"
|
2022-12-19 14:09:55 +00:00
|
|
|
#include "unit-tests/signal-processing-blocks/tracking/gps_l2_m_dll_pll_tracking_test.cc"
|
|
|
|
#endif
|
2021-02-23 08:55:56 +00:00
|
|
|
// #include "unit-tests/signal-processing-blocks/pvt/rtklib_solver_test.cc"
|
2017-01-28 15:49:46 +00:00
|
|
|
#include "unit-tests/signal-processing-blocks/tracking/gps_l1_ca_dll_pll_tracking_test.cc"
|
2022-08-30 09:30:53 +00:00
|
|
|
#include "unit-tests/signal-processing-blocks/tracking/gps_l1_ca_gaussian_tracking_test.cc"
|
2018-07-19 14:26:51 +00:00
|
|
|
#include "unit-tests/signal-processing-blocks/tracking/tracking_pull-in_test.cc"
|
2018-08-29 16:20:41 +00:00
|
|
|
#if FPGA_BLOCKS_TEST
|
2018-08-10 11:12:06 +00:00
|
|
|
#include "unit-tests/signal-processing-blocks/tracking/tracking_pull-in_test_fpga.cc"
|
2019-02-28 20:45:30 +00:00
|
|
|
#endif // FPGA_BLOCKS_TEST
|
2017-04-12 15:04:51 +00:00
|
|
|
#include "unit-tests/signal-processing-blocks/observables/hybrid_observables_test.cc"
|
2018-09-13 14:36:21 +00:00
|
|
|
#if FPGA_BLOCKS_TEST
|
|
|
|
#include "unit-tests/signal-processing-blocks/observables/hybrid_observables_test_fpga.cc"
|
2019-02-28 20:45:30 +00:00
|
|
|
#endif // FPGA_BLOCKS_TEST
|
2018-12-09 21:00:09 +00:00
|
|
|
#include "unit-tests/signal-processing-blocks/telemetry_decoder/gps_l1_ca_telemetry_decoder_test.cc"
|
2019-02-28 20:45:30 +00:00
|
|
|
#endif // EXTRA_TESTS
|
2017-01-28 15:49:46 +00:00
|
|
|
|
2018-09-07 12:36:11 +00:00
|
|
|
#endif // UNIT_TESTING_MINIMAL
|
2017-02-13 16:20:49 +00:00
|
|
|
|
2015-06-05 16:46:00 +00:00
|
|
|
// For GPS NAVIGATION (L1)
|
2019-02-22 09:47:24 +00:00
|
|
|
Concurrent_Queue<Gps_Acq_Assist> global_gps_acq_assist_queue;
|
|
|
|
Concurrent_Map<Gps_Acq_Assist> global_gps_acq_assist_map;
|
2012-01-23 00:52:05 +00:00
|
|
|
|
|
|
|
int main(int argc, char **argv)
|
|
|
|
{
|
2020-07-07 16:53:50 +00:00
|
|
|
std::cout << "Running GNSS-SDR Tests...\n";
|
2015-06-12 15:58:50 +00:00
|
|
|
int res = 0;
|
2016-10-13 22:26:05 +00:00
|
|
|
try
|
2018-03-03 01:03:39 +00:00
|
|
|
{
|
2016-10-13 22:26:05 +00:00
|
|
|
testing::InitGoogleTest(&argc, argv);
|
2018-03-03 01:03:39 +00:00
|
|
|
}
|
|
|
|
catch (...)
|
|
|
|
{
|
|
|
|
} // catch the "testing::internal::<unnamed>::ClassUniqueToAlwaysTrue" from gtest
|
2024-04-29 06:27:33 +00:00
|
|
|
#if USE_GLOG_AND_GFLAGS
|
2020-08-13 18:54:22 +00:00
|
|
|
gflags::ParseCommandLineFlags(&argc, &argv, true);
|
2015-06-12 15:58:50 +00:00
|
|
|
google::InitGoogleLogging(argv[0]);
|
2024-04-29 06:27:33 +00:00
|
|
|
#else
|
|
|
|
absl::ParseCommandLine(argc, argv);
|
|
|
|
absl::LogSink *testLogSink = new TestingLogSink;
|
|
|
|
absl::AddLogSink(testLogSink);
|
|
|
|
absl::InitializeLog();
|
|
|
|
#endif
|
2015-05-15 01:02:45 +00:00
|
|
|
try
|
2018-03-03 01:03:39 +00:00
|
|
|
{
|
2015-06-12 15:58:50 +00:00
|
|
|
res = RUN_ALL_TESTS();
|
2018-03-03 01:03:39 +00:00
|
|
|
}
|
|
|
|
catch (...)
|
|
|
|
{
|
2015-05-22 16:37:24 +00:00
|
|
|
LOG(WARNING) << "Unexpected catch";
|
2018-03-03 01:03:39 +00:00
|
|
|
}
|
2024-04-29 06:27:33 +00:00
|
|
|
#if USE_GLOG_AND_GFLAGS
|
2020-08-13 18:54:22 +00:00
|
|
|
gflags::ShutDownCommandLineFlags();
|
2024-04-29 06:27:33 +00:00
|
|
|
#else
|
|
|
|
absl::FlushLogSinks();
|
|
|
|
#endif
|
2015-06-12 15:58:50 +00:00
|
|
|
return res;
|
2012-01-23 00:52:05 +00:00
|
|
|
}
|