aboutsummaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
authorGiovanni Di Sirio <gdisirio@gmail.com>2016-02-16 10:07:00 +0000
committerGiovanni Di Sirio <gdisirio@gmail.com>2016-02-16 10:07:00 +0000
commitcf204e72ea5fd6e4be8b3295cb148fde5fdd47d2 (patch)
tree5aae4b9a6c78c8f14c2a6ca8cd6446f42b3b29bd /test
parent641f2c372605cf405f0dda8536b45a78e0e5e2e2 (diff)
downloadChibiOS-cf204e72ea5fd6e4be8b3295cb148fde5fdd47d2.tar.gz
ChibiOS-cf204e72ea5fd6e4be8b3295cb148fde5fdd47d2.tar.bz2
ChibiOS-cf204e72ea5fd6e4be8b3295cb148fde5fdd47d2.zip
Tree reorganization.
git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@8900 35acf78f-673a-0410-8e92-d51de3d6d3f4
Diffstat (limited to 'test')
-rw-r--r--test/nil/test_root.c4
-rw-r--r--test/nil/test_root.h2
-rw-r--r--test/nil/test_sequence_002.c6
-rw-r--r--test/rt/test.c13
-rw-r--r--test/rt/test.h1
-rw-r--r--test/rt/test.mk1
-rw-r--r--test/rt/testbmk.c45
-rw-r--r--test/rt/testdyn.c24
-rw-r--r--test/rt/testheap.c26
-rw-r--r--test/rt/testmbox.c20
-rw-r--r--test/rt/testmtx.c8
-rw-r--r--test/rt/testpools.c3
-rw-r--r--test/rt/testsem.c24
-rw-r--r--test/rt/testthd.c20
14 files changed, 90 insertions, 107 deletions
diff --git a/test/nil/test_root.c b/test/nil/test_root.c
index 12ae7ef52..4ea4458b2 100644
--- a/test/nil/test_root.c
+++ b/test/nil/test_root.c
@@ -51,7 +51,7 @@ thread_reference_t gtr1;
*/
THD_WORKING_AREA(wa_test_support, 128);
THD_FUNCTION(test_support, arg) {
-#if NIL_CFG_USE_EVENTS == TRUE
+#if CH_CFG_USE_EVENTS == TRUE
thread_t *tp = (thread_t *)arg;
#else
(void)arg;
@@ -68,7 +68,7 @@ THD_FUNCTION(test_support, arg) {
chSemSignalI(&gsem1);
chSemResetI(&gsem2, 0);
chThdResumeI(&gtr1, MSG_OK);
-#if NIL_CFG_USE_EVENTS == TRUE
+#if CH_CFG_USE_EVENTS == TRUE
chEvtSignalI(tp, 0x55);
#endif
chSchRescheduleS();
diff --git a/test/nil/test_root.h b/test/nil/test_root.h
index 34f776494..c51899359 100644
--- a/test/nil/test_root.h
+++ b/test/nil/test_root.h
@@ -25,7 +25,7 @@
#ifndef _TEST_ROOT_H_
#define _TEST_ROOT_H_
-#include "nil.h"
+#include "ch.h"
#include "test_sequence_001.h"
#include "test_sequence_002.h"
diff --git a/test/nil/test_sequence_002.c b/test/nil/test_sequence_002.c
index 7b1d41d64..486d2e441 100644
--- a/test/nil/test_sequence_002.c
+++ b/test/nil/test_sequence_002.c
@@ -327,7 +327,7 @@ static const testcase_t test_002_004 = {
};
#endif /* TRUE */
-#if (NIL_CFG_USE_EVENTS == TRUE) || defined(__DOXYGEN__)
+#if (CH_CFG_USE_EVENTS == TRUE) || defined(__DOXYGEN__)
/**
* @page test_002_005 Events functionality
*
@@ -408,7 +408,7 @@ static const testcase_t test_002_005 = {
NULL,
test_002_005_execute
};
-#endif /* NIL_CFG_USE_EVENTS == TRUE */
+#endif /* CH_CFG_USE_EVENTS == TRUE */
/****************************************************************************
* Exported data.
@@ -430,7 +430,7 @@ const testcase_t * const test_sequence_002[] = {
#if TRUE || defined(__DOXYGEN__)
&test_002_004,
#endif
-#if (NIL_CFG_USE_EVENTS == TRUE) || defined(__DOXYGEN__)
+#if (CH_CFG_USE_EVENTS == TRUE) || defined(__DOXYGEN__)
&test_002_005,
#endif
NULL
diff --git a/test/rt/test.c b/test/rt/test.c
index f4a08eeea..fcba9607d 100644
--- a/test/rt/test.c
+++ b/test/rt/test.c
@@ -35,7 +35,6 @@
#include "testevt.h"
#include "testheap.h"
#include "testpools.h"
-#include "testdyn.h"
#include "testqueues.h"
#include "testbmk.h"
@@ -52,7 +51,6 @@ static ROMCONST struct testcase * ROMCONST *patterns[] = {
patternevt,
patternheap,
patternpools,
- patterndyn,
patternqueues,
patternbmk,
NULL
@@ -194,17 +192,6 @@ bool _test_assert_time_window(unsigned point, systime_t start, systime_t end) {
*/
/**
- * @brief Sets a termination request in all the test-spawned threads.
- */
-void test_terminate_threads(void) {
- int i;
-
- for (i = 0; i < MAX_THREADS; i++)
- if (threads[i])
- chThdTerminate(threads[i]);
-}
-
-/**
* @brief Waits for the completion of all the test-spawned threads.
*/
void test_wait_threads(void) {
diff --git a/test/rt/test.h b/test/rt/test.h
index da080db2d..eb1f35c54 100644
--- a/test/rt/test.h
+++ b/test/rt/test.h
@@ -90,7 +90,6 @@ extern "C" {
bool _test_assert(unsigned point, bool condition);
bool _test_assert_sequence(unsigned point, char *expected);
bool _test_assert_time_window(unsigned point, systime_t start, systime_t end);
- void test_terminate_threads(void);
void test_wait_threads(void);
systime_t test_wait_tick(void);
void test_start_timer(unsigned ms);
diff --git a/test/rt/test.mk b/test/rt/test.mk
index 03de3c89a..1a3b368bb 100644
--- a/test/rt/test.mk
+++ b/test/rt/test.mk
@@ -8,7 +8,6 @@ TESTSRC = ${CHIBIOS}/test/rt/test.c \
${CHIBIOS}/test/rt/testevt.c \
${CHIBIOS}/test/rt/testheap.c \
${CHIBIOS}/test/rt/testpools.c \
- ${CHIBIOS}/test/rt/testdyn.c \
${CHIBIOS}/test/rt/testqueues.c \
${CHIBIOS}/test/rt/testsys.c \
${CHIBIOS}/test/rt/testbmk.c
diff --git a/test/rt/testbmk.c b/test/rt/testbmk.c
index b4f4af7d6..639ba2b7b 100644
--- a/test/rt/testbmk.c
+++ b/test/rt/testbmk.c
@@ -211,7 +211,7 @@ static THD_FUNCTION(thread4, p) {
chSysLock();
do {
chSchGoSleepS(CH_STATE_SUSPENDED);
- msg = self->p_u.rdymsg;
+ msg = self->u.rdymsg;
} while (msg == MSG_OK);
chSysUnlock();
}
@@ -344,8 +344,7 @@ ROMCONST struct testcase testbmk6 = {
static THD_FUNCTION(thread3, p) {
- (void)p;
- while (!chThdShouldTerminateX())
+ while (!*(bool *)p)
chSemWait(&sem1);
}
@@ -356,12 +355,13 @@ static void bmk7_setup(void) {
static void bmk7_execute(void) {
uint32_t n;
+ bool terminate = false;
- threads[0] = chThdCreateStatic(wa[0], WA_SIZE, chThdGetPriorityX()+5, thread3, NULL);
- threads[1] = chThdCreateStatic(wa[1], WA_SIZE, chThdGetPriorityX()+4, thread3, NULL);
- threads[2] = chThdCreateStatic(wa[2], WA_SIZE, chThdGetPriorityX()+3, thread3, NULL);
- threads[3] = chThdCreateStatic(wa[3], WA_SIZE, chThdGetPriorityX()+2, thread3, NULL);
- threads[4] = chThdCreateStatic(wa[4], WA_SIZE, chThdGetPriorityX()+1, thread3, NULL);
+ threads[0] = chThdCreateStatic(wa[0], WA_SIZE, chThdGetPriorityX()+5, thread3, &terminate);
+ threads[1] = chThdCreateStatic(wa[1], WA_SIZE, chThdGetPriorityX()+4, thread3, &terminate);
+ threads[2] = chThdCreateStatic(wa[2], WA_SIZE, chThdGetPriorityX()+3, thread3, &terminate);
+ threads[3] = chThdCreateStatic(wa[3], WA_SIZE, chThdGetPriorityX()+2, thread3, &terminate);
+ threads[4] = chThdCreateStatic(wa[4], WA_SIZE, chThdGetPriorityX()+1, thread3, &terminate);
n = 0;
test_wait_tick();
@@ -373,7 +373,7 @@ static void bmk7_execute(void) {
_sim_check_for_interrupts();
#endif
} while (!test_timer_done);
- test_terminate_threads();
+ terminate = true;
chSemReset(&sem1, 0);
test_wait_threads();
@@ -401,39 +401,44 @@ ROMCONST struct testcase testbmk7 = {
* The performance is calculated by measuring the number of iterations after
* a second of continuous operations.
*/
+typedef struct {
+ bool terminate;
+ uint32_t n;
+} params_t;
static THD_FUNCTION(thread8, p) {
+ params_t *pp = (params_t *)p;
do {
chThdYield();
chThdYield();
chThdYield();
chThdYield();
- (*(uint32_t *)p) += 4;
+ pp->n += 4;
#if defined(SIMULATOR)
_sim_check_for_interrupts();
#endif
- } while(!chThdShouldTerminateX());
+ } while (!pp->terminate);
}
static void bmk8_execute(void) {
- uint32_t n;
+ params_t params = {false, 0};
- n = 0;
+ params.n = 0;
test_wait_tick();
- threads[0] = chThdCreateStatic(wa[0], WA_SIZE, chThdGetPriorityX()-1, thread8, (void *)&n);
- threads[1] = chThdCreateStatic(wa[1], WA_SIZE, chThdGetPriorityX()-1, thread8, (void *)&n);
- threads[2] = chThdCreateStatic(wa[2], WA_SIZE, chThdGetPriorityX()-1, thread8, (void *)&n);
- threads[3] = chThdCreateStatic(wa[3], WA_SIZE, chThdGetPriorityX()-1, thread8, (void *)&n);
- threads[4] = chThdCreateStatic(wa[4], WA_SIZE, chThdGetPriorityX()-1, thread8, (void *)&n);
+ threads[0] = chThdCreateStatic(wa[0], WA_SIZE, chThdGetPriorityX()-1, thread8, (void *)&params);
+ threads[1] = chThdCreateStatic(wa[1], WA_SIZE, chThdGetPriorityX()-1, thread8, (void *)&params);
+ threads[2] = chThdCreateStatic(wa[2], WA_SIZE, chThdGetPriorityX()-1, thread8, (void *)&params);
+ threads[3] = chThdCreateStatic(wa[3], WA_SIZE, chThdGetPriorityX()-1, thread8, (void *)&params);
+ threads[4] = chThdCreateStatic(wa[4], WA_SIZE, chThdGetPriorityX()-1, thread8, (void *)&params);
chThdSleepSeconds(1);
- test_terminate_threads();
+ params.terminate = true;
test_wait_threads();
test_print("--- Score : ");
- test_printn(n);
+ test_printn(params.n);
test_println(" ctxswc/S");
}
diff --git a/test/rt/testdyn.c b/test/rt/testdyn.c
index 7a6cdfb20..9e8932c10 100644
--- a/test/rt/testdyn.c
+++ b/test/rt/testdyn.c
@@ -81,10 +81,9 @@ static void dyn1_setup(void) {
static void dyn1_execute(void) {
size_t n, sz;
- void *p1;
tprio_t prio = chThdGetPriorityX();
- (void)chHeapStatus(&heap1, &sz);
+ (void)chHeapStatus(&heap1, &sz, NULL);
/* Starting threads from the heap. */
threads[0] = chThdCreateFromHeap(&heap1,
THD_WORKING_AREA_SIZE(THREADS_STACK_SIZE),
@@ -92,13 +91,10 @@ static void dyn1_execute(void) {
threads[1] = chThdCreateFromHeap(&heap1,
THD_WORKING_AREA_SIZE(THREADS_STACK_SIZE),
prio-2, thread, "B");
- /* Allocating the whole heap in order to make the thread creation fail.*/
- (void)chHeapStatus(&heap1, &n);
- p1 = chHeapAlloc(&heap1, n);
+ /* Large working area in order to make the thread creation fail.*/
threads[2] = chThdCreateFromHeap(&heap1,
- THD_WORKING_AREA_SIZE(THREADS_STACK_SIZE),
+ THD_WORKING_AREA_SIZE(THREADS_STACK_SIZE * 16),
prio-3, thread, "C");
- chHeapFree(p1);
test_assert(1, (threads[0] != NULL) &&
(threads[1] != NULL) &&
@@ -112,7 +108,7 @@ static void dyn1_execute(void) {
test_assert_sequence(2, "AB");
/* Heap status checked again.*/
- test_assert(3, chHeapStatus(&heap1, &n) == 1, "heap fragmented");
+ test_assert(3, chHeapStatus(&heap1, &n, NULL) == 1, "heap fragmented");
test_assert(4, n == sz, "heap size changed");
}
@@ -212,11 +208,11 @@ static void dyn3_execute(void) {
/* Testing references increase/decrease and final detach.*/
tp = chThdCreateFromHeap(&heap1, WA_SIZE, prio-1, thread, "A");
- test_assert(1, tp->p_refs == 1, "wrong initial reference counter");
+ test_assert(1, tp->refs == 1, "wrong initial reference counter");
chThdAddRef(tp);
- test_assert(2, tp->p_refs == 2, "references increase failure");
+ test_assert(2, tp->refs == 2, "references increase failure");
chThdRelease(tp);
- test_assert(3, tp->p_refs == 1, "references decrease failure");
+ test_assert(3, tp->refs == 1, "references decrease failure");
/* Verify the new threads count.*/
test_assert(4, regfind(tp), "thread missing from registry");
@@ -224,12 +220,12 @@ static void dyn3_execute(void) {
/* Detach and let the thread execute and terminate.*/
chThdRelease(tp);
- test_assert(6, tp->p_refs == 0, "detach failure");
- test_assert(7, tp->p_state == CH_STATE_READY, "invalid state");
+ test_assert(6, tp->refs == 0, "detach failure");
+ test_assert(7, tp->state == CH_STATE_READY, "invalid state");
test_assert(8, regfind(tp), "thread disappeared");
test_assert(9, regfind(tp), "thread disappeared");
chThdSleepMilliseconds(50); /* The thread just terminates. */
- test_assert(10, tp->p_state == CH_STATE_FINAL, "invalid state");
+ test_assert(10, tp->state == CH_STATE_FINAL, "invalid state");
/* Clearing the zombie by scanning the registry.*/
test_assert(11, regfind(tp), "thread disappeared");
diff --git a/test/rt/testheap.c b/test/rt/testheap.c
index b1ab00103..fed10328e 100644
--- a/test/rt/testheap.c
+++ b/test/rt/testheap.c
@@ -77,7 +77,7 @@ static void heap1_execute(void) {
* Test on the default heap in order to cover the core allocator at
* least one time.
*/
- (void)chHeapStatus(NULL, &sz);
+ (void)chHeapStatus(NULL, &sz, NULL);
p1 = chHeapAlloc(NULL, SIZE);
test_assert(1, p1 != NULL, "allocation failed");
chHeapFree(p1);
@@ -85,7 +85,7 @@ static void heap1_execute(void) {
test_assert(2, p1 == NULL, "allocation not failed");
/* Initial local heap state.*/
- (void)chHeapStatus(&test_heap, &sz);
+ (void)chHeapStatus(&test_heap, &sz, NULL);
/* Same order.*/
p1 = chHeapAlloc(&test_heap, SIZE);
@@ -94,7 +94,7 @@ static void heap1_execute(void) {
chHeapFree(p1); /* Does not merge.*/
chHeapFree(p2); /* Merges backward.*/
chHeapFree(p3); /* Merges both sides.*/
- test_assert(3, chHeapStatus(&test_heap, &n) == 1, "heap fragmented");
+ test_assert(3, chHeapStatus(&test_heap, &n, NULL) == 1, "heap fragmented");
/* Reverse order.*/
p1 = chHeapAlloc(&test_heap, SIZE);
@@ -103,39 +103,39 @@ static void heap1_execute(void) {
chHeapFree(p3); /* Merges forward.*/
chHeapFree(p2); /* Merges forward.*/
chHeapFree(p1); /* Merges forward.*/
- test_assert(4, chHeapStatus(&test_heap, &n) == 1, "heap fragmented");
+ test_assert(4, chHeapStatus(&test_heap, &n, NULL) == 1, "heap fragmented");
/* Small fragments handling.*/
p1 = chHeapAlloc(&test_heap, SIZE + 1);
p2 = chHeapAlloc(&test_heap, SIZE);
chHeapFree(p1);
- test_assert(5, chHeapStatus(&test_heap, &n) == 2, "invalid state");
+ test_assert(5, chHeapStatus(&test_heap, &n, NULL) == 2, "invalid state");
p1 = chHeapAlloc(&test_heap, SIZE);
/* Note, the first situation happens when the alignment size is smaller
than the header size, the second in the other cases.*/
- test_assert(6, (chHeapStatus(&test_heap, &n) == 1) ||
- (chHeapStatus(&test_heap, &n) == 2), "heap fragmented");
+ test_assert(6, (chHeapStatus(&test_heap, &n, NULL) == 1) ||
+ (chHeapStatus(&test_heap, &n, NULL) == 2), "heap fragmented");
chHeapFree(p2);
chHeapFree(p1);
- test_assert(7, chHeapStatus(&test_heap, &n) == 1, "heap fragmented");
+ test_assert(7, chHeapStatus(&test_heap, &n, NULL) == 1, "heap fragmented");
/* Skip fragment handling.*/
p1 = chHeapAlloc(&test_heap, SIZE);
p2 = chHeapAlloc(&test_heap, SIZE);
chHeapFree(p1);
- test_assert(8, chHeapStatus(&test_heap, &n) == 2, "invalid state");
+ test_assert(8, chHeapStatus(&test_heap, &n, NULL) == 2, "invalid state");
p1 = chHeapAlloc(&test_heap, SIZE * 2); /* Skips first fragment.*/
chHeapFree(p1);
chHeapFree(p2);
- test_assert(9, chHeapStatus(&test_heap, &n) == 1, "heap fragmented");
+ test_assert(9, chHeapStatus(&test_heap, &n, NULL) == 1, "heap fragmented");
/* Allocate all handling.*/
- (void)chHeapStatus(&test_heap, &n);
+ (void)chHeapStatus(&test_heap, &n, NULL);
p1 = chHeapAlloc(&test_heap, n);
- test_assert(10, chHeapStatus(&test_heap, &n) == 0, "not empty");
+ test_assert(10, chHeapStatus(&test_heap, &n, NULL) == 0, "not empty");
chHeapFree(p1);
- test_assert(11, chHeapStatus(&test_heap, &n) == 1, "heap fragmented");
+ test_assert(11, chHeapStatus(&test_heap, &n, NULL) == 1, "heap fragmented");
test_assert(12, n == sz, "size changed");
}
diff --git a/test/rt/testmbox.c b/test/rt/testmbox.c
index 901038ceb..9795dc9a0 100644
--- a/test/rt/testmbox.c
+++ b/test/rt/testmbox.c
@@ -113,7 +113,7 @@ static void mbox1_execute(void) {
*/
test_assert_lock(8, chMBGetFreeCountI(&mb1) == 0, "still empty");
test_assert_lock(9, chMBGetUsedCountI(&mb1) == MB_SIZE, "not full");
- test_assert_lock(10, mb1.mb_rdptr == mb1.mb_wrptr, "pointers not aligned");
+ test_assert_lock(10, mb1.rdptr == mb1.wrptr, "pointers not aligned");
/*
* Testing dequeuing.
@@ -132,8 +132,8 @@ static void mbox1_execute(void) {
test_assert(13, msg1 == MSG_OK, "wrong wake-up message");
msg1 = chMBFetch(&mb1, &msg2, TIME_INFINITE);
test_assert(14, msg1 == MSG_OK, "wrong wake-up message");
- test_assert(15, mb1.mb_buffer == mb1.mb_wrptr, "write pointer not aligned to base");
- test_assert(16, mb1.mb_buffer == mb1.mb_rdptr, "read pointer not aligned to base");
+ test_assert(15, mb1.buffer == mb1.wrptr, "write pointer not aligned to base");
+ test_assert(16, mb1.buffer == mb1.rdptr, "read pointer not aligned to base");
/*
* Testing fetch timeout.
@@ -150,7 +150,7 @@ static void mbox1_execute(void) {
*/
test_assert_lock(19, chMBGetFreeCountI(&mb1) == MB_SIZE, "not empty");
test_assert_lock(20, chMBGetUsedCountI(&mb1) == 0, "still full");
- test_assert_lock(21, mb1.mb_rdptr == mb1.mb_wrptr, "pointers not aligned");
+ test_assert_lock(21, mb1.rdptr == mb1.wrptr, "pointers not aligned");
/*
* Testing I-Class.
@@ -167,7 +167,7 @@ static void mbox1_execute(void) {
msg1 = chMBPostI(&mb1, 'E');
chSysUnlock();
test_assert(26, msg1 == MSG_OK, "wrong wake-up message");
- test_assert(27, mb1.mb_rdptr == mb1.mb_wrptr, "pointers not aligned");
+ test_assert(27, mb1.rdptr == mb1.wrptr, "pointers not aligned");
for (i = 0; i < MB_SIZE; i++) {
chSysLock();
msg1 = chMBFetchI(&mb1, &msg2);
@@ -178,7 +178,7 @@ static void mbox1_execute(void) {
test_assert_sequence(29, "ABCDE");
test_assert_lock(30, chMBGetFreeCountI(&mb1) == MB_SIZE, "not empty");
test_assert_lock(31, chMBGetUsedCountI(&mb1) == 0, "still full");
- test_assert(32, mb1.mb_rdptr == mb1.mb_wrptr, "pointers not aligned");
+ test_assert(32, mb1.rdptr == mb1.wrptr, "pointers not aligned");
chSysLock();
msg1 = chMBPostAheadI(&mb1, 'E');
@@ -192,7 +192,7 @@ static void mbox1_execute(void) {
msg1 = chMBPostAheadI(&mb1, 'A');
chSysUnlock();
test_assert(37, msg1 == MSG_OK, "wrong wake-up message");
- test_assert(38, mb1.mb_rdptr == mb1.mb_wrptr, "pointers not aligned");
+ test_assert(38, mb1.rdptr == mb1.wrptr, "pointers not aligned");
for (i = 0; i < MB_SIZE; i++) {
chSysLock();
msg1 = chMBFetchI(&mb1, &msg2);
@@ -203,7 +203,7 @@ static void mbox1_execute(void) {
test_assert_sequence(40, "ABCDE");
test_assert_lock(41, chMBGetFreeCountI(&mb1) == MB_SIZE, "not empty");
test_assert_lock(42, chMBGetUsedCountI(&mb1) == 0, "still full");
- test_assert(43, mb1.mb_rdptr == mb1.mb_wrptr, "pointers not aligned");
+ test_assert(43, mb1.rdptr == mb1.wrptr, "pointers not aligned");
/*
* Testing reset.
@@ -215,8 +215,8 @@ static void mbox1_execute(void) {
*/
test_assert_lock(44, chMBGetFreeCountI(&mb1) == MB_SIZE, "not empty");
test_assert_lock(45, chMBGetUsedCountI(&mb1) == 0, "still full");
- test_assert_lock(46, mb1.mb_buffer == mb1.mb_wrptr, "write pointer not aligned to base");
- test_assert_lock(47, mb1.mb_buffer == mb1.mb_rdptr, "read pointer not aligned to base");
+ test_assert_lock(46, mb1.buffer == mb1.wrptr, "write pointer not aligned to base");
+ test_assert_lock(47, mb1.buffer == mb1.rdptr, "read pointer not aligned to base");
}
ROMCONST struct testcase testmbox1 = {
diff --git a/test/rt/testmtx.c b/test/rt/testmtx.c
index f34072ad0..31737b1ba 100644
--- a/test/rt/testmtx.c
+++ b/test/rt/testmtx.c
@@ -436,15 +436,15 @@ static void mtx5_execute(void) {
chMtxUnlockS(&m1);
chSysUnlock();
- test_assert(3, queue_isempty(&m1.m_queue), "queue not empty");
- test_assert(4, m1.m_owner == NULL, "still owned");
+ test_assert(3, queue_isempty(&m1.queue), "queue not empty");
+ test_assert(4, m1.owner == NULL, "still owned");
test_assert(5, chThdGetPriorityX() == prio, "wrong priority level");
#endif /* !CH_CFG_USE_MUTEXES_RECURSIVE */
chMtxLock(&m1);
chMtxUnlockAll();
- test_assert(6, queue_isempty(&m1.m_queue), "queue not empty");
- test_assert(7, m1.m_owner == NULL, "still owned");
+ test_assert(6, queue_isempty(&m1.queue), "queue not empty");
+ test_assert(7, m1.owner == NULL, "still owned");
}
ROMCONST struct testcase testmtx5 = {
diff --git a/test/rt/testpools.c b/test/rt/testpools.c
index 0e11eb084..9eed0c3e9 100644
--- a/test/rt/testpools.c
+++ b/test/rt/testpools.c
@@ -57,9 +57,10 @@ static MEMORYPOOL_DECL(mp1, THD_WORKING_AREA_SIZE(THREADS_STACK_SIZE), NULL);
* operation.
*/
-static void *null_provider(size_t size) {
+static void *null_provider(size_t size, unsigned align) {
(void)size;
+ (void)align;
return NULL;
}
diff --git a/test/rt/testsem.c b/test/rt/testsem.c
index c8258b2de..fe6766b29 100644
--- a/test/rt/testsem.c
+++ b/test/rt/testsem.c
@@ -150,8 +150,8 @@ static void sem2_execute(void) {
*/
msg = chSemWaitTimeout(&sem1, TIME_IMMEDIATE);
test_assert(1, msg == MSG_TIMEOUT, "wrong wake-up message");
- test_assert(2, queue_isempty(&sem1.s_queue), "queue not empty");
- test_assert(3, sem1.s_cnt == 0, "counter not zero");
+ test_assert(2, queue_isempty(&sem1.queue), "queue not empty");
+ test_assert(3, sem1.cnt == 0, "counter not zero");
/*
* Testing not timeout condition.
@@ -161,8 +161,8 @@ static void sem2_execute(void) {
msg = chSemWaitTimeout(&sem1, MS2ST(500));
test_wait_threads();
test_assert(4, msg == MSG_OK, "wrong wake-up message");
- test_assert(5, queue_isempty(&sem1.s_queue), "queue not empty");
- test_assert(6, sem1.s_cnt == 0, "counter not zero");
+ test_assert(5, queue_isempty(&sem1.queue), "queue not empty");
+ test_assert(6, sem1.cnt == 0, "counter not zero");
/*
* Testing timeout condition.
@@ -173,8 +173,8 @@ static void sem2_execute(void) {
test_emit_token('A' + i);
msg = chSemWaitTimeout(&sem1, MS2ST(50));
test_assert(7, msg == MSG_TIMEOUT, "wrong wake-up message");
- test_assert(8, queue_isempty(&sem1.s_queue), "queue not empty");
- test_assert(9, sem1.s_cnt == 0, "counter not zero");
+ test_assert(8, queue_isempty(&sem1.queue), "queue not empty");
+ test_assert(9, sem1.cnt == 0, "counter not zero");
}
test_assert_sequence(10, "ABCDE");
test_assert_time_window(11, target_time, target_time + ALLOWED_DELAY);
@@ -215,12 +215,12 @@ static void sem3_execute(void) {
threads[0] = chThdCreateStatic(wa[0], WA_SIZE, chThdGetPriorityX()+1, thread3, 0);
chSemSignalWait(&sem1, &sem1);
- test_assert(1, queue_isempty(&sem1.s_queue), "queue not empty");
- test_assert(2, sem1.s_cnt == 0, "counter not zero");
+ test_assert(1, queue_isempty(&sem1.queue), "queue not empty");
+ test_assert(2, sem1.cnt == 0, "counter not zero");
chSemSignalWait(&sem1, &sem1);
- test_assert(3, queue_isempty(&sem1.s_queue), "queue not empty");
- test_assert(4, sem1.s_cnt == 0, "counter not zero");
+ test_assert(3, queue_isempty(&sem1.queue), "queue not empty");
+ test_assert(4, sem1.cnt == 0, "counter not zero");
}
ROMCONST struct testcase testsem3 = {
@@ -265,12 +265,12 @@ static void sem4_execute(void) {
counter semaphore state..*/
chBSemSignal(&bsem);
test_assert_lock(3, chBSemGetStateI(&bsem) == FALSE, "still taken");
- test_assert_lock(4, chSemGetCounterI(&bsem.bs_sem) == 1, "unexpected counter");
+ test_assert_lock(4, chSemGetCounterI(&bsem.sem) == 1, "unexpected counter");
/* Checking signaling overflow, the counter must not go beyond 1.*/
chBSemSignal(&bsem);
test_assert_lock(3, chBSemGetStateI(&bsem) == FALSE, "taken");
- test_assert_lock(5, chSemGetCounterI(&bsem.bs_sem) == 1, "unexpected counter");
+ test_assert_lock(5, chSemGetCounterI(&bsem.sem) == 1, "unexpected counter");
}
ROMCONST struct testcase testsem4 = {
diff --git a/test/rt/testthd.c b/test/rt/testthd.c
index 5b1127aa3..e7e8ddb38 100644
--- a/test/rt/testthd.c
+++ b/test/rt/testthd.c
@@ -96,11 +96,7 @@ static void thd2_execute(void) {
threads[0] = chThdCreateStatic(wa[0], WA_SIZE, chThdGetPriorityX()-5, thread, "E");
threads[4] = chThdCreateStatic(wa[4], WA_SIZE, chThdGetPriorityX()-1, thread, "A");
threads[3] = chThdCreateStatic(wa[3], WA_SIZE, chThdGetPriorityX()-2, thread, "B");
- /* Done this way for coverage of chThdCreateI() and chThdStart().*/
- chSysLock();
- threads[2] = chThdCreateI(wa[2], WA_SIZE, chThdGetPriorityX()-3, thread, "C");
- chSysUnlock();
- chThdStart(threads[2]);
+ threads[2] = chThdCreateStatic(wa[2], WA_SIZE, chThdGetPriorityX()-3, thread, "C");
test_wait_threads();
test_assert_sequence(1, "ABCDE");
}
@@ -140,7 +136,7 @@ static void thd3_execute(void) {
#if CH_CFG_USE_MUTEXES || defined(__DOXYGEN__)
/* Simulates a priority boost situation (p_prio > p_realprio).*/
chSysLock();
- chThdGetSelfX()->p_prio += 2;
+ chThdGetSelfX()->prio += 2;
chSysUnlock();
test_assert(5, chThdGetPriorityX() == prio + 2,
"unexpected priority level");
@@ -149,23 +145,23 @@ static void thd3_execute(void) {
p1 = chThdSetPriority(prio + 1);
test_assert(6, p1 == prio,
"unexpected returned priority level");
- test_assert(7, chThdGetSelfX()->p_prio == prio + 2,
+ test_assert(7, chThdGetSelfX()->prio == prio + 2,
"unexpected priority level");
- test_assert(8, chThdGetSelfX()->p_realprio == prio + 1,
+ test_assert(8, chThdGetSelfX()->realprio == prio + 1,
"unexpected returned real priority level");
/* Tries to raise above the boost level. */
p1 = chThdSetPriority(prio + 3);
test_assert(9, p1 == prio + 1,
"unexpected returned priority level");
- test_assert(10, chThdGetSelfX()->p_prio == prio + 3,
+ test_assert(10, chThdGetSelfX()->prio == prio + 3,
"unexpected priority level");
- test_assert(11, chThdGetSelfX()->p_realprio == prio + 3,
+ test_assert(11, chThdGetSelfX()->realprio == prio + 3,
"unexpected real priority level");
chSysLock();
- chThdGetSelfX()->p_prio = prio;
- chThdGetSelfX()->p_realprio = prio;
+ chThdGetSelfX()->prio = prio;
+ chThdGetSelfX()->realprio = prio;
chSysUnlock();
#endif
}