aboutsummaryrefslogtreecommitdiffstats
path: root/host/tests
Commit message (Collapse)AuthorAgeFilesLines
* convert: Add benchmarking abilitiesAaron Rossetto2022-02-281-10/+97
| | | | | This commit adds code to the convert tests to support the ability to benchmark individual conversion test cases.
* tests: Force converter tests to be run with all available priosMartin Braun2022-02-281-49/+91
|
* convert: Minor cleanupAaron Rossetto2022-02-281-113/+36
| | | | | | | | | | | | | | | | | | | This commit implements some minor cleanup of various converter- and convert test-related code: * Improves the log messages regarding which converter was returned for a request. * Modifies the result checking code in the converter tests to only report an out-of-range sample error once, rather than reporting every out-of-range sample encountered during the test. This vastly cuts down on the output when a conversion has failed. * Adds a function `reverse_converter()` which, given a `convert::id_type` describing a conversion from C1 to C2, returns a `convert::id_type` describing the reverse conversion (C2 to C1). * Removes two redundant test cases from the converter test.
* Build uhd_test library as static when `-DBUILD_SHARED_LIBS=ON`David Seifert2022-02-241-1/+1
| | | | | * A uhd_test.so lacks the necessary symbols for testing due to default visibility set to hidden.
* host: Throw exception when accessing properties with incorrect typeLane Kolbly2022-02-071-0/+25
|
* uhd: Harmonize fuzzy frequency comparisonsMartin Braun2022-02-041-0/+10
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Throughout UHD, we often do floating-point comparisons for frequency ranges that require resilience to floating point rounding errors. Most of the time the checks look like this: ```cpp if (fp_compare_epsilon<double>(freq) > boundary) { // ... } ``` The exception is the N320 daughterboard control, which uses a custom epsilon: ```cpp if (fp_compare_epsilon<double>(freq, RHODIUM_FREQ_COMPARE_EPSILON) > boundary) { // ... } ``` This was, for the most part, not by design, but because authors simply didn't think about which epsilon value was appropriate for the frequency comparison. This was complicated by the fact that fp_compare_epsilon previously had some issues. This patch introduces FREQ_COMPARE_EPSILON, which is a sensible default value for fp_compare_epsilon when doing frequency comparisons (note that fp_compare_delta already had such a value). Also, it introduces freq_compare_epsilon(x), which is a shorthand for fp_compare_epsilon<double>(x, FREQ_COMPARE_EPSILON). We then replace all occurrences of fp_compare_epsilon<double> which are specific to frequency checks with freq_compare_epsilon.
* math: fp_compare: Adapt fp_compare_epsilon API to actual useMartin Braun2022-02-041-0/+15
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | UHD had an issue where the design of fp_compare_epsilon and its usage differed. In fact, the *only* usage of fp_compare_epsilon outside of unit tests was to do a fuzzy frequency comparison, and it always took a form like this: ```cpp // The argument EPSILON may be implied, i.e., using the default if (fp_compare_epsilon<double>(test_freq, EPSILON) < boundary_freq) { // ... } ``` However, the API of fp_compare_epsilon was such that it would apply DOUBLE_PRECISION_EPSILON to part of the frequency comparison, thus rendering the argument EPSILON obsolete. When the default EPSILON was used, this was OK, but only when the floating point type of fp_compare_epsilon<> was `double`, and not `float`. As an example, consider the following: ``` if (fp_compare_epsilon<double>(1e9 + x, LITTLE_EPSILON) == 1e9) { // .... } double BIG_EPSILON = x * 10; if (fp_compare_epsilon<double>(1e9 + x, BIG_EPSILON) == 1e9) { // .... } ``` If you expect the second comparison to pass even if the first failed, then you are not alone. However, that's not what UHD would do. Because of the aforementioned behaviour, it would use DOUBLE_PRECISION_EPSILON for the right hand comparison, which would fail again. Instead of fixing the instances of fp_compare_epsilon throughout UHD, this patch changes the comparison algorithm from "very close with tolerance epsilon" to "close enough with tolerance epsilon". This requires only one side to be close to the other, using its own epsilon, so the aforementioned example would always pass on the second check. However, this exposed a second bug in fp_compare_epsilon. For greater-/less-than comparisons, it would use epsilon like a delta value, i.e., it would check if a + epsilon < b - epsilon That means that if a < b, but (b-a) < 2*epsilon, this check would return "false", i.e., it would report that a >= b, which is incorrect. These operators are now changed such that they first check equality of a and b using the algorithm described in the code, and then compare the values of a and b (ignoring epsilon) directly. A unit test for this case was added.
* host: zbx: Expose tuning table on property treeLane Kolbly2022-02-031-0/+59
| | | | | This allows viewing or, conceivably, customizing the tuning table that ZBX uses, depending on the particular needs of the end user.
* tests: Modularize x4xx_radio_mock to use it in other testsMartin Anderseck2022-01-252-269/+293
| | | | | Move x4xx_radio_mock_reg_iface_t and x400_radio_fixture from radio block test into own file to reuse it more easily in the future.
* host: Implement nameless_gain_mixinLane Kolbly2022-01-201-0/+1
|
* tests: disable x4xx_radio_block_test on macOSSteven Koo2022-01-191-26/+31
| | | | | | | | This commit disables x4xx_radio_block_test on macOS because the platform has stricter casting and symbol export rules, which causes this test to fail. Signed-off-by: Steven Koo <steven.koo@ni.com>
* SPI: Implement SPI engine for x410Martin Anderseck2022-01-131-0/+1
| | | | | Add SPI Core host implementation for x410 and a discoverable feature to make it accessible.
* host: tests: Make x4xx unit test support GPIOLane Kolbly2022-01-111-1/+1
|
* rfnoc: Add atomic item size property for RFNoC blocksLars Amsel2022-01-101-0/+106
| | | | | | | | | | | | | | | An RFNoC block (like the radio) might require a minimal number of items in each clock cycle, e.g. the radio has to process SPC (samples per cycle). Because data in RFNoC is transmitted and processed in packets, we have to make sure the items inside these packets are a multiple of the items processed in each cycle. This commit adds an atomic item size properties which is set by the radio and adapted by the streamers. The streamers adapt the SPP property of the radio block controller depending on the MTU value. This might lead to an SPP value which does not align with the SPC value of the radio block, hence we add a property resolver for the atomic item size.
* host: rf_control: Add internal antenna API abstraction.Lane Kolbly2022-01-051-0/+1
|
* host: tests: Add unit test for ZBX antenna APILane Kolbly2022-01-051-0/+20
|
* rfnoc: Fix block_id::get_tree_root()Martin Braun2021-12-161-0/+2
| | | | | The path it returned was only valid in UHD 3. Added unit test to confirm.
* tests: Add replay-back-edge testMartin Braun2021-12-091-0/+44
| | | | | | | | | This tests the following graph: DDC -> Replay -> DDC, where the initial and final blocks are the same (i.e., a loop). This could be useful for generating and capturing data with the same replay block while testing a block. Note that this test will fail if the edge consistency checks are buggy.
* cmake: tests: Conditionally compile tests for X400Martin Braun2021-12-081-30/+32
| | | | | When using ENABLE_X400=OFF, we should also disable the corresponding tests, or we get linker errors.
* tests: Remove non-functional DPDK testAndrew Lynch2021-12-061-97/+2
|
* dpdk: Upgrade to DPDK 19.11 APIAndrew Lynch2021-12-061-2/+2
| | | | Support DPDK versions 19.11 and 20.11
* uhd: Remove superfluous boost/bind.hpp includesMartin Braun2021-12-031-2/+0
| | | | | On newer versions of Boost, they show deprecation notes. However, they're not actually used any more so they can go.
* rfnoc: Clarify usage of MTU vs. max payload size, remove DEFAULT_SPPMartin Braun2021-12-025-18/+64
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | These two values where being mixed up in the code. To summarize: - The MTU is the max CHDR packet size, including header & timestamp. - The max payload is the total number of bytes regular payload plus metadata that can be fit into into a CHDR packet. It is strictly smaller than the MTU. For example, for 64-bit CHDR widths, if a timestamp is desired, the max payload is 16 bytes smaller than the MTU. The other issue was that we were using a magic constant (DEFAULT_SPP) which was causing conflicts with MTUs and max payloads. This constant was harmful in multiple ways: - The explanatory comment was incorrect (it stated it would cap packets to 1500 bytes, which it didn't) - It imposed random, hardcoded values that interfered with an 'spp discovery', i.e., the ability to derive a good spp value from MTUs - The current value capped packet sizes to 8000 bytes CHDR packets, even when we wanted to use bigger ones This patch changes the following: - noc_block_base now has improved docs for MTU, and additional APIs (get_max_payload_size(), get_chdr_hdr_len()) which return the current payload size given MTU and CHDR width, and the CHDR header length. - The internally used graph nodes for TX and RX streamers also get equipped with the same new two API calls. - The radio, siggen, and replay block all where doing different calculations for their spp/ipp values. Now, they all use the max payload value to calculate spp/ipp. Unit tests where adapted accordingly. Usage of DEFAULT_SPP was removed. - The replay block used a hardcoded 16 bytes for header lengths, which was replaced by get_chdr_hdr_len() - The TX and RX streamers where discarding the MTU value and using the max payload size as the MTU, which then propagated throughout the graph. Now, both values are stored and can be used where appropriate.
* tests: add automated streaming testsMatthew Crymble2021-11-303-0/+382
|
* tests: add streaming setup script for performance enhancementsMatthew Crymble2021-11-301-0/+288
| | | | | | | | | This script is intended to be run before streaming. - Manages network interfaces, memory buffers, and other aspects of the system configuration to give the host machine ideal performance during streaming. - Installs/updates dpdk/util dependencies for the script - Generates and writes uhd config files for dpdk
* tests: Remove skip_dram from streaming performance test scriptMartin Braun2021-11-161-2/+2
|
* rfnoc: Add CHDR width to make argsMartin Braun2021-11-121-0/+2
| | | | | | | This provides every block controller with a copy of its CHDR width. Note: mock blocks always get configured with a 64-bit CHDR width, to retain API compatibility.
* tests: Fix rfnoc_graph mock nodes stop-stream commandMartin Braun2021-11-121-1/+1
| | | | Thanks to Github user johnwstanford for pointing this out.
* host: Add RPC calls for GPIO voltageLane Kolbly2021-11-051-1/+21
|
* host: x4xx: Implement GPIO APILane Kolbly2021-11-031-0/+2
| | | | | | | | | | | | This implements the GPIO API for X410 through get_gpio_attr and set_gpio_attr. In ATR mode, which channel's ATR state is chosen by the set_gpio_src call, setting e.g. DB0_RF0 for channel 0 or DB0_RF1 for channel 1. In manual mode, all 24 bits (for both ports) are set in a single register write. Although the front panel of the device has two ports, labelled GPIO0 and GPIO1, this API exposes them as though they were a single 24-bit GPIO port.
* host: Add GPIO functions to MPM RPC shimLane Kolbly2021-11-031-0/+15
|
* tests: Use reference type to prevent copyA. Maitland Bottoms2021-10-221-1/+1
| | | | Thanks to mait for the fix!
* uhd: math: Replace wrap-frequency math with a single functionMartin Braun2021-10-191-0/+8
| | | | | | | | | In multiple places in the UHD code, we were doing the same calculation for a wrapped frequency (wrap it into the first Nyquist zone). This math was using boost::math, too. Instead of editing every instance, we create a new function, uhd::math::wrap_frequency(), and replace all of its separate implementations with this function. The new function also no longer relies on boost::math::sign.
* uhd: math: Add a sign() functionMartin Braun2021-10-191-0/+7
| | | | | We've been having issues with moving locations of Boost headers for this function, and it's simple enough to implement ourselves.
* devtest: Clarify data type in multi_usrp_test::send_waveform()Martin Braun2021-10-061-1/+1
|
* devtest: Add receive stability test to B2xx devtestMartin Braun2021-09-282-0/+52
|
* devtest: Add receive stability testMartin Braun2021-09-281-0/+174
| | | | | | | At this point, this test chokes an RX streamer to force an overrun. It then confirms that the overrun message is returned to the call site, and that the streamer returns to continuous streaming after the overrun handling.
* uhd: zbx: Prevent TX antenna config from disrupting RXLane Kolbly2021-09-161-0/+20
| | | | | | | | | | | | | | So, both the set_tx_antenna_switches and set_rx_antenna_switches functions configure the TX0_ANT_11 register (which controls the final switch before the TX/RX port, switching it between the three TX paths and the RX path). The RX antenna configuration code will, if the RX antenna is set to TX/RX, configure that switch to the TX/RX->RX path when the ATR is set to RX. However, the TX antenna config code will always configure that switch to the "bypass" path, for both the 0X and RX ATR modes, regardless of whether the RX side actually needs that path. Ergo, this change makes set_tx_antenna_switches only configure that switch when it is configuring the XX or TX modes.
* cmake: Replace CMAKE_{SOURCE,BINARY}_DIR with UHD_*_DIRMartin Braun2021-09-103-72/+72
| | | | | | | | | | | | | | | | | | | | | | | | | | See the CMake 3.8 documentation on these two variables: https://cmake.org/cmake/help/v3.8/variable/PROJECT-NAME_SOURCE_DIR.html https://cmake.org/cmake/help/v3.8/variable/CMAKE_SOURCE_DIR.html Under normal circumstances, these two are identical. For sub-projects (i.e., when building UHD as part of something else that is also a CMake project), only the former is useful. There is no discernible downside of using UHD_SOURCE_DIR over CMAKE_SOURCE_DIR. This was changed using sed: $ sed -i "s/CMAKE_SOURCE_DIR/UHD_SOURCE_DIR/g" \ `ag -l CMAKE_SOURCE_DIR **/{CMakeLists.txt,*.cmake}` $ sed -i "s/CMAKE_BINARY_DIR/UHD_BINARY_DIR/g" \ `ag -l CMAKE_BINARY_DIR **/{CMakeLists.txt,*.cmake}` At the same time, we also replace the CMake variable UHD_HOST_ROOT (used in MPM) with UHD_SOURCE_DIR. There's no reason to have two variables with the same meaning and different names, but more importantly, this means that UHD_SOURCE_DIR is defined even in those cases where MPM calls into CMake files from UHD without any additional patches. Shoutout to GitHub user marcobergamin for bringing this up.
* tests: Fix check in link_testMartin Braun2021-08-311-2/+2
| | | | | | | | The test_recv_get_release test should be checking received packets had the same content as they did on send(), but was instead assigning to the received buffer. Shoutouts to GitHub user johnwstanford for pointing out the issue.
* rfnoc: ddc: Improve unit tests and documentationMartin Braun2021-08-301-5/+19
| | | | | | | The previous commit fixed a bug in the DUC, where get_frequency_range() reported incorrect values. The DDC did not have this bug, but we port the updates to the unit tests and the documentation from the DUC to the DDC for consistency's sake.
* rfnoc: duc: Fix frequency range for DUC blockMartin Braun2021-08-301-7/+21
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The tuning range of the DUC depends on the output sample rate (which is larger), but it was using the input sample rate. This was causing a bug where for Tx, the DSP tuning range was limited when using multi_usrp API, and thus would not allow to DSP-tune beyond the current sampling rate. In this patch, we also re-use the existing calculation of the sampling rate, and harmonize that code between duc_block_control and ddc_block_control. Consider the following Python REPL code: >>> import uhd >>> U = uhd.usrp.MultiUSRP('type=x300') >>> U.set_rx_rate(10e6) >>> U.set_tx_rate(10e6) >>> # Creating a streaming is required, or the input rate will not be >>> # set: >>> S = U.get_tx_stream(uhd.usrp.StreamArgs("fc32", "sc16")) >>> treq = uhd.types.TuneRequest(1e9) >>> treq.rf_freq = 1e9 >>> treq.dsp_freq = 50e6 >>> treq.dsp_freq_policy = uhd.types.TuneRequestPolicy.manual >>> treq.rf_freq_policy = uhd.types.TuneRequestPolicy.manual >>> tres = U.set_rx_freq(treq, 0) >>> print(str(tres)) Tune Result: Target RF Freq: 1000.000000 (MHz) Actual RF Freq: 1000.000000 (MHz) Target DSP Freq: 50.000000 (MHz) Actual DSP Freq: 5.000000 (MHz) >>> # Note the last two lines: The *target* DSP freq was already clipped >>> # to 5 MHz. These lines show 50.0 MHz when this patch is applied. This bugfix is accompanied some related changes: - The unit test is amended to verify the behaviour - The API documentation is amended with details on its behaviour
* tests: Add recv(0) case to rx_streamer_testAaron Rossetto2021-08-201-0/+39
|
* test: Fix potential resource leakMartin Anderseck2021-08-041-5/+4
| | | | | | | Fixed issue where variable tmp_file going out of scope could have leaked the storage it points to. Replaced the declaration of tmp_file by using a unique pointer with custom deleter that takes care of closing the tmpfile when it is not needed anymore.
* uhd: Fix usage of std::abs with template parametersMartin Braun2021-07-231-3/+3
| | | | | | | | | `std::abs` is only a templated function, when dealing with complex numbers. For real values, it is an overload. There is no documented standard way to use `std::abs<double>()` for real-valued arguments. We therefore remove all usages of `std::abs<>()` and replace them with `std::abs()` where they were taking a real-valued argument.
* rfnoc: allow find_blocks to search by device number or block count.Lars Amsel2021-07-201-0/+1
| | | | | | | | | | | | | In current implementation it is not possible to find all blocks of a device by calling find_blocks("0/"). The same is true for the block count. This is caused by the valid block id regex which requires a block name. This regex is used to validate the block name as well as to match block ids in search. This fix looses the requirement for the block name to allow searches by device number and block count and also extends the is_valid_block_id method to require the block name match to be non empty (which restores the previous behaviour at this point).
* rfnoc: fix block id check to allow underscoreLars Amsel2021-07-141-0/+7
| | | | | | | We allow underscore in RFNoC's block names but the regular expressions only allowed the underscore in the block name RE. This fix adds the underscore to the block id RE as well as adapts the unit tests accordingly.
* tests: add missing header, required by some compilersMichael Dickens2021-07-021-0/+1
| | | | Ref: https://github.com/EttusResearch/uhd/issues/451
* uhd: Remove includes of list_of.hpp where appropriateMartin Braun2021-06-243-4/+0
| | | | This Boost header is included in some places, despite not being used.
* uhd: Remove all occurences of boost::math::*round()Martin Braun2021-06-241-5/+3
| | | | | | | Its behaviour is almost identical to std::lround, which we use instead. The only downside of std::lround is that it always returns a long, which we don't always need. We thus add some casts for those cases to make the compiler happy.