From 0ae0e54042c31c8ac54c4cfc0b61df6bcfcf7df7 Mon Sep 17 00:00:00 2001 From: Adrian Stanea Date: Tue, 8 Oct 2024 15:09:59 +0300 Subject: [PATCH 1/3] tests/digital: add missing function import Signed-off-by: Adrian Stanea --- tests/m2k_digital_test.py | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/tests/m2k_digital_test.py b/tests/m2k_digital_test.py index 553d06dd..0869ee16 100644 --- a/tests/m2k_digital_test.py +++ b/tests/m2k_digital_test.py @@ -1,7 +1,15 @@ import unittest import libm2k -from digital_functions import set_digital_trigger, check_digital_channels_state, check_digital_output, \ - check_digital_trigger, check_open_drain_mode, test_kernel_buffers, test_pattern_generator_pulse +from digital_functions import ( + check_digital_channels_state, + check_digital_output, + check_digital_trigger, + check_open_drain_mode, + set_digital_trigger, + test_kernel_buffers, + test_last_sample_hold, + test_pattern_generator_pulse, +) from digital_functions import test_digital_cyclic_buffer import reset_def_values as reset from open_context import ctx, dig, d_trig @@ -81,4 +89,4 @@ def test_last_sample_hold(self): # All channels result_ok = test_last_sample_hold(dig, d_trig, ctx, None) with self.subTest(msg="DIO all"): - self.assertEqual(result_ok, True, f"Failed to hold the last sample on all DIO test") \ No newline at end of file + self.assertEqual(result_ok, True, f"Failed to hold the last sample on all DIO test") From 36633a5ed6499648a1bedc2c137b93922d1311e5 Mon Sep 17 00:00:00 2001 From: Adrian Stanea Date: Tue, 8 Oct 2024 16:12:18 +0300 Subject: [PATCH 2/3] tests/analog: remove assert to allow subsequent subtests to run after a failure Signed-off-by: Adrian Stanea --- tests/analog_functions.py | 9 --------- 1 file changed, 9 deletions(-) diff --git a/tests/analog_functions.py b/tests/analog_functions.py index 8881f049..45a1a54d 100644 --- a/tests/analog_functions.py +++ b/tests/analog_functions.py @@ -1418,14 +1418,11 @@ def check_for_glitch(data, threshold=0.3): if channel is None: # Both channels should idle at 0V before push due to being reset is_idle_ok = is_idle_ok and are_values_within_range(data[:, :2000], -0.20, 0.20, channel) - assert is_idle_ok, "STEP1: Both channels should idle low before push due to being reset" elif channel == libm2k.ANALOG_IN_CHANNEL_1: # CH2 should idle at 0V if we are testing CH1 is_idle_ok = is_idle_ok and are_values_within_range(data, -0.20, 0.20, libm2k.ANALOG_IN_CHANNEL_2) - assert is_idle_ok, "STEP1: CH2 should idle at 0V if we are testing CH1" elif channel == libm2k.ANALOG_IN_CHANNEL_2: is_idle_ok = is_idle_ok and are_values_within_range(data, -0.20, 0.20, libm2k.ANALOG_IN_CHANNEL_1) - assert is_idle_ok, "STEP1: CH1 should idle at 0V if we are testing CH2" # Shoud hold last sample from new buffer for current channel config is_idle_ok = is_idle_ok and are_values_within_range(data[:, -2000:], cfg["amplitude"] * 0.85, cfg["amplitude"] * 1.15, channel) @@ -1448,10 +1445,8 @@ def check_for_glitch(data, threshold=0.3): if channel == libm2k.ANALOG_IN_CHANNEL_1: # CH2 should idle at 0V if we are testing CH1 is_idle_ok = is_idle_ok and are_values_within_range(data, -0.20, 0.20, libm2k.ANALOG_IN_CHANNEL_2) - assert is_idle_ok, "STEP2: CH2 should idle at 0V if we are testing CH1" elif channel == libm2k.ANALOG_IN_CHANNEL_2: is_idle_ok = is_idle_ok and are_values_within_range(data, -0.20, 0.20, libm2k.ANALOG_IN_CHANNEL_1) - assert is_idle_ok, "STEP2: CH1 should idle at 0V if we are testing CH2" glitched = glitched or check_for_glitch(data) if gen_reports: plot_to_file(title=f"Last Sample Hold: {chn_str} - {sr_str} - Falling Ramp", @@ -1472,10 +1467,8 @@ def check_for_glitch(data, threshold=0.3): if channel == libm2k.ANALOG_IN_CHANNEL_1: # CH2 should idle at 0V if we are testing CH1 is_idle_ok = is_idle_ok and are_values_within_range(data, -0.20, 0.20, libm2k.ANALOG_IN_CHANNEL_2) - assert is_idle_ok, "STEP3: CH2 should idle at 0V if we are testing CH1" elif channel == libm2k.ANALOG_IN_CHANNEL_2: is_idle_ok = is_idle_ok and are_values_within_range(data, -0.20, 0.20, libm2k.ANALOG_IN_CHANNEL_1) - assert is_idle_ok, "STEP3: CH1 should idle at 0V if we are testing CH2" glitched = glitched or check_for_glitch(data) if gen_reports: plot_to_file(title=f"Last Sample Hold: {chn_str} - {sr_str} - Rising Ramp", @@ -1496,10 +1489,8 @@ def check_for_glitch(data, threshold=0.3): if channel == libm2k.ANALOG_IN_CHANNEL_1: # CH2 should idle at 0V if we are testing CH1 is_idle_ok = is_idle_ok and are_values_within_range(data, -0.20, 0.20, libm2k.ANALOG_IN_CHANNEL_2) - assert is_idle_ok, "STEP4: CH2 should idle at 0V if we are testing CH1" elif channel == libm2k.ANALOG_IN_CHANNEL_2: is_idle_ok = is_idle_ok and are_values_within_range(data, -0.20, 0.20, libm2k.ANALOG_IN_CHANNEL_1) - assert is_idle_ok, "STEP4: CH1 should idle at 0V if we are testing CH2" glitched = glitched or check_for_glitch(data) if gen_reports: plot_to_file(title=f"Last Sample Hold: {chn_str} - {sr_str} - Falling Ramp", From 6f06f29d7bff12c10c8e9e9bf7c07f2a3e81fef5 Mon Sep 17 00:00:00 2001 From: Adrian Stanea Date: Tue, 8 Oct 2024 16:53:38 +0300 Subject: [PATCH 3/3] tests: skip dual board test results Signed-off-by: Adrian Stanea --- tests/dual_board/.gitignore | 1 + 1 file changed, 1 insertion(+) create mode 100644 tests/dual_board/.gitignore diff --git a/tests/dual_board/.gitignore b/tests/dual_board/.gitignore new file mode 100644 index 00000000..b65cf752 --- /dev/null +++ b/tests/dual_board/.gitignore @@ -0,0 +1 @@ +results* \ No newline at end of file