Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Misc. timing test fixes #19596

Closed
wants to merge 3 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion kernel/queue.c
Original file line number Diff line number Diff line change
Expand Up @@ -307,7 +307,7 @@ static void *k_queue_poll(struct k_queue *queue, s32_t timeout)

if ((val == NULL) && (timeout != K_FOREVER)) {
elapsed = k_uptime_get_32() - start;
done = elapsed > timeout;
done = elapsed >= timeout;
}
} while (!val && !done);

Expand Down
4 changes: 2 additions & 2 deletions tests/kernel/fifo/fifo_timeout/src/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -367,7 +367,8 @@ static void test_timeout_fifo_thread(void)
&timeout, NULL,
FIFO_THREAD_PRIO, K_INHERIT_PERMS, 0);

packet = k_fifo_get(&fifo_timeout[0], timeout + 10);
packet = k_fifo_get(&fifo_timeout[0], timeout
+ k_ticks_to_ms_ceil32(2));
pizi-nordic marked this conversation as resolved.
Show resolved Hide resolved
zassert_true(packet != NULL, NULL);
zassert_true(is_timeout_in_range(start_time, timeout), NULL);
put_scratch_packet(packet);
Expand All @@ -382,7 +383,6 @@ static void test_timeout_fifo_thread(void)
test_thread_timeout_reply_values,
&reply_packet, NULL, NULL,
FIFO_THREAD_PRIO, K_INHERIT_PERMS, 0);

k_yield();
packet = k_fifo_get(&timeout_order_fifo, K_NO_WAIT);
zassert_true(packet != NULL, NULL);
Expand Down
4 changes: 2 additions & 2 deletions tests/kernel/interrupt/src/nested_irq.c
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
*/
#include "interrupt.h"

#define DURATION 5
#define DURATION 10
struct k_timer timer;

/* This tests uses two IRQ lines, selected within the range of IRQ lines
Expand Down Expand Up @@ -85,7 +85,7 @@ void isr0(void *param)
*/
k_busy_wait(MS_TO_US(1000));
#else
k_busy_wait(MS_TO_US(10));
k_busy_wait(DURATION * 1000 + (int)k_ticks_to_us_ceil64(1));
#endif
printk("%s execution completed !!\n", __func__);
zassert_equal(new_val, old_val, "Nested interrupt is not working\n");
Expand Down
3 changes: 2 additions & 1 deletion tests/kernel/lifo/lifo_usage/src/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -324,7 +324,8 @@ static void test_timeout_lifo_thread(void)
&timeout, NULL,
LIFO_THREAD_PRIO, K_INHERIT_PERMS, 0);

packet = k_lifo_get(&lifo_timeout[0], timeout + 10);
packet = k_lifo_get(&lifo_timeout[0], timeout
+ k_ticks_to_ms_ceil32(2));
zassert_true(packet != NULL, NULL);
zassert_true(is_timeout_in_range(start_time, timeout), NULL);
put_scratch_packet(packet);
Expand Down