Skip to content

Commit 5acd29e

Browse files
nordic-krchkartben
authored andcommitted
tests: all: Fix remaining issues reported by string validation
Fix issues reported by string validation which was added to strings used in zassert macros. Signed-off-by: Krzysztof Chruściński <[email protected]>
1 parent 88a1805 commit 5acd29e

File tree

29 files changed

+94
-98
lines changed

29 files changed

+94
-98
lines changed

tests/bluetooth/controller/ctrl_isoal/src/sub_sets/isoal_test_rx.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -930,7 +930,7 @@ ZTEST(test_rx_unframed, test_rx_time_wrapping)
930930
-((int64_t)ISOAL_TIME_WRAPPING_POINT_US);
931931
expected_result = ISOAL_TIME_WRAPPING_POINT_US + time_diff + 1;
932932
result = isoal_get_wrapped_time_test(time_now, time_diff);
933-
zassert_equal(result, expected_result, "%lu != %lu", result, expected_result);
933+
zassert_equal(result, expected_result, "%u != %u", result, expected_result);
934934

935935
/* Maximum negative difference from maximum time */
936936
time_now = ISOAL_TIME_WRAPPING_POINT_US;
@@ -939,14 +939,14 @@ ZTEST(test_rx_unframed, test_rx_time_wrapping)
939939
-((int64_t)ISOAL_TIME_WRAPPING_POINT_US);
940940
expected_result = ISOAL_TIME_WRAPPING_POINT_US + time_diff;
941941
result = isoal_get_wrapped_time_test(time_now, time_diff);
942-
zassert_equal(result, expected_result, "%lu != %lu", result, expected_result);
942+
zassert_equal(result, expected_result, "%u != %u", result, expected_result);
943943

944944
/* Maximum positive difference from maximum time */
945945
time_now = ISOAL_TIME_WRAPPING_POINT_US;
946946
time_diff = (time_wrapping_point == UINT32_MAX ? INT32_MAX : ISOAL_TIME_WRAPPING_POINT_US);
947947
expected_result = time_diff - 1;
948948
result = isoal_get_wrapped_time_test(time_now, time_diff);
949-
zassert_equal(result, expected_result, "%lu != %lu", result, expected_result);
949+
zassert_equal(result, expected_result, "%u != %u", result, expected_result);
950950
}
951951

952952
/**

tests/bluetooth/controller/ctrl_isoal/src/sub_sets/isoal_test_tx.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -121,7 +121,7 @@ static void check_next_custom_source_pdu_write_test_sdu_payload(const uint8_t *d
121121
for (size_t i = 0; i < custom_source_pdu_write_test_sdu_payloads.out_size[pos]; i++) {
122122
zassert_equal(custom_source_pdu_write_test_sdu_payloads.out[pos][i],
123123
data[i],
124-
"[Line %lu] deviation at index %u, expected %u, got %u",
124+
"[Line %u] deviation at index %u, expected %u, got %u",
125125
line,
126126
i,
127127
data[i],
@@ -243,7 +243,7 @@ static isoal_status_t custom_source_pdu_emit_test(struct node_tx_iso *node_tx,
243243
source_pdu_emit_test_fake.arg0_##_typ); \
244244
zassert_equal(_payload_count, \
245245
source_pdu_emit_test_handler_fake.arg0_##_typ.payload_count, \
246-
"\t\t%u != %u", \
246+
"\t\t%llu != %u", \
247247
_payload_count, \
248248
source_pdu_emit_test_handler_fake.arg0_##_typ.payload_count); \
249249
zassert_equal(_sdu_fragments, \

tests/bluetooth/mesh/blob_io_flash/src/main.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -123,7 +123,7 @@ ZTEST(blob_io_flash, test_chunk_read)
123123

124124
err = blob_flash_stream.io.rd(&blob_flash_stream.io, &xfer, &block, &chunk);
125125
zassert_equal(err, 0, "BLOB I/O read failed with err=%d off=%d len=%d",
126-
err, block.offset + chunk.offset, chunk.size);
126+
err, (int)(block.offset + chunk.offset), (int)chunk.size);
127127

128128
zassert_mem_equal(&chunk_data, &test_data[tests_data_offset], chunk.size,
129129
"Incorrect data written into flash");

tests/kernel/common/src/clock.c

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -137,12 +137,10 @@ ZTEST(clock, test_clock_cycle_32)
137137
/*avoid cycle counter wrap around*/
138138
if (c1 > c0) {
139139
/* delta cycle should be greater than 1 milli-second*/
140-
zassert_true((c1 - c0) >
141-
(sys_clock_hw_cycles_per_sec() / MSEC_PER_SEC),
142-
NULL);
140+
zassert_true((c1 - c0) > (sys_clock_hw_cycles_per_sec() / MSEC_PER_SEC));
143141
/* delta NS should be greater than 1 milli-second */
144142
zassert_true((uint32_t)k_cyc_to_ns_floor64(c1 - c0) >
145-
(NSEC_PER_SEC / MSEC_PER_SEC), NULL);
143+
(NSEC_PER_SEC / MSEC_PER_SEC));
146144
}
147145
}
148146

tests/kernel/common/src/pow2.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ static void test_pow2_ceil_x(unsigned long test_value,
6060
unsigned int result = Z_POW2_CEIL(x);
6161

6262
zassert_equal(result, expected_result,
63-
"ZPOW2_CEIL(%lu) returned %lu, expected %lu",
63+
"ZPOW2_CEIL(%lu) returned %ld, expected %lu",
6464
test_value, result, expected_result);
6565
}
6666

tests/kernel/context/src/main.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -251,7 +251,7 @@ static void _test_kernel_cpu_idle(int atomic)
251251
dt = k_uptime_ticks() - t0;
252252
zassert_true(abs((int32_t) (dt - dur)) <= slop,
253253
"Inaccurate wakeup, idled for %d ticks, expected %d",
254-
dt, dur);
254+
(int)dt, dur);
255255
}
256256
}
257257

tests/kernel/interrupt/src/dynamic_isr.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -114,7 +114,7 @@ extern const void *x86_irq_args[];
114114

115115
/**TESTPOINT: pass word-sized parameter to interrupt */
116116
zassert_equal(handler_test_result, ISR_DYN_ARG,
117-
"parameter(0x%lx) in handler is not correct",
117+
"parameter(0x%" PRIxPTR ") in handler is not correct",
118118
handler_test_result);
119119

120120
trigger_irq(vector_num);

tests/kernel/semaphore/semaphore/src/main.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -972,7 +972,7 @@ ZTEST(semaphore, test_sem_measure_timeout_from_thread)
972972

973973
zassert_true((diff_ticks < SEC2MS(1)),
974974
"k_sem_take took too long: %d >= %d",
975-
diff_ticks, SEC2MS(1));
975+
(int)diff_ticks, SEC2MS(1));
976976
k_thread_join(&sem_tid_1, K_FOREVER);
977977
}
978978

tests/kernel/timer/starve/src/main.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ ZTEST(starve_fn, test_starve)
8484

8585
zassert_equal(na_capture, 0,
8686
"%sTimer alarm fired: %u\n",
87-
na_capture);
87+
tag(), na_capture);
8888

8989
k_timer_start(&tmr, K_MSEC(TIMER_DELAY_ms), K_NO_WAIT);
9090

tests/kernel/timer/timer_api/src/main.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -791,7 +791,7 @@ ZTEST_USER(timer_api, test_timeout_abs)
791791
} while (t0 != t1);
792792

793793
zassert_true(t0 + rem_ticks == exp_ticks,
794-
"Wrong remaining: now %lld rem %lld expires %lld (%d)",
794+
"Wrong remaining: now %lld rem %lld expires %lld (%lld)",
795795
(uint64_t)t0, (uint64_t)rem_ticks, (uint64_t)exp_ticks,
796796
t0+rem_ticks-exp_ticks);
797797

0 commit comments

Comments
 (0)