Skip to content

Commit 7a6b355

Browse files
nordic-krchnashif
authored andcommitted
tests: boards: nrf: dmm: Adjust test to dmm changes
After changing dmm to not apply data cache line alignment for all regions test needs to be aligned. Signed-off-by: Krzysztof Chruściński <[email protected]>
1 parent 5f32265 commit 7a6b355

File tree

1 file changed

+11
-7
lines changed
  • tests/boards/nrf/dmm/src

1 file changed

+11
-7
lines changed

tests/boards/nrf/dmm/src/main.c

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -74,15 +74,17 @@ static bool dmm_buffer_in_region_check(struct dmm_test_region *dtr, void *buf, s
7474
}
7575

7676
static void dmm_check_output_buffer(struct dmm_test_region *dtr, uint32_t *fill_value,
77-
void *data, size_t size, bool was_prealloc)
77+
void *data, size_t size, bool was_prealloc, bool is_cached)
7878
{
7979
void *buf;
8080
int retval;
8181

8282
memset(data, (*fill_value)++, size);
8383
retval = dmm_buffer_out_prepare(dtr->mem_reg, data, size, &buf);
8484
zassert_ok(retval);
85-
zassert_true(IS_ALIGNED(buf, DMM_DCACHE_LINE_SIZE));
85+
if (IS_ENABLED(CONFIG_DCACHE) && is_cached) {
86+
zassert_true(IS_ALIGNED(buf, CONFIG_DCACHE_LINE_SIZE));
87+
}
8688

8789
if (IS_ENABLED(CONFIG_HAS_NORDIC_DMM)) {
8890
if (was_prealloc) {
@@ -112,7 +114,9 @@ static void dmm_check_input_buffer(struct dmm_test_region *dtr, uint32_t *fill_v
112114

113115
retval = dmm_buffer_in_prepare(dtr->mem_reg, data, size, &buf);
114116
zassert_ok(retval);
115-
zassert_true(IS_ALIGNED(buf, DMM_DCACHE_LINE_SIZE));
117+
if (IS_ENABLED(CONFIG_DCACHE) && is_cached) {
118+
zassert_true(IS_ALIGNED(buf, CONFIG_DCACHE_LINE_SIZE));
119+
}
116120

117121
if (IS_ENABLED(CONFIG_HAS_NORDIC_DMM)) {
118122
if (was_prealloc) {
@@ -162,15 +166,15 @@ ZTEST_USER_F(dmm, test_check_dev_cache_out_allocate)
162166
uint8_t user_data[16];
163167

164168
dmm_check_output_buffer(&fixture->regions[DMM_TEST_REGION_CACHE], &fixture->fill_value,
165-
user_data, sizeof(user_data), false);
169+
user_data, sizeof(user_data), false, true);
166170
}
167171

168172
ZTEST_USER_F(dmm, test_check_dev_cache_out_preallocate)
169173
{
170174
static uint8_t user_data[16] DMM_MEMORY_SECTION(DUT_CACHE);
171175

172176
dmm_check_output_buffer(&fixture->regions[DMM_TEST_REGION_CACHE], &fixture->fill_value,
173-
user_data, sizeof(user_data), true);
177+
user_data, sizeof(user_data), true, true);
174178
}
175179

176180
ZTEST_USER_F(dmm, test_check_dev_nocache_in_allocate)
@@ -194,15 +198,15 @@ ZTEST_USER_F(dmm, test_check_dev_nocache_out_allocate)
194198
uint8_t user_data[16];
195199

196200
dmm_check_output_buffer(&fixture->regions[DMM_TEST_REGION_NOCACHE], &fixture->fill_value,
197-
user_data, sizeof(user_data), false);
201+
user_data, sizeof(user_data), false, false);
198202
}
199203

200204
ZTEST_USER_F(dmm, test_check_dev_nocache_out_preallocate)
201205
{
202206
static uint8_t user_data[16] DMM_MEMORY_SECTION(DUT_NOCACHE);
203207

204208
dmm_check_output_buffer(&fixture->regions[DMM_TEST_REGION_NOCACHE], &fixture->fill_value,
205-
user_data, sizeof(user_data), true);
209+
user_data, sizeof(user_data), true, false);
206210
}
207211

208212
ZTEST_SUITE(dmm, NULL, test_setup, NULL, test_cleanup, NULL);

0 commit comments

Comments
 (0)