diff options
author | Lane Kolbly <lane.kolbly@ni.com> | 2022-02-23 17:04:48 -0600 |
---|---|---|
committer | Aaron Rossetto <aaron.rossetto@ni.com> | 2022-03-11 09:10:04 -0600 |
commit | 7484b4f095e3bf7c16fc2f91dc1a78f04397bf01 (patch) | |
tree | 03954f38370ba6e96acdac6eff6de271c3250195 /host/tests/rfnoc_block_tests | |
parent | 6d58b692e4d26f662e6b2317e9c65043d398f00e (diff) | |
download | uhd-7484b4f095e3bf7c16fc2f91dc1a78f04397bf01.tar.gz uhd-7484b4f095e3bf7c16fc2f91dc1a78f04397bf01.tar.bz2 uhd-7484b4f095e3bf7c16fc2f91dc1a78f04397bf01.zip |
host: test: Add UHD_UNITTEST_LOG_LEVEL override
Diffstat (limited to 'host/tests/rfnoc_block_tests')
-rw-r--r-- | host/tests/rfnoc_block_tests/x4xx_radio_mock.hpp | 15 |
1 files changed, 13 insertions, 2 deletions
diff --git a/host/tests/rfnoc_block_tests/x4xx_radio_mock.hpp b/host/tests/rfnoc_block_tests/x4xx_radio_mock.hpp index 21b8529cc..80492773b 100644 --- a/host/tests/rfnoc_block_tests/x4xx_radio_mock.hpp +++ b/host/tests/rfnoc_block_tests/x4xx_radio_mock.hpp @@ -211,12 +211,23 @@ public: */ constexpr size_t DEFAULT_MTU = 8000; -//! Helper class to make sure we get the most logging regardless of environment -// settings +//! Helper class to make sure we get the most logging. The logging level can be +// overridden using a special test-specific environment variable, +// `UHD_UNITTEST_LOG_LEVEL`. struct uhd_log_enabler { uhd_log_enabler(uhd::log::severity_level level) { + const char* env_p = std::getenv("UHD_UNITTEST_LOG_LEVEL"); + if (env_p) { + auto parsed_level = uhd::log::parse_log_level_from_string(env_p); + if (parsed_level) { + level = *parsed_level; + } else { + std::cout << "Unable to parse UHD_UNITTEST_LOG_LEVEL " << env_p << std::endl; + } + } + std::cout << "Setting log level to " << level << "..." << std::endl; uhd::log::set_log_level(level); uhd::log::set_console_level(level); |