From 834bc8753f235f0a2f52e6ce7de24efcac1312f6 Mon Sep 17 00:00:00 2001 From: Trecia Agoylo Date: Tue, 13 Feb 2024 12:20:55 +0800 Subject: [PATCH] test: update test coverage for ad7768 and ad7768-4 Signed-off-by: Trecia Agoylo --- test/dma_tests.py | 8 +++++++- test/test_ad7768.py | 26 +++++++++++++------------- test/test_ad7768_4.py | 24 ++++++++++++------------ 3 files changed, 32 insertions(+), 26 deletions(-) diff --git a/test/dma_tests.py b/test/dma_tests.py index 6be96cc71..54e42fe8e 100644 --- a/test/dma_tests.py +++ b/test/dma_tests.py @@ -17,7 +17,13 @@ def dma_rx( - uri, classname, channel, use_rx2=False, buffer_size=2 ** 15, annotated=False, param_set=None + uri, + classname, + channel, + use_rx2=False, + buffer_size=2 ** 15, + annotated=False, + param_set=None, ): """dma_rx: Construct RX buffers and verify data is non-zero when pulled. Collected buffer is of size 2**15 and 10 buffers are checked diff --git a/test/test_ad7768.py b/test/test_ad7768.py index 36942cf8e..b8f948de9 100644 --- a/test/test_ad7768.py +++ b/test/test_ad7768.py @@ -3,14 +3,6 @@ hardware = ["ad7768"] classname = "adi.ad7768" -######################################### -@pytest.mark.iio_hardware(hardware, True) -@pytest.mark.parametrize("classname", [(classname)]) -@pytest.mark.parametrize("channel", [0, 1, 2, 3, 4, 5, 6, 7]) -def test_ad7768_rx_data(test_dma_rx, iio_uri, classname, channel): - test_dma_rx(iio_uri, classname, channel) - - ######################################### @pytest.mark.iio_hardware(hardware) @pytest.mark.parametrize("classname", [(classname)]) @@ -20,9 +12,6 @@ def test_ad7768_rx_data(test_dma_rx, iio_uri, classname, channel): ( "sampling_frequency", [ - 1000, - 2000, - 4000, 8000, 16000, 32000, @@ -33,8 +22,19 @@ def test_ad7768_rx_data(test_dma_rx, iio_uri, classname, channel): ], # End on a rate compatible with all power modes ), ("filter_type", ["WIDEBAND", "SINC5"],), - ("power_mode", ["MEDIAN_MODE", "FAST_MODE"],), + ("power_mode", ["LOW_POWER_MODE", "MEDIAN_MODE", "FAST_MODE"],), ], ) -def test_ad4630_attr(test_attribute_multiple_values, iio_uri, classname, attr, val): +def test_ad7768_attr(test_attribute_multiple_values, iio_uri, classname, attr, val): test_attribute_multiple_values(iio_uri, classname, attr, val, 0) + + +######################################### +@pytest.mark.iio_hardware(hardware, True) +@pytest.mark.parametrize("classname", [(classname)]) +@pytest.mark.parametrize("channel", [0, 1, 2, 3, 4, 5, 6, 7]) +@pytest.mark.parametrize( + "param_set", [dict(filter_type="SINC5"), dict(filter_type="WIDEBAND")] +) +def test_ad7768_rx_data(test_dma_rx, iio_uri, classname, channel, param_set): + test_dma_rx(iio_uri, classname, channel, param_set=param_set) diff --git a/test/test_ad7768_4.py b/test/test_ad7768_4.py index fc49fd80a..6079c3343 100644 --- a/test/test_ad7768_4.py +++ b/test/test_ad7768_4.py @@ -3,14 +3,6 @@ hardware = ["ad7768-4"] classname = "adi.ad7768_4" -######################################### -@pytest.mark.iio_hardware(hardware, True) -@pytest.mark.parametrize("classname", [(classname)]) -@pytest.mark.parametrize("channel", [0, 1, 2, 3]) -def test_ad7768_4_rx_data(test_dma_rx, iio_uri, classname, channel): - test_dma_rx(iio_uri, classname, channel) - - ######################################### @pytest.mark.iio_hardware(hardware) @pytest.mark.parametrize("classname", [(classname)]) @@ -20,9 +12,6 @@ def test_ad7768_4_rx_data(test_dma_rx, iio_uri, classname, channel): ( "sampling_frequency", [ - 1000, - 2000, - 4000, 8000, 16000, 32000, @@ -33,9 +22,20 @@ def test_ad7768_4_rx_data(test_dma_rx, iio_uri, classname, channel): ], # End on a rate compatible with all power modes ), ("filter_type", ["WIDEBAND", "SINC5"],), - ("power_mode", ["MEDIAN_MODE", "FAST_MODE"],), + ("power_mode", ["LOW_POWER_MODE", "MEDIAN_MODE", "FAST_MODE"],), ("sync_start_enable", ["arm"],), ], ) def test_ad7768_4_attr(test_attribute_multiple_values, iio_uri, classname, attr, val): test_attribute_multiple_values(iio_uri, classname, attr, val, 0) + + +######################################### +@pytest.mark.iio_hardware(hardware, True) +@pytest.mark.parametrize("classname", [(classname)]) +@pytest.mark.parametrize("channel", [0, 1, 2, 3]) +@pytest.mark.parametrize( + "param_set", [dict(filter_type="SINC5"), dict(filter_type="WIDEBAND")] +) +def test_ad7768_4_rx_data(test_dma_rx, iio_uri, classname, channel, param_set): + test_dma_rx(iio_uri, classname, channel, param_set=param_set)