Skip to content

Commit 687f4ce

Browse files
nordic-seglkartben
authored andcommitted
tests: drivers: audio: dmic_api: Enable coverage calculation
When test is run with enabled coverage, additional RAM is required to store coverage data. Digital Microphone test is reserving most of the available RAM to store audio samples. Thus, test fails to build with coverage enabled due to RAM overflow. Decrease size of the audio buffer when coverage is enabled. Signed-off-by: Sebastian Głąb <[email protected]>
1 parent 259d41f commit 687f4ce

File tree

1 file changed

+6
-0
lines changed
  • tests/drivers/audio/dmic_api/src

1 file changed

+6
-0
lines changed

tests/drivers/audio/dmic_api/src/main.c

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,8 +34,14 @@ static const struct device *dmic_dev = DEVICE_DT_GET(DT_ALIAS(dmic_dev));
3434
/* Milliseconds to wait for a block to be read. */
3535
#define READ_TIMEOUT 1000
3636
/* Size of a block for 100 ms of audio data. */
37+
#if defined(CONFIG_COVERAGE)
38+
/* Use smaller buffer in coverage mode. */
39+
#define BLOCK_SIZE(_sample_rate, _number_of_channels) \
40+
(BYTES_PER_SAMPLE * (_sample_rate / 100) * _number_of_channels)
41+
#else
3742
#define BLOCK_SIZE(_sample_rate, _number_of_channels) \
3843
(BYTES_PER_SAMPLE * (_sample_rate / 10) * _number_of_channels)
44+
#endif
3945

4046
/* Driver will allocate blocks from this slab to receive audio data into them.
4147
* Application, after getting a given block from the driver and processing its

0 commit comments

Comments
 (0)