• Richard Fitzgerald's avatar
    ASoC: cs-amp-lib: Add KUnit test for calibration helpers · 17786231
    Richard Fitzgerald authored
    Add a KUnit test for the cs-amp-lib library. This has test cases
    for cs_amp_get_efi_calibration_data() and cs_amp_write_cal_coeffs().
    
    A KUNIT_STATIC_STUB_REDIRECT() has been added to
    cs_amp_get_efi_variable() and cs_amp_write_cal_coeff() so that the
    KUnit test can redirect these to test harness functions.
    
    Much of the testing involves invoking the same function with different
    parameters, i.e. the number of amps and the amp index within the array.
    This uses parameterization rather than looping. The idea is to avoid
    looping over configurations within one test case as that has a higher
    chance of having a bug that doesn't actually test all the expected cases.
    Having the test run exactly one configuration, and then tear-down, is less
    prone to accidentally skipped configurations.
    Signed-off-by: default avatarRichard Fitzgerald <rf@opensource.cirrus.com>
    Link: https://msgid.link/r/20240304143705.26362-1-rf@opensource.cirrus.comSigned-off-by: default avatarMark Brown <broonie@kernel.org>
    17786231
cs-amp-lib-test.c 23.2 KB