From 2310f80695b4051cb63ca14878dfc5e76acb94e6 Mon Sep 17 00:00:00 2001 From: gdisirio Date: Wed, 3 Oct 2007 17:14:03 +0000 Subject: git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@30 35acf78f-673a-0410-8e92-d51de3d6d3f4 --- test/test.c | 273 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 273 insertions(+) create mode 100644 test/test.c (limited to 'test') diff --git a/test/test.c b/test/test.c new file mode 100644 index 000000000..deed9a08c --- /dev/null +++ b/test/test.c @@ -0,0 +1,273 @@ +/* + ChibiOS/RT - Copyright (C) 2006-2007 Giovanni Di Sirio. + + This file is part of ChibiOS/RT. + + ChibiOS/RT is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 3 of the License, or + (at your option) any later version. + + ChibiOS/RT is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see . +*/ + +#include + +#if defined(WIN32) && defined(_DEBUG) +static BYTE8 wsT1[UserStackSize(512)]; +static BYTE8 wsT2[UserStackSize(512)]; +static BYTE8 wsT3[UserStackSize(512)]; +static BYTE8 wsT4[UserStackSize(512)]; +static BYTE8 wsT5[UserStackSize(512)]; +#else +static BYTE8 wsT1[UserStackSize(64)]; +static BYTE8 wsT2[UserStackSize(64)]; +static BYTE8 wsT3[UserStackSize(64)]; +static BYTE8 wsT4[UserStackSize(64)]; +static BYTE8 wsT5[UserStackSize(64)]; +#endif +static Thread *t1, *t2, *t3, *t4, *t5; + +static FullDuplexDriver *comp; +static Semaphore sem1, sem2; + +static void wait(void) { + + chThdWait(t1); + chThdWait(t2); + chThdWait(t3); + chThdWait(t4); + chThdWait(t5); +} + +static void println(char *msgp) { + + while (*msgp) + chFDDPut(comp, *msgp++); + chFDDPut(comp, '\r'); + chFDDPut(comp, '\n'); +} + +t_msg Thread1(void *p) { + + chFDDPut(comp, *(BYTE8 *)p); + return 0; +} + +t_msg Thread2(void *p) { + + chSemWait(&sem1); + chFDDPut(comp, *(BYTE8 *)p); + return 0; +} + +t_msg Thread3(void *p) { + + chSemRaisePrioWait(&sem1); + chFDDPut(comp, *(BYTE8 *)p); + return 0; +} + +t_msg Thread4(void *p) { + + chSemWait(&sem1); + chFDDPut(comp, *(BYTE8 *)p); + /* + * NOTE: chSemSignalWait() is not the same of chSemSignal()+chSemWait(). + * The former is performed atomically, try it. + */ + chSemSignalWait(&sem1, &sem2); +// chSemSignal(&sem1); +// chSemWait(&sem2); + chFDDPut(comp, *(BYTE8 *)p); + chSemSignal(&sem2); + return 0; +} + +t_msg Thread5(void *p) { + + chSemWait(&sem1); + chFDDPut(comp, *(BYTE8 *)p); + chSemRaisePrioSignalWait(&sem1, &sem2); +// chSemSignal(&sem1); +// chSemRaisePrioWait(&sem2); + chFDDPut(comp, *(BYTE8 *)p); + chSemLowerPrioSignal(&sem2); + return 0; +} + +t_msg Thread6(void *p) { + t_msg msg; + int i; + + for (i = 0; i < 5; i++) { + msg = chMsgSend(p, 'A' + i); + chFDDPut(comp, msg); + } + chMsgSend(p, 0); + return 0; +} + +t_msg Thread7(void *p) { + + // NOTE, this thread does not serve messages this causes the client to + // timeout. + chThdSleep(3000); + return 0; +} + +/** + * Tester thread, this thread must be created with priority \p NORMALPRIO. + */ +t_msg TestThread(void *p) { + t_msg msg; + int i; + + comp = p; + + /* + * Ready list ordering test. + */ + println("*** Ready List, priority enqueuing test #1, you should read ABCDE:"); + t5 = chThdCreate(NORMALPRIO-5, 0, wsT5, sizeof(wsT5), Thread1, "E"); + t4 = chThdCreate(NORMALPRIO-4, 0, wsT4, sizeof(wsT4), Thread1, "D"); + t3 = chThdCreate(NORMALPRIO-3, 0, wsT3, sizeof(wsT3), Thread1, "C"); + t2 = chThdCreate(NORMALPRIO-2, 0, wsT2, sizeof(wsT2), Thread1, "B"); + t1 = chThdCreate(NORMALPRIO-1, 0, wsT1, sizeof(wsT1), Thread1, "A"); + wait(); + println(""); + println("*** Ready List, priority enqueuing test #2, you should read ABCDE:"); + t4 = chThdCreate(NORMALPRIO-4, 0, wsT4, sizeof(wsT4), Thread1, "D"); + t5 = chThdCreate(NORMALPRIO-5, 0, wsT5, sizeof(wsT5), Thread1, "E"); + t1 = chThdCreate(NORMALPRIO-1, 0, wsT1, sizeof(wsT1), Thread1, "A"); + t2 = chThdCreate(NORMALPRIO-2, 0, wsT2, sizeof(wsT2), Thread1, "B"); + t3 = chThdCreate(NORMALPRIO-3, 0, wsT3, sizeof(wsT3), Thread1, "C"); + wait(); + println(""); + + /* + * Semaphores test. + */ + chSemInit(&sem1, 0); + println("*** Semaphores, FIFO enqueuing test, you should read ABCDE:"); + t1 = chThdCreate(NORMALPRIO+5, 0, wsT1, sizeof(wsT1), Thread2, "A"); + t2 = chThdCreate(NORMALPRIO+1, 0, wsT2, sizeof(wsT2), Thread2, "B"); + t3 = chThdCreate(NORMALPRIO+3, 0, wsT3, sizeof(wsT3), Thread2, "C"); + t4 = chThdCreate(NORMALPRIO+4, 0, wsT4, sizeof(wsT4), Thread2, "D"); + t5 = chThdCreate(NORMALPRIO+2, 0, wsT5, sizeof(wsT5), Thread2, "E"); + chSemSignal(&sem1); + chSemSignal(&sem1); + chSemSignal(&sem1); + chSemSignal(&sem1); + chSemSignal(&sem1); + wait(); + println(""); + println("*** Semaphores, priority enqueuing test #1, you should read ABCDE:"); + t5 = chThdCreate(NORMALPRIO+1, 0, wsT5, sizeof(wsT5), Thread3, "E"); + t4 = chThdCreate(NORMALPRIO+2, 0, wsT4, sizeof(wsT4), Thread3, "D"); + t3 = chThdCreate(NORMALPRIO+3, 0, wsT3, sizeof(wsT3), Thread3, "C"); + t2 = chThdCreate(NORMALPRIO+4, 0, wsT2, sizeof(wsT2), Thread3, "B"); + t1 = chThdCreate(NORMALPRIO+5, 0, wsT1, sizeof(wsT1), Thread3, "A"); + chSemLowerPrioSignal(&sem1); + chSemLowerPrioSignal(&sem1); + chSemLowerPrioSignal(&sem1); + chSemLowerPrioSignal(&sem1); + chSemLowerPrioSignal(&sem1); + wait(); + println(""); + println("*** Semaphores, priority enqueuing test #2, you should read ABCDE:"); + t4 = chThdCreate(NORMALPRIO+2, 0, wsT4, sizeof(wsT4), Thread3, "D"); + t5 = chThdCreate(NORMALPRIO+1, 0, wsT5, sizeof(wsT5), Thread3, "E"); + t1 = chThdCreate(NORMALPRIO+5, 0, wsT1, sizeof(wsT1), Thread3, "A"); + t2 = chThdCreate(NORMALPRIO+4, 0, wsT2, sizeof(wsT2), Thread3, "B"); + t3 = chThdCreate(NORMALPRIO+3, 0, wsT3, sizeof(wsT3), Thread3, "C"); + chSemLowerPrioSignal(&sem1); + chSemLowerPrioSignal(&sem1); + chSemLowerPrioSignal(&sem1); + chSemLowerPrioSignal(&sem1); + chSemLowerPrioSignal(&sem1); + wait(); + println(""); + println("*** Semaphores, atomicity test #1, you should read ABCDEABCDE:"); + chSemInit(&sem1, 0); + chSemInit(&sem2, 1); + t1 = chThdCreate(NORMALPRIO+1, 0, wsT1, sizeof(wsT1), Thread4, "A"); + t2 = chThdCreate(NORMALPRIO+2, 0, wsT2, sizeof(wsT2), Thread4, "B"); + t3 = chThdCreate(NORMALPRIO+3, 0, wsT3, sizeof(wsT3), Thread4, "C"); + t4 = chThdCreate(NORMALPRIO+4, 0, wsT4, sizeof(wsT4), Thread4, "D"); + t5 = chThdCreate(NORMALPRIO+5, 0, wsT5, sizeof(wsT5), Thread4, "E"); + chSemSignal(&sem1); + wait(); + println(""); + println("*** Semaphores, atomicity test #2, you should read ABCDEABCDE:"); + chSemInit(&sem1, 0); + chSemInit(&sem2, 1); + t1 = chThdCreate(NORMALPRIO+1, 0, wsT1, sizeof(wsT1), Thread4, "A"); + t2 = chThdCreate(NORMALPRIO+5, 0, wsT2, sizeof(wsT2), Thread4, "B"); + t3 = chThdCreate(NORMALPRIO+2, 0, wsT3, sizeof(wsT3), Thread4, "C"); + t4 = chThdCreate(NORMALPRIO+4, 0, wsT4, sizeof(wsT4), Thread4, "D"); + t5 = chThdCreate(NORMALPRIO+3, 0, wsT5, sizeof(wsT5), Thread4, "E"); + chSemSignal(&sem1); + wait(); + println(""); + println("*** Semaphores, atomicity test #3, you should read AABBCCDDEE:"); + chSemInit(&sem1, 0); + chSemInit(&sem2, 1); + t1 = chThdCreate(NORMALPRIO+1, 0, wsT1, sizeof(wsT1), Thread5, "A"); + t2 = chThdCreate(NORMALPRIO+2, 0, wsT2, sizeof(wsT2), Thread5, "B"); + t3 = chThdCreate(NORMALPRIO+3, 0, wsT3, sizeof(wsT3), Thread5, "C"); + t4 = chThdCreate(NORMALPRIO+4, 0, wsT4, sizeof(wsT4), Thread5, "D"); + t5 = chThdCreate(NORMALPRIO+5, 0, wsT5, sizeof(wsT5), Thread5, "E"); + chSemSignal(&sem1); + wait(); + println(""); + println("*** Semaphores, atomicity test #4, you should read AABBCCDDEE:"); + chSemInit(&sem1, 0); + chSemInit(&sem2, 1); + t1 = chThdCreate(NORMALPRIO+1, 0, wsT1, sizeof(wsT1), Thread5, "A"); + t2 = chThdCreate(NORMALPRIO+5, 0, wsT2, sizeof(wsT2), Thread5, "B"); + t3 = chThdCreate(NORMALPRIO+2, 0, wsT3, sizeof(wsT3), Thread5, "C"); + t4 = chThdCreate(NORMALPRIO+4, 0, wsT4, sizeof(wsT4), Thread5, "D"); + t5 = chThdCreate(NORMALPRIO+3, 0, wsT5, sizeof(wsT5), Thread5, "E"); + chSemSignal(&sem1); + wait(); + println(""); + println("*** Semaphores, timeout test, you should read ABCDE (slowly):"); + chSemInit(&sem1, 0); + for (i = 0; i < 5; i++) { + chFDDPut(comp, 'A'+i); + chSemWaitTimeout(&sem1, 500); + } + println(""); + + /* + * Messages test. + */ + println("*** Messages, dispatch test, you should read AABBCCDDEE:"); + t1 = chThdCreate(NORMALPRIO-1, 0, wsT1, sizeof(wsT1), Thread6, chThdSelf()); + do { + chMsgRelease(msg = chMsgWait()); + if (msg) + chFDDPut(comp, msg); + } while (msg); + chThdWait(t1); + println(""); + println("*** Messages, timeout test, you should read ABCDE (slowly):"); + t1 = chThdCreate(NORMALPRIO-1, 0, wsT1, sizeof(wsT1), Thread7, chThdSelf()); + for (i = 0; i < 5; i++) { + chFDDPut(comp, 'A'+i); + chMsgSendTimeout(t1, 'A'+i, 500); + } + chMsgSendTimeout(t1, 0, 500); + chThdWait(t1); + println(""); + + println("\r\nTest complete"); + return 0; +} -- cgit v1.2.3 From dd18ff8898aaeef5c34012da4f537f057cd0b082 Mon Sep 17 00:00:00 2001 From: gdisirio Date: Wed, 3 Oct 2007 18:18:58 +0000 Subject: git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@31 35acf78f-673a-0410-8e92-d51de3d6d3f4 --- test/test.c | 84 +++++++------------------------------------------------------ 1 file changed, 9 insertions(+), 75 deletions(-) (limited to 'test') diff --git a/test/test.c b/test/test.c index deed9a08c..4351e79a2 100644 --- a/test/test.c +++ b/test/test.c @@ -75,34 +75,6 @@ t_msg Thread3(void *p) { } t_msg Thread4(void *p) { - - chSemWait(&sem1); - chFDDPut(comp, *(BYTE8 *)p); - /* - * NOTE: chSemSignalWait() is not the same of chSemSignal()+chSemWait(). - * The former is performed atomically, try it. - */ - chSemSignalWait(&sem1, &sem2); -// chSemSignal(&sem1); -// chSemWait(&sem2); - chFDDPut(comp, *(BYTE8 *)p); - chSemSignal(&sem2); - return 0; -} - -t_msg Thread5(void *p) { - - chSemWait(&sem1); - chFDDPut(comp, *(BYTE8 *)p); - chSemRaisePrioSignalWait(&sem1, &sem2); -// chSemSignal(&sem1); -// chSemRaisePrioWait(&sem2); - chFDDPut(comp, *(BYTE8 *)p); - chSemLowerPrioSignal(&sem2); - return 0; -} - -t_msg Thread6(void *p) { t_msg msg; int i; @@ -114,7 +86,7 @@ t_msg Thread6(void *p) { return 0; } -t_msg Thread7(void *p) { +t_msg Thread5(void *p) { // NOTE, this thread does not serve messages this causes the client to // timeout. @@ -130,6 +102,10 @@ t_msg TestThread(void *p) { int i; comp = p; + println("*****************************"); + println("*** ChibiOS/RT test suite ***"); + println("*****************************"); + println(""); /* * Ready list ordering test. @@ -169,6 +145,7 @@ t_msg TestThread(void *p) { wait(); println(""); println("*** Semaphores, priority enqueuing test #1, you should read ABCDE:"); + chSemInit(&sem1, 0); t5 = chThdCreate(NORMALPRIO+1, 0, wsT5, sizeof(wsT5), Thread3, "E"); t4 = chThdCreate(NORMALPRIO+2, 0, wsT4, sizeof(wsT4), Thread3, "D"); t3 = chThdCreate(NORMALPRIO+3, 0, wsT3, sizeof(wsT3), Thread3, "C"); @@ -182,6 +159,7 @@ t_msg TestThread(void *p) { wait(); println(""); println("*** Semaphores, priority enqueuing test #2, you should read ABCDE:"); + chSemInit(&sem1, 0); t4 = chThdCreate(NORMALPRIO+2, 0, wsT4, sizeof(wsT4), Thread3, "D"); t5 = chThdCreate(NORMALPRIO+1, 0, wsT5, sizeof(wsT5), Thread3, "E"); t1 = chThdCreate(NORMALPRIO+5, 0, wsT1, sizeof(wsT1), Thread3, "A"); @@ -194,50 +172,6 @@ t_msg TestThread(void *p) { chSemLowerPrioSignal(&sem1); wait(); println(""); - println("*** Semaphores, atomicity test #1, you should read ABCDEABCDE:"); - chSemInit(&sem1, 0); - chSemInit(&sem2, 1); - t1 = chThdCreate(NORMALPRIO+1, 0, wsT1, sizeof(wsT1), Thread4, "A"); - t2 = chThdCreate(NORMALPRIO+2, 0, wsT2, sizeof(wsT2), Thread4, "B"); - t3 = chThdCreate(NORMALPRIO+3, 0, wsT3, sizeof(wsT3), Thread4, "C"); - t4 = chThdCreate(NORMALPRIO+4, 0, wsT4, sizeof(wsT4), Thread4, "D"); - t5 = chThdCreate(NORMALPRIO+5, 0, wsT5, sizeof(wsT5), Thread4, "E"); - chSemSignal(&sem1); - wait(); - println(""); - println("*** Semaphores, atomicity test #2, you should read ABCDEABCDE:"); - chSemInit(&sem1, 0); - chSemInit(&sem2, 1); - t1 = chThdCreate(NORMALPRIO+1, 0, wsT1, sizeof(wsT1), Thread4, "A"); - t2 = chThdCreate(NORMALPRIO+5, 0, wsT2, sizeof(wsT2), Thread4, "B"); - t3 = chThdCreate(NORMALPRIO+2, 0, wsT3, sizeof(wsT3), Thread4, "C"); - t4 = chThdCreate(NORMALPRIO+4, 0, wsT4, sizeof(wsT4), Thread4, "D"); - t5 = chThdCreate(NORMALPRIO+3, 0, wsT5, sizeof(wsT5), Thread4, "E"); - chSemSignal(&sem1); - wait(); - println(""); - println("*** Semaphores, atomicity test #3, you should read AABBCCDDEE:"); - chSemInit(&sem1, 0); - chSemInit(&sem2, 1); - t1 = chThdCreate(NORMALPRIO+1, 0, wsT1, sizeof(wsT1), Thread5, "A"); - t2 = chThdCreate(NORMALPRIO+2, 0, wsT2, sizeof(wsT2), Thread5, "B"); - t3 = chThdCreate(NORMALPRIO+3, 0, wsT3, sizeof(wsT3), Thread5, "C"); - t4 = chThdCreate(NORMALPRIO+4, 0, wsT4, sizeof(wsT4), Thread5, "D"); - t5 = chThdCreate(NORMALPRIO+5, 0, wsT5, sizeof(wsT5), Thread5, "E"); - chSemSignal(&sem1); - wait(); - println(""); - println("*** Semaphores, atomicity test #4, you should read AABBCCDDEE:"); - chSemInit(&sem1, 0); - chSemInit(&sem2, 1); - t1 = chThdCreate(NORMALPRIO+1, 0, wsT1, sizeof(wsT1), Thread5, "A"); - t2 = chThdCreate(NORMALPRIO+5, 0, wsT2, sizeof(wsT2), Thread5, "B"); - t3 = chThdCreate(NORMALPRIO+2, 0, wsT3, sizeof(wsT3), Thread5, "C"); - t4 = chThdCreate(NORMALPRIO+4, 0, wsT4, sizeof(wsT4), Thread5, "D"); - t5 = chThdCreate(NORMALPRIO+3, 0, wsT5, sizeof(wsT5), Thread5, "E"); - chSemSignal(&sem1); - wait(); - println(""); println("*** Semaphores, timeout test, you should read ABCDE (slowly):"); chSemInit(&sem1, 0); for (i = 0; i < 5; i++) { @@ -250,7 +184,7 @@ t_msg TestThread(void *p) { * Messages test. */ println("*** Messages, dispatch test, you should read AABBCCDDEE:"); - t1 = chThdCreate(NORMALPRIO-1, 0, wsT1, sizeof(wsT1), Thread6, chThdSelf()); + t1 = chThdCreate(NORMALPRIO-1, 0, wsT1, sizeof(wsT1), Thread4, chThdSelf()); do { chMsgRelease(msg = chMsgWait()); if (msg) @@ -259,7 +193,7 @@ t_msg TestThread(void *p) { chThdWait(t1); println(""); println("*** Messages, timeout test, you should read ABCDE (slowly):"); - t1 = chThdCreate(NORMALPRIO-1, 0, wsT1, sizeof(wsT1), Thread7, chThdSelf()); + t1 = chThdCreate(NORMALPRIO-1, 0, wsT1, sizeof(wsT1), Thread5, chThdSelf()); for (i = 0; i < 5; i++) { chFDDPut(comp, 'A'+i); chMsgSendTimeout(t1, 'A'+i, 500); -- cgit v1.2.3 From d6d799ed48f8193bee286187132221f831726a07 Mon Sep 17 00:00:00 2001 From: gdisirio Date: Sat, 6 Oct 2007 08:58:52 +0000 Subject: git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@39 35acf78f-673a-0410-8e92-d51de3d6d3f4 --- test/test.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'test') diff --git a/test/test.c b/test/test.c index 4351e79a2..fbaedd280 100644 --- a/test/test.c +++ b/test/test.c @@ -35,7 +35,7 @@ static BYTE8 wsT5[UserStackSize(64)]; static Thread *t1, *t2, *t3, *t4, *t5; static FullDuplexDriver *comp; -static Semaphore sem1, sem2; +static Semaphore sem1; static void wait(void) { -- cgit v1.2.3 From e776216d02920673266e31d553078f4edec4a264 Mon Sep 17 00:00:00 2001 From: gdisirio Date: Tue, 13 Nov 2007 16:38:23 +0000 Subject: git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@89 35acf78f-673a-0410-8e92-d51de3d6d3f4 --- test/test.c | 51 +++++++++++++++++++++++++++++++++++++++++++++++++-- 1 file changed, 49 insertions(+), 2 deletions(-) (limited to 'test') diff --git a/test/test.c b/test/test.c index fbaedd280..8fe61794c 100644 --- a/test/test.c +++ b/test/test.c @@ -46,10 +46,29 @@ static void wait(void) { chThdWait(t5); } -static void println(char *msgp) { +static void printn(unsigned int n) { + char buf[16], *p; + + if (!n) + chFDDPut(comp, '0'); + else { + p = buf; + while (n) + *p++ = (n % 10) + '0', n /= 10; + while (p > buf) + chFDDPut(comp, *--p); + } +} + +static void print(char *msgp) { while (*msgp) chFDDPut(comp, *msgp++); +} + +static void println(char *msgp) { + + print(msgp); chFDDPut(comp, '\r'); chFDDPut(comp, '\n'); } @@ -94,12 +113,19 @@ t_msg Thread5(void *p) { return 0; } +t_msg Thread6(void *p) { + + while (!chThdShouldTerminate()) + chMsgRelease(chMsgWait() + 1); + return 0; +} + /** * Tester thread, this thread must be created with priority \p NORMALPRIO. */ t_msg TestThread(void *p) { t_msg msg; - int i; + unsigned int i; comp = p; println("*****************************"); @@ -202,6 +228,27 @@ t_msg TestThread(void *p) { chThdWait(t1); println(""); + /* + * Kernel benchmarks. + */ + println("*** Kernel Benchmark, context switch stress test:"); + t_time time = chSysGetTime() + 1; + while (chSysGetTime() < time) + ; + time += 1000; + i = 0; + t1 = chThdCreate(NORMALPRIO+1, 0, wsT1, sizeof(wsT1), Thread6, chThdSelf()); + while (chSysGetTime() < time) + i = chMsgSend(t1, i); + chThdTerminate(t1); + chMsgSend(t1, 0); /* Lets the thread check the termination flag.*/ + chThdWait(t1); + print("Messages throughput = "); + printn(i); + print(" msg/S, "); + printn(i << 1); + println(" ctxsw/S"); + println("\r\nTest complete"); return 0; } -- cgit v1.2.3 From 890c5532da783e8d58cfbf28822bcedaa8a0c61d Mon Sep 17 00:00:00 2001 From: gdisirio Date: Wed, 14 Nov 2007 16:32:41 +0000 Subject: git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@90 35acf78f-673a-0410-8e92-d51de3d6d3f4 --- test/test.c | 75 ++++++++++++++++++++++++++++++++++--------------------------- 1 file changed, 42 insertions(+), 33 deletions(-) (limited to 'test') diff --git a/test/test.c b/test/test.c index 8fe61794c..a40a059f3 100644 --- a/test/test.c +++ b/test/test.c @@ -19,6 +19,8 @@ #include +void ChkIntSources(void); + #if defined(WIN32) && defined(_DEBUG) static BYTE8 wsT1[UserStackSize(512)]; static BYTE8 wsT2[UserStackSize(512)]; @@ -126,6 +128,7 @@ t_msg Thread6(void *p) { t_msg TestThread(void *p) { t_msg msg; unsigned int i; + t_time time; comp = p; println("*****************************"); @@ -137,19 +140,19 @@ t_msg TestThread(void *p) { * Ready list ordering test. */ println("*** Ready List, priority enqueuing test #1, you should read ABCDE:"); - t5 = chThdCreate(NORMALPRIO-5, 0, wsT5, sizeof(wsT5), Thread1, "E"); - t4 = chThdCreate(NORMALPRIO-4, 0, wsT4, sizeof(wsT4), Thread1, "D"); - t3 = chThdCreate(NORMALPRIO-3, 0, wsT3, sizeof(wsT3), Thread1, "C"); - t2 = chThdCreate(NORMALPRIO-2, 0, wsT2, sizeof(wsT2), Thread1, "B"); - t1 = chThdCreate(NORMALPRIO-1, 0, wsT1, sizeof(wsT1), Thread1, "A"); + t5 = chThdCreate(chThdGetPriority()-5, 0, wsT5, sizeof(wsT5), Thread1, "E"); + t4 = chThdCreate(chThdGetPriority()-4, 0, wsT4, sizeof(wsT4), Thread1, "D"); + t3 = chThdCreate(chThdGetPriority()-3, 0, wsT3, sizeof(wsT3), Thread1, "C"); + t2 = chThdCreate(chThdGetPriority()-2, 0, wsT2, sizeof(wsT2), Thread1, "B"); + t1 = chThdCreate(chThdGetPriority()-1, 0, wsT1, sizeof(wsT1), Thread1, "A"); wait(); println(""); println("*** Ready List, priority enqueuing test #2, you should read ABCDE:"); - t4 = chThdCreate(NORMALPRIO-4, 0, wsT4, sizeof(wsT4), Thread1, "D"); - t5 = chThdCreate(NORMALPRIO-5, 0, wsT5, sizeof(wsT5), Thread1, "E"); - t1 = chThdCreate(NORMALPRIO-1, 0, wsT1, sizeof(wsT1), Thread1, "A"); - t2 = chThdCreate(NORMALPRIO-2, 0, wsT2, sizeof(wsT2), Thread1, "B"); - t3 = chThdCreate(NORMALPRIO-3, 0, wsT3, sizeof(wsT3), Thread1, "C"); + t4 = chThdCreate(chThdGetPriority()-4, 0, wsT4, sizeof(wsT4), Thread1, "D"); + t5 = chThdCreate(chThdGetPriority()-5, 0, wsT5, sizeof(wsT5), Thread1, "E"); + t1 = chThdCreate(chThdGetPriority()-1, 0, wsT1, sizeof(wsT1), Thread1, "A"); + t2 = chThdCreate(chThdGetPriority()-2, 0, wsT2, sizeof(wsT2), Thread1, "B"); + t3 = chThdCreate(chThdGetPriority()-3, 0, wsT3, sizeof(wsT3), Thread1, "C"); wait(); println(""); @@ -158,11 +161,11 @@ t_msg TestThread(void *p) { */ chSemInit(&sem1, 0); println("*** Semaphores, FIFO enqueuing test, you should read ABCDE:"); - t1 = chThdCreate(NORMALPRIO+5, 0, wsT1, sizeof(wsT1), Thread2, "A"); - t2 = chThdCreate(NORMALPRIO+1, 0, wsT2, sizeof(wsT2), Thread2, "B"); - t3 = chThdCreate(NORMALPRIO+3, 0, wsT3, sizeof(wsT3), Thread2, "C"); - t4 = chThdCreate(NORMALPRIO+4, 0, wsT4, sizeof(wsT4), Thread2, "D"); - t5 = chThdCreate(NORMALPRIO+2, 0, wsT5, sizeof(wsT5), Thread2, "E"); + t1 = chThdCreate(chThdGetPriority()+5, 0, wsT1, sizeof(wsT1), Thread2, "A"); + t2 = chThdCreate(chThdGetPriority()+1, 0, wsT2, sizeof(wsT2), Thread2, "B"); + t3 = chThdCreate(chThdGetPriority()+3, 0, wsT3, sizeof(wsT3), Thread2, "C"); + t4 = chThdCreate(chThdGetPriority()+4, 0, wsT4, sizeof(wsT4), Thread2, "D"); + t5 = chThdCreate(chThdGetPriority()+2, 0, wsT5, sizeof(wsT5), Thread2, "E"); chSemSignal(&sem1); chSemSignal(&sem1); chSemSignal(&sem1); @@ -172,11 +175,11 @@ t_msg TestThread(void *p) { println(""); println("*** Semaphores, priority enqueuing test #1, you should read ABCDE:"); chSemInit(&sem1, 0); - t5 = chThdCreate(NORMALPRIO+1, 0, wsT5, sizeof(wsT5), Thread3, "E"); - t4 = chThdCreate(NORMALPRIO+2, 0, wsT4, sizeof(wsT4), Thread3, "D"); - t3 = chThdCreate(NORMALPRIO+3, 0, wsT3, sizeof(wsT3), Thread3, "C"); - t2 = chThdCreate(NORMALPRIO+4, 0, wsT2, sizeof(wsT2), Thread3, "B"); - t1 = chThdCreate(NORMALPRIO+5, 0, wsT1, sizeof(wsT1), Thread3, "A"); + t5 = chThdCreate(chThdGetPriority()+1, 0, wsT5, sizeof(wsT5), Thread3, "E"); + t4 = chThdCreate(chThdGetPriority()+2, 0, wsT4, sizeof(wsT4), Thread3, "D"); + t3 = chThdCreate(chThdGetPriority()+3, 0, wsT3, sizeof(wsT3), Thread3, "C"); + t2 = chThdCreate(chThdGetPriority()+4, 0, wsT2, sizeof(wsT2), Thread3, "B"); + t1 = chThdCreate(chThdGetPriority()+5, 0, wsT1, sizeof(wsT1), Thread3, "A"); chSemLowerPrioSignal(&sem1); chSemLowerPrioSignal(&sem1); chSemLowerPrioSignal(&sem1); @@ -186,11 +189,11 @@ t_msg TestThread(void *p) { println(""); println("*** Semaphores, priority enqueuing test #2, you should read ABCDE:"); chSemInit(&sem1, 0); - t4 = chThdCreate(NORMALPRIO+2, 0, wsT4, sizeof(wsT4), Thread3, "D"); - t5 = chThdCreate(NORMALPRIO+1, 0, wsT5, sizeof(wsT5), Thread3, "E"); - t1 = chThdCreate(NORMALPRIO+5, 0, wsT1, sizeof(wsT1), Thread3, "A"); - t2 = chThdCreate(NORMALPRIO+4, 0, wsT2, sizeof(wsT2), Thread3, "B"); - t3 = chThdCreate(NORMALPRIO+3, 0, wsT3, sizeof(wsT3), Thread3, "C"); + t4 = chThdCreate(chThdGetPriority()+2, 0, wsT4, sizeof(wsT4), Thread3, "D"); + t5 = chThdCreate(chThdGetPriority()+1, 0, wsT5, sizeof(wsT5), Thread3, "E"); + t1 = chThdCreate(chThdGetPriority()+5, 0, wsT1, sizeof(wsT1), Thread3, "A"); + t2 = chThdCreate(chThdGetPriority()+4, 0, wsT2, sizeof(wsT2), Thread3, "B"); + t3 = chThdCreate(chThdGetPriority()+3, 0, wsT3, sizeof(wsT3), Thread3, "C"); chSemLowerPrioSignal(&sem1); chSemLowerPrioSignal(&sem1); chSemLowerPrioSignal(&sem1); @@ -210,7 +213,7 @@ t_msg TestThread(void *p) { * Messages test. */ println("*** Messages, dispatch test, you should read AABBCCDDEE:"); - t1 = chThdCreate(NORMALPRIO-1, 0, wsT1, sizeof(wsT1), Thread4, chThdSelf()); + t1 = chThdCreate(chThdGetPriority()-1, 0, wsT1, sizeof(wsT1), Thread4, chThdSelf()); do { chMsgRelease(msg = chMsgWait()); if (msg) @@ -219,7 +222,7 @@ t_msg TestThread(void *p) { chThdWait(t1); println(""); println("*** Messages, timeout test, you should read ABCDE (slowly):"); - t1 = chThdCreate(NORMALPRIO-1, 0, wsT1, sizeof(wsT1), Thread5, chThdSelf()); + t1 = chThdCreate(chThdGetPriority()-1, 0, wsT1, sizeof(wsT1), Thread5, chThdSelf()); for (i = 0; i < 5; i++) { chFDDPut(comp, 'A'+i); chMsgSendTimeout(t1, 'A'+i, 500); @@ -232,16 +235,22 @@ t_msg TestThread(void *p) { * Kernel benchmarks. */ println("*** Kernel Benchmark, context switch stress test:"); - t_time time = chSysGetTime() + 1; - while (chSysGetTime() < time) - ; + time = chSysGetTime() + 1; + while (chSysGetTime() < time) { +#if defined(WIN32) + ChkIntSources(); +#endif + } time += 1000; i = 0; - t1 = chThdCreate(NORMALPRIO+1, 0, wsT1, sizeof(wsT1), Thread6, chThdSelf()); - while (chSysGetTime() < time) + t1 = chThdCreate(chThdGetPriority()-1, 0, wsT1, sizeof(wsT1), Thread6, chThdSelf()); + while (chSysGetTime() < time) { i = chMsgSend(t1, i); +#if defined(WIN32) + ChkIntSources(); +#endif + } chThdTerminate(t1); - chMsgSend(t1, 0); /* Lets the thread check the termination flag.*/ chThdWait(t1); print("Messages throughput = "); printn(i); -- cgit v1.2.3 From d1733a8bd3635776fe3c762891ede4abf77e2b24 Mon Sep 17 00:00:00 2001 From: gdisirio Date: Wed, 21 Nov 2007 16:42:13 +0000 Subject: git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@102 35acf78f-673a-0410-8e92-d51de3d6d3f4 --- test/test.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'test') diff --git a/test/test.c b/test/test.c index a40a059f3..fe0cb5df7 100644 --- a/test/test.c +++ b/test/test.c @@ -77,7 +77,7 @@ static void println(char *msgp) { t_msg Thread1(void *p) { - chFDDPut(comp, *(BYTE8 *)p); +// chFDDPut(comp, *(BYTE8 *)p); return 0; } -- cgit v1.2.3 From 080fb7d084f878e792563a60a255b5fc993ae0ba Mon Sep 17 00:00:00 2001 From: gdisirio Date: Thu, 22 Nov 2007 11:29:17 +0000 Subject: git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@104 35acf78f-673a-0410-8e92-d51de3d6d3f4 --- test/test.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'test') diff --git a/test/test.c b/test/test.c index fe0cb5df7..a40a059f3 100644 --- a/test/test.c +++ b/test/test.c @@ -77,7 +77,7 @@ static void println(char *msgp) { t_msg Thread1(void *p) { -// chFDDPut(comp, *(BYTE8 *)p); + chFDDPut(comp, *(BYTE8 *)p); return 0; } -- cgit v1.2.3 From 97bf45204321755cf2e78a7cc7ff616edaec59c4 Mon Sep 17 00:00:00 2001 From: gdisirio Date: Thu, 22 Nov 2007 15:24:50 +0000 Subject: git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@105 35acf78f-673a-0410-8e92-d51de3d6d3f4 --- test/test.c | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) (limited to 'test') diff --git a/test/test.c b/test/test.c index a40a059f3..412e46866 100644 --- a/test/test.c +++ b/test/test.c @@ -22,17 +22,17 @@ void ChkIntSources(void); #if defined(WIN32) && defined(_DEBUG) -static BYTE8 wsT1[UserStackSize(512)]; -static BYTE8 wsT2[UserStackSize(512)]; -static BYTE8 wsT3[UserStackSize(512)]; -static BYTE8 wsT4[UserStackSize(512)]; -static BYTE8 wsT5[UserStackSize(512)]; +static WorkingArea(wsT1, 512); +static WorkingArea(wsT2, 512); +static WorkingArea(wsT3, 512); +static WorkingArea(wsT4, 512); +static WorkingArea(wsT5, 512); #else -static BYTE8 wsT1[UserStackSize(64)]; -static BYTE8 wsT2[UserStackSize(64)]; -static BYTE8 wsT3[UserStackSize(64)]; -static BYTE8 wsT4[UserStackSize(64)]; -static BYTE8 wsT5[UserStackSize(64)]; +static WorkingArea(wsT1, 64); +static WorkingArea(wsT2, 64); +static WorkingArea(wsT3, 64); +static WorkingArea(wsT4, 64); +static WorkingArea(wsT5, 64); #endif static Thread *t1, *t2, *t3, *t4, *t5; -- cgit v1.2.3 From f20b97abe74cfbb1f28ef70043cf718fbebf4fa4 Mon Sep 17 00:00:00 2001 From: gdisirio Date: Thu, 29 Nov 2007 09:16:53 +0000 Subject: git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@118 35acf78f-673a-0410-8e92-d51de3d6d3f4 --- test/test.c | 31 +++++++++++++++++++++++++++++-- 1 file changed, 29 insertions(+), 2 deletions(-) (limited to 'test') diff --git a/test/test.c b/test/test.c index 412e46866..7ea1bb89c 100644 --- a/test/test.c +++ b/test/test.c @@ -19,7 +19,9 @@ #include +#if defined(WIN32) void ChkIntSources(void); +#endif #if defined(WIN32) && defined(_DEBUG) static WorkingArea(wsT1, 512); @@ -122,6 +124,11 @@ t_msg Thread6(void *p) { return 0; } +t_msg Thread7(void *p) { + + return (unsigned int)p + 1; +} + /** * Tester thread, this thread must be created with priority \p NORMALPRIO. */ @@ -254,9 +261,29 @@ t_msg TestThread(void *p) { chThdWait(t1); print("Messages throughput = "); printn(i); - print(" msg/S, "); + print(" msgs/S, "); printn(i << 1); - println(" ctxsw/S"); + println(" ctxsws/S"); + + println("*** Kernel Benchmark, threads creation/termination:"); + time = chSysGetTime() + 1; + while (chSysGetTime() < time) { +#if defined(WIN32) + ChkIntSources(); +#endif + } + time += 1000; + i = 0; + while (chSysGetTime() < time) { + t1 = chThdCreate(chThdGetPriority()-1, 0, wsT1, sizeof(wsT1), Thread7, (void *)i); + i = chThdWait(t1); +#if defined(WIN32) + ChkIntSources(); +#endif + } + print("Threads throughput = "); + printn(i); + print(" threads/S"); println("\r\nTest complete"); return 0; -- cgit v1.2.3 From 443c9c7db609dd2ac895bd605837f1c028076ada Mon Sep 17 00:00:00 2001 From: gdisirio Date: Mon, 3 Dec 2007 16:19:47 +0000 Subject: git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@125 35acf78f-673a-0410-8e92-d51de3d6d3f4 --- test/test.c | 30 +++++++++++++++++++++++++++++- 1 file changed, 29 insertions(+), 1 deletion(-) (limited to 'test') diff --git a/test/test.c b/test/test.c index 7ea1bb89c..07272468f 100644 --- a/test/test.c +++ b/test/test.c @@ -129,10 +129,13 @@ t_msg Thread7(void *p) { return (unsigned int)p + 1; } + /** * Tester thread, this thread must be created with priority \p NORMALPRIO. */ t_msg TestThread(void *p) { + static BYTE8 ib[16]; + static Queue iq; t_msg msg; unsigned int i; t_time time; @@ -283,7 +286,32 @@ t_msg TestThread(void *p) { } print("Threads throughput = "); printn(i); - print(" threads/S"); + println(" threads/S"); + + println("*** Kernel Benchmark, I/O Queues throughput:"); + chIQInit(&iq, ib, sizeof(ib), NULL); + time = chSysGetTime() + 1; + while (chSysGetTime() < time) { +#if defined(WIN32) + ChkIntSources(); +#endif + } + time += 1000; + i = 0; + while (chSysGetTime() < time) { + chIQPutI(&iq, i >> 24); + chIQPutI(&iq, i >> 16); + chIQPutI(&iq, i >> 8); + chIQPutI(&iq, i); + i = chIQGet(&iq) << 24; + i |= chIQGet(&iq) << 16; + i |= chIQGet(&iq) << 8; + i |= chIQGet(&iq); + i++; + } + print("Queues throughput = "); + printn(i * 4); + print(" bytes/S"); println("\r\nTest complete"); return 0; -- cgit v1.2.3 From 27e5e31d4a19b7ede40f79dbe6e3237ee3511302 Mon Sep 17 00:00:00 2001 From: gdisirio Date: Fri, 7 Dec 2007 13:29:14 +0000 Subject: git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@128 35acf78f-673a-0410-8e92-d51de3d6d3f4 --- test/test.c | 1 - 1 file changed, 1 deletion(-) (limited to 'test') diff --git a/test/test.c b/test/test.c index 07272468f..289e74a3f 100644 --- a/test/test.c +++ b/test/test.c @@ -129,7 +129,6 @@ t_msg Thread7(void *p) { return (unsigned int)p + 1; } - /** * Tester thread, this thread must be created with priority \p NORMALPRIO. */ -- cgit v1.2.3 From 1fb3d146edfcf92426cbf6ae58dcb7c69a0f97bf Mon Sep 17 00:00:00 2001 From: gdisirio Date: Sat, 8 Dec 2007 12:05:22 +0000 Subject: git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@132 35acf78f-673a-0410-8e92-d51de3d6d3f4 --- test/test.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'test') diff --git a/test/test.c b/test/test.c index 289e74a3f..15b70b9d4 100644 --- a/test/test.c +++ b/test/test.c @@ -310,7 +310,7 @@ t_msg TestThread(void *p) { } print("Queues throughput = "); printn(i * 4); - print(" bytes/S"); + println(" bytes/S"); println("\r\nTest complete"); return 0; -- cgit v1.2.3 From 430010715e7a9af17185412273165674f3b58f20 Mon Sep 17 00:00:00 2001 From: gdisirio Date: Sun, 16 Dec 2007 19:01:30 +0000 Subject: git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@141 35acf78f-673a-0410-8e92-d51de3d6d3f4 --- test/test.c | 232 +++++++++++++++++++++++++++++++++++++++++++++--------------- 1 file changed, 175 insertions(+), 57 deletions(-) (limited to 'test') diff --git a/test/test.c b/test/test.c index 15b70b9d4..5f6736843 100644 --- a/test/test.c +++ b/test/test.c @@ -40,6 +40,7 @@ static Thread *t1, *t2, *t3, *t4, *t5; static FullDuplexDriver *comp; static Semaphore sem1; +static Mutex m1, m2; static void wait(void) { @@ -92,8 +93,9 @@ t_msg Thread2(void *p) { t_msg Thread3(void *p) { - chSemRaisePrioWait(&sem1); + chMtxLock(&m1); chFDDPut(comp, *(BYTE8 *)p); + chMtxUnlock(); return 0; } @@ -129,25 +131,8 @@ t_msg Thread7(void *p) { return (unsigned int)p + 1; } -/** - * Tester thread, this thread must be created with priority \p NORMALPRIO. - */ -t_msg TestThread(void *p) { - static BYTE8 ib[16]; - static Queue iq; - t_msg msg; - unsigned int i; - t_time time; +static void testrdy1(void) { - comp = p; - println("*****************************"); - println("*** ChibiOS/RT test suite ***"); - println("*****************************"); - println(""); - - /* - * Ready list ordering test. - */ println("*** Ready List, priority enqueuing test #1, you should read ABCDE:"); t5 = chThdCreate(chThdGetPriority()-5, 0, wsT5, sizeof(wsT5), Thread1, "E"); t4 = chThdCreate(chThdGetPriority()-4, 0, wsT4, sizeof(wsT4), Thread1, "D"); @@ -156,6 +141,10 @@ t_msg TestThread(void *p) { t1 = chThdCreate(chThdGetPriority()-1, 0, wsT1, sizeof(wsT1), Thread1, "A"); wait(); println(""); +} + +static void testrdy2(void) { + println("*** Ready List, priority enqueuing test #2, you should read ABCDE:"); t4 = chThdCreate(chThdGetPriority()-4, 0, wsT4, sizeof(wsT4), Thread1, "D"); t5 = chThdCreate(chThdGetPriority()-5, 0, wsT5, sizeof(wsT5), Thread1, "E"); @@ -164,12 +153,12 @@ t_msg TestThread(void *p) { t3 = chThdCreate(chThdGetPriority()-3, 0, wsT3, sizeof(wsT3), Thread1, "C"); wait(); println(""); +} + +static void testsem1(void) { - /* - * Semaphores test. - */ - chSemInit(&sem1, 0); println("*** Semaphores, FIFO enqueuing test, you should read ABCDE:"); + chSemInit(&sem1, 0); t1 = chThdCreate(chThdGetPriority()+5, 0, wsT1, sizeof(wsT1), Thread2, "A"); t2 = chThdCreate(chThdGetPriority()+1, 0, wsT2, sizeof(wsT2), Thread2, "B"); t3 = chThdCreate(chThdGetPriority()+3, 0, wsT3, sizeof(wsT3), Thread2, "C"); @@ -182,45 +171,111 @@ t_msg TestThread(void *p) { chSemSignal(&sem1); wait(); println(""); - println("*** Semaphores, priority enqueuing test #1, you should read ABCDE:"); +} + +static void testsem2(void) { + unsigned int i; + + println("*** Semaphores, timeout test, you should read ABCDE (slowly):"); chSemInit(&sem1, 0); + for (i = 0; i < 5; i++) { + chFDDPut(comp, 'A' + i); + chSemWaitTimeout(&sem1, 500); + } + println(""); +} + +static void testmtx1(void) { + + chMtxInit(&m1); + println("*** Mutexes, priority enqueuing test, you should read ABCDE:"); + chMtxLock(&m1); t5 = chThdCreate(chThdGetPriority()+1, 0, wsT5, sizeof(wsT5), Thread3, "E"); - t4 = chThdCreate(chThdGetPriority()+2, 0, wsT4, sizeof(wsT4), Thread3, "D"); + t4 = chThdCreate(chThdGetPriority()+3, 0, wsT4, sizeof(wsT4), Thread3, "D"); t3 = chThdCreate(chThdGetPriority()+3, 0, wsT3, sizeof(wsT3), Thread3, "C"); t2 = chThdCreate(chThdGetPriority()+4, 0, wsT2, sizeof(wsT2), Thread3, "B"); t1 = chThdCreate(chThdGetPriority()+5, 0, wsT1, sizeof(wsT1), Thread3, "A"); - chSemLowerPrioSignal(&sem1); - chSemLowerPrioSignal(&sem1); - chSemLowerPrioSignal(&sem1); - chSemLowerPrioSignal(&sem1); - chSemLowerPrioSignal(&sem1); + chMtxUnlock(); wait(); println(""); - println("*** Semaphores, priority enqueuing test #2, you should read ABCDE:"); - chSemInit(&sem1, 0); - t4 = chThdCreate(chThdGetPriority()+2, 0, wsT4, sizeof(wsT4), Thread3, "D"); - t5 = chThdCreate(chThdGetPriority()+1, 0, wsT5, sizeof(wsT5), Thread3, "E"); - t1 = chThdCreate(chThdGetPriority()+5, 0, wsT1, sizeof(wsT1), Thread3, "A"); - t2 = chThdCreate(chThdGetPriority()+4, 0, wsT2, sizeof(wsT2), Thread3, "B"); - t3 = chThdCreate(chThdGetPriority()+3, 0, wsT3, sizeof(wsT3), Thread3, "C"); - chSemLowerPrioSignal(&sem1); - chSemLowerPrioSignal(&sem1); - chSemLowerPrioSignal(&sem1); - chSemLowerPrioSignal(&sem1); - chSemLowerPrioSignal(&sem1); - wait(); +} + +t_msg Thread8(void *p) { + + chThdSleep(5); + chMtxLock(&m1); + chMtxUnlock(); + chFDDPut(comp, *(BYTE8 *)p); + return 0; +} + +t_msg Thread9(void *p) { + + chMtxLock(&m1); + chThdSleep(20); + chMtxUnlock(); + chFDDPut(comp, *(BYTE8 *)p); + return 0; +} + +t_msg Thread10(void *p) { + + chThdSleep(10); + /* 50mS CPU pulse */ + t_time time = chSysGetTime() + 50; + while (chSysGetTime() != time) + ; + chFDDPut(comp, *(BYTE8 *)p); + return 0; +} + +t_msg Thread11(void *p) { + + chThdSleep(5); + chSemWait(&sem1); + chSemSignal(&sem1); + chFDDPut(comp, *(BYTE8 *)p); + return 0; +} + +t_msg Thread12(void *p) { + + chSemWait(&sem1); + chThdSleep(20); + chSemSignal(&sem1); + chFDDPut(comp, *(BYTE8 *)p); + return 0; +} + +static void testmtx2(void) { + + chMtxInit(&m1); + println("*** Mutexes, mutex with inheritance, you should read ABC:"); + t1 = chThdCreate(chThdGetPriority()-1, 0, wsT1, sizeof(wsT1), Thread8, "A"); + t2 = chThdCreate(chThdGetPriority()-3, 0, wsT2, sizeof(wsT2), Thread9, "C"); + t3 = chThdCreate(chThdGetPriority()-2, 0, wsT3, sizeof(wsT3), Thread10, "B"); + chThdWait(t1); + chThdWait(t2); + chThdWait(t3); println(""); - println("*** Semaphores, timeout test, you should read ABCDE (slowly):"); - chSemInit(&sem1, 0); - for (i = 0; i < 5; i++) { - chFDDPut(comp, 'A'+i); - chSemWaitTimeout(&sem1, 500); - } +} + +static void testmtx3(void) { + + chSemInit(&sem1, 1); + println("*** Mutexes, mutex without inheritance, inversion happens, you should read BAC:"); + t1 = chThdCreate(chThdGetPriority()-1, 0, wsT1, sizeof(wsT1), Thread11, "A"); + t2 = chThdCreate(chThdGetPriority()-3, 0, wsT2, sizeof(wsT2), Thread12, "C"); + t3 = chThdCreate(chThdGetPriority()-2, 0, wsT3, sizeof(wsT3), Thread10, "B"); + chThdWait(t1); + chThdWait(t2); + chThdWait(t3); println(""); +} + +static void testmsg1(void) { + t_msg msg; - /* - * Messages test. - */ println("*** Messages, dispatch test, you should read AABBCCDDEE:"); t1 = chThdCreate(chThdGetPriority()-1, 0, wsT1, sizeof(wsT1), Thread4, chThdSelf()); do { @@ -230,19 +285,26 @@ t_msg TestThread(void *p) { } while (msg); chThdWait(t1); println(""); +} + +static void testmsg2(void) { + unsigned int i; + println("*** Messages, timeout test, you should read ABCDE (slowly):"); t1 = chThdCreate(chThdGetPriority()-1, 0, wsT1, sizeof(wsT1), Thread5, chThdSelf()); for (i = 0; i < 5; i++) { - chFDDPut(comp, 'A'+i); - chMsgSendTimeout(t1, 'A'+i, 500); + chFDDPut(comp, 'A' + i); + chMsgSendTimeout(t1, 'A' + i, 500); } chMsgSendTimeout(t1, 0, 500); chThdWait(t1); println(""); +} + +static void bench1(void) { + unsigned int i; + t_time time; - /* - * Kernel benchmarks. - */ println("*** Kernel Benchmark, context switch stress test:"); time = chSysGetTime() + 1; while (chSysGetTime() < time) { @@ -266,6 +328,11 @@ t_msg TestThread(void *p) { print(" msgs/S, "); printn(i << 1); println(" ctxsws/S"); +} + +static void bench2(void) { + unsigned int i; + t_time time; println("*** Kernel Benchmark, threads creation/termination:"); time = chSysGetTime() + 1; @@ -286,6 +353,13 @@ t_msg TestThread(void *p) { print("Threads throughput = "); printn(i); println(" threads/S"); +} + +static void bench3(void) { + static BYTE8 ib[16]; + static Queue iq; + unsigned int i; + t_time time; println("*** Kernel Benchmark, I/O Queues throughput:"); chIQInit(&iq, ib, sizeof(ib), NULL); @@ -311,6 +385,50 @@ t_msg TestThread(void *p) { print("Queues throughput = "); printn(i * 4); println(" bytes/S"); +} + +/** + * Tester thread, this thread must be created with priority \p NORMALPRIO. + */ +t_msg TestThread(void *p) { + + comp = p; + println("*****************************"); + println("*** ChibiOS/RT test suite ***"); + println("*****************************"); + println(""); + + /* + * Ready list ordering tests. + */ + testrdy1(); + testrdy2(); + + /* + * Semaphores tests. + */ + testsem1(); + testsem2(); + + /* + * Mutexes tests. + */ + testmtx1(); + testmtx2(); + testmtx3(); + + /* + * Messages tests. + */ + testmsg1(); + testmsg2(); + + /* + * Kernel benchmarks. + */ + bench1(); + bench2(); + bench3(); println("\r\nTest complete"); return 0; -- cgit v1.2.3 From c69790a0f323c27ee365e8745d60e4cfbca103c2 Mon Sep 17 00:00:00 2001 From: gdisirio Date: Wed, 19 Dec 2007 11:23:56 +0000 Subject: git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@151 35acf78f-673a-0410-8e92-d51de3d6d3f4 --- test/test.c | 118 +++++++++++++++++++++++++++++++++++++++++++++++++++--------- 1 file changed, 101 insertions(+), 17 deletions(-) (limited to 'test') diff --git a/test/test.c b/test/test.c index 5f6736843..a13ac4ef5 100644 --- a/test/test.c +++ b/test/test.c @@ -78,6 +78,13 @@ static void println(char *msgp) { chFDDPut(comp, '\n'); } +static void CPU(t_time ms) { + + t_time time = chSysGetTime() + ms; + while (chSysGetTime() != time) + ; +} + t_msg Thread1(void *p) { chFDDPut(comp, *(BYTE8 *)p); @@ -131,7 +138,7 @@ t_msg Thread7(void *p) { return (unsigned int)p + 1; } -static void testrdy1(void) { +void testrdy1(void) { println("*** Ready List, priority enqueuing test #1, you should read ABCDE:"); t5 = chThdCreate(chThdGetPriority()-5, 0, wsT5, sizeof(wsT5), Thread1, "E"); @@ -143,7 +150,7 @@ static void testrdy1(void) { println(""); } -static void testrdy2(void) { +void testrdy2(void) { println("*** Ready List, priority enqueuing test #2, you should read ABCDE:"); t4 = chThdCreate(chThdGetPriority()-4, 0, wsT4, sizeof(wsT4), Thread1, "D"); @@ -155,7 +162,7 @@ static void testrdy2(void) { println(""); } -static void testsem1(void) { +void testsem1(void) { println("*** Semaphores, FIFO enqueuing test, you should read ABCDE:"); chSemInit(&sem1, 0); @@ -173,7 +180,7 @@ static void testsem1(void) { println(""); } -static void testsem2(void) { +void testsem2(void) { unsigned int i; println("*** Semaphores, timeout test, you should read ABCDE (slowly):"); @@ -185,7 +192,7 @@ static void testsem2(void) { println(""); } -static void testmtx1(void) { +void testmtx1(void) { chMtxInit(&m1); println("*** Mutexes, priority enqueuing test, you should read ABCDE:"); @@ -221,10 +228,7 @@ t_msg Thread9(void *p) { t_msg Thread10(void *p) { chThdSleep(10); - /* 50mS CPU pulse */ - t_time time = chSysGetTime() + 50; - while (chSysGetTime() != time) - ; + CPU(50); chFDDPut(comp, *(BYTE8 *)p); return 0; } @@ -247,10 +251,16 @@ t_msg Thread12(void *p) { return 0; } -static void testmtx2(void) { +/* + * Time + * 0 ++++++++++++++++++AL+....2++++++++++++++AU0------------------------------ + * 1 .....................++-------------------------------------------------- + * 2 .......................++AL.............+++++++++AU++++++++++++++++++++++ + */ +void testmtx2(void) { chMtxInit(&m1); - println("*** Mutexes, mutex with inheritance, you should read ABC:"); + println("*** Mutexes, mutex with inheritance (simple case), you should read ABC:"); t1 = chThdCreate(chThdGetPriority()-1, 0, wsT1, sizeof(wsT1), Thread8, "A"); t2 = chThdCreate(chThdGetPriority()-3, 0, wsT2, sizeof(wsT2), Thread9, "C"); t3 = chThdCreate(chThdGetPriority()-2, 0, wsT3, sizeof(wsT3), Thread10, "B"); @@ -260,7 +270,7 @@ static void testmtx2(void) { println(""); } -static void testmtx3(void) { +void testmtx3(void) { chSemInit(&sem1, 1); println("*** Mutexes, mutex without inheritance, inversion happens, you should read BAC:"); @@ -273,7 +283,80 @@ static void testmtx3(void) { println(""); } -static void testmsg1(void) { +t_msg Thread13(void *p) { + + chMtxLock(&m1); + CPU(50); + chMtxUnlock(); + chFDDPut(comp, *(BYTE8 *)p); + return 0; +} + +t_msg Thread14(void *p) { + + chThdSleep(10); + chMtxLock(&m2); + CPU(20); + chMtxLock(&m1); + CPU(50); + chMtxUnlock(); + CPU(20); + chMtxUnlock(); + chFDDPut(comp, *(BYTE8 *)p); + return 0; +} + +t_msg Thread15(void *p) { + + chThdSleep(20); + chMtxLock(&m2); + CPU(50); + chMtxUnlock(); + chFDDPut(comp, *(BYTE8 *)p); + return 0; +} + +t_msg Thread16(void *p) { + + chThdSleep(40); + CPU(200); + chFDDPut(comp, *(BYTE8 *)p); + return 0; +} + +t_msg Thread17(void *p) { + + chThdSleep(50); + chMtxLock(&m2); + CPU(50); + chMtxUnlock(); + chFDDPut(comp, *(BYTE8 *)p); + return 0; +} + +/* + * Time 0 10 20 30 40 50 + * 0 +++BL++------------------2++++------4+++++BU0-------------------------- + * 1 .......++AL++--2+++++++++BL.........4.....++++++++BU4++++AU1----------- + * 2 .............++AL............................................------++AU + * 3 ..............................++++-------------------------------++.... + * 4 ..................................++AL...................++++AU++...... + */ +void testmtx4(void) { + + chMtxInit(&m1); /* B */ + chMtxInit(&m2); /* A */ + println("*** Mutexes, mutex with inheritance (complex case), you should read ABCDE:"); + t1 = chThdCreate(chThdGetPriority()-5, 0, wsT1, sizeof(wsT1), Thread13, "E"); + t2 = chThdCreate(chThdGetPriority()-4, 0, wsT2, sizeof(wsT2), Thread14, "D"); + t3 = chThdCreate(chThdGetPriority()-3, 0, wsT3, sizeof(wsT3), Thread15, "C"); + t4 = chThdCreate(chThdGetPriority()-2, 0, wsT4, sizeof(wsT4), Thread16, "B"); + t5 = chThdCreate(chThdGetPriority()-1, 0, wsT5, sizeof(wsT5), Thread17, "A"); + wait(); + println(""); +} + +void testmsg1(void) { t_msg msg; println("*** Messages, dispatch test, you should read AABBCCDDEE:"); @@ -287,7 +370,7 @@ static void testmsg1(void) { println(""); } -static void testmsg2(void) { +void testmsg2(void) { unsigned int i; println("*** Messages, timeout test, you should read ABCDE (slowly):"); @@ -301,7 +384,7 @@ static void testmsg2(void) { println(""); } -static void bench1(void) { +void bench1(void) { unsigned int i; t_time time; @@ -330,7 +413,7 @@ static void bench1(void) { println(" ctxsws/S"); } -static void bench2(void) { +void bench2(void) { unsigned int i; t_time time; @@ -355,7 +438,7 @@ static void bench2(void) { println(" threads/S"); } -static void bench3(void) { +void bench3(void) { static BYTE8 ib[16]; static Queue iq; unsigned int i; @@ -416,6 +499,7 @@ t_msg TestThread(void *p) { testmtx1(); testmtx2(); testmtx3(); + testmtx4(); /* * Messages tests. -- cgit v1.2.3 From 6c8aadd17a89d399a8ee2e77d5885f4db3bcab06 Mon Sep 17 00:00:00 2001 From: gdisirio Date: Fri, 21 Dec 2007 15:27:59 +0000 Subject: git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@154 35acf78f-673a-0410-8e92-d51de3d6d3f4 --- test/test.c | 124 ++++++++++++++++++++++++++++++++++++++++++++++-------------- 1 file changed, 95 insertions(+), 29 deletions(-) (limited to 'test') diff --git a/test/test.c b/test/test.c index a13ac4ef5..1687a36c7 100644 --- a/test/test.c +++ b/test/test.c @@ -78,13 +78,26 @@ static void println(char *msgp) { chFDDPut(comp, '\n'); } -static void CPU(t_time ms) { +__attribute__((noinline)) +void CPU(t_time ms) { t_time time = chSysGetTime() + ms; while (chSysGetTime() != time) ; } +__attribute__((noinline)) +t_time wait_tick(void) { + + t_time time = chSysGetTime() + 1; + while (chSysGetTime() < time) { +#if defined(WIN32) + ChkIntSources(); +#endif + } + return time; +} + t_msg Thread1(void *p) { chFDDPut(comp, *(BYTE8 *)p); @@ -384,47 +397,93 @@ void testmsg2(void) { println(""); } -void bench1(void) { +__attribute__((noinline)) +unsigned int msg_loop_test(Thread *tp) { unsigned int i; - t_time time; - println("*** Kernel Benchmark, context switch stress test:"); - time = chSysGetTime() + 1; - while (chSysGetTime() < time) { -#if defined(WIN32) - ChkIntSources(); -#endif - } - time += 1000; + t_time time = wait_tick() + 1000; i = 0; - t1 = chThdCreate(chThdGetPriority()-1, 0, wsT1, sizeof(wsT1), Thread6, chThdSelf()); while (chSysGetTime() < time) { - i = chMsgSend(t1, i); + i = chMsgSend(tp, i); #if defined(WIN32) ChkIntSources(); #endif } + return i; +} + +__attribute__((noinline)) +void precache(void) { + unsigned int i; + + println("\r\nPreparing for benchmarks\r\n"); + t1 = chThdCreate(chThdGetPriority()-1, 0, wsT1, sizeof(wsT1), Thread6, 0); + i = msg_loop_test(t1); + chThdTerminate(t1); + chThdWait(t1); +} + +__attribute__((noinline)) +void bench1(void) { + unsigned int i; + + println("*** Kernel Benchmark, context switch test #1 (optimal):"); + t1 = chThdCreate(chThdGetPriority()-1, 0, wsT1, sizeof(wsT1), Thread6, 0); + i = msg_loop_test(t1); chThdTerminate(t1); chThdWait(t1); print("Messages throughput = "); printn(i); print(" msgs/S, "); printn(i << 1); - println(" ctxsws/S"); + println(" ctxswc/S"); } +__attribute__((noinline)) void bench2(void) { unsigned int i; + + println("*** Kernel Benchmark, context switch test #2 (no threads in ready list):"); + t1 = chThdCreate(chThdGetPriority()+1, 0, wsT1, sizeof(wsT1), Thread6, 0); + i = msg_loop_test(t1); + chThdTerminate(t1); +chMsgSend(t1, 0); + chThdWait(t1); + print("Messages throughput = "); + printn(i); + print(" msgs/S, "); + printn(i << 1); + println(" ctxswc/S"); +} + +__attribute__((noinline)) +void bench3(void) { + unsigned int i; + + println("*** Kernel Benchmark, context switch test #3 (04 threads in ready list):"); + t1 = chThdCreate(chThdGetPriority()+1, 0, wsT1, sizeof(wsT1), Thread6, "A"); + t2 = chThdCreate(chThdGetPriority()-2, 0, wsT2, sizeof(wsT2), Thread7, "B"); + t3 = chThdCreate(chThdGetPriority()-3, 0, wsT3, sizeof(wsT3), Thread7, "C"); + t4 = chThdCreate(chThdGetPriority()-4, 0, wsT4, sizeof(wsT4), Thread7, "D"); + t5 = chThdCreate(chThdGetPriority()-5, 0, wsT5, sizeof(wsT5), Thread7, "E"); + i = msg_loop_test(t1); + chThdTerminate(t1); +chMsgSend(t1, 0); + wait(); + print("Messages throughput = "); + printn(i); + print(" msgs/S, "); + printn(i << 1); + println(" ctxswc/S"); +} + +__attribute__((noinline)) +void bench4(void) { + unsigned int i; t_time time; println("*** Kernel Benchmark, threads creation/termination:"); - time = chSysGetTime() + 1; - while (chSysGetTime() < time) { -#if defined(WIN32) - ChkIntSources(); -#endif - } - time += 1000; + time = wait_tick() + 1000; i = 0; while (chSysGetTime() < time) { t1 = chThdCreate(chThdGetPriority()-1, 0, wsT1, sizeof(wsT1), Thread7, (void *)i); @@ -438,7 +497,8 @@ void bench2(void) { println(" threads/S"); } -void bench3(void) { +__attribute__((noinline)) +void bench5(void) { static BYTE8 ib[16]; static Queue iq; unsigned int i; @@ -446,13 +506,7 @@ void bench3(void) { println("*** Kernel Benchmark, I/O Queues throughput:"); chIQInit(&iq, ib, sizeof(ib), NULL); - time = chSysGetTime() + 1; - while (chSysGetTime() < time) { -#if defined(WIN32) - ChkIntSources(); -#endif - } - time += 1000; + time = wait_tick() + 1000; i = 0; while (chSysGetTime() < time) { chIQPutI(&iq, i >> 24); @@ -509,10 +563,22 @@ t_msg TestThread(void *p) { /* * Kernel benchmarks. + * NOTE: The calls to chThdSleep() are required in order to give I/O queues + * enough time to transmit everything, else the tests would get some + * extra interrupts to serve from previous tests. */ + precache(); + chThdSleep(100); bench1(); + chThdSleep(100); bench2(); + chThdSleep(100); bench3(); + chThdSleep(100); + bench4(); + chThdSleep(100); + bench5(); + chThdSleep(100); println("\r\nTest complete"); return 0; -- cgit v1.2.3 From 398c024927d7fb31d86c50e081a74a9c8fd45769 Mon Sep 17 00:00:00 2001 From: gdisirio Date: Sun, 23 Dec 2007 09:40:50 +0000 Subject: git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@159 35acf78f-673a-0410-8e92-d51de3d6d3f4 --- test/test.c | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) (limited to 'test') diff --git a/test/test.c b/test/test.c index 1687a36c7..30aa43a2d 100644 --- a/test/test.c +++ b/test/test.c @@ -23,7 +23,7 @@ void ChkIntSources(void); #endif -#if defined(WIN32) && defined(_DEBUG) +#if defined(WIN32) static WorkingArea(wsT1, 512); static WorkingArea(wsT2, 512); static WorkingArea(wsT3, 512); @@ -82,8 +82,11 @@ __attribute__((noinline)) void CPU(t_time ms) { t_time time = chSysGetTime() + ms; - while (chSysGetTime() != time) - ; + while (chSysGetTime() != time) { +#if defined(WIN32) + ChkIntSources(); +#endif + } } __attribute__((noinline)) @@ -518,6 +521,9 @@ void bench5(void) { i |= chIQGet(&iq) << 8; i |= chIQGet(&iq); i++; +#if defined(WIN32) + ChkIntSources(); +#endif } print("Queues throughput = "); printn(i * 4); -- cgit v1.2.3 From 68003a03c299850f0b66adfa4df6c9d6b6ba6ab2 Mon Sep 17 00:00:00 2001 From: gdisirio Date: Wed, 23 Jan 2008 14:50:42 +0000 Subject: git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@182 35acf78f-673a-0410-8e92-d51de3d6d3f4 --- test/test.c | 23 ----------------------- 1 file changed, 23 deletions(-) (limited to 'test') diff --git a/test/test.c b/test/test.c index 30aa43a2d..7d8d3b792 100644 --- a/test/test.c +++ b/test/test.c @@ -134,14 +134,6 @@ t_msg Thread4(void *p) { return 0; } -t_msg Thread5(void *p) { - - // NOTE, this thread does not serve messages this causes the client to - // timeout. - chThdSleep(3000); - return 0; -} - t_msg Thread6(void *p) { while (!chThdShouldTerminate()) @@ -386,20 +378,6 @@ void testmsg1(void) { println(""); } -void testmsg2(void) { - unsigned int i; - - println("*** Messages, timeout test, you should read ABCDE (slowly):"); - t1 = chThdCreate(chThdGetPriority()-1, 0, wsT1, sizeof(wsT1), Thread5, chThdSelf()); - for (i = 0; i < 5; i++) { - chFDDPut(comp, 'A' + i); - chMsgSendTimeout(t1, 'A' + i, 500); - } - chMsgSendTimeout(t1, 0, 500); - chThdWait(t1); - println(""); -} - __attribute__((noinline)) unsigned int msg_loop_test(Thread *tp) { unsigned int i; @@ -565,7 +543,6 @@ t_msg TestThread(void *p) { * Messages tests. */ testmsg1(); - testmsg2(); /* * Kernel benchmarks. -- cgit v1.2.3 From ec0a917ae1bef32f1848161e759ef98542327523 Mon Sep 17 00:00:00 2001 From: gdisirio Date: Mon, 3 Mar 2008 15:52:55 +0000 Subject: git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@212 35acf78f-673a-0410-8e92-d51de3d6d3f4 --- test/test.c | 28 ++++++++++++++-------------- 1 file changed, 14 insertions(+), 14 deletions(-) (limited to 'test') diff --git a/test/test.c b/test/test.c index 7d8d3b792..097406620 100644 --- a/test/test.c +++ b/test/test.c @@ -103,21 +103,21 @@ t_time wait_tick(void) { t_msg Thread1(void *p) { - chFDDPut(comp, *(BYTE8 *)p); + chFDDPut(comp, *(uint8_t *)p); return 0; } t_msg Thread2(void *p) { chSemWait(&sem1); - chFDDPut(comp, *(BYTE8 *)p); + chFDDPut(comp, *(uint8_t *)p); return 0; } t_msg Thread3(void *p) { chMtxLock(&m1); - chFDDPut(comp, *(BYTE8 *)p); + chFDDPut(comp, *(uint8_t *)p); chMtxUnlock(); return 0; } @@ -220,7 +220,7 @@ t_msg Thread8(void *p) { chThdSleep(5); chMtxLock(&m1); chMtxUnlock(); - chFDDPut(comp, *(BYTE8 *)p); + chFDDPut(comp, *(uint8_t *)p); return 0; } @@ -229,7 +229,7 @@ t_msg Thread9(void *p) { chMtxLock(&m1); chThdSleep(20); chMtxUnlock(); - chFDDPut(comp, *(BYTE8 *)p); + chFDDPut(comp, *(uint8_t *)p); return 0; } @@ -237,7 +237,7 @@ t_msg Thread10(void *p) { chThdSleep(10); CPU(50); - chFDDPut(comp, *(BYTE8 *)p); + chFDDPut(comp, *(uint8_t *)p); return 0; } @@ -246,7 +246,7 @@ t_msg Thread11(void *p) { chThdSleep(5); chSemWait(&sem1); chSemSignal(&sem1); - chFDDPut(comp, *(BYTE8 *)p); + chFDDPut(comp, *(uint8_t *)p); return 0; } @@ -255,7 +255,7 @@ t_msg Thread12(void *p) { chSemWait(&sem1); chThdSleep(20); chSemSignal(&sem1); - chFDDPut(comp, *(BYTE8 *)p); + chFDDPut(comp, *(uint8_t *)p); return 0; } @@ -296,7 +296,7 @@ t_msg Thread13(void *p) { chMtxLock(&m1); CPU(50); chMtxUnlock(); - chFDDPut(comp, *(BYTE8 *)p); + chFDDPut(comp, *(uint8_t *)p); return 0; } @@ -310,7 +310,7 @@ t_msg Thread14(void *p) { chMtxUnlock(); CPU(20); chMtxUnlock(); - chFDDPut(comp, *(BYTE8 *)p); + chFDDPut(comp, *(uint8_t *)p); return 0; } @@ -320,7 +320,7 @@ t_msg Thread15(void *p) { chMtxLock(&m2); CPU(50); chMtxUnlock(); - chFDDPut(comp, *(BYTE8 *)p); + chFDDPut(comp, *(uint8_t *)p); return 0; } @@ -328,7 +328,7 @@ t_msg Thread16(void *p) { chThdSleep(40); CPU(200); - chFDDPut(comp, *(BYTE8 *)p); + chFDDPut(comp, *(uint8_t *)p); return 0; } @@ -338,7 +338,7 @@ t_msg Thread17(void *p) { chMtxLock(&m2); CPU(50); chMtxUnlock(); - chFDDPut(comp, *(BYTE8 *)p); + chFDDPut(comp, *(uint8_t *)p); return 0; } @@ -480,7 +480,7 @@ void bench4(void) { __attribute__((noinline)) void bench5(void) { - static BYTE8 ib[16]; + static uint8_t ib[16]; static Queue iq; unsigned int i; t_time time; -- cgit v1.2.3 From 5e64a9fec2e17d008b9488faa027d2beaa130a88 Mon Sep 17 00:00:00 2001 From: gdisirio Date: Wed, 5 Mar 2008 10:59:11 +0000 Subject: git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@215 35acf78f-673a-0410-8e92-d51de3d6d3f4 --- test/test.c | 52 ++++++++++++++++++++++++++-------------------------- 1 file changed, 26 insertions(+), 26 deletions(-) (limited to 'test') diff --git a/test/test.c b/test/test.c index 097406620..4a714931d 100644 --- a/test/test.c +++ b/test/test.c @@ -79,9 +79,9 @@ static void println(char *msgp) { } __attribute__((noinline)) -void CPU(t_time ms) { +void CPU(systime_t ms) { - t_time time = chSysGetTime() + ms; + systime_t time = chSysGetTime() + ms; while (chSysGetTime() != time) { #if defined(WIN32) ChkIntSources(); @@ -90,9 +90,9 @@ void CPU(t_time ms) { } __attribute__((noinline)) -t_time wait_tick(void) { +systime_t wait_tick(void) { - t_time time = chSysGetTime() + 1; + systime_t time = chSysGetTime() + 1; while (chSysGetTime() < time) { #if defined(WIN32) ChkIntSources(); @@ -101,20 +101,20 @@ t_time wait_tick(void) { return time; } -t_msg Thread1(void *p) { +msg_t Thread1(void *p) { chFDDPut(comp, *(uint8_t *)p); return 0; } -t_msg Thread2(void *p) { +msg_t Thread2(void *p) { chSemWait(&sem1); chFDDPut(comp, *(uint8_t *)p); return 0; } -t_msg Thread3(void *p) { +msg_t Thread3(void *p) { chMtxLock(&m1); chFDDPut(comp, *(uint8_t *)p); @@ -122,8 +122,8 @@ t_msg Thread3(void *p) { return 0; } -t_msg Thread4(void *p) { - t_msg msg; +msg_t Thread4(void *p) { + msg_t msg; int i; for (i = 0; i < 5; i++) { @@ -134,14 +134,14 @@ t_msg Thread4(void *p) { return 0; } -t_msg Thread6(void *p) { +msg_t Thread6(void *p) { while (!chThdShouldTerminate()) chMsgRelease(chMsgWait() + 1); return 0; } -t_msg Thread7(void *p) { +msg_t Thread7(void *p) { return (unsigned int)p + 1; } @@ -215,7 +215,7 @@ void testmtx1(void) { println(""); } -t_msg Thread8(void *p) { +msg_t Thread8(void *p) { chThdSleep(5); chMtxLock(&m1); @@ -224,7 +224,7 @@ t_msg Thread8(void *p) { return 0; } -t_msg Thread9(void *p) { +msg_t Thread9(void *p) { chMtxLock(&m1); chThdSleep(20); @@ -233,7 +233,7 @@ t_msg Thread9(void *p) { return 0; } -t_msg Thread10(void *p) { +msg_t Thread10(void *p) { chThdSleep(10); CPU(50); @@ -241,7 +241,7 @@ t_msg Thread10(void *p) { return 0; } -t_msg Thread11(void *p) { +msg_t Thread11(void *p) { chThdSleep(5); chSemWait(&sem1); @@ -250,7 +250,7 @@ t_msg Thread11(void *p) { return 0; } -t_msg Thread12(void *p) { +msg_t Thread12(void *p) { chSemWait(&sem1); chThdSleep(20); @@ -291,7 +291,7 @@ void testmtx3(void) { println(""); } -t_msg Thread13(void *p) { +msg_t Thread13(void *p) { chMtxLock(&m1); CPU(50); @@ -300,7 +300,7 @@ t_msg Thread13(void *p) { return 0; } -t_msg Thread14(void *p) { +msg_t Thread14(void *p) { chThdSleep(10); chMtxLock(&m2); @@ -314,7 +314,7 @@ t_msg Thread14(void *p) { return 0; } -t_msg Thread15(void *p) { +msg_t Thread15(void *p) { chThdSleep(20); chMtxLock(&m2); @@ -324,7 +324,7 @@ t_msg Thread15(void *p) { return 0; } -t_msg Thread16(void *p) { +msg_t Thread16(void *p) { chThdSleep(40); CPU(200); @@ -332,7 +332,7 @@ t_msg Thread16(void *p) { return 0; } -t_msg Thread17(void *p) { +msg_t Thread17(void *p) { chThdSleep(50); chMtxLock(&m2); @@ -365,7 +365,7 @@ void testmtx4(void) { } void testmsg1(void) { - t_msg msg; + msg_t msg; println("*** Messages, dispatch test, you should read AABBCCDDEE:"); t1 = chThdCreate(chThdGetPriority()-1, 0, wsT1, sizeof(wsT1), Thread4, chThdSelf()); @@ -382,7 +382,7 @@ __attribute__((noinline)) unsigned int msg_loop_test(Thread *tp) { unsigned int i; - t_time time = wait_tick() + 1000; + systime_t time = wait_tick() + 1000; i = 0; while (chSysGetTime() < time) { i = chMsgSend(tp, i); @@ -461,7 +461,7 @@ chMsgSend(t1, 0); __attribute__((noinline)) void bench4(void) { unsigned int i; - t_time time; + systime_t time; println("*** Kernel Benchmark, threads creation/termination:"); time = wait_tick() + 1000; @@ -483,7 +483,7 @@ void bench5(void) { static uint8_t ib[16]; static Queue iq; unsigned int i; - t_time time; + systime_t time; println("*** Kernel Benchmark, I/O Queues throughput:"); chIQInit(&iq, ib, sizeof(ib), NULL); @@ -511,7 +511,7 @@ void bench5(void) { /** * Tester thread, this thread must be created with priority \p NORMALPRIO. */ -t_msg TestThread(void *p) { +msg_t TestThread(void *p) { comp = p; println("*****************************"); -- cgit v1.2.3 From 8c39bfc93d6c68e5d64707916558b6316f611be2 Mon Sep 17 00:00:00 2001 From: gdisirio Date: Wed, 5 Mar 2008 15:56:12 +0000 Subject: git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@216 35acf78f-673a-0410-8e92-d51de3d6d3f4 --- test/test.c | 46 ++++++++++++++++++++++++---------------------- 1 file changed, 24 insertions(+), 22 deletions(-) (limited to 'test') diff --git a/test/test.c b/test/test.c index 4a714931d..c01e6a89c 100644 --- a/test/test.c +++ b/test/test.c @@ -51,7 +51,7 @@ static void wait(void) { chThdWait(t5); } -static void printn(unsigned int n) { +static void printn(uint32_t n) { char buf[16], *p; if (!n) @@ -59,7 +59,7 @@ static void printn(unsigned int n) { else { p = buf; while (n) - *p++ = (n % 10) + '0', n /= 10; + *p++ = (n % 10) + '0', n /= 10; while (p > buf) chFDDPut(comp, *--p); } @@ -137,13 +137,13 @@ msg_t Thread4(void *p) { msg_t Thread6(void *p) { while (!chThdShouldTerminate()) - chMsgRelease(chMsgWait() + 1); + chMsgRelease(chMsgWait()); return 0; } msg_t Thread7(void *p) { - return (unsigned int)p + 1; + return (msg_t)NULL; } void testrdy1(void) { @@ -380,12 +380,13 @@ void testmsg1(void) { __attribute__((noinline)) unsigned int msg_loop_test(Thread *tp) { - unsigned int i; + uint32_t i; systime_t time = wait_tick() + 1000; i = 0; while (chSysGetTime() < time) { - i = chMsgSend(tp, i); + (void)chMsgSend(tp, 0); + i++; #if defined(WIN32) ChkIntSources(); #endif @@ -395,7 +396,7 @@ unsigned int msg_loop_test(Thread *tp) { __attribute__((noinline)) void precache(void) { - unsigned int i; + uint32_t i; println("\r\nPreparing for benchmarks\r\n"); t1 = chThdCreate(chThdGetPriority()-1, 0, wsT1, sizeof(wsT1), Thread6, 0); @@ -406,7 +407,7 @@ void precache(void) { __attribute__((noinline)) void bench1(void) { - unsigned int i; + uint32_t i; println("*** Kernel Benchmark, context switch test #1 (optimal):"); t1 = chThdCreate(chThdGetPriority()-1, 0, wsT1, sizeof(wsT1), Thread6, 0); @@ -422,7 +423,7 @@ void bench1(void) { __attribute__((noinline)) void bench2(void) { - unsigned int i; + uint32_t i; println("*** Kernel Benchmark, context switch test #2 (no threads in ready list):"); t1 = chThdCreate(chThdGetPriority()+1, 0, wsT1, sizeof(wsT1), Thread6, 0); @@ -439,7 +440,7 @@ chMsgSend(t1, 0); __attribute__((noinline)) void bench3(void) { - unsigned int i; + uint32_t i; println("*** Kernel Benchmark, context switch test #3 (04 threads in ready list):"); t1 = chThdCreate(chThdGetPriority()+1, 0, wsT1, sizeof(wsT1), Thread6, "A"); @@ -460,15 +461,16 @@ chMsgSend(t1, 0); __attribute__((noinline)) void bench4(void) { - unsigned int i; + uint32_t i; systime_t time; println("*** Kernel Benchmark, threads creation/termination:"); time = wait_tick() + 1000; i = 0; while (chSysGetTime() < time) { - t1 = chThdCreate(chThdGetPriority()-1, 0, wsT1, sizeof(wsT1), Thread7, (void *)i); - i = chThdWait(t1); + t1 = chThdCreate(chThdGetPriority()-1, 0, wsT1, sizeof(wsT1), Thread7, NULL); + chThdWait(t1); + i++; #if defined(WIN32) ChkIntSources(); #endif @@ -482,7 +484,7 @@ __attribute__((noinline)) void bench5(void) { static uint8_t ib[16]; static Queue iq; - unsigned int i; + uint32_t i; systime_t time; println("*** Kernel Benchmark, I/O Queues throughput:"); @@ -490,14 +492,14 @@ void bench5(void) { time = wait_tick() + 1000; i = 0; while (chSysGetTime() < time) { - chIQPutI(&iq, i >> 24); - chIQPutI(&iq, i >> 16); - chIQPutI(&iq, i >> 8); - chIQPutI(&iq, i); - i = chIQGet(&iq) << 24; - i |= chIQGet(&iq) << 16; - i |= chIQGet(&iq) << 8; - i |= chIQGet(&iq); + chIQPutI(&iq, 0); + chIQPutI(&iq, 1); + chIQPutI(&iq, 2); + chIQPutI(&iq, 3); + (void)chIQGet(&iq); + (void)chIQGet(&iq); + (void)chIQGet(&iq); + (void)chIQGet(&iq); i++; #if defined(WIN32) ChkIntSources(); -- cgit v1.2.3 From 165bcc4a0708ff3252fe73156eace36b5980dbf9 Mon Sep 17 00:00:00 2001 From: gdisirio Date: Thu, 27 Mar 2008 12:33:31 +0000 Subject: git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@249 35acf78f-673a-0410-8e92-d51de3d6d3f4 --- test/test.h | 33 +++++++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) create mode 100644 test/test.h (limited to 'test') diff --git a/test/test.h b/test/test.h new file mode 100644 index 000000000..b05f9aa61 --- /dev/null +++ b/test/test.h @@ -0,0 +1,33 @@ +/* + ChibiOS/RT - Copyright (C) 2006-2007 Giovanni Di Sirio. + + This file is part of ChibiOS/RT. + + ChibiOS/RT is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 3 of the License, or + (at your option) any later version. + + ChibiOS/RT is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see . +*/ + +#include + +#ifndef _TEST_H_ +#define _TEST_H_ + +#ifdef __cplusplus +extern "C" { +#endif + msg_t TestThread(void *p); +#ifdef __cplusplus +} +#endif + +#endif /* _TEST_H_ */ -- cgit v1.2.3 From 4e914e72d86c226b8d9674cb05675d549bee89e8 Mon Sep 17 00:00:00 2001 From: gdisirio Date: Wed, 16 Apr 2008 15:43:05 +0000 Subject: git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@267 35acf78f-673a-0410-8e92-d51de3d6d3f4 --- test/test.c | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) (limited to 'test') diff --git a/test/test.c b/test/test.c index c01e6a89c..4cca26b31 100644 --- a/test/test.c +++ b/test/test.c @@ -24,17 +24,17 @@ void ChkIntSources(void); #endif #if defined(WIN32) -static WorkingArea(wsT1, 512); -static WorkingArea(wsT2, 512); -static WorkingArea(wsT3, 512); -static WorkingArea(wsT4, 512); -static WorkingArea(wsT5, 512); +WorkingArea(wsT1, 512); +WorkingArea(wsT2, 512); +WorkingArea(wsT3, 512); +WorkingArea(wsT4, 512); +WorkingArea(wsT5, 512); #else -static WorkingArea(wsT1, 64); -static WorkingArea(wsT2, 64); -static WorkingArea(wsT3, 64); -static WorkingArea(wsT4, 64); -static WorkingArea(wsT5, 64); +WorkingArea(wsT1, 64); +WorkingArea(wsT2, 64); +WorkingArea(wsT3, 64); +WorkingArea(wsT4, 64); +WorkingArea(wsT5, 64); #endif static Thread *t1, *t2, *t3, *t4, *t5; -- cgit v1.2.3 From e6ee866d8a37842faa3e9a99e3c3b4935ba28bf0 Mon Sep 17 00:00:00 2001 From: gdisirio Date: Thu, 17 Apr 2008 14:44:21 +0000 Subject: git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@268 35acf78f-673a-0410-8e92-d51de3d6d3f4 --- test/test.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'test') diff --git a/test/test.c b/test/test.c index 4cca26b31..22337132e 100644 --- a/test/test.c +++ b/test/test.c @@ -30,11 +30,11 @@ WorkingArea(wsT3, 512); WorkingArea(wsT4, 512); WorkingArea(wsT5, 512); #else -WorkingArea(wsT1, 64); -WorkingArea(wsT2, 64); -WorkingArea(wsT3, 64); -WorkingArea(wsT4, 64); -WorkingArea(wsT5, 64); +WorkingArea(wsT1, 128); +WorkingArea(wsT2, 128); +WorkingArea(wsT3, 128); +WorkingArea(wsT4, 128); +WorkingArea(wsT5, 128); #endif static Thread *t1, *t2, *t3, *t4, *t5; -- cgit v1.2.3 From 300ecfe103d1d305e78a15196d2fa1aecfddc729 Mon Sep 17 00:00:00 2001 From: gdisirio Date: Thu, 26 Jun 2008 10:54:55 +0000 Subject: git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@323 35acf78f-673a-0410-8e92-d51de3d6d3f4 --- test/test.c | 605 +++++++++++++-------------------------------------------- test/test.h | 30 ++- test/testmsg.c | 65 +++++++ test/testmsg.h | 25 +++ test/testmtx.c | 219 +++++++++++++++++++++ test/testmtx.h | 25 +++ test/testrdy.c | 86 ++++++++ test/testrdy.h | 25 +++ test/testsem.c | 102 ++++++++++ test/testsem.h | 25 +++ 10 files changed, 730 insertions(+), 477 deletions(-) create mode 100644 test/testmsg.c create mode 100644 test/testmsg.h create mode 100644 test/testmtx.c create mode 100644 test/testmtx.h create mode 100644 test/testrdy.c create mode 100644 test/testrdy.h create mode 100644 test/testsem.c create mode 100644 test/testsem.h (limited to 'test') diff --git a/test/test.c b/test/test.c index 22337132e..d6f9f0717 100644 --- a/test/test.c +++ b/test/test.c @@ -19,39 +19,46 @@ #include -#if defined(WIN32) -void ChkIntSources(void); -#endif +#include "test.h" +#include "testrdy.h" +#include "testsem.h" +#include "testmtx.h" +#include "testmsg.h" -#if defined(WIN32) -WorkingArea(wsT1, 512); -WorkingArea(wsT2, 512); -WorkingArea(wsT3, 512); -WorkingArea(wsT4, 512); -WorkingArea(wsT5, 512); -#else -WorkingArea(wsT1, 128); -WorkingArea(wsT2, 128); -WorkingArea(wsT3, 128); -WorkingArea(wsT4, 128); -WorkingArea(wsT5, 128); -#endif -static Thread *t1, *t2, *t3, *t4, *t5; +/* + * Array of all the test cases. + */ +static const struct testcase *tests[] = { + &testrdy1, + &testrdy2, + &testsem1, + &testsem2, + &testmtx1, + &testmtx2, + &testmtx3, + &testmsg1, + NULL +}; + +static bool_t local_fail, global_fail; +static char *failmsg; +static char tokens_buffer[MAX_TOKENS]; +static char *tokp; +static WorkingArea(waT0, THREADS_STACK_SIZE); +static WorkingArea(waT1, THREADS_STACK_SIZE); +static WorkingArea(waT2, THREADS_STACK_SIZE); +static WorkingArea(waT3, THREADS_STACK_SIZE); +static WorkingArea(waT4, THREADS_STACK_SIZE); + +void *wa[MAX_THREADS] = {waT0, waT1, waT2, waT3, waT4}; +Thread *threads[MAX_THREADS]; +/* + * Console output. + */ static FullDuplexDriver *comp; -static Semaphore sem1; -static Mutex m1, m2; -static void wait(void) { - - chThdWait(t1); - chThdWait(t2); - chThdWait(t3); - chThdWait(t4); - chThdWait(t5); -} - -static void printn(uint32_t n) { +void test_printn(uint32_t n) { char buf[16], *p; if (!n) @@ -65,506 +72,154 @@ static void printn(uint32_t n) { } } -static void print(char *msgp) { +void test_print(char *msgp) { while (*msgp) chFDDPut(comp, *msgp++); } -static void println(char *msgp) { +void test_println(char *msgp) { - print(msgp); + test_print(msgp); chFDDPut(comp, '\r'); chFDDPut(comp, '\n'); } -__attribute__((noinline)) -void CPU(systime_t ms) { - - systime_t time = chSysGetTime() + ms; - while (chSysGetTime() != time) { -#if defined(WIN32) - ChkIntSources(); -#endif - } -} - -__attribute__((noinline)) -systime_t wait_tick(void) { - - systime_t time = chSysGetTime() + 1; - while (chSysGetTime() < time) { -#if defined(WIN32) - ChkIntSources(); -#endif - } - return time; -} - -msg_t Thread1(void *p) { - - chFDDPut(comp, *(uint8_t *)p); - return 0; -} - -msg_t Thread2(void *p) { - - chSemWait(&sem1); - chFDDPut(comp, *(uint8_t *)p); - return 0; -} - -msg_t Thread3(void *p) { - - chMtxLock(&m1); - chFDDPut(comp, *(uint8_t *)p); - chMtxUnlock(); - return 0; -} - -msg_t Thread4(void *p) { - msg_t msg; - int i; - - for (i = 0; i < 5; i++) { - msg = chMsgSend(p, 'A' + i); - chFDDPut(comp, msg); - } - chMsgSend(p, 0); - return 0; -} - -msg_t Thread6(void *p) { - - while (!chThdShouldTerminate()) - chMsgRelease(chMsgWait()); - return 0; -} - -msg_t Thread7(void *p) { - - return (msg_t)NULL; -} - -void testrdy1(void) { - - println("*** Ready List, priority enqueuing test #1, you should read ABCDE:"); - t5 = chThdCreate(chThdGetPriority()-5, 0, wsT5, sizeof(wsT5), Thread1, "E"); - t4 = chThdCreate(chThdGetPriority()-4, 0, wsT4, sizeof(wsT4), Thread1, "D"); - t3 = chThdCreate(chThdGetPriority()-3, 0, wsT3, sizeof(wsT3), Thread1, "C"); - t2 = chThdCreate(chThdGetPriority()-2, 0, wsT2, sizeof(wsT2), Thread1, "B"); - t1 = chThdCreate(chThdGetPriority()-1, 0, wsT1, sizeof(wsT1), Thread1, "A"); - wait(); - println(""); -} - -void testrdy2(void) { - - println("*** Ready List, priority enqueuing test #2, you should read ABCDE:"); - t4 = chThdCreate(chThdGetPriority()-4, 0, wsT4, sizeof(wsT4), Thread1, "D"); - t5 = chThdCreate(chThdGetPriority()-5, 0, wsT5, sizeof(wsT5), Thread1, "E"); - t1 = chThdCreate(chThdGetPriority()-1, 0, wsT1, sizeof(wsT1), Thread1, "A"); - t2 = chThdCreate(chThdGetPriority()-2, 0, wsT2, sizeof(wsT2), Thread1, "B"); - t3 = chThdCreate(chThdGetPriority()-3, 0, wsT3, sizeof(wsT3), Thread1, "C"); - wait(); - println(""); -} - -void testsem1(void) { - - println("*** Semaphores, FIFO enqueuing test, you should read ABCDE:"); - chSemInit(&sem1, 0); - t1 = chThdCreate(chThdGetPriority()+5, 0, wsT1, sizeof(wsT1), Thread2, "A"); - t2 = chThdCreate(chThdGetPriority()+1, 0, wsT2, sizeof(wsT2), Thread2, "B"); - t3 = chThdCreate(chThdGetPriority()+3, 0, wsT3, sizeof(wsT3), Thread2, "C"); - t4 = chThdCreate(chThdGetPriority()+4, 0, wsT4, sizeof(wsT4), Thread2, "D"); - t5 = chThdCreate(chThdGetPriority()+2, 0, wsT5, sizeof(wsT5), Thread2, "E"); - chSemSignal(&sem1); - chSemSignal(&sem1); - chSemSignal(&sem1); - chSemSignal(&sem1); - chSemSignal(&sem1); - wait(); - println(""); -} - -void testsem2(void) { - unsigned int i; - - println("*** Semaphores, timeout test, you should read ABCDE (slowly):"); - chSemInit(&sem1, 0); - for (i = 0; i < 5; i++) { - chFDDPut(comp, 'A' + i); - chSemWaitTimeout(&sem1, 500); - } - println(""); -} - -void testmtx1(void) { - - chMtxInit(&m1); - println("*** Mutexes, priority enqueuing test, you should read ABCDE:"); - chMtxLock(&m1); - t5 = chThdCreate(chThdGetPriority()+1, 0, wsT5, sizeof(wsT5), Thread3, "E"); - t4 = chThdCreate(chThdGetPriority()+3, 0, wsT4, sizeof(wsT4), Thread3, "D"); - t3 = chThdCreate(chThdGetPriority()+3, 0, wsT3, sizeof(wsT3), Thread3, "C"); - t2 = chThdCreate(chThdGetPriority()+4, 0, wsT2, sizeof(wsT2), Thread3, "B"); - t1 = chThdCreate(chThdGetPriority()+5, 0, wsT1, sizeof(wsT1), Thread3, "A"); - chMtxUnlock(); - wait(); - println(""); -} - -msg_t Thread8(void *p) { - - chThdSleep(5); - chMtxLock(&m1); - chMtxUnlock(); - chFDDPut(comp, *(uint8_t *)p); - return 0; -} - -msg_t Thread9(void *p) { - - chMtxLock(&m1); - chThdSleep(20); - chMtxUnlock(); - chFDDPut(comp, *(uint8_t *)p); - return 0; -} - -msg_t Thread10(void *p) { +/* + * Tokens. + */ +static void clear_tokens(void) { - chThdSleep(10); - CPU(50); - chFDDPut(comp, *(uint8_t *)p); - return 0; + tokp = tokens_buffer; } -msg_t Thread11(void *p) { +static void print_tokens(void) { + char *cp = tokens_buffer; - chThdSleep(5); - chSemWait(&sem1); - chSemSignal(&sem1); - chFDDPut(comp, *(uint8_t *)p); - return 0; + while (cp < tokp) + chFDDPut(comp, *cp++); } -msg_t Thread12(void *p) { +void test_emit_token(char token) { - chSemWait(&sem1); - chThdSleep(20); - chSemSignal(&sem1); - chFDDPut(comp, *(uint8_t *)p); - return 0; + chSysLock(); + *tokp++ = token; + chSysUnlock(); } /* - * Time - * 0 ++++++++++++++++++AL+....2++++++++++++++AU0------------------------------ - * 1 .....................++-------------------------------------------------- - * 2 .......................++AL.............+++++++++AU++++++++++++++++++++++ + * Assertions. */ -void testmtx2(void) { - - chMtxInit(&m1); - println("*** Mutexes, mutex with inheritance (simple case), you should read ABC:"); - t1 = chThdCreate(chThdGetPriority()-1, 0, wsT1, sizeof(wsT1), Thread8, "A"); - t2 = chThdCreate(chThdGetPriority()-3, 0, wsT2, sizeof(wsT2), Thread9, "C"); - t3 = chThdCreate(chThdGetPriority()-2, 0, wsT3, sizeof(wsT3), Thread10, "B"); - chThdWait(t1); - chThdWait(t2); - chThdWait(t3); - println(""); -} +void test_fail(char * msg) { -void testmtx3(void) { - - chSemInit(&sem1, 1); - println("*** Mutexes, mutex without inheritance, inversion happens, you should read BAC:"); - t1 = chThdCreate(chThdGetPriority()-1, 0, wsT1, sizeof(wsT1), Thread11, "A"); - t2 = chThdCreate(chThdGetPriority()-3, 0, wsT2, sizeof(wsT2), Thread12, "C"); - t3 = chThdCreate(chThdGetPriority()-2, 0, wsT3, sizeof(wsT3), Thread10, "B"); - chThdWait(t1); - chThdWait(t2); - chThdWait(t3); - println(""); + local_fail = TRUE; + global_fail = TRUE; + failmsg = msg; } -msg_t Thread13(void *p) { - - chMtxLock(&m1); - CPU(50); - chMtxUnlock(); - chFDDPut(comp, *(uint8_t *)p); - return 0; -} +void test_assert(bool_t condition, char * msg) { -msg_t Thread14(void *p) { - - chThdSleep(10); - chMtxLock(&m2); - CPU(20); - chMtxLock(&m1); - CPU(50); - chMtxUnlock(); - CPU(20); - chMtxUnlock(); - chFDDPut(comp, *(uint8_t *)p); - return 0; + if (!condition) + test_fail(msg); } -msg_t Thread15(void *p) { - - chThdSleep(20); - chMtxLock(&m2); - CPU(50); - chMtxUnlock(); - chFDDPut(comp, *(uint8_t *)p); - return 0; -} - -msg_t Thread16(void *p) { - - chThdSleep(40); - CPU(200); - chFDDPut(comp, *(uint8_t *)p); - return 0; +void test_assert_sequence(char *expected) { + char *cp = tokens_buffer; + while (cp < tokp) { + if (*cp++ != *expected++) + test_fail(NULL); + } + if (*expected) + test_fail(NULL); } -msg_t Thread17(void *p) { +void test_assert_time_window(systime_t start, systime_t end) { - chThdSleep(50); - chMtxLock(&m2); - CPU(50); - chMtxUnlock(); - chFDDPut(comp, *(uint8_t *)p); - return 0; + test_assert(chSysInTimeWindow(start, end), "time window error"); } /* - * Time 0 10 20 30 40 50 - * 0 +++BL++------------------2++++------4+++++BU0-------------------------- - * 1 .......++AL++--2+++++++++BL.........4.....++++++++BU4++++AU1----------- - * 2 .............++AL............................................------++AU - * 3 ..............................++++-------------------------------++.... - * 4 ..................................++AL...................++++AU++...... + * Threads utils. */ -void testmtx4(void) { - - chMtxInit(&m1); /* B */ - chMtxInit(&m2); /* A */ - println("*** Mutexes, mutex with inheritance (complex case), you should read ABCDE:"); - t1 = chThdCreate(chThdGetPriority()-5, 0, wsT1, sizeof(wsT1), Thread13, "E"); - t2 = chThdCreate(chThdGetPriority()-4, 0, wsT2, sizeof(wsT2), Thread14, "D"); - t3 = chThdCreate(chThdGetPriority()-3, 0, wsT3, sizeof(wsT3), Thread15, "C"); - t4 = chThdCreate(chThdGetPriority()-2, 0, wsT4, sizeof(wsT4), Thread16, "B"); - t5 = chThdCreate(chThdGetPriority()-1, 0, wsT5, sizeof(wsT5), Thread17, "A"); - wait(); - println(""); -} +void test_wait_threads(void) { + int i; -void testmsg1(void) { - msg_t msg; - - println("*** Messages, dispatch test, you should read AABBCCDDEE:"); - t1 = chThdCreate(chThdGetPriority()-1, 0, wsT1, sizeof(wsT1), Thread4, chThdSelf()); - do { - chMsgRelease(msg = chMsgWait()); - if (msg) - chFDDPut(comp, msg); - } while (msg); - chThdWait(t1); - println(""); + for (i = 0; i < MAX_THREADS; i++) + if (threads[i]) + chThdWait(threads[i]); } -__attribute__((noinline)) -unsigned int msg_loop_test(Thread *tp) { - uint32_t i; +void test_cpu_pulse(systime_t ms) { - systime_t time = wait_tick() + 1000; - i = 0; - while (chSysGetTime() < time) { - (void)chMsgSend(tp, 0); - i++; + systime_t start = chSysGetTime(); + while (chSysInTimeWindow(start, start + ms)) { #if defined(WIN32) ChkIntSources(); #endif } - return i; } -__attribute__((noinline)) -void precache(void) { - uint32_t i; - - println("\r\nPreparing for benchmarks\r\n"); - t1 = chThdCreate(chThdGetPriority()-1, 0, wsT1, sizeof(wsT1), Thread6, 0); - i = msg_loop_test(t1); - chThdTerminate(t1); - chThdWait(t1); -} +/* + * Test suite execution. + */ +static void execute_test(const struct testcase *tcp) { + int i; -__attribute__((noinline)) -void bench1(void) { - uint32_t i; - - println("*** Kernel Benchmark, context switch test #1 (optimal):"); - t1 = chThdCreate(chThdGetPriority()-1, 0, wsT1, sizeof(wsT1), Thread6, 0); - i = msg_loop_test(t1); - chThdTerminate(t1); - chThdWait(t1); - print("Messages throughput = "); - printn(i); - print(" msgs/S, "); - printn(i << 1); - println(" ctxswc/S"); -} + /* Initialization */ + clear_tokens(); + local_fail = FALSE; + for (i = 0; i < MAX_THREADS; i++) + threads[i] = NULL; -__attribute__((noinline)) -void bench2(void) { - uint32_t i; - - println("*** Kernel Benchmark, context switch test #2 (no threads in ready list):"); - t1 = chThdCreate(chThdGetPriority()+1, 0, wsT1, sizeof(wsT1), Thread6, 0); - i = msg_loop_test(t1); - chThdTerminate(t1); -chMsgSend(t1, 0); - chThdWait(t1); - print("Messages throughput = "); - printn(i); - print(" msgs/S, "); - printn(i << 1); - println(" ctxswc/S"); + tcp->setup(); + tcp->execute(); + tcp->teardown(); } -__attribute__((noinline)) -void bench3(void) { - uint32_t i; - - println("*** Kernel Benchmark, context switch test #3 (04 threads in ready list):"); - t1 = chThdCreate(chThdGetPriority()+1, 0, wsT1, sizeof(wsT1), Thread6, "A"); - t2 = chThdCreate(chThdGetPriority()-2, 0, wsT2, sizeof(wsT2), Thread7, "B"); - t3 = chThdCreate(chThdGetPriority()-3, 0, wsT3, sizeof(wsT3), Thread7, "C"); - t4 = chThdCreate(chThdGetPriority()-4, 0, wsT4, sizeof(wsT4), Thread7, "D"); - t5 = chThdCreate(chThdGetPriority()-5, 0, wsT5, sizeof(wsT5), Thread7, "E"); - i = msg_loop_test(t1); - chThdTerminate(t1); -chMsgSend(t1, 0); - wait(); - print("Messages throughput = "); - printn(i); - print(" msgs/S, "); - printn(i << 1); - println(" ctxswc/S"); -} +msg_t TestThread(void *p) { + int i; -__attribute__((noinline)) -void bench4(void) { - uint32_t i; - systime_t time; + comp = p; + test_println(""); + test_println("*****************************"); + test_println("*** ChibiOS/RT test suite ***"); + test_println("*****************************"); + test_println(""); - println("*** Kernel Benchmark, threads creation/termination:"); - time = wait_tick() + 1000; + global_fail = FALSE; i = 0; - while (chSysGetTime() < time) { - t1 = chThdCreate(chThdGetPriority()-1, 0, wsT1, sizeof(wsT1), Thread7, NULL); - chThdWait(t1); - i++; -#if defined(WIN32) - ChkIntSources(); + while (tests[i]) { +#if DELAY_BETWEEN_TESTS > 0 + chThdSleep(DELAY_BETWEEN_TESTS); #endif - } - print("Threads throughput = "); - printn(i); - println(" threads/S"); -} - -__attribute__((noinline)) -void bench5(void) { - static uint8_t ib[16]; - static Queue iq; - uint32_t i; - systime_t time; - - println("*** Kernel Benchmark, I/O Queues throughput:"); - chIQInit(&iq, ib, sizeof(ib), NULL); - time = wait_tick() + 1000; - i = 0; - while (chSysGetTime() < time) { - chIQPutI(&iq, 0); - chIQPutI(&iq, 1); - chIQPutI(&iq, 2); - chIQPutI(&iq, 3); - (void)chIQGet(&iq); - (void)chIQGet(&iq); - (void)chIQGet(&iq); - (void)chIQGet(&iq); + test_println("------------------------------------------------------------"); + test_print("--- Test Case "); + test_printn(i + 1); + test_print(" ("); + test_print(tests[i]->gettest()); + test_println(")"); + execute_test(tests[i]); + if (local_fail) { + test_print("--- Result: FAIL ("); + if (failmsg) + test_print(failmsg); + else { + test_print("sequence error: "); + print_tokens(); + } + test_println(")"); + } + else + test_println("--- Result: SUCCESS"); i++; -#if defined(WIN32) - ChkIntSources(); -#endif } - print("Queues throughput = "); - printn(i * 4); - println(" bytes/S"); -} + test_println("------------------------------------------------------------"); + test_println(""); + test_print("Final result: "); + if (global_fail) + test_println("FAIL"); + else + test_println("SUCCESS"); -/** - * Tester thread, this thread must be created with priority \p NORMALPRIO. - */ -msg_t TestThread(void *p) { - - comp = p; - println("*****************************"); - println("*** ChibiOS/RT test suite ***"); - println("*****************************"); - println(""); - - /* - * Ready list ordering tests. - */ - testrdy1(); - testrdy2(); - - /* - * Semaphores tests. - */ - testsem1(); - testsem2(); - - /* - * Mutexes tests. - */ - testmtx1(); - testmtx2(); - testmtx3(); - testmtx4(); - - /* - * Messages tests. - */ - testmsg1(); - - /* - * Kernel benchmarks. - * NOTE: The calls to chThdSleep() are required in order to give I/O queues - * enough time to transmit everything, else the tests would get some - * extra interrupts to serve from previous tests. - */ - precache(); - chThdSleep(100); - bench1(); - chThdSleep(100); - bench2(); - chThdSleep(100); - bench3(); - chThdSleep(100); - bench4(); - chThdSleep(100); - bench5(); - chThdSleep(100); - - println("\r\nTest complete"); return 0; } diff --git a/test/test.h b/test/test.h index b05f9aa61..9e2759ede 100644 --- a/test/test.h +++ b/test/test.h @@ -17,17 +17,43 @@ along with this program. If not, see . */ -#include - #ifndef _TEST_H_ #define _TEST_H_ +#define MAX_THREADS 5 +#define MAX_TOKENS 16 +#define DELAY_BETWEEN_TESTS 200 + +#if defined(CH_ARCHITECTURE_AVR) || defined(CH_ARCHITECTURE_MSP430) +#define THREADS_STACK_SIZE 64 +#else +#define THREADS_STACK_SIZE 128 +#endif +#define STKSIZE UserStackSize(THREADS_STACK_SIZE) + +struct testcase { + char *(*gettest)(void); + void (*setup)(void); + void (*teardown)(void); + void (*execute)(void); +}; + #ifdef __cplusplus extern "C" { #endif msg_t TestThread(void *p); + void test_emit_token(char token); + void test_fail(char * msg); + void test_assert(bool_t condition, char * msg); + void test_assert_sequence(char *expected); + void test_assert_time_window(systime_t start, systime_t end); + void test_wait_threads(void); + void test_cpu_pulse(systime_t ms); #ifdef __cplusplus } #endif +extern Thread *threads[MAX_THREADS]; +extern void *wa[MAX_THREADS]; + #endif /* _TEST_H_ */ diff --git a/test/testmsg.c b/test/testmsg.c new file mode 100644 index 000000000..31959c619 --- /dev/null +++ b/test/testmsg.c @@ -0,0 +1,65 @@ +/* + ChibiOS/RT - Copyright (C) 2006-2007 Giovanni Di Sirio. + + This file is part of ChibiOS/RT. + + ChibiOS/RT is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 3 of the License, or + (at your option) any later version. + + ChibiOS/RT is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see . +*/ + +#include + +#include "test.h" + +static char *msg1_gettest(void) { + + return "Messages, dispatch test"; +} + +static void msg1_setup(void) { +} + +static void msg1_teardown(void) { +} + +static msg_t thread(void *p) { + msg_t msg; + int i; + + for (i = 0; i < 5; i++) { + msg = chMsgSend(p, 'A' + i); + test_emit_token(msg); + } + chMsgSend(p, 0); + return 0; +} + +static void msg1_execute(void) { + msg_t msg; + + threads[0] = chThdCreate(chThdGetPriority()-1, 0, wa[0], STKSIZE, thread, chThdSelf()); + do { + chMsgRelease(msg = chMsgWait()); + if (msg) + test_emit_token(msg); + } while (msg); + test_wait_threads(); + test_assert_sequence("AABBCCDDEE"); +} + +const struct testcase testmsg1 = { + msg1_gettest, + msg1_setup, + msg1_teardown, + msg1_execute +}; diff --git a/test/testmsg.h b/test/testmsg.h new file mode 100644 index 000000000..8c9631bb7 --- /dev/null +++ b/test/testmsg.h @@ -0,0 +1,25 @@ +/* + ChibiOS/RT - Copyright (C) 2006-2007 Giovanni Di Sirio. + + This file is part of ChibiOS/RT. + + ChibiOS/RT is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 3 of the License, or + (at your option) any later version. + + ChibiOS/RT is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see . +*/ + +#ifndef _TESTMSG_H_ +#define _TESTMSG_H_ + +extern const struct testcase testmsg1; + +#endif /* _TESTMSG_H_ */ diff --git a/test/testmtx.c b/test/testmtx.c new file mode 100644 index 000000000..2f1aaa33f --- /dev/null +++ b/test/testmtx.c @@ -0,0 +1,219 @@ +/* + ChibiOS/RT - Copyright (C) 2006-2007 Giovanni Di Sirio. + + This file is part of ChibiOS/RT. + + ChibiOS/RT is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 3 of the License, or + (at your option) any later version. + + ChibiOS/RT is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see . +*/ + +#include + +#include "test.h" + +#define ALLOWED_DELAY 5 + +static Mutex m1, m2; + +static char *mtx1_gettest(void) { + + return "Mutexes, priority enqueuing test"; +} + +static void mtx1_setup(void) { + + chMtxInit(&m1); +} + +static void mtx1_teardown(void) { +} + +static msg_t thread1(void *p) { + + chMtxLock(&m1); + test_emit_token(*(char *)p); + chMtxUnlock(); + return 0; +} + +static void mtx1_execute(void) { + + chMtxLock(&m1); + threads[0] = chThdCreate(chThdGetPriority()+1, 0, wa[0], STKSIZE, thread1, "E"); + threads[1] = chThdCreate(chThdGetPriority()+2, 0, wa[1], STKSIZE, thread1, "D"); + threads[2] = chThdCreate(chThdGetPriority()+3, 0, wa[2], STKSIZE, thread1, "C"); + threads[3] = chThdCreate(chThdGetPriority()+4, 0, wa[3], STKSIZE, thread1, "B"); + threads[4] = chThdCreate(chThdGetPriority()+5, 0, wa[4], STKSIZE, thread1, "A"); + chMtxUnlock(); + test_wait_threads(); + test_assert_sequence("ABCDE"); +} + +const struct testcase testmtx1 = { + mtx1_gettest, + mtx1_setup, + mtx1_teardown, + mtx1_execute +}; + +static char *mtx2_gettest(void) { + + return "Mutexes, priority inheritance, simple case"; +} + +static void mtx2_setup(void) { + + chMtxInit(&m1); +} + +static void mtx2_teardown(void) { +} + +static msg_t thread2(void *p) { + + chThdSleep(5); + chMtxLock(&m1); + chMtxUnlock(); + test_emit_token(*(char *)p); + return 0; +} + +static msg_t thread3(void *p) { + + chMtxLock(&m1); + chThdSleep(20); + chMtxUnlock(); + test_emit_token(*(char *)p); + return 0; +} + +static msg_t thread4(void *p) { + + chThdSleep(10); + test_cpu_pulse(50); + test_emit_token(*(char *)p); + return 0; +} + +/* + * Time + * 0 ++++++++++++++++++AL+....2++++++++++++++AU0------------------------------ + * 1 .....................++-------------------------------------------------- + * 2 .......................++AL.............+++++++++AU++++++++++++++++++++++ + */ +static void mtx2_execute(void) { + + threads[0] = chThdCreate(chThdGetPriority()-1, 0, wa[0], STKSIZE, thread2, "A"); + threads[1] = chThdCreate(chThdGetPriority()-3, 0, wa[1], STKSIZE, thread3, "C"); + threads[2] = chThdCreate(chThdGetPriority()-2, 0, wa[2], STKSIZE, thread4, "B"); + test_wait_threads(); + test_assert_sequence("ABC"); +} + +const struct testcase testmtx2 = { + mtx2_gettest, + mtx2_setup, + mtx2_teardown, + mtx2_execute +}; + +static char *mtx3_gettest(void) { + + return "Mutexes, priority inheritance, complex case"; +} + +static void mtx3_setup(void) { + + chMtxInit(&m1); + chMtxInit(&m2); +} + +static void mtx3_teardown(void) { +} + +static msg_t thread5(void *p) { + + chMtxLock(&m1); + test_cpu_pulse(50); + chMtxUnlock(); + test_emit_token(*(char *)p); + return 0; +} + +static msg_t thread6(void *p) { + + chThdSleep(10); + chMtxLock(&m2); + test_cpu_pulse(20); + chMtxLock(&m1); + test_cpu_pulse(50); + chMtxUnlock(); + test_cpu_pulse(20); + chMtxUnlock(); + test_emit_token(*(char *)p); + return 0; +} + +static msg_t thread7(void *p) { + + chThdSleep(20); + chMtxLock(&m2); + test_cpu_pulse(50); + chMtxUnlock(); + test_emit_token(*(char *)p); + return 0; +} + +static msg_t thread8(void *p) { + + chThdSleep(40); + test_cpu_pulse(200); + test_emit_token(*(char *)p); + return 0; +} + +static msg_t thread9(void *p) { + + chThdSleep(50); + chMtxLock(&m2); + test_cpu_pulse(50); + chMtxUnlock(); + test_emit_token(*(char *)p); + return 0; +} + +/* + * Time 0 10 20 30 40 50 + * 0 +++BL++------------------2++++------4+++++BU0-------------------------- + * 1 .......++AL++--2+++++++++BL.........4.....++++++++BU4++++AU1----------- + * 2 .............++AL............................................------++AU + * 3 ..............................++++-------------------------------++.... + * 4 ..................................++AL...................++++AU++...... + */ +static void mtx3_execute(void) { + + threads[0] = chThdCreate(chThdGetPriority()-5, 0, wa[0], STKSIZE, thread5, "E"); + threads[1] = chThdCreate(chThdGetPriority()-4, 0, wa[1], STKSIZE, thread6, "D"); + threads[2] = chThdCreate(chThdGetPriority()-3, 0, wa[2], STKSIZE, thread7, "C"); + threads[3] = chThdCreate(chThdGetPriority()-2, 0, wa[3], STKSIZE, thread8, "B"); + threads[4] = chThdCreate(chThdGetPriority()-1, 0, wa[4], STKSIZE, thread9, "A"); + test_wait_threads(); + test_assert_sequence("ABCDE"); +} + +const struct testcase testmtx3 = { + mtx3_gettest, + mtx3_setup, + mtx3_teardown, + mtx3_execute +}; diff --git a/test/testmtx.h b/test/testmtx.h new file mode 100644 index 000000000..068fbc7b8 --- /dev/null +++ b/test/testmtx.h @@ -0,0 +1,25 @@ +/* + ChibiOS/RT - Copyright (C) 2006-2007 Giovanni Di Sirio. + + This file is part of ChibiOS/RT. + + ChibiOS/RT is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 3 of the License, or + (at your option) any later version. + + ChibiOS/RT is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see . +*/ + +#ifndef _TESTMTX_H_ +#define _TESTMTX_H_ + +extern const struct testcase testmtx1, testmtx2, testmtx3; + +#endif /* _TESTMTX_H_ */ diff --git a/test/testrdy.c b/test/testrdy.c new file mode 100644 index 000000000..ec8a0d2dd --- /dev/null +++ b/test/testrdy.c @@ -0,0 +1,86 @@ +/* + ChibiOS/RT - Copyright (C) 2006-2007 Giovanni Di Sirio. + + This file is part of ChibiOS/RT. + + ChibiOS/RT is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 3 of the License, or + (at your option) any later version. + + ChibiOS/RT is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see . +*/ + +#include + +#include "test.h" + +static msg_t thread(void *p) { + + test_emit_token(*(char *)p); + return 0; +} + +static char *rdy1_gettest(void) { + + return "Ready List, priority enqueuing test #1"; +} + +static void rdy1_setup(void) { +} + +static void rdy1_teardown(void) { +} + +static void rdy1_execute(void) { + + threads[0] = chThdCreate(chThdGetPriority()-5, 0, wa[0], STKSIZE, thread, "E"); + threads[1] = chThdCreate(chThdGetPriority()-4, 0, wa[1], STKSIZE, thread, "D"); + threads[2] = chThdCreate(chThdGetPriority()-3, 0, wa[2], STKSIZE, thread, "C"); + threads[3] = chThdCreate(chThdGetPriority()-2, 0, wa[3], STKSIZE, thread, "B"); + threads[4] = chThdCreate(chThdGetPriority()-1, 0, wa[4], STKSIZE, thread, "A"); + test_wait_threads(); + test_assert_sequence("ABCDE"); +} + +const struct testcase testrdy1 = { + rdy1_gettest, + rdy1_setup, + rdy1_teardown, + rdy1_execute +}; + +static char *rdy2_gettest(void) { + + return "Ready List, priority enqueuing test #2"; +} + +static void rdy2_setup(void) { +} + +static void rdy2_teardown(void) { +} + +static void rdy2_execute(void) { + + threads[1] = chThdCreate(chThdGetPriority()-4, 0, wa[1], STKSIZE, thread, "D"); + threads[0] = chThdCreate(chThdGetPriority()-5, 0, wa[0], STKSIZE, thread, "E"); + threads[4] = chThdCreate(chThdGetPriority()-1, 0, wa[4], STKSIZE, thread, "A"); + threads[3] = chThdCreate(chThdGetPriority()-2, 0, wa[3], STKSIZE, thread, "B"); + threads[2] = chThdCreate(chThdGetPriority()-3, 0, wa[2], STKSIZE, thread, "C"); + test_wait_threads(); + test_assert_sequence("ABCDE"); +} + +const struct testcase testrdy2 = { + rdy2_gettest, + rdy2_setup, + rdy2_teardown, + rdy2_execute +}; diff --git a/test/testrdy.h b/test/testrdy.h new file mode 100644 index 000000000..68719351f --- /dev/null +++ b/test/testrdy.h @@ -0,0 +1,25 @@ +/* + ChibiOS/RT - Copyright (C) 2006-2007 Giovanni Di Sirio. + + This file is part of ChibiOS/RT. + + ChibiOS/RT is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 3 of the License, or + (at your option) any later version. + + ChibiOS/RT is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see . +*/ + +#ifndef _TESTRDY_H_ +#define _TESTRDY_H_ + +extern const struct testcase testrdy1, testrdy2; + +#endif /* _TESTRDY_H_ */ diff --git a/test/testsem.c b/test/testsem.c new file mode 100644 index 000000000..ef6a664fd --- /dev/null +++ b/test/testsem.c @@ -0,0 +1,102 @@ +/* + ChibiOS/RT - Copyright (C) 2006-2007 Giovanni Di Sirio. + + This file is part of ChibiOS/RT. + + ChibiOS/RT is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 3 of the License, or + (at your option) any later version. + + ChibiOS/RT is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see . +*/ + +#include + +#include "test.h" + +#define ALLOWED_DELAY 5 + +static Semaphore sem1; + +static char *sem1_gettest(void) { + + return "Semaphores, FIFO enqueuing test"; +} + +static void sem1_setup(void) { + + chSemInit(&sem1, 0); +} + +static void sem1_teardown(void) { +} + +static msg_t thread(void *p) { + + chSemWait(&sem1); + test_emit_token(*(char *)p); + return 0; +} + +static void sem1_execute(void) { + + threads[0] = chThdCreate(chThdGetPriority()+5, 0, wa[0], STKSIZE, thread, "A"); + threads[1] = chThdCreate(chThdGetPriority()+1, 0, wa[1], STKSIZE, thread, "B"); + threads[2] = chThdCreate(chThdGetPriority()+3, 0, wa[2], STKSIZE, thread, "C"); + threads[3] = chThdCreate(chThdGetPriority()+4, 0, wa[3], STKSIZE, thread, "D"); + threads[4] = chThdCreate(chThdGetPriority()+2, 0, wa[4], STKSIZE, thread, "E"); + chSemSignal(&sem1); + chSemSignal(&sem1); + chSemSignal(&sem1); + chSemSignal(&sem1); + chSemSignal(&sem1); + test_wait_threads(); + test_assert_sequence("ABCDE"); +} + +const struct testcase testsem1 = { + sem1_gettest, + sem1_setup, + sem1_teardown, + sem1_execute +}; + +static char *sem2_gettest(void) { + + return "Semaphores, timeout test"; +} + +static void sem2_setup(void) { + + chSemInit(&sem1, 0); +} + +static void sem2_teardown(void) { +} + +static void sem2_execute(void) { + int i; + systime_t target_time; + + target_time = chSysGetTime() + 5 * 500; + for (i = 0; i < 5; i++) { + test_emit_token('A' + i); + chSemWaitTimeout(&sem1, 500); + } + test_assert_sequence("ABCDE"); + test_assert_time_window(target_time, target_time + ALLOWED_DELAY); +} + +const struct testcase testsem2 = { + sem2_gettest, + sem2_setup, + sem2_teardown, + sem2_execute +}; diff --git a/test/testsem.h b/test/testsem.h new file mode 100644 index 000000000..8bb6b17bf --- /dev/null +++ b/test/testsem.h @@ -0,0 +1,25 @@ +/* + ChibiOS/RT - Copyright (C) 2006-2007 Giovanni Di Sirio. + + This file is part of ChibiOS/RT. + + ChibiOS/RT is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 3 of the License, or + (at your option) any later version. + + ChibiOS/RT is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see . +*/ + +#ifndef _TESTSEM_H_ +#define _TESTSEM_H_ + +extern const struct testcase testsem1, testsem2; + +#endif /* _TESTSEM_H_ */ -- cgit v1.2.3 From 8292744ffd977bbe16d4fe4273a4acdc196e463d Mon Sep 17 00:00:00 2001 From: gdisirio Date: Thu, 26 Jun 2008 13:36:25 +0000 Subject: git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@324 35acf78f-673a-0410-8e92-d51de3d6d3f4 --- test/test.c | 30 +++++++- test/test.h | 4 + test/testbmk.c | 233 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++ test/testbmk.h | 25 +++++++ 4 files changed, 290 insertions(+), 2 deletions(-) create mode 100644 test/testbmk.c create mode 100644 test/testbmk.h (limited to 'test') diff --git a/test/test.c b/test/test.c index d6f9f0717..f9a185d03 100644 --- a/test/test.c +++ b/test/test.c @@ -24,6 +24,7 @@ #include "testsem.h" #include "testmtx.h" #include "testmsg.h" +#include "testbmk.h" /* * Array of all the test cases. @@ -37,6 +38,11 @@ static const struct testcase *tests[] = { &testmtx2, &testmtx3, &testmsg1, + &testbmk1, + &testbmk2, + &testbmk3, + &testbmk4, + &testbmk5, NULL }; @@ -159,6 +165,26 @@ void test_cpu_pulse(systime_t ms) { } } +systime_t test_wait_tick(void) { + + systime_t time = chSysGetTime() + 1; + if (time) { + while (chSysGetTime() < time) { +#if defined(WIN32) + ChkIntSources(); +#endif + } + } + else { + while (chSysGetTime() > time) { +#if defined(WIN32) + ChkIntSources(); +#endif + } + } + return time; +} + /* * Test suite execution. */ @@ -192,7 +218,7 @@ msg_t TestThread(void *p) { #if DELAY_BETWEEN_TESTS > 0 chThdSleep(DELAY_BETWEEN_TESTS); #endif - test_println("------------------------------------------------------------"); + test_println("---------------------------------------------------------------------------"); test_print("--- Test Case "); test_printn(i + 1); test_print(" ("); @@ -213,7 +239,7 @@ msg_t TestThread(void *p) { test_println("--- Result: SUCCESS"); i++; } - test_println("------------------------------------------------------------"); + test_println("---------------------------------------------------------------------------"); test_println(""); test_print("Final result: "); if (global_fail) diff --git a/test/test.h b/test/test.h index 9e2759ede..468505d01 100644 --- a/test/test.h +++ b/test/test.h @@ -42,12 +42,16 @@ struct testcase { extern "C" { #endif msg_t TestThread(void *p); + void test_printn(uint32_t n); + void test_print(char *msgp); + void test_println(char *msgp); void test_emit_token(char token); void test_fail(char * msg); void test_assert(bool_t condition, char * msg); void test_assert_sequence(char *expected); void test_assert_time_window(systime_t start, systime_t end); void test_wait_threads(void); + systime_t test_wait_tick(void); void test_cpu_pulse(systime_t ms); #ifdef __cplusplus } diff --git a/test/testbmk.c b/test/testbmk.c new file mode 100644 index 000000000..2dc349d92 --- /dev/null +++ b/test/testbmk.c @@ -0,0 +1,233 @@ +/* + ChibiOS/RT - Copyright (C) 2006-2007 Giovanni Di Sirio. + + This file is part of ChibiOS/RT. + + ChibiOS/RT is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 3 of the License, or + (at your option) any later version. + + ChibiOS/RT is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see . +*/ + +#include + +#include "test.h" + +__attribute__((noinline)) +static unsigned int msg_loop_test(Thread *tp) { + + uint32_t n = 0; + systime_t start = test_wait_tick(); + systime_t end = start + 1000; + while (chSysInTimeWindow(start, end)) { + (void)chMsgSend(tp, 0); + n++; +#if defined(WIN32) + ChkIntSources(); +#endif + } + return n; +} + +static char *bmk1_gettest(void) { + + return "Benchmark, context switch #1, optimal"; +} + +static void bmk1_setup(void) { +} + +static void bmk1_teardown(void) { +} + +static msg_t thread1(void *p) { + + while (!chThdShouldTerminate()) + chMsgRelease(chMsgWait()); + return 0; +} + +static void bmk1_execute(void) { + uint32_t n; + + threads[0] = chThdCreate(chThdGetPriority()-1, 0, wa[0], STKSIZE, thread1, 0); + n = msg_loop_test(threads[0]); + chThdTerminate(threads[0]); + test_wait_threads(); + test_print("--- Score : "); + test_printn(n); + test_print(" msgs/S, "); + test_printn(n << 1); + test_println(" ctxswc/S"); +} + +const struct testcase testbmk1 = { + bmk1_gettest, + bmk1_setup, + bmk1_teardown, + bmk1_execute +}; + +static char *bmk2_gettest(void) { + + return "Benchmark, context switch #2, empty ready list"; +} + +static void bmk2_setup(void) { +} + +static void bmk2_teardown(void) { +} + +static void bmk2_execute(void) { + uint32_t n; + + threads[0] = chThdCreate(chThdGetPriority()+1, 0, wa[0], STKSIZE, thread1, 0); + n = msg_loop_test(threads[0]); + chThdTerminate(threads[0]); + chMsgSend(threads[0], 0); + test_wait_threads(); + test_print("--- Score : "); + test_printn(n); + test_print(" msgs/S, "); + test_printn(n << 1); + test_println(" ctxswc/S"); +} + +const struct testcase testbmk2 = { + bmk2_gettest, + bmk2_setup, + bmk2_teardown, + bmk2_execute +}; + +static char *bmk3_gettest(void) { + + return "Benchmark, context switch #3, 4 threads in ready list"; +} + +static void bmk3_setup(void) { +} + +static void bmk3_teardown(void) { +} + +static msg_t thread2(void *p) { + + return 0; +} + +static void bmk3_execute(void) { + uint32_t n; + + threads[0] = chThdCreate(chThdGetPriority()+1, 0, wa[0], STKSIZE, thread1, 0); + threads[1] = chThdCreate(chThdGetPriority()-2, 0, wa[1], STKSIZE, thread2, 0); + threads[2] = chThdCreate(chThdGetPriority()-3, 0, wa[2], STKSIZE, thread2, 0); + threads[3] = chThdCreate(chThdGetPriority()-4, 0, wa[3], STKSIZE, thread2, 0); + threads[4] = chThdCreate(chThdGetPriority()-5, 0, wa[4], STKSIZE, thread2, 0); + n = msg_loop_test(threads[0]); + chThdTerminate(threads[0]); + chMsgSend(threads[0], 0); + test_wait_threads(); + test_print("--- Score : "); + test_printn(n); + test_print(" msgs/S, "); + test_printn(n << 1); + test_println(" ctxswc/S"); +} + +const struct testcase testbmk3 = { + bmk3_gettest, + bmk3_setup, + bmk3_teardown, + bmk3_execute +}; + +static char *bmk4_gettest(void) { + + return "Benchmark, threads creation/termination"; +} + +static void bmk4_setup(void) { +} + +static void bmk4_teardown(void) { +} + +static void bmk4_execute(void) { + + systime_t start = test_wait_tick(); + systime_t end = start + 1000; + uint32_t n = 0; + while (chSysInTimeWindow(start, end)) { + threads[0] = chThdCreate(chThdGetPriority()-1, 0, wa[0], STKSIZE, thread2, NULL); + chThdWait(threads[0]); + n++; +#if defined(WIN32) + ChkIntSources(); +#endif + } + test_print("--- Score : "); + test_printn(n); + test_println(" threads/S"); +} + +const struct testcase testbmk4 = { + bmk4_gettest, + bmk4_setup, + bmk4_teardown, + bmk4_execute +}; + +static char *bmk5_gettest(void) { + + return "Benchmark, I/O Queues throughput"; +} + +static void bmk5_setup(void) { +} + +static void bmk5_teardown(void) { +} + +static void bmk5_execute(void) { + static uint8_t ib[16]; + static Queue iq; + + chIQInit(&iq, ib, sizeof(ib), NULL); + systime_t start = test_wait_tick(); + systime_t end = start + 1000; + uint32_t n = 0; + while (chSysInTimeWindow(start, end)) { + chIQPutI(&iq, 0); + chIQPutI(&iq, 1); + chIQPutI(&iq, 2); + chIQPutI(&iq, 3); + (void)chIQGet(&iq); + (void)chIQGet(&iq); + (void)chIQGet(&iq); + (void)chIQGet(&iq); + n++; +#if defined(WIN32) + ChkIntSources(); +#endif + } + test_print("--- Score : "); + test_printn(n * 4); + test_println(" bytes/S"); +} + +const struct testcase testbmk5 = { + bmk5_gettest, + bmk5_setup, + bmk5_teardown, + bmk5_execute +}; diff --git a/test/testbmk.h b/test/testbmk.h new file mode 100644 index 000000000..346e4c842 --- /dev/null +++ b/test/testbmk.h @@ -0,0 +1,25 @@ +/* + ChibiOS/RT - Copyright (C) 2006-2007 Giovanni Di Sirio. + + This file is part of ChibiOS/RT. + + ChibiOS/RT is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 3 of the License, or + (at your option) any later version. + + ChibiOS/RT is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see . +*/ + +#ifndef _TESTBMK_H_ +#define _TESTBMK_H_ + +extern const struct testcase testbmk1, testbmk2, testbmk3, testbmk4, testbmk5; + +#endif /* _TESTBMK_H_ */ -- cgit v1.2.3 From cc44376c6e07d5c47561db9f6179e51e0654391d Mon Sep 17 00:00:00 2001 From: gdisirio Date: Thu, 26 Jun 2008 14:06:21 +0000 Subject: git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@325 35acf78f-673a-0410-8e92-d51de3d6d3f4 --- test/test.mk | 3 +++ 1 file changed, 3 insertions(+) create mode 100644 test/test.mk (limited to 'test') diff --git a/test/test.mk b/test/test.mk new file mode 100644 index 000000000..ce890a855 --- /dev/null +++ b/test/test.mk @@ -0,0 +1,3 @@ +# List of all the ChibiOS/RT test files. +TESTSRC = ../../test/test.c ../../test/testrdy.c ../../test/testsem.c \ + ../../test/testmtx.c ../../test/testmsg.c ../../test/testbmk.c -- cgit v1.2.3 From 8a02a67d832e1c3515f91f97dcb2a2b61be3268f Mon Sep 17 00:00:00 2001 From: gdisirio Date: Thu, 26 Jun 2008 14:35:14 +0000 Subject: git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@326 35acf78f-673a-0410-8e92-d51de3d6d3f4 --- test/testmtx.c | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) (limited to 'test') diff --git a/test/testmtx.c b/test/testmtx.c index 2f1aaa33f..526a64ffa 100644 --- a/test/testmtx.c +++ b/test/testmtx.c @@ -48,13 +48,15 @@ static msg_t thread1(void *p) { static void mtx1_execute(void) { + tprio_t prio = chThdGetPriority(); // Bacause priority inheritance. chMtxLock(&m1); - threads[0] = chThdCreate(chThdGetPriority()+1, 0, wa[0], STKSIZE, thread1, "E"); - threads[1] = chThdCreate(chThdGetPriority()+2, 0, wa[1], STKSIZE, thread1, "D"); - threads[2] = chThdCreate(chThdGetPriority()+3, 0, wa[2], STKSIZE, thread1, "C"); - threads[3] = chThdCreate(chThdGetPriority()+4, 0, wa[3], STKSIZE, thread1, "B"); - threads[4] = chThdCreate(chThdGetPriority()+5, 0, wa[4], STKSIZE, thread1, "A"); + threads[0] = chThdCreate(prio+1, 0, wa[0], STKSIZE, thread1, "E"); + threads[1] = chThdCreate(prio+2, 0, wa[1], STKSIZE, thread1, "D"); + threads[2] = chThdCreate(prio+3, 0, wa[2], STKSIZE, thread1, "C"); + threads[3] = chThdCreate(prio+4, 0, wa[3], STKSIZE, thread1, "B"); + threads[4] = chThdCreate(prio+5, 0, wa[4], STKSIZE, thread1, "A"); chMtxUnlock(); + test_assert(prio == chThdGetPriority(), "priority return failure"); test_wait_threads(); test_assert_sequence("ABCDE"); } -- cgit v1.2.3 From 5f4dbf9ca9ba32bfeefa3dbab412867dc63f0892 Mon Sep 17 00:00:00 2001 From: gdisirio Date: Wed, 2 Jul 2008 12:32:13 +0000 Subject: git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@328 35acf78f-673a-0410-8e92-d51de3d6d3f4 --- test/test.c | 37 +++++++++++++++++++++---------------- test/test.h | 2 ++ test/testbmk.c | 18 +++++++++--------- 3 files changed, 32 insertions(+), 25 deletions(-) (limited to 'test') diff --git a/test/test.c b/test/test.c index f9a185d03..5f78c8526 100644 --- a/test/test.c +++ b/test/test.c @@ -167,22 +167,27 @@ void test_cpu_pulse(systime_t ms) { systime_t test_wait_tick(void) { - systime_t time = chSysGetTime() + 1; - if (time) { - while (chSysGetTime() < time) { -#if defined(WIN32) - ChkIntSources(); -#endif - } - } - else { - while (chSysGetTime() > time) { -#if defined(WIN32) - ChkIntSources(); -#endif - } - } - return time; + chThdSleep(1); + return chSysGetTime(); +} + +/* + * Timer utils. + */ +static VirtualTimer vt; +bool_t test_timer_done; + +static void tmr(void *p) { + + test_timer_done = TRUE; +} + +void test_start_timer(systime_t time) { + + test_timer_done = FALSE; + chSysLock(); + chVTSetI(&vt, time, tmr, NULL); + chSysUnlock(); } /* diff --git a/test/test.h b/test/test.h index 468505d01..7a2e86f0b 100644 --- a/test/test.h +++ b/test/test.h @@ -53,11 +53,13 @@ extern "C" { void test_wait_threads(void); systime_t test_wait_tick(void); void test_cpu_pulse(systime_t ms); + void test_start_timer(systime_t time); #ifdef __cplusplus } #endif extern Thread *threads[MAX_THREADS]; extern void *wa[MAX_THREADS]; +extern bool_t test_timer_done; #endif /* _TEST_H_ */ diff --git a/test/testbmk.c b/test/testbmk.c index 2dc349d92..b0f44f315 100644 --- a/test/testbmk.c +++ b/test/testbmk.c @@ -25,9 +25,9 @@ __attribute__((noinline)) static unsigned int msg_loop_test(Thread *tp) { uint32_t n = 0; - systime_t start = test_wait_tick(); - systime_t end = start + 1000; - while (chSysInTimeWindow(start, end)) { + test_wait_tick(); + test_start_timer(1000); + while (!test_timer_done) { (void)chMsgSend(tp, 0); n++; #if defined(WIN32) @@ -164,10 +164,10 @@ static void bmk4_teardown(void) { static void bmk4_execute(void) { - systime_t start = test_wait_tick(); - systime_t end = start + 1000; uint32_t n = 0; - while (chSysInTimeWindow(start, end)) { + test_wait_tick(); + test_start_timer(1000); + while (!test_timer_done) { threads[0] = chThdCreate(chThdGetPriority()-1, 0, wa[0], STKSIZE, thread2, NULL); chThdWait(threads[0]); n++; @@ -203,10 +203,10 @@ static void bmk5_execute(void) { static Queue iq; chIQInit(&iq, ib, sizeof(ib), NULL); - systime_t start = test_wait_tick(); - systime_t end = start + 1000; uint32_t n = 0; - while (chSysInTimeWindow(start, end)) { + test_wait_tick(); + test_start_timer(1000); + while (!test_timer_done) { chIQPutI(&iq, 0); chIQPutI(&iq, 1); chIQPutI(&iq, 2); -- cgit v1.2.3 From d7443aaab6d740ef3175530c45c49f2a49b9c9d5 Mon Sep 17 00:00:00 2001 From: gdisirio Date: Wed, 2 Jul 2008 14:01:18 +0000 Subject: git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@329 35acf78f-673a-0410-8e92-d51de3d6d3f4 --- test/testbmk.c | 21 +++++++++++---------- 1 file changed, 11 insertions(+), 10 deletions(-) (limited to 'test') diff --git a/test/testbmk.c b/test/testbmk.c index b0f44f315..18a62bf00 100644 --- a/test/testbmk.c +++ b/test/testbmk.c @@ -27,13 +27,13 @@ static unsigned int msg_loop_test(Thread *tp) { uint32_t n = 0; test_wait_tick(); test_start_timer(1000); - while (!test_timer_done) { + do { (void)chMsgSend(tp, 0); n++; #if defined(WIN32) ChkIntSources(); #endif - } + } while (!test_timer_done); return n; } @@ -122,7 +122,7 @@ static void bmk3_teardown(void) { static msg_t thread2(void *p) { - return 0; + return (msg_t)p; } static void bmk3_execute(void) { @@ -153,7 +153,7 @@ const struct testcase testbmk3 = { static char *bmk4_gettest(void) { - return "Benchmark, threads creation/termination"; + return "Benchmark, threads creation/termination, worst case"; } static void bmk4_setup(void) { @@ -165,16 +165,17 @@ static void bmk4_teardown(void) { static void bmk4_execute(void) { uint32_t n = 0; + void *wap = wa[0]; + tprio_t prio = chThdGetPriority() - 1; test_wait_tick(); test_start_timer(1000); - while (!test_timer_done) { - threads[0] = chThdCreate(chThdGetPriority()-1, 0, wa[0], STKSIZE, thread2, NULL); - chThdWait(threads[0]); + do { + chThdWait(chThdCreate(prio, 0, wap, STKSIZE, thread2, NULL)); n++; #if defined(WIN32) ChkIntSources(); #endif - } + } while (!test_timer_done); test_print("--- Score : "); test_printn(n); test_println(" threads/S"); @@ -206,7 +207,7 @@ static void bmk5_execute(void) { uint32_t n = 0; test_wait_tick(); test_start_timer(1000); - while (!test_timer_done) { + do { chIQPutI(&iq, 0); chIQPutI(&iq, 1); chIQPutI(&iq, 2); @@ -219,7 +220,7 @@ static void bmk5_execute(void) { #if defined(WIN32) ChkIntSources(); #endif - } + } while (!test_timer_done); test_print("--- Score : "); test_printn(n * 4); test_println(" bytes/S"); -- cgit v1.2.3 From 558007d1cfab3d9f8a93e847e61cea6b182f3310 Mon Sep 17 00:00:00 2001 From: gdisirio Date: Thu, 3 Jul 2008 15:18:59 +0000 Subject: git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@330 35acf78f-673a-0410-8e92-d51de3d6d3f4 --- test/testbmk.c | 31 ++++++++++++++++--------------- 1 file changed, 16 insertions(+), 15 deletions(-) (limited to 'test') diff --git a/test/testbmk.c b/test/testbmk.c index 18a62bf00..8631138d1 100644 --- a/test/testbmk.c +++ b/test/testbmk.c @@ -21,6 +21,15 @@ #include "test.h" +static msg_t thread1(void *p) { + msg_t msg; + + do { + chMsgRelease(msg = chMsgWait()); + } while (msg); + return 0; +} + __attribute__((noinline)) static unsigned int msg_loop_test(Thread *tp) { @@ -28,12 +37,13 @@ static unsigned int msg_loop_test(Thread *tp) { test_wait_tick(); test_start_timer(1000); do { - (void)chMsgSend(tp, 0); + (void)chMsgSend(tp, 1); n++; #if defined(WIN32) ChkIntSources(); #endif } while (!test_timer_done); + (void)chMsgSend(tp, 0); return n; } @@ -48,13 +58,6 @@ static void bmk1_setup(void) { static void bmk1_teardown(void) { } -static msg_t thread1(void *p) { - - while (!chThdShouldTerminate()) - chMsgRelease(chMsgWait()); - return 0; -} - static void bmk1_execute(void) { uint32_t n; @@ -93,7 +96,6 @@ static void bmk2_execute(void) { threads[0] = chThdCreate(chThdGetPriority()+1, 0, wa[0], STKSIZE, thread1, 0); n = msg_loop_test(threads[0]); chThdTerminate(threads[0]); - chMsgSend(threads[0], 0); test_wait_threads(); test_print("--- Score : "); test_printn(n); @@ -109,6 +111,11 @@ const struct testcase testbmk2 = { bmk2_execute }; +static msg_t thread2(void *p) { + + return (msg_t)p; +} + static char *bmk3_gettest(void) { return "Benchmark, context switch #3, 4 threads in ready list"; @@ -120,11 +127,6 @@ static void bmk3_setup(void) { static void bmk3_teardown(void) { } -static msg_t thread2(void *p) { - - return (msg_t)p; -} - static void bmk3_execute(void) { uint32_t n; @@ -135,7 +137,6 @@ static void bmk3_execute(void) { threads[4] = chThdCreate(chThdGetPriority()-5, 0, wa[4], STKSIZE, thread2, 0); n = msg_loop_test(threads[0]); chThdTerminate(threads[0]); - chMsgSend(threads[0], 0); test_wait_threads(); test_print("--- Score : "); test_printn(n); -- cgit v1.2.3 From e5bd63772994b9b9aa448c43870acf3580efaab7 Mon Sep 17 00:00:00 2001 From: gdisirio Date: Fri, 4 Jul 2008 09:50:46 +0000 Subject: git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@332 35acf78f-673a-0410-8e92-d51de3d6d3f4 --- test/testbmk.c | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) (limited to 'test') diff --git a/test/testbmk.c b/test/testbmk.c index 8631138d1..a75ccddc2 100644 --- a/test/testbmk.c +++ b/test/testbmk.c @@ -61,7 +61,7 @@ static void bmk1_teardown(void) { static void bmk1_execute(void) { uint32_t n; - threads[0] = chThdCreate(chThdGetPriority()-1, 0, wa[0], STKSIZE, thread1, 0); + threads[0] = chThdCreateFast(chThdGetPriority()-1, wa[0], STKSIZE, thread1); n = msg_loop_test(threads[0]); chThdTerminate(threads[0]); test_wait_threads(); @@ -93,7 +93,7 @@ static void bmk2_teardown(void) { static void bmk2_execute(void) { uint32_t n; - threads[0] = chThdCreate(chThdGetPriority()+1, 0, wa[0], STKSIZE, thread1, 0); + threads[0] = chThdCreateFast(chThdGetPriority()+1, wa[0], STKSIZE, thread1); n = msg_loop_test(threads[0]); chThdTerminate(threads[0]); test_wait_threads(); @@ -130,11 +130,11 @@ static void bmk3_teardown(void) { static void bmk3_execute(void) { uint32_t n; - threads[0] = chThdCreate(chThdGetPriority()+1, 0, wa[0], STKSIZE, thread1, 0); - threads[1] = chThdCreate(chThdGetPriority()-2, 0, wa[1], STKSIZE, thread2, 0); - threads[2] = chThdCreate(chThdGetPriority()-3, 0, wa[2], STKSIZE, thread2, 0); - threads[3] = chThdCreate(chThdGetPriority()-4, 0, wa[3], STKSIZE, thread2, 0); - threads[4] = chThdCreate(chThdGetPriority()-5, 0, wa[4], STKSIZE, thread2, 0); + threads[0] = chThdCreateFast(chThdGetPriority()+1, wa[0], STKSIZE, thread1); + threads[1] = chThdCreateFast(chThdGetPriority()-2, wa[1], STKSIZE, thread2); + threads[2] = chThdCreateFast(chThdGetPriority()-3, wa[2], STKSIZE, thread2); + threads[3] = chThdCreateFast(chThdGetPriority()-4, wa[3], STKSIZE, thread2); + threads[4] = chThdCreateFast(chThdGetPriority()-5, wa[4], STKSIZE, thread2); n = msg_loop_test(threads[0]); chThdTerminate(threads[0]); test_wait_threads(); @@ -171,7 +171,7 @@ static void bmk4_execute(void) { test_wait_tick(); test_start_timer(1000); do { - chThdWait(chThdCreate(prio, 0, wap, STKSIZE, thread2, NULL)); + chThdWait(chThdCreateFast(prio, wap, STKSIZE, thread2)); n++; #if defined(WIN32) ChkIntSources(); -- cgit v1.2.3 From 4507047a830c080ebaf43526a043657a6580d088 Mon Sep 17 00:00:00 2001 From: gdisirio Date: Sun, 6 Jul 2008 08:45:08 +0000 Subject: git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@336 35acf78f-673a-0410-8e92-d51de3d6d3f4 --- test/test.c | 1 + test/testbmk.c | 49 +++++++++++++++++++++++++++++++++++++++++++------ test/testbmk.h | 3 ++- 3 files changed, 46 insertions(+), 7 deletions(-) (limited to 'test') diff --git a/test/test.c b/test/test.c index 5f78c8526..3f2cc9514 100644 --- a/test/test.c +++ b/test/test.c @@ -43,6 +43,7 @@ static const struct testcase *tests[] = { &testbmk3, &testbmk4, &testbmk5, + &testbmk6, NULL }; diff --git a/test/testbmk.c b/test/testbmk.c index a75ccddc2..392297782 100644 --- a/test/testbmk.c +++ b/test/testbmk.c @@ -191,7 +191,7 @@ const struct testcase testbmk4 = { static char *bmk5_gettest(void) { - return "Benchmark, I/O Queues throughput"; + return "Benchmark, threads creation/termination, optimal"; } static void bmk5_setup(void) { @@ -201,6 +201,43 @@ static void bmk5_teardown(void) { } static void bmk5_execute(void) { + + uint32_t n = 0; + void *wap = wa[0]; + tprio_t prio = chThdGetPriority() + 1; + test_wait_tick(); + test_start_timer(1000); + do { + chThdCreateFast(prio, wap, STKSIZE, thread2); + n++; +#if defined(WIN32) + ChkIntSources(); +#endif + } while (!test_timer_done); + test_print("--- Score : "); + test_printn(n); + test_println(" threads/S"); +} + +const struct testcase testbmk5 = { + bmk5_gettest, + bmk5_setup, + bmk5_teardown, + bmk5_execute +}; + +static char *bmk6_gettest(void) { + + return "Benchmark, I/O Queues throughput"; +} + +static void bmk6_setup(void) { +} + +static void bmk6_teardown(void) { +} + +static void bmk6_execute(void) { static uint8_t ib[16]; static Queue iq; @@ -227,9 +264,9 @@ static void bmk5_execute(void) { test_println(" bytes/S"); } -const struct testcase testbmk5 = { - bmk5_gettest, - bmk5_setup, - bmk5_teardown, - bmk5_execute +const struct testcase testbmk6 = { + bmk6_gettest, + bmk6_setup, + bmk6_teardown, + bmk6_execute }; diff --git a/test/testbmk.h b/test/testbmk.h index 346e4c842..e52abee28 100644 --- a/test/testbmk.h +++ b/test/testbmk.h @@ -20,6 +20,7 @@ #ifndef _TESTBMK_H_ #define _TESTBMK_H_ -extern const struct testcase testbmk1, testbmk2, testbmk3, testbmk4, testbmk5; +extern const struct testcase testbmk1, testbmk2, testbmk3, + testbmk4, testbmk5, testbmk6; #endif /* _TESTBMK_H_ */ -- cgit v1.2.3 From e150283e1f071673e1d3490cbf85651e5502d421 Mon Sep 17 00:00:00 2001 From: gdisirio Date: Wed, 30 Jul 2008 11:01:56 +0000 Subject: Various optimizations to the scheduler. git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@378 35acf78f-673a-0410-8e92-d51de3d6d3f4 --- test/testbmk.c | 122 ++++++++++++++++++++++++++++++++++----------------------- test/testbmk.h | 3 +- 2 files changed, 76 insertions(+), 49 deletions(-) (limited to 'test') diff --git a/test/testbmk.c b/test/testbmk.c index 392297782..f2fcb94dc 100644 --- a/test/testbmk.c +++ b/test/testbmk.c @@ -21,6 +21,10 @@ #include "test.h" +static Semaphore sem1; + +static void empty(void) {} + static msg_t thread1(void *p) { msg_t msg; @@ -52,12 +56,6 @@ static char *bmk1_gettest(void) { return "Benchmark, context switch #1, optimal"; } -static void bmk1_setup(void) { -} - -static void bmk1_teardown(void) { -} - static void bmk1_execute(void) { uint32_t n; @@ -74,8 +72,8 @@ static void bmk1_execute(void) { const struct testcase testbmk1 = { bmk1_gettest, - bmk1_setup, - bmk1_teardown, + empty, + empty, bmk1_execute }; @@ -84,12 +82,6 @@ static char *bmk2_gettest(void) { return "Benchmark, context switch #2, empty ready list"; } -static void bmk2_setup(void) { -} - -static void bmk2_teardown(void) { -} - static void bmk2_execute(void) { uint32_t n; @@ -106,8 +98,8 @@ static void bmk2_execute(void) { const struct testcase testbmk2 = { bmk2_gettest, - bmk2_setup, - bmk2_teardown, + empty, + empty, bmk2_execute }; @@ -121,12 +113,6 @@ static char *bmk3_gettest(void) { return "Benchmark, context switch #3, 4 threads in ready list"; } -static void bmk3_setup(void) { -} - -static void bmk3_teardown(void) { -} - static void bmk3_execute(void) { uint32_t n; @@ -147,8 +133,8 @@ static void bmk3_execute(void) { const struct testcase testbmk3 = { bmk3_gettest, - bmk3_setup, - bmk3_teardown, + empty, + empty, bmk3_execute }; @@ -157,12 +143,6 @@ static char *bmk4_gettest(void) { return "Benchmark, threads creation/termination, worst case"; } -static void bmk4_setup(void) { -} - -static void bmk4_teardown(void) { -} - static void bmk4_execute(void) { uint32_t n = 0; @@ -184,8 +164,8 @@ static void bmk4_execute(void) { const struct testcase testbmk4 = { bmk4_gettest, - bmk4_setup, - bmk4_teardown, + empty, + empty, bmk4_execute }; @@ -194,12 +174,6 @@ static char *bmk5_gettest(void) { return "Benchmark, threads creation/termination, optimal"; } -static void bmk5_setup(void) { -} - -static void bmk5_teardown(void) { -} - static void bmk5_execute(void) { uint32_t n = 0; @@ -221,23 +195,75 @@ static void bmk5_execute(void) { const struct testcase testbmk5 = { bmk5_gettest, - bmk5_setup, - bmk5_teardown, + empty, + empty, bmk5_execute }; +static msg_t thread3(void *p) { + + while (!chThdShouldTerminate()) + chSemWait(&sem1); + return 0; +} + static char *bmk6_gettest(void) { - return "Benchmark, I/O Queues throughput"; + return "Benchmark, mass reschedulation, 5 threads"; } static void bmk6_setup(void) { -} -static void bmk6_teardown(void) { + chSemInit(&sem1, 0); } static void bmk6_execute(void) { + uint32_t n; + + threads[0] = chThdCreateFast(chThdGetPriority()+1, wa[0], STKSIZE, thread3); + threads[1] = chThdCreateFast(chThdGetPriority()+2, wa[1], STKSIZE, thread3); + threads[2] = chThdCreateFast(chThdGetPriority()+3, wa[2], STKSIZE, thread3); + threads[3] = chThdCreateFast(chThdGetPriority()+4, wa[3], STKSIZE, thread3); + threads[4] = chThdCreateFast(chThdGetPriority()+5, wa[4], STKSIZE, thread3); + + n = 0; + test_wait_tick(); + test_start_timer(1000); + do { + chSemReset(&sem1, 0); + n++; +#if defined(WIN32) + ChkIntSources(); +#endif + } while (!test_timer_done); + chThdTerminate(threads[0]); + chThdTerminate(threads[1]); + chThdTerminate(threads[2]); + chThdTerminate(threads[3]); + chThdTerminate(threads[4]); + chSemReset(&sem1, 0); + test_wait_threads(); + + test_print("--- Score : "); + test_printn(n); + test_print(" reschedulations/S, "); + test_printn(n * 6); + test_println(" ctxswc/S"); +} + +const struct testcase testbmk6 = { + bmk6_gettest, + bmk6_setup, + empty, + bmk6_execute +}; + +static char *bmk7_gettest(void) { + + return "Benchmark, I/O Queues throughput"; +} + +static void bmk7_execute(void) { static uint8_t ib[16]; static Queue iq; @@ -264,9 +290,9 @@ static void bmk6_execute(void) { test_println(" bytes/S"); } -const struct testcase testbmk6 = { - bmk6_gettest, - bmk6_setup, - bmk6_teardown, - bmk6_execute +const struct testcase testbmk7 = { + bmk7_gettest, + empty, + empty, + bmk7_execute }; diff --git a/test/testbmk.h b/test/testbmk.h index e52abee28..5e99dc3d5 100644 --- a/test/testbmk.h +++ b/test/testbmk.h @@ -21,6 +21,7 @@ #define _TESTBMK_H_ extern const struct testcase testbmk1, testbmk2, testbmk3, - testbmk4, testbmk5, testbmk6; + testbmk4, testbmk5, testbmk6, + testbmk7; #endif /* _TESTBMK_H_ */ -- cgit v1.2.3 From da290782934b7038dfccd5f76b2b75a792e7304f Mon Sep 17 00:00:00 2001 From: gdisirio Date: Wed, 30 Jul 2008 14:56:35 +0000 Subject: git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@379 35acf78f-673a-0410-8e92-d51de3d6d3f4 --- test/test.c | 8 ++++++++ test/test.h | 1 + test/testbmk.c | 6 +----- 3 files changed, 10 insertions(+), 5 deletions(-) (limited to 'test') diff --git a/test/test.c b/test/test.c index 3f2cc9514..2c180ba4b 100644 --- a/test/test.c +++ b/test/test.c @@ -148,6 +148,14 @@ void test_assert_time_window(systime_t start, systime_t end) { /* * Threads utils. */ +void test_terminate_threads(void) { + int i; + + for (i = 0; i < MAX_THREADS; i++) + if (threads[i]) + chThdTerminate(threads[i]); +} + void test_wait_threads(void) { int i; diff --git a/test/test.h b/test/test.h index 7a2e86f0b..3bee948cd 100644 --- a/test/test.h +++ b/test/test.h @@ -50,6 +50,7 @@ extern "C" { void test_assert(bool_t condition, char * msg); void test_assert_sequence(char *expected); void test_assert_time_window(systime_t start, systime_t end); + void test_terminate_threads(void); void test_wait_threads(void); systime_t test_wait_tick(void); void test_cpu_pulse(systime_t ms); diff --git a/test/testbmk.c b/test/testbmk.c index f2fcb94dc..acdfa50e8 100644 --- a/test/testbmk.c +++ b/test/testbmk.c @@ -236,11 +236,7 @@ static void bmk6_execute(void) { ChkIntSources(); #endif } while (!test_timer_done); - chThdTerminate(threads[0]); - chThdTerminate(threads[1]); - chThdTerminate(threads[2]); - chThdTerminate(threads[3]); - chThdTerminate(threads[4]); + test_terminate_threads(); chSemReset(&sem1, 0); test_wait_threads(); -- cgit v1.2.3 From 5d40605546682121c1220d8e676d4d9bc760b785 Mon Sep 17 00:00:00 2001 From: gdisirio Date: Fri, 8 Aug 2008 09:31:54 +0000 Subject: git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@389 35acf78f-673a-0410-8e92-d51de3d6d3f4 --- test/test.c | 1 + 1 file changed, 1 insertion(+) (limited to 'test') diff --git a/test/test.c b/test/test.c index 2c180ba4b..1a0b9a4ec 100644 --- a/test/test.c +++ b/test/test.c @@ -44,6 +44,7 @@ static const struct testcase *tests[] = { &testbmk4, &testbmk5, &testbmk6, + &testbmk7, NULL }; -- cgit v1.2.3 From 3ae2e8ddb38615434dccd5a6462faae144633d27 Mon Sep 17 00:00:00 2001 From: gdisirio Date: Tue, 26 Aug 2008 14:43:09 +0000 Subject: git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@409 35acf78f-673a-0410-8e92-d51de3d6d3f4 --- test/test.c | 6 ++++++ test/test.mk | 3 ++- test/testmtx.c | 4 ++++ test/testpools.c | 63 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++ test/testpools.h | 25 ++++++++++++++++++++++ 5 files changed, 100 insertions(+), 1 deletion(-) create mode 100644 test/testpools.c create mode 100644 test/testpools.h (limited to 'test') diff --git a/test/test.c b/test/test.c index 1a0b9a4ec..96bd43938 100644 --- a/test/test.c +++ b/test/test.c @@ -24,6 +24,7 @@ #include "testsem.h" #include "testmtx.h" #include "testmsg.h" +#include "testpools.h" #include "testbmk.h" /* @@ -34,10 +35,15 @@ static const struct testcase *tests[] = { &testrdy2, &testsem1, &testsem2, +#ifdef CH_USE_MUTEXES &testmtx1, &testmtx2, &testmtx3, +#endif &testmsg1, +#ifdef CH_USE_MEMPOOLS + &testpools1, +#endif &testbmk1, &testbmk2, &testbmk3, diff --git a/test/test.mk b/test/test.mk index ce890a855..73e6e1bc0 100644 --- a/test/test.mk +++ b/test/test.mk @@ -1,3 +1,4 @@ # List of all the ChibiOS/RT test files. TESTSRC = ../../test/test.c ../../test/testrdy.c ../../test/testsem.c \ - ../../test/testmtx.c ../../test/testmsg.c ../../test/testbmk.c + ../../test/testmtx.c ../../test/testmsg.c ../../test/testpools.c \ + ../../test/testbmk.c diff --git a/test/testmtx.c b/test/testmtx.c index 526a64ffa..2243b375f 100644 --- a/test/testmtx.c +++ b/test/testmtx.c @@ -21,6 +21,8 @@ #include "test.h" +#ifdef CH_USE_MUTEXES + #define ALLOWED_DELAY 5 static Mutex m1, m2; @@ -219,3 +221,5 @@ const struct testcase testmtx3 = { mtx3_teardown, mtx3_execute }; + +#endif /* CH_USE_MUTEXES */ diff --git a/test/testpools.c b/test/testpools.c new file mode 100644 index 000000000..a86eecedd --- /dev/null +++ b/test/testpools.c @@ -0,0 +1,63 @@ +/* + ChibiOS/RT - Copyright (C) 2006-2007 Giovanni Di Sirio. + + This file is part of ChibiOS/RT. + + ChibiOS/RT is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 3 of the License, or + (at your option) any later version. + + ChibiOS/RT is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see . +*/ + +#include + +#include "test.h" + +#ifdef CH_USE_MEMPOOLS + +static MemoryPool mp1; + +static char *pools1_gettest(void) { + + return "Memory Pools, allocation and enqueuing test"; +} + +static void pools1_setup(void) { + + chPoolInit(&mp1, UserStackSize(THREADS_STACK_SIZE)); +} + +static void pools1_teardown(void) { +} + +static void pools1_execute(void) { + int i; + + /* Adding the WAs to the pool. */ + for (i = 0; i < 5; i++) + chPoolFree(&mp1, wa[i]); + + /* Empting the pool again. */ + for (i = 0; i < 5; i++) + test_assert(chPoolAlloc(&mp1, FALSE) != NULL, "pool list empty"); + + /* Now must be empty. */ + test_assert(chPoolAlloc(&mp1, FALSE) == NULL, "pool list not empty"); +} + +const struct testcase testpools1 = { + pools1_gettest, + pools1_setup, + pools1_teardown, + pools1_execute +}; + +#endif /* CH_USE_MEMPOOLS */ diff --git a/test/testpools.h b/test/testpools.h new file mode 100644 index 000000000..413d1eb76 --- /dev/null +++ b/test/testpools.h @@ -0,0 +1,25 @@ +/* + ChibiOS/RT - Copyright (C) 2006-2007 Giovanni Di Sirio. + + This file is part of ChibiOS/RT. + + ChibiOS/RT is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 3 of the License, or + (at your option) any later version. + + ChibiOS/RT is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see . +*/ + +#ifndef _TESTPOOLS_H_ +#define _TESTPOOLS_H_ + +extern const struct testcase testpools1; + +#endif /* _TESTPOOLS_H_ */ -- cgit v1.2.3 From 7ffd1d5e5b41393b518ad0a3b6e94056d9044e26 Mon Sep 17 00:00:00 2001 From: gdisirio Date: Thu, 28 Aug 2008 15:10:54 +0000 Subject: git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@413 35acf78f-673a-0410-8e92-d51de3d6d3f4 --- test/test.c | 4 ++++ test/test.mk | 6 ++--- test/testheap.c | 71 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++ test/testheap.h | 25 ++++++++++++++++++++ 4 files changed, 103 insertions(+), 3 deletions(-) create mode 100644 test/testheap.c create mode 100644 test/testheap.h (limited to 'test') diff --git a/test/test.c b/test/test.c index 96bd43938..5712f7bb2 100644 --- a/test/test.c +++ b/test/test.c @@ -24,6 +24,7 @@ #include "testsem.h" #include "testmtx.h" #include "testmsg.h" +#include "testheap.h" #include "testpools.h" #include "testbmk.h" @@ -41,6 +42,9 @@ static const struct testcase *tests[] = { &testmtx3, #endif &testmsg1, +#ifdef CH_USE_HEAP + &testheap1, +#endif #ifdef CH_USE_MEMPOOLS &testpools1, #endif diff --git a/test/test.mk b/test/test.mk index 73e6e1bc0..10b86d4eb 100644 --- a/test/test.mk +++ b/test/test.mk @@ -1,4 +1,4 @@ # List of all the ChibiOS/RT test files. -TESTSRC = ../../test/test.c ../../test/testrdy.c ../../test/testsem.c \ - ../../test/testmtx.c ../../test/testmsg.c ../../test/testpools.c \ - ../../test/testbmk.c +TESTSRC = ../../test/test.c ../../test/testrdy.c ../../test/testsem.c \ + ../../test/testmtx.c ../../test/testmsg.c ../../test/testheap.c \ + ../../test/testpools.c ../../test/testbmk.c diff --git a/test/testheap.c b/test/testheap.c new file mode 100644 index 000000000..c719818f6 --- /dev/null +++ b/test/testheap.c @@ -0,0 +1,71 @@ +/* + ChibiOS/RT - Copyright (C) 2006-2007 Giovanni Di Sirio. + + This file is part of ChibiOS/RT. + + ChibiOS/RT is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 3 of the License, or + (at your option) any later version. + + ChibiOS/RT is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see . +*/ + +#include + +#include "test.h" + +#ifdef CH_USE_HEAP + +#define SIZE 16 + +static char *heap1_gettest(void) { + + return "Heap, allocation and fragmentation test"; +} + +static void heap1_setup(void) { +} + +static void heap1_teardown(void) { +} + +static void heap1_execute(void) { + void *p1, *p2, *p3; + + /* Test skipped if the heap is already fragmented. */ + if (chHeapNotFragmented()) { + /* Same order */ + p1 = chHeapAlloc(SIZE); + p2 = chHeapAlloc(SIZE); + p3 = chHeapAlloc(SIZE); + chHeapFree(p1); /* Does not merge */ + chHeapFree(p2); /* Merges backward */ + chHeapFree(p3); /* Merges both sides */ + test_assert(chHeapNotFragmented(), "heap fragmented #1"); + + /* Reverse order */ + p1 = chHeapAlloc(SIZE); + p2 = chHeapAlloc(SIZE); + p3 = chHeapAlloc(SIZE); + chHeapFree(p3); /* Merges forward */ + chHeapFree(p2); /* Merges forward */ + chHeapFree(p1); /* Merges forward */ + test_assert(chHeapNotFragmented(), "heap fragmented #2"); + } +} + +const struct testcase testheap1 = { + heap1_gettest, + heap1_setup, + heap1_teardown, + heap1_execute +}; + +#endif /* CH_USE_HEAP */ diff --git a/test/testheap.h b/test/testheap.h new file mode 100644 index 000000000..4fc6d17ce --- /dev/null +++ b/test/testheap.h @@ -0,0 +1,25 @@ +/* + ChibiOS/RT - Copyright (C) 2006-2007 Giovanni Di Sirio. + + This file is part of ChibiOS/RT. + + ChibiOS/RT is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 3 of the License, or + (at your option) any later version. + + ChibiOS/RT is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see . +*/ + +#ifndef _TESTHEAP_H_ +#define _TESTHEAP_H_ + +extern const struct testcase testheap1; + +#endif /* _TESTHEAP_H_ */ -- cgit v1.2.3 From 79bedccb6c48dfadc47ac91549ba0043d3ab9e53 Mon Sep 17 00:00:00 2001 From: gdisirio Date: Fri, 29 Aug 2008 17:31:01 +0000 Subject: git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@416 35acf78f-673a-0410-8e92-d51de3d6d3f4 --- test/testheap.c | 19 ++++++++++++++++--- 1 file changed, 16 insertions(+), 3 deletions(-) (limited to 'test') diff --git a/test/testheap.c b/test/testheap.c index c719818f6..775902dd3 100644 --- a/test/testheap.c +++ b/test/testheap.c @@ -38,9 +38,15 @@ static void heap1_teardown(void) { static void heap1_execute(void) { void *p1, *p2, *p3; + size_t n, sz; /* Test skipped if the heap is already fragmented. */ - if (chHeapNotFragmented()) { + + if ((n = chHeapStatus(&sz)) == 1) { + test_print("--- Size : "); + test_printn(sz); + test_println(" bytes, not fragmented"); + /* Same order */ p1 = chHeapAlloc(SIZE); p2 = chHeapAlloc(SIZE); @@ -48,7 +54,7 @@ static void heap1_execute(void) { chHeapFree(p1); /* Does not merge */ chHeapFree(p2); /* Merges backward */ chHeapFree(p3); /* Merges both sides */ - test_assert(chHeapNotFragmented(), "heap fragmented #1"); + test_assert(chHeapStatus(&n) == 1, "heap fragmented #1"); /* Reverse order */ p1 = chHeapAlloc(SIZE); @@ -57,7 +63,14 @@ static void heap1_execute(void) { chHeapFree(p3); /* Merges forward */ chHeapFree(p2); /* Merges forward */ chHeapFree(p1); /* Merges forward */ - test_assert(chHeapNotFragmented(), "heap fragmented #2"); + test_assert(chHeapStatus(&n) == 1, "heap fragmented #2"); + + test_assert(n == sz, "heap size changed"); + } + else { + test_print("--- Size : "); + test_printn(sz); + test_println(" bytes, fragmented, test skipped"); } } -- cgit v1.2.3 From 250ee8cdd43ffa4ba9ecab7548b18c4fc91f849d Mon Sep 17 00:00:00 2001 From: gdisirio Date: Mon, 8 Sep 2008 14:06:38 +0000 Subject: git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@428 35acf78f-673a-0410-8e92-d51de3d6d3f4 --- test/testpools.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'test') diff --git a/test/testpools.c b/test/testpools.c index a86eecedd..83614fcd5 100644 --- a/test/testpools.c +++ b/test/testpools.c @@ -32,7 +32,7 @@ static char *pools1_gettest(void) { static void pools1_setup(void) { - chPoolInit(&mp1, UserStackSize(THREADS_STACK_SIZE)); + chPoolInit(&mp1, UserStackSize(THREADS_STACK_SIZE), FALSE); } static void pools1_teardown(void) { @@ -47,10 +47,10 @@ static void pools1_execute(void) { /* Empting the pool again. */ for (i = 0; i < 5; i++) - test_assert(chPoolAlloc(&mp1, FALSE) != NULL, "pool list empty"); + test_assert(chPoolAlloc(&mp1) != NULL, "pool list empty"); /* Now must be empty. */ - test_assert(chPoolAlloc(&mp1, FALSE) == NULL, "pool list not empty"); + test_assert(chPoolAlloc(&mp1) == NULL, "pool list not empty"); } const struct testcase testpools1 = { -- cgit v1.2.3 From 8248aca2825c3650d0aeb43bb999b23fd2997804 Mon Sep 17 00:00:00 2001 From: gdisirio Date: Sat, 13 Sep 2008 09:01:16 +0000 Subject: git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@432 35acf78f-673a-0410-8e92-d51de3d6d3f4 --- test/testpools.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'test') diff --git a/test/testpools.c b/test/testpools.c index 83614fcd5..40a31fad7 100644 --- a/test/testpools.c +++ b/test/testpools.c @@ -32,7 +32,7 @@ static char *pools1_gettest(void) { static void pools1_setup(void) { - chPoolInit(&mp1, UserStackSize(THREADS_STACK_SIZE), FALSE); + chPoolInit(&mp1, UserStackSize(THREADS_STACK_SIZE)); } static void pools1_teardown(void) { -- cgit v1.2.3 From 2a9e6947a1c0cefe24f8ac7f1b4997e0f661572f Mon Sep 17 00:00:00 2001 From: gdisirio Date: Sat, 20 Sep 2008 15:34:56 +0000 Subject: git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@434 35acf78f-673a-0410-8e92-d51de3d6d3f4 --- test/testmsg.c | 2 +- test/testmtx.c | 26 +++++++++++++------------- test/testrdy.c | 20 ++++++++++---------- test/testsem.c | 10 +++++----- 4 files changed, 29 insertions(+), 29 deletions(-) (limited to 'test') diff --git a/test/testmsg.c b/test/testmsg.c index 31959c619..5e9cba0d8 100644 --- a/test/testmsg.c +++ b/test/testmsg.c @@ -47,7 +47,7 @@ static msg_t thread(void *p) { static void msg1_execute(void) { msg_t msg; - threads[0] = chThdCreate(chThdGetPriority()-1, 0, wa[0], STKSIZE, thread, chThdSelf()); + threads[0] = chThdCreate(chThdGetPriority()-1, wa[0], STKSIZE, thread, chThdSelf()); do { chMsgRelease(msg = chMsgWait()); if (msg) diff --git a/test/testmtx.c b/test/testmtx.c index 2243b375f..f5a4c139c 100644 --- a/test/testmtx.c +++ b/test/testmtx.c @@ -52,11 +52,11 @@ static void mtx1_execute(void) { tprio_t prio = chThdGetPriority(); // Bacause priority inheritance. chMtxLock(&m1); - threads[0] = chThdCreate(prio+1, 0, wa[0], STKSIZE, thread1, "E"); - threads[1] = chThdCreate(prio+2, 0, wa[1], STKSIZE, thread1, "D"); - threads[2] = chThdCreate(prio+3, 0, wa[2], STKSIZE, thread1, "C"); - threads[3] = chThdCreate(prio+4, 0, wa[3], STKSIZE, thread1, "B"); - threads[4] = chThdCreate(prio+5, 0, wa[4], STKSIZE, thread1, "A"); + threads[0] = chThdCreate(prio+1, wa[0], STKSIZE, thread1, "E"); + threads[1] = chThdCreate(prio+2, wa[1], STKSIZE, thread1, "D"); + threads[2] = chThdCreate(prio+3, wa[2], STKSIZE, thread1, "C"); + threads[3] = chThdCreate(prio+4, wa[3], STKSIZE, thread1, "B"); + threads[4] = chThdCreate(prio+5, wa[4], STKSIZE, thread1, "A"); chMtxUnlock(); test_assert(prio == chThdGetPriority(), "priority return failure"); test_wait_threads(); @@ -117,9 +117,9 @@ static msg_t thread4(void *p) { */ static void mtx2_execute(void) { - threads[0] = chThdCreate(chThdGetPriority()-1, 0, wa[0], STKSIZE, thread2, "A"); - threads[1] = chThdCreate(chThdGetPriority()-3, 0, wa[1], STKSIZE, thread3, "C"); - threads[2] = chThdCreate(chThdGetPriority()-2, 0, wa[2], STKSIZE, thread4, "B"); + threads[0] = chThdCreate(chThdGetPriority()-1, wa[0], STKSIZE, thread2, "A"); + threads[1] = chThdCreate(chThdGetPriority()-3, wa[1], STKSIZE, thread3, "C"); + threads[2] = chThdCreate(chThdGetPriority()-2, wa[2], STKSIZE, thread4, "B"); test_wait_threads(); test_assert_sequence("ABC"); } @@ -206,11 +206,11 @@ static msg_t thread9(void *p) { */ static void mtx3_execute(void) { - threads[0] = chThdCreate(chThdGetPriority()-5, 0, wa[0], STKSIZE, thread5, "E"); - threads[1] = chThdCreate(chThdGetPriority()-4, 0, wa[1], STKSIZE, thread6, "D"); - threads[2] = chThdCreate(chThdGetPriority()-3, 0, wa[2], STKSIZE, thread7, "C"); - threads[3] = chThdCreate(chThdGetPriority()-2, 0, wa[3], STKSIZE, thread8, "B"); - threads[4] = chThdCreate(chThdGetPriority()-1, 0, wa[4], STKSIZE, thread9, "A"); + threads[0] = chThdCreate(chThdGetPriority()-5, wa[0], STKSIZE, thread5, "E"); + threads[1] = chThdCreate(chThdGetPriority()-4, wa[1], STKSIZE, thread6, "D"); + threads[2] = chThdCreate(chThdGetPriority()-3, wa[2], STKSIZE, thread7, "C"); + threads[3] = chThdCreate(chThdGetPriority()-2, wa[3], STKSIZE, thread8, "B"); + threads[4] = chThdCreate(chThdGetPriority()-1, wa[4], STKSIZE, thread9, "A"); test_wait_threads(); test_assert_sequence("ABCDE"); } diff --git a/test/testrdy.c b/test/testrdy.c index ec8a0d2dd..fd6b7b17f 100644 --- a/test/testrdy.c +++ b/test/testrdy.c @@ -40,11 +40,11 @@ static void rdy1_teardown(void) { static void rdy1_execute(void) { - threads[0] = chThdCreate(chThdGetPriority()-5, 0, wa[0], STKSIZE, thread, "E"); - threads[1] = chThdCreate(chThdGetPriority()-4, 0, wa[1], STKSIZE, thread, "D"); - threads[2] = chThdCreate(chThdGetPriority()-3, 0, wa[2], STKSIZE, thread, "C"); - threads[3] = chThdCreate(chThdGetPriority()-2, 0, wa[3], STKSIZE, thread, "B"); - threads[4] = chThdCreate(chThdGetPriority()-1, 0, wa[4], STKSIZE, thread, "A"); + threads[0] = chThdCreate(chThdGetPriority()-5, wa[0], STKSIZE, thread, "E"); + threads[1] = chThdCreate(chThdGetPriority()-4, wa[1], STKSIZE, thread, "D"); + threads[2] = chThdCreate(chThdGetPriority()-3, wa[2], STKSIZE, thread, "C"); + threads[3] = chThdCreate(chThdGetPriority()-2, wa[3], STKSIZE, thread, "B"); + threads[4] = chThdCreate(chThdGetPriority()-1, wa[4], STKSIZE, thread, "A"); test_wait_threads(); test_assert_sequence("ABCDE"); } @@ -69,11 +69,11 @@ static void rdy2_teardown(void) { static void rdy2_execute(void) { - threads[1] = chThdCreate(chThdGetPriority()-4, 0, wa[1], STKSIZE, thread, "D"); - threads[0] = chThdCreate(chThdGetPriority()-5, 0, wa[0], STKSIZE, thread, "E"); - threads[4] = chThdCreate(chThdGetPriority()-1, 0, wa[4], STKSIZE, thread, "A"); - threads[3] = chThdCreate(chThdGetPriority()-2, 0, wa[3], STKSIZE, thread, "B"); - threads[2] = chThdCreate(chThdGetPriority()-3, 0, wa[2], STKSIZE, thread, "C"); + threads[1] = chThdCreate(chThdGetPriority()-4, wa[1], STKSIZE, thread, "D"); + threads[0] = chThdCreate(chThdGetPriority()-5, wa[0], STKSIZE, thread, "E"); + threads[4] = chThdCreate(chThdGetPriority()-1, wa[4], STKSIZE, thread, "A"); + threads[3] = chThdCreate(chThdGetPriority()-2, wa[3], STKSIZE, thread, "B"); + threads[2] = chThdCreate(chThdGetPriority()-3, wa[2], STKSIZE, thread, "C"); test_wait_threads(); test_assert_sequence("ABCDE"); } diff --git a/test/testsem.c b/test/testsem.c index ef6a664fd..4442117e9 100644 --- a/test/testsem.c +++ b/test/testsem.c @@ -47,11 +47,11 @@ static msg_t thread(void *p) { static void sem1_execute(void) { - threads[0] = chThdCreate(chThdGetPriority()+5, 0, wa[0], STKSIZE, thread, "A"); - threads[1] = chThdCreate(chThdGetPriority()+1, 0, wa[1], STKSIZE, thread, "B"); - threads[2] = chThdCreate(chThdGetPriority()+3, 0, wa[2], STKSIZE, thread, "C"); - threads[3] = chThdCreate(chThdGetPriority()+4, 0, wa[3], STKSIZE, thread, "D"); - threads[4] = chThdCreate(chThdGetPriority()+2, 0, wa[4], STKSIZE, thread, "E"); + threads[0] = chThdCreate(chThdGetPriority()+5, wa[0], STKSIZE, thread, "A"); + threads[1] = chThdCreate(chThdGetPriority()+1, wa[1], STKSIZE, thread, "B"); + threads[2] = chThdCreate(chThdGetPriority()+3, wa[2], STKSIZE, thread, "C"); + threads[3] = chThdCreate(chThdGetPriority()+4, wa[3], STKSIZE, thread, "D"); + threads[4] = chThdCreate(chThdGetPriority()+2, wa[4], STKSIZE, thread, "E"); chSemSignal(&sem1); chSemSignal(&sem1); chSemSignal(&sem1); -- cgit v1.2.3 From 9a1c91e6ee9baaee3529e16fc732cbd9c7e99844 Mon Sep 17 00:00:00 2001 From: gdisirio Date: Mon, 22 Sep 2008 15:29:48 +0000 Subject: git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@437 35acf78f-673a-0410-8e92-d51de3d6d3f4 --- test/testmsg.c | 2 +- test/testmtx.c | 26 +++++++++++++------------- test/testrdy.c | 20 ++++++++++---------- test/testsem.c | 10 +++++----- 4 files changed, 29 insertions(+), 29 deletions(-) (limited to 'test') diff --git a/test/testmsg.c b/test/testmsg.c index 5e9cba0d8..fcf811fa1 100644 --- a/test/testmsg.c +++ b/test/testmsg.c @@ -47,7 +47,7 @@ static msg_t thread(void *p) { static void msg1_execute(void) { msg_t msg; - threads[0] = chThdCreate(chThdGetPriority()-1, wa[0], STKSIZE, thread, chThdSelf()); + threads[0] = chThdCreateStatic(wa[0], STKSIZE, chThdGetPriority()-1, thread, chThdSelf()); do { chMsgRelease(msg = chMsgWait()); if (msg) diff --git a/test/testmtx.c b/test/testmtx.c index f5a4c139c..3954e9338 100644 --- a/test/testmtx.c +++ b/test/testmtx.c @@ -52,11 +52,11 @@ static void mtx1_execute(void) { tprio_t prio = chThdGetPriority(); // Bacause priority inheritance. chMtxLock(&m1); - threads[0] = chThdCreate(prio+1, wa[0], STKSIZE, thread1, "E"); - threads[1] = chThdCreate(prio+2, wa[1], STKSIZE, thread1, "D"); - threads[2] = chThdCreate(prio+3, wa[2], STKSIZE, thread1, "C"); - threads[3] = chThdCreate(prio+4, wa[3], STKSIZE, thread1, "B"); - threads[4] = chThdCreate(prio+5, wa[4], STKSIZE, thread1, "A"); + threads[0] = chThdCreateStatic(wa[0], STKSIZE, prio+1, thread1, "E"); + threads[1] = chThdCreateStatic(wa[1], STKSIZE, prio+2, thread1, "D"); + threads[2] = chThdCreateStatic(wa[2], STKSIZE, prio+3, thread1, "C"); + threads[3] = chThdCreateStatic(wa[3], STKSIZE, prio+4, thread1, "B"); + threads[4] = chThdCreateStatic(wa[4], STKSIZE, prio+5, thread1, "A"); chMtxUnlock(); test_assert(prio == chThdGetPriority(), "priority return failure"); test_wait_threads(); @@ -117,9 +117,9 @@ static msg_t thread4(void *p) { */ static void mtx2_execute(void) { - threads[0] = chThdCreate(chThdGetPriority()-1, wa[0], STKSIZE, thread2, "A"); - threads[1] = chThdCreate(chThdGetPriority()-3, wa[1], STKSIZE, thread3, "C"); - threads[2] = chThdCreate(chThdGetPriority()-2, wa[2], STKSIZE, thread4, "B"); + threads[0] = chThdCreateStatic(wa[0], STKSIZE, chThdGetPriority()-1, thread2, "A"); + threads[1] = chThdCreateStatic(wa[1], STKSIZE, chThdGetPriority()-3, thread3, "C"); + threads[2] = chThdCreateStatic(wa[2], STKSIZE, chThdGetPriority()-2, thread4, "B"); test_wait_threads(); test_assert_sequence("ABC"); } @@ -206,11 +206,11 @@ static msg_t thread9(void *p) { */ static void mtx3_execute(void) { - threads[0] = chThdCreate(chThdGetPriority()-5, wa[0], STKSIZE, thread5, "E"); - threads[1] = chThdCreate(chThdGetPriority()-4, wa[1], STKSIZE, thread6, "D"); - threads[2] = chThdCreate(chThdGetPriority()-3, wa[2], STKSIZE, thread7, "C"); - threads[3] = chThdCreate(chThdGetPriority()-2, wa[3], STKSIZE, thread8, "B"); - threads[4] = chThdCreate(chThdGetPriority()-1, wa[4], STKSIZE, thread9, "A"); + threads[0] = chThdCreateStatic(wa[0], STKSIZE, chThdGetPriority()-5, thread5, "E"); + threads[1] = chThdCreateStatic(wa[1], STKSIZE, chThdGetPriority()-4, thread6, "D"); + threads[2] = chThdCreateStatic(wa[2], STKSIZE, chThdGetPriority()-3, thread7, "C"); + threads[3] = chThdCreateStatic(wa[3], STKSIZE, chThdGetPriority()-2, thread8, "B"); + threads[4] = chThdCreateStatic(wa[4], STKSIZE, chThdGetPriority()-1, thread9, "A"); test_wait_threads(); test_assert_sequence("ABCDE"); } diff --git a/test/testrdy.c b/test/testrdy.c index fd6b7b17f..2d39e5ff4 100644 --- a/test/testrdy.c +++ b/test/testrdy.c @@ -40,11 +40,11 @@ static void rdy1_teardown(void) { static void rdy1_execute(void) { - threads[0] = chThdCreate(chThdGetPriority()-5, wa[0], STKSIZE, thread, "E"); - threads[1] = chThdCreate(chThdGetPriority()-4, wa[1], STKSIZE, thread, "D"); - threads[2] = chThdCreate(chThdGetPriority()-3, wa[2], STKSIZE, thread, "C"); - threads[3] = chThdCreate(chThdGetPriority()-2, wa[3], STKSIZE, thread, "B"); - threads[4] = chThdCreate(chThdGetPriority()-1, wa[4], STKSIZE, thread, "A"); + threads[0] = chThdCreateStatic(wa[0], STKSIZE, chThdGetPriority()-5, thread, "E"); + threads[1] = chThdCreateStatic(wa[1], STKSIZE, chThdGetPriority()-4, thread, "D"); + threads[2] = chThdCreateStatic(wa[2], STKSIZE, chThdGetPriority()-3, thread, "C"); + threads[3] = chThdCreateStatic(wa[3], STKSIZE, chThdGetPriority()-2, thread, "B"); + threads[4] = chThdCreateStatic(wa[4], STKSIZE, chThdGetPriority()-1, thread, "A"); test_wait_threads(); test_assert_sequence("ABCDE"); } @@ -69,11 +69,11 @@ static void rdy2_teardown(void) { static void rdy2_execute(void) { - threads[1] = chThdCreate(chThdGetPriority()-4, wa[1], STKSIZE, thread, "D"); - threads[0] = chThdCreate(chThdGetPriority()-5, wa[0], STKSIZE, thread, "E"); - threads[4] = chThdCreate(chThdGetPriority()-1, wa[4], STKSIZE, thread, "A"); - threads[3] = chThdCreate(chThdGetPriority()-2, wa[3], STKSIZE, thread, "B"); - threads[2] = chThdCreate(chThdGetPriority()-3, wa[2], STKSIZE, thread, "C"); + threads[1] = chThdCreateStatic(wa[1], STKSIZE, chThdGetPriority()-4, thread, "D"); + threads[0] = chThdCreateStatic(wa[0], STKSIZE, chThdGetPriority()-5, thread, "E"); + threads[4] = chThdCreateStatic(wa[4], STKSIZE, chThdGetPriority()-1, thread, "A"); + threads[3] = chThdCreateStatic(wa[3], STKSIZE, chThdGetPriority()-2, thread, "B"); + threads[2] = chThdCreateStatic(wa[2], STKSIZE, chThdGetPriority()-3, thread, "C"); test_wait_threads(); test_assert_sequence("ABCDE"); } diff --git a/test/testsem.c b/test/testsem.c index 4442117e9..6afa715cb 100644 --- a/test/testsem.c +++ b/test/testsem.c @@ -47,11 +47,11 @@ static msg_t thread(void *p) { static void sem1_execute(void) { - threads[0] = chThdCreate(chThdGetPriority()+5, wa[0], STKSIZE, thread, "A"); - threads[1] = chThdCreate(chThdGetPriority()+1, wa[1], STKSIZE, thread, "B"); - threads[2] = chThdCreate(chThdGetPriority()+3, wa[2], STKSIZE, thread, "C"); - threads[3] = chThdCreate(chThdGetPriority()+4, wa[3], STKSIZE, thread, "D"); - threads[4] = chThdCreate(chThdGetPriority()+2, wa[4], STKSIZE, thread, "E"); + threads[0] = chThdCreateStatic(wa[0], STKSIZE, chThdGetPriority()+5, thread, "A"); + threads[1] = chThdCreateStatic(wa[1], STKSIZE, chThdGetPriority()+1, thread, "B"); + threads[2] = chThdCreateStatic(wa[2], STKSIZE, chThdGetPriority()+3, thread, "C"); + threads[3] = chThdCreateStatic(wa[3], STKSIZE, chThdGetPriority()+4, thread, "D"); + threads[4] = chThdCreateStatic(wa[4], STKSIZE, chThdGetPriority()+2, thread, "E"); chSemSignal(&sem1); chSemSignal(&sem1); chSemSignal(&sem1); -- cgit v1.2.3 From 0544bfe97b6a530687d9b492221a3dc6b924d98e Mon Sep 17 00:00:00 2001 From: gdisirio Date: Tue, 23 Sep 2008 15:04:14 +0000 Subject: git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@438 35acf78f-673a-0410-8e92-d51de3d6d3f4 --- test/test.c | 7 +++ test/test.mk | 2 +- test/testdyn.c | 135 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++ test/testdyn.h | 25 +++++++++++ test/testheap.c | 1 - 5 files changed, 168 insertions(+), 2 deletions(-) create mode 100644 test/testdyn.c create mode 100644 test/testdyn.h (limited to 'test') diff --git a/test/test.c b/test/test.c index 5712f7bb2..fa2625215 100644 --- a/test/test.c +++ b/test/test.c @@ -26,6 +26,7 @@ #include "testmsg.h" #include "testheap.h" #include "testpools.h" +#include "testdyn.h" #include "testbmk.h" /* @@ -47,6 +48,12 @@ static const struct testcase *tests[] = { #endif #ifdef CH_USE_MEMPOOLS &testpools1, +#endif +#if defined(CH_USE_DYNAMIC) && defined(CH_USE_HEAP) + &testdyn1, +#endif +#if defined(CH_USE_DYNAMIC) && defined(CH_USE_MEMPOOLS) + &testdyn2, #endif &testbmk1, &testbmk2, diff --git a/test/test.mk b/test/test.mk index 10b86d4eb..9ea33e412 100644 --- a/test/test.mk +++ b/test/test.mk @@ -1,4 +1,4 @@ # List of all the ChibiOS/RT test files. TESTSRC = ../../test/test.c ../../test/testrdy.c ../../test/testsem.c \ ../../test/testmtx.c ../../test/testmsg.c ../../test/testheap.c \ - ../../test/testpools.c ../../test/testbmk.c + ../../test/testpools.c ../../test/testdyn.c ../../test/testbmk.c diff --git a/test/testdyn.c b/test/testdyn.c new file mode 100644 index 000000000..1f952b6ac --- /dev/null +++ b/test/testdyn.c @@ -0,0 +1,135 @@ +/* + ChibiOS/RT - Copyright (C) 2006-2007 Giovanni Di Sirio. + + This file is part of ChibiOS/RT. + + ChibiOS/RT is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 3 of the License, or + (at your option) any later version. + + ChibiOS/RT is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see . +*/ + +#include + +#include "test.h" + +#ifdef CH_USE_DYNAMIC + +static msg_t thread(void *p) { + + test_emit_token(*(char *)p); + return 0; +} + +#ifdef CH_USE_HEAP +static char *dyn1_gettest(void) { + + return "Dynamic APIs, threads creation from heap"; +} + +static void dyn1_setup(void) { +} + +static void dyn1_teardown(void) { +} + +static void dyn1_execute(void) { + size_t n, sz; + tprio_t prio = chThdGetPriority(); + + /* Test skipped if the heap is already fragmented. */ + if ((n = chHeapStatus(&sz)) == 1) { + /* Starting threads from the heap. */ + threads[0] = chThdCreateFromHeap(UserStackSize(THREADS_STACK_SIZE), + prio-1, thread, "A"); + threads[1] = chThdCreateFromHeap(UserStackSize(THREADS_STACK_SIZE), + prio-2, thread, "B"); + + test_assert((threads[0] != NULL) && + (threads[1] != NULL) && + (threads[2] == NULL) && + (threads[3] == NULL) && + (threads[4] == NULL), + "thread creation failed"); + + /* Claiming the memory from terminated threads. */ + test_wait_threads(); + test_assert_sequence("AB"); + + /* Heap status checked again.*/ + test_assert(chHeapStatus(&n) == 1, "heap fragmented"); + test_assert(n == sz, "heap size changed"); + } +} + +const struct testcase testdyn1 = { + dyn1_gettest, + dyn1_setup, + dyn1_teardown, + dyn1_execute +}; +#endif /* CH_USE_HEAP */ + +#ifdef CH_USE_MEMPOOLS +static MemoryPool mp1; + +static char *dyn2_gettest(void) { + + return "Dynamic APIs, threads creation from memory pool"; +} + +static void dyn2_setup(void) { + + chPoolInit(&mp1, UserStackSize(THREADS_STACK_SIZE)); +} + +static void dyn2_teardown(void) { +} + +static void dyn2_execute(void) { + int i; + tprio_t prio = chThdGetPriority(); + + /* Adding the WAs to the pool. */ + for (i = 0; i < 5; i++) + chPoolFree(&mp1, wa[i]); + + /* Starting threads from the memory pool. */ + threads[0] = chThdCreateFromMemoryPool(&mp1, prio-1, thread, "A"); + threads[1] = chThdCreateFromMemoryPool(&mp1, prio-2, thread, "B"); + threads[2] = chThdCreateFromMemoryPool(&mp1, prio-3, thread, "C"); + threads[3] = chThdCreateFromMemoryPool(&mp1, prio-4, thread, "D"); + threads[4] = chThdCreateFromMemoryPool(&mp1, prio-5, thread, "E"); + + test_assert((threads[0] != NULL) && + (threads[1] != NULL) && + (threads[2] != NULL) && + (threads[3] != NULL) && + (threads[4] != NULL), + "thread creation failed"); + + /* Claiming the memory from terminated threads. */ + test_wait_threads(); + test_assert_sequence("ABCDE"); + + /* Now the pool must be empty again. */ + test_assert(chPoolAlloc(&mp1) == NULL, "pool list not empty"); +} + +const struct testcase testdyn2 = { + dyn2_gettest, + dyn2_setup, + dyn2_teardown, + dyn2_execute +}; +#endif /* CH_USE_MEMPOOLS */ + +#endif /* CH_USE_DYNAMIC */ diff --git a/test/testdyn.h b/test/testdyn.h new file mode 100644 index 000000000..bb2a396bb --- /dev/null +++ b/test/testdyn.h @@ -0,0 +1,25 @@ +/* + ChibiOS/RT - Copyright (C) 2006-2007 Giovanni Di Sirio. + + This file is part of ChibiOS/RT. + + ChibiOS/RT is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 3 of the License, or + (at your option) any later version. + + ChibiOS/RT is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see . +*/ + +#ifndef _TESTDYN_H_ +#define _TESTDYN_H_ + +extern const struct testcase testdyn1, testdyn2; + +#endif /* _TESTDYN_H_ */ diff --git a/test/testheap.c b/test/testheap.c index 775902dd3..b6468b6be 100644 --- a/test/testheap.c +++ b/test/testheap.c @@ -41,7 +41,6 @@ static void heap1_execute(void) { size_t n, sz; /* Test skipped if the heap is already fragmented. */ - if ((n = chHeapStatus(&sz)) == 1) { test_print("--- Size : "); test_printn(sz); -- cgit v1.2.3 From 7fdee68e5bf8c080cd0a79942cc5675ed0c71e58 Mon Sep 17 00:00:00 2001 From: gdisirio Date: Tue, 23 Sep 2008 18:04:28 +0000 Subject: git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@439 35acf78f-673a-0410-8e92-d51de3d6d3f4 --- test/testdyn.c | 2 +- test/testpools.c | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) (limited to 'test') diff --git a/test/testdyn.c b/test/testdyn.c index 1f952b6ac..f7b9e3107 100644 --- a/test/testdyn.c +++ b/test/testdyn.c @@ -99,7 +99,7 @@ static void dyn2_execute(void) { tprio_t prio = chThdGetPriority(); /* Adding the WAs to the pool. */ - for (i = 0; i < 5; i++) + for (i = 0; i < MAX_THREADS; i++) chPoolFree(&mp1, wa[i]); /* Starting threads from the memory pool. */ diff --git a/test/testpools.c b/test/testpools.c index 40a31fad7..2d3ee0f00 100644 --- a/test/testpools.c +++ b/test/testpools.c @@ -42,11 +42,11 @@ static void pools1_execute(void) { int i; /* Adding the WAs to the pool. */ - for (i = 0; i < 5; i++) + for (i = 0; i < MAX_THREADS; i++) chPoolFree(&mp1, wa[i]); /* Empting the pool again. */ - for (i = 0; i < 5; i++) + for (i = 0; i < MAX_THREADS; i++) test_assert(chPoolAlloc(&mp1) != NULL, "pool list empty"); /* Now must be empty. */ -- cgit v1.2.3 From 56c0992fe6abb5b06f74f8518eb07b9bc63eac99 Mon Sep 17 00:00:00 2001 From: gdisirio Date: Tue, 23 Sep 2008 18:34:51 +0000 Subject: git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@440 35acf78f-673a-0410-8e92-d51de3d6d3f4 --- test/testdyn.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'test') diff --git a/test/testdyn.c b/test/testdyn.c index f7b9e3107..0751e052a 100644 --- a/test/testdyn.c +++ b/test/testdyn.c @@ -99,7 +99,7 @@ static void dyn2_execute(void) { tprio_t prio = chThdGetPriority(); /* Adding the WAs to the pool. */ - for (i = 0; i < MAX_THREADS; i++) + for (i = 0; i < 5; i++) chPoolFree(&mp1, wa[i]); /* Starting threads from the memory pool. */ @@ -120,7 +120,9 @@ static void dyn2_execute(void) { test_wait_threads(); test_assert_sequence("ABCDE"); - /* Now the pool must be empty again. */ + /* Now the pool must be full again. */ + for (i = 0; i < 5; i++) + test_assert(chPoolAlloc(&mp1) != NULL, "pool list empty"); test_assert(chPoolAlloc(&mp1) == NULL, "pool list not empty"); } -- cgit v1.2.3 From c95c06216f9869d959f6b116bc65bd5548cad801 Mon Sep 17 00:00:00 2001 From: gdisirio Date: Sat, 27 Sep 2008 08:33:34 +0000 Subject: git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@445 35acf78f-673a-0410-8e92-d51de3d6d3f4 --- test/test.h | 3 +++ 1 file changed, 3 insertions(+) (limited to 'test') diff --git a/test/test.h b/test/test.h index 3bee948cd..bb59c196e 100644 --- a/test/test.h +++ b/test/test.h @@ -55,6 +55,9 @@ extern "C" { systime_t test_wait_tick(void); void test_cpu_pulse(systime_t ms); void test_start_timer(systime_t time); +#if defined(WIN32) + void ChkIntSources(void); +#endif #ifdef __cplusplus } #endif -- cgit v1.2.3 From 875c8f368683e77371f75c0b9f1aa18237f118f2 Mon Sep 17 00:00:00 2001 From: gdisirio Date: Wed, 15 Oct 2008 18:26:16 +0000 Subject: git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@468 35acf78f-673a-0410-8e92-d51de3d6d3f4 --- test/test.c | 10 ++++++---- test/test.h | 6 +++--- test/testmtx.c | 14 +++++++------- test/testsem.c | 6 +++--- 4 files changed, 19 insertions(+), 17 deletions(-) (limited to 'test') diff --git a/test/test.c b/test/test.c index fa2625215..bd39b1371 100644 --- a/test/test.c +++ b/test/test.c @@ -182,10 +182,11 @@ void test_wait_threads(void) { chThdWait(threads[i]); } -void test_cpu_pulse(systime_t ms) { +void test_cpu_pulse(unsigned ms) { + systime_t duration = MS2ST(ms); systime_t start = chSysGetTime(); - while (chSysInTimeWindow(start, start + ms)) { + while (chSysInTimeWindow(start, start + duration)) { #if defined(WIN32) ChkIntSources(); #endif @@ -209,11 +210,12 @@ static void tmr(void *p) { test_timer_done = TRUE; } -void test_start_timer(systime_t time) { +void test_start_timer(unsigned ms) { + systime_t duration = MS2ST(ms); test_timer_done = FALSE; chSysLock(); - chVTSetI(&vt, time, tmr, NULL); + chVTSetI(&vt, duration, tmr, NULL); chSysUnlock(); } diff --git a/test/test.h b/test/test.h index bb59c196e..524907b76 100644 --- a/test/test.h +++ b/test/test.h @@ -22,7 +22,7 @@ #define MAX_THREADS 5 #define MAX_TOKENS 16 -#define DELAY_BETWEEN_TESTS 200 +#define DELAY_BETWEEN_TESTS MS2ST(200) #if defined(CH_ARCHITECTURE_AVR) || defined(CH_ARCHITECTURE_MSP430) #define THREADS_STACK_SIZE 64 @@ -53,8 +53,8 @@ extern "C" { void test_terminate_threads(void); void test_wait_threads(void); systime_t test_wait_tick(void); - void test_cpu_pulse(systime_t ms); - void test_start_timer(systime_t time); + void test_cpu_pulse(unsigned ms); + void test_start_timer(unsigned ms); #if defined(WIN32) void ChkIntSources(void); #endif diff --git a/test/testmtx.c b/test/testmtx.c index 3954e9338..f389ebe6f 100644 --- a/test/testmtx.c +++ b/test/testmtx.c @@ -85,7 +85,7 @@ static void mtx2_teardown(void) { static msg_t thread2(void *p) { - chThdSleep(5); + chThdSleep(MS2ST(10)); chMtxLock(&m1); chMtxUnlock(); test_emit_token(*(char *)p); @@ -95,7 +95,7 @@ static msg_t thread2(void *p) { static msg_t thread3(void *p) { chMtxLock(&m1); - chThdSleep(20); + chThdSleep(MS2ST(40)); chMtxUnlock(); test_emit_token(*(char *)p); return 0; @@ -103,7 +103,7 @@ static msg_t thread3(void *p) { static msg_t thread4(void *p) { - chThdSleep(10); + chThdSleep(MS2ST(20)); test_cpu_pulse(50); test_emit_token(*(char *)p); return 0; @@ -156,7 +156,7 @@ static msg_t thread5(void *p) { static msg_t thread6(void *p) { - chThdSleep(10); + chThdSleep(MS2ST(10)); chMtxLock(&m2); test_cpu_pulse(20); chMtxLock(&m1); @@ -170,7 +170,7 @@ static msg_t thread6(void *p) { static msg_t thread7(void *p) { - chThdSleep(20); + chThdSleep(MS2ST(20)); chMtxLock(&m2); test_cpu_pulse(50); chMtxUnlock(); @@ -180,7 +180,7 @@ static msg_t thread7(void *p) { static msg_t thread8(void *p) { - chThdSleep(40); + chThdSleep(MS2ST(40)); test_cpu_pulse(200); test_emit_token(*(char *)p); return 0; @@ -188,7 +188,7 @@ static msg_t thread8(void *p) { static msg_t thread9(void *p) { - chThdSleep(50); + chThdSleep(MS2ST(50)); chMtxLock(&m2); test_cpu_pulse(50); chMtxUnlock(); diff --git a/test/testsem.c b/test/testsem.c index 6afa715cb..f2105a7dd 100644 --- a/test/testsem.c +++ b/test/testsem.c @@ -21,7 +21,7 @@ #include "test.h" -#define ALLOWED_DELAY 5 +#define ALLOWED_DELAY MS2ST(5) static Semaphore sem1; @@ -85,10 +85,10 @@ static void sem2_execute(void) { int i; systime_t target_time; - target_time = chSysGetTime() + 5 * 500; + target_time = chSysGetTime() + MS2ST(5 * 500); for (i = 0; i < 5; i++) { test_emit_token('A' + i); - chSemWaitTimeout(&sem1, 500); + chSemWaitTimeout(&sem1, MS2ST(500)); } test_assert_sequence("ABCDE"); test_assert_time_window(target_time, target_time + ALLOWED_DELAY); -- cgit v1.2.3 From e3974196a3f092878c2ec0d466d0ec412298be6b Mon Sep 17 00:00:00 2001 From: gdisirio Date: Wed, 15 Oct 2008 18:53:15 +0000 Subject: git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@472 35acf78f-673a-0410-8e92-d51de3d6d3f4 --- test/test.c | 2 +- test/test.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) (limited to 'test') diff --git a/test/test.c b/test/test.c index bd39b1371..eacb2a9e3 100644 --- a/test/test.c +++ b/test/test.c @@ -250,7 +250,7 @@ msg_t TestThread(void *p) { i = 0; while (tests[i]) { #if DELAY_BETWEEN_TESTS > 0 - chThdSleep(DELAY_BETWEEN_TESTS); + chThdSleep(MS2ST(DELAY_BETWEEN_TESTS)); #endif test_println("---------------------------------------------------------------------------"); test_print("--- Test Case "); diff --git a/test/test.h b/test/test.h index 524907b76..bc777fabb 100644 --- a/test/test.h +++ b/test/test.h @@ -22,7 +22,7 @@ #define MAX_THREADS 5 #define MAX_TOKENS 16 -#define DELAY_BETWEEN_TESTS MS2ST(200) +#define DELAY_BETWEEN_TESTS 200 #if defined(CH_ARCHITECTURE_AVR) || defined(CH_ARCHITECTURE_MSP430) #define THREADS_STACK_SIZE 64 -- cgit v1.2.3 From 3c4cadc596f201c3377de40a62685b3b9d7b9de1 Mon Sep 17 00:00:00 2001 From: gdisirio Date: Sun, 26 Oct 2008 10:45:42 +0000 Subject: git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@484 35acf78f-673a-0410-8e92-d51de3d6d3f4 --- test/test.c | 2 +- test/testmtx.c | 14 +++++++------- 2 files changed, 8 insertions(+), 8 deletions(-) (limited to 'test') diff --git a/test/test.c b/test/test.c index eacb2a9e3..c56a23552 100644 --- a/test/test.c +++ b/test/test.c @@ -250,7 +250,7 @@ msg_t TestThread(void *p) { i = 0; while (tests[i]) { #if DELAY_BETWEEN_TESTS > 0 - chThdSleep(MS2ST(DELAY_BETWEEN_TESTS)); + chThdSleepMilliseconds(DELAY_BETWEEN_TESTS); #endif test_println("---------------------------------------------------------------------------"); test_print("--- Test Case "); diff --git a/test/testmtx.c b/test/testmtx.c index f389ebe6f..6c1beea28 100644 --- a/test/testmtx.c +++ b/test/testmtx.c @@ -85,7 +85,7 @@ static void mtx2_teardown(void) { static msg_t thread2(void *p) { - chThdSleep(MS2ST(10)); + chThdSleepMilliseconds(10); chMtxLock(&m1); chMtxUnlock(); test_emit_token(*(char *)p); @@ -95,7 +95,7 @@ static msg_t thread2(void *p) { static msg_t thread3(void *p) { chMtxLock(&m1); - chThdSleep(MS2ST(40)); + chThdSleepMilliseconds(40); chMtxUnlock(); test_emit_token(*(char *)p); return 0; @@ -103,7 +103,7 @@ static msg_t thread3(void *p) { static msg_t thread4(void *p) { - chThdSleep(MS2ST(20)); + chThdSleepMilliseconds(20); test_cpu_pulse(50); test_emit_token(*(char *)p); return 0; @@ -156,7 +156,7 @@ static msg_t thread5(void *p) { static msg_t thread6(void *p) { - chThdSleep(MS2ST(10)); + chThdSleepMilliseconds(10); chMtxLock(&m2); test_cpu_pulse(20); chMtxLock(&m1); @@ -170,7 +170,7 @@ static msg_t thread6(void *p) { static msg_t thread7(void *p) { - chThdSleep(MS2ST(20)); + chThdSleepMilliseconds(20); chMtxLock(&m2); test_cpu_pulse(50); chMtxUnlock(); @@ -180,7 +180,7 @@ static msg_t thread7(void *p) { static msg_t thread8(void *p) { - chThdSleep(MS2ST(40)); + chThdSleepMilliseconds(40); test_cpu_pulse(200); test_emit_token(*(char *)p); return 0; @@ -188,7 +188,7 @@ static msg_t thread8(void *p) { static msg_t thread9(void *p) { - chThdSleep(MS2ST(50)); + chThdSleepMilliseconds(50); chMtxLock(&m2); test_cpu_pulse(50); chMtxUnlock(); -- cgit v1.2.3 From a701fdfd1494a45cdbdaa382f0c88c5636aa64dd Mon Sep 17 00:00:00 2001 From: gdisirio Date: Sat, 1 Nov 2008 17:49:53 +0000 Subject: git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@489 35acf78f-673a-0410-8e92-d51de3d6d3f4 --- test/test.c | 19 +++++++++++-------- test/test.h | 28 ++++++++++++++++++++++++---- test/testmtx.c | 2 +- 3 files changed, 36 insertions(+), 13 deletions(-) (limited to 'test') diff --git a/test/test.c b/test/test.c index c56a23552..9510eb39d 100644 --- a/test/test.c +++ b/test/test.c @@ -135,32 +135,35 @@ void test_emit_token(char token) { /* * Assertions. */ -void test_fail(char * msg) { +bool_t _test_fail(char * msg) { local_fail = TRUE; global_fail = TRUE; failmsg = msg; + return TRUE; } -void test_assert(bool_t condition, char * msg) { +bool_t _test_assert(bool_t condition, char * msg) { if (!condition) - test_fail(msg); + return _test_fail(msg); + return FALSE; } -void test_assert_sequence(char *expected) { +bool_t _test_assert_sequence(char *expected) { char *cp = tokens_buffer; while (cp < tokp) { if (*cp++ != *expected++) - test_fail(NULL); + return _test_fail(NULL); } if (*expected) - test_fail(NULL); + return _test_fail(NULL); + return FALSE; } -void test_assert_time_window(systime_t start, systime_t end) { +bool_t _test_assert_time_window(systime_t start, systime_t end) { - test_assert(chSysInTimeWindow(start, end), "time window error"); + return _test_assert(chSysInTimeWindow(start, end), "time window error"); } /* diff --git a/test/test.h b/test/test.h index bc777fabb..864b12e4f 100644 --- a/test/test.h +++ b/test/test.h @@ -46,10 +46,10 @@ extern "C" { void test_print(char *msgp); void test_println(char *msgp); void test_emit_token(char token); - void test_fail(char * msg); - void test_assert(bool_t condition, char * msg); - void test_assert_sequence(char *expected); - void test_assert_time_window(systime_t start, systime_t end); + bool_t _test_fail(char * msg); + bool_t _test_assert(bool_t condition, char * msg); + bool_t _test_assert_sequence(char *expected); + bool_t _test_assert_time_window(systime_t start, systime_t end); void test_terminate_threads(void); void test_wait_threads(void); systime_t test_wait_tick(void); @@ -62,6 +62,26 @@ extern "C" { } #endif +#define test_fail(msg) { \ + test_fail(msg); \ + return; \ +} + +#define test_assert(condition, msg) { \ + if (_test_assert(condition, msg)) \ + return; \ +} + +#define test_assert_sequence(expected) { \ + if (_test_assert_sequence(expected)) \ + return; \ +} + +#define test_assert_time_window(start, end) { \ + if (_test_assert_time_window(start, end)) \ + return; \ +} + extern Thread *threads[MAX_THREADS]; extern void *wa[MAX_THREADS]; extern bool_t test_timer_done; diff --git a/test/testmtx.c b/test/testmtx.c index 6c1beea28..0bf69cbf7 100644 --- a/test/testmtx.c +++ b/test/testmtx.c @@ -58,8 +58,8 @@ static void mtx1_execute(void) { threads[3] = chThdCreateStatic(wa[3], STKSIZE, prio+4, thread1, "B"); threads[4] = chThdCreateStatic(wa[4], STKSIZE, prio+5, thread1, "A"); chMtxUnlock(); - test_assert(prio == chThdGetPriority(), "priority return failure"); test_wait_threads(); + test_assert(prio == chThdGetPriority(), "priority return failure"); test_assert_sequence("ABCDE"); } -- cgit v1.2.3 From aac96ddde3e160390b4f810f852adff0fb97913b Mon Sep 17 00:00:00 2001 From: gdisirio Date: Sun, 2 Nov 2008 12:43:53 +0000 Subject: git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@492 35acf78f-673a-0410-8e92-d51de3d6d3f4 --- test/test.c | 1 + test/testbmk.c | 37 +++++++++++++++++++++++++++++++++++++ test/testbmk.h | 2 +- 3 files changed, 39 insertions(+), 1 deletion(-) (limited to 'test') diff --git a/test/test.c b/test/test.c index 9510eb39d..667b89749 100644 --- a/test/test.c +++ b/test/test.c @@ -62,6 +62,7 @@ static const struct testcase *tests[] = { &testbmk5, &testbmk6, &testbmk7, + &testbmk8, NULL }; diff --git a/test/testbmk.c b/test/testbmk.c index acdfa50e8..02b810e1f 100644 --- a/test/testbmk.c +++ b/test/testbmk.c @@ -292,3 +292,40 @@ const struct testcase testbmk7 = { empty, bmk7_execute }; + +static char *bmk8_gettest(void) { + + return "Benchmark, virtual timers set/reset"; +} + +static void tmo(void *param) {} + +static void bmk8_execute(void) { + static VirtualTimer vt1, vt2; + uint32_t n = 0; + + test_wait_tick(); + test_start_timer(1000); + do { + chSysLock(); + chVTSetI(&vt1, 1, tmo, NULL); + chVTSetI(&vt2, 10000, tmo, NULL); + chVTResetI(&vt1); + chVTResetI(&vt2); + chSysUnlock(); + n++; +#if defined(WIN32) + ChkIntSources(); +#endif + } while (!test_timer_done); + test_print("--- Score : "); + test_printn(n * 2); + test_println(" timers/S"); +} + +const struct testcase testbmk8 = { + bmk8_gettest, + empty, + empty, + bmk8_execute +}; diff --git a/test/testbmk.h b/test/testbmk.h index 5e99dc3d5..afa3381e4 100644 --- a/test/testbmk.h +++ b/test/testbmk.h @@ -22,6 +22,6 @@ extern const struct testcase testbmk1, testbmk2, testbmk3, testbmk4, testbmk5, testbmk6, - testbmk7; + testbmk7, testbmk8; #endif /* _TESTBMK_H_ */ -- cgit v1.2.3 From 87d83b1b7e37925f3e32e79e6e6baedb5b13f192 Mon Sep 17 00:00:00 2001 From: gdisirio Date: Sun, 9 Nov 2008 09:31:17 +0000 Subject: git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@504 35acf78f-673a-0410-8e92-d51de3d6d3f4 --- test/test.c | 8 ++++++++ test/test.mk | 5 +++-- test/testsem.c | 4 ++++ 3 files changed, 15 insertions(+), 2 deletions(-) (limited to 'test') diff --git a/test/test.c b/test/test.c index 667b89749..9a1af1725 100644 --- a/test/test.c +++ b/test/test.c @@ -24,6 +24,7 @@ #include "testsem.h" #include "testmtx.h" #include "testmsg.h" +#include "testevt.h" #include "testheap.h" #include "testpools.h" #include "testdyn.h" @@ -35,14 +36,21 @@ static const struct testcase *tests[] = { &testrdy1, &testrdy2, +#ifdef CH_USE_SEMAPHORES &testsem1, &testsem2, +#endif #ifdef CH_USE_MUTEXES &testmtx1, &testmtx2, &testmtx3, #endif +#ifdef CH_USE_MESSAGES &testmsg1, +#endif +#ifdef CH_USE_EVENTS + &testevt1, +#endif #ifdef CH_USE_HEAP &testheap1, #endif diff --git a/test/test.mk b/test/test.mk index 9ea33e412..e65db3345 100644 --- a/test/test.mk +++ b/test/test.mk @@ -1,4 +1,5 @@ # List of all the ChibiOS/RT test files. TESTSRC = ../../test/test.c ../../test/testrdy.c ../../test/testsem.c \ - ../../test/testmtx.c ../../test/testmsg.c ../../test/testheap.c \ - ../../test/testpools.c ../../test/testdyn.c ../../test/testbmk.c + ../../test/testmtx.c ../../test/testmsg.c ../../test/testevt.c \ + ../../test/testheap.c ../../test/testpools.c ../../test/testdyn.c \ + ../../test/testbmk.c diff --git a/test/testsem.c b/test/testsem.c index f2105a7dd..26c5556f5 100644 --- a/test/testsem.c +++ b/test/testsem.c @@ -21,6 +21,8 @@ #include "test.h" +#ifdef CH_USE_SEMAPHORES + #define ALLOWED_DELAY MS2ST(5) static Semaphore sem1; @@ -100,3 +102,5 @@ const struct testcase testsem2 = { sem2_teardown, sem2_execute }; + +#endif /* CH_USE_SEMAPHORES */ -- cgit v1.2.3 From 0dd1ffc0882d6355dde36502c84ddc82822eb9c3 Mon Sep 17 00:00:00 2001 From: gdisirio Date: Sun, 9 Nov 2008 11:45:37 +0000 Subject: git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@506 35acf78f-673a-0410-8e92-d51de3d6d3f4 --- test/test.c | 5 +++ test/test.mk | 8 ++--- test/testcond.c | 105 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++ test/testcond.h | 26 ++++++++++++++ 4 files changed, 140 insertions(+), 4 deletions(-) create mode 100644 test/testcond.c create mode 100644 test/testcond.h (limited to 'test') diff --git a/test/test.c b/test/test.c index 9a1af1725..b603a20b8 100644 --- a/test/test.c +++ b/test/test.c @@ -23,6 +23,7 @@ #include "testrdy.h" #include "testsem.h" #include "testmtx.h" +#include "testcond.h" #include "testmsg.h" #include "testevt.h" #include "testheap.h" @@ -44,6 +45,10 @@ static const struct testcase *tests[] = { &testmtx1, &testmtx2, &testmtx3, +#ifdef CH_USE_CONDVARS + &testcond1, + &testcond2, +#endif #endif #ifdef CH_USE_MESSAGES &testmsg1, diff --git a/test/test.mk b/test/test.mk index e65db3345..9677d21dc 100644 --- a/test/test.mk +++ b/test/test.mk @@ -1,5 +1,5 @@ # List of all the ChibiOS/RT test files. -TESTSRC = ../../test/test.c ../../test/testrdy.c ../../test/testsem.c \ - ../../test/testmtx.c ../../test/testmsg.c ../../test/testevt.c \ - ../../test/testheap.c ../../test/testpools.c ../../test/testdyn.c \ - ../../test/testbmk.c +TESTSRC = ../../test/test.c ../../test/testrdy.c ../../test/testsem.c \ + ../../test/testmtx.c ../../test/testcond.c ../../test/testmsg.c \ + ../../test/testevt.c ../../test/testheap.c ../../test/testpools.c \ + ../../test/testdyn.c ../../test/testbmk.c diff --git a/test/testcond.c b/test/testcond.c new file mode 100644 index 000000000..07c2a441e --- /dev/null +++ b/test/testcond.c @@ -0,0 +1,105 @@ +/* + ChibiOS/RT - Copyright (C) 2006-2007 Giovanni Di Sirio. + + This file is part of ChibiOS/RT. + + ChibiOS/RT is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 3 of the License, or + (at your option) any later version. + + ChibiOS/RT is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see . +*/ + +#include + +#include "test.h" + +#if defined(CH_USE_CONDVARS) && defined(CH_USE_MUTEXES) + +static Mutex m1; +static CondVar c1; + +static char *cond1_gettest(void) { + + return "CondVar, signal test"; +} + +static void cond1_setup(void) { + + chCondInit(&c1); + chMtxInit(&m1); +} + +static void cond1_teardown(void) { +} + +static msg_t thread1(void *p) { + + chMtxLock(&m1); + chCondWait(&c1); + test_emit_token(*(char *)p); + chMtxUnlock(); + return 0; +} + +static void cond1_execute(void) { + + // Bacause priority inheritance. + tprio_t prio = chThdGetPriority(); + threads[0] = chThdCreate(prio+1, 0, wa[0], STKSIZE, thread1, "E"); + threads[1] = chThdCreate(prio+2, 0, wa[1], STKSIZE, thread1, "D"); + threads[2] = chThdCreate(prio+3, 0, wa[2], STKSIZE, thread1, "C"); + threads[3] = chThdCreate(prio+4, 0, wa[3], STKSIZE, thread1, "B"); + threads[4] = chThdCreate(prio+5, 0, wa[4], STKSIZE, thread1, "A"); + test_assert(prio == chThdGetPriority(), "priority return failure"); + chCondSignal(&c1); + chCondSignal(&c1); + chCondSignal(&c1); + chCondSignal(&c1); + chCondSignal(&c1); + test_wait_threads(); + test_assert_sequence("ABCDE"); +} + +const struct testcase testcond1 = { + cond1_gettest, + cond1_setup, + cond1_teardown, + cond1_execute +}; + +static char *cond2_gettest(void) { + + return "CondVar, broadcast test"; +} + +static void cond2_execute(void) { + + // Bacause priority inheritance. + tprio_t prio = chThdGetPriority(); + threads[0] = chThdCreate(prio+1, 0, wa[0], STKSIZE, thread1, "E"); + threads[1] = chThdCreate(prio+2, 0, wa[1], STKSIZE, thread1, "D"); + threads[2] = chThdCreate(prio+3, 0, wa[2], STKSIZE, thread1, "C"); + threads[3] = chThdCreate(prio+4, 0, wa[3], STKSIZE, thread1, "B"); + threads[4] = chThdCreate(prio+5, 0, wa[4], STKSIZE, thread1, "A"); + test_assert(prio == chThdGetPriority(), "priority return failure"); + chCondBroadcast(&c1); + test_wait_threads(); + test_assert_sequence("ABCDE"); +} + +const struct testcase testcond2 = { + cond2_gettest, + cond1_setup, + cond1_teardown, + cond2_execute +}; + +#endif /* defined(CH_USE_CONDVARS) && defined(CH_USE_MUTEXES) */ diff --git a/test/testcond.h b/test/testcond.h new file mode 100644 index 000000000..8e6f286b1 --- /dev/null +++ b/test/testcond.h @@ -0,0 +1,26 @@ +/* + ChibiOS/RT - Copyright (C) 2006-2007 Giovanni Di Sirio. + + This file is part of ChibiOS/RT. + + ChibiOS/RT is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 3 of the License, or + (at your option) any later version. + + ChibiOS/RT is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see . +*/ + +#ifndef _TESTCOND_H_ +#define _TESTCOND_H_ + +extern const struct testcase testcond1; +extern const struct testcase testcond2; + +#endif /* _TESTCOND_H_ */ -- cgit v1.2.3 From b3e92dc72078603137a7182759419e2b801755b9 Mon Sep 17 00:00:00 2001 From: gdisirio Date: Sat, 29 Nov 2008 10:54:24 +0000 Subject: git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@521 35acf78f-673a-0410-8e92-d51de3d6d3f4 --- test/test.c | 10 +++++----- test/test.h | 2 +- test/testbmk.c | 28 ++++++++++++++-------------- test/testcond.c | 20 ++++++++++---------- test/testdyn.c | 6 +++--- test/testmsg.c | 2 +- test/testmtx.c | 26 +++++++++++++------------- test/testpools.c | 2 +- test/testrdy.c | 20 ++++++++++---------- test/testsem.c | 10 +++++----- 10 files changed, 63 insertions(+), 63 deletions(-) (limited to 'test') diff --git a/test/test.c b/test/test.c index b603a20b8..83be7410a 100644 --- a/test/test.c +++ b/test/test.c @@ -83,11 +83,11 @@ static bool_t local_fail, global_fail; static char *failmsg; static char tokens_buffer[MAX_TOKENS]; static char *tokp; -static WorkingArea(waT0, THREADS_STACK_SIZE); -static WorkingArea(waT1, THREADS_STACK_SIZE); -static WorkingArea(waT2, THREADS_STACK_SIZE); -static WorkingArea(waT3, THREADS_STACK_SIZE); -static WorkingArea(waT4, THREADS_STACK_SIZE); +static WORKING_AREA(waT0, THREADS_STACK_SIZE); +static WORKING_AREA(waT1, THREADS_STACK_SIZE); +static WORKING_AREA(waT2, THREADS_STACK_SIZE); +static WORKING_AREA(waT3, THREADS_STACK_SIZE); +static WORKING_AREA(waT4, THREADS_STACK_SIZE); void *wa[MAX_THREADS] = {waT0, waT1, waT2, waT3, waT4}; Thread *threads[MAX_THREADS]; diff --git a/test/test.h b/test/test.h index 864b12e4f..fe850faf1 100644 --- a/test/test.h +++ b/test/test.h @@ -29,7 +29,7 @@ #else #define THREADS_STACK_SIZE 128 #endif -#define STKSIZE UserStackSize(THREADS_STACK_SIZE) +#define WA_SIZE THD_WA_SIZE(THREADS_STACK_SIZE) struct testcase { char *(*gettest)(void); diff --git a/test/testbmk.c b/test/testbmk.c index 02b810e1f..19775a2d3 100644 --- a/test/testbmk.c +++ b/test/testbmk.c @@ -59,7 +59,7 @@ static char *bmk1_gettest(void) { static void bmk1_execute(void) { uint32_t n; - threads[0] = chThdCreateFast(chThdGetPriority()-1, wa[0], STKSIZE, thread1); + threads[0] = chThdCreateFast(chThdGetPriority()-1, wa[0], WA_SIZE, thread1); n = msg_loop_test(threads[0]); chThdTerminate(threads[0]); test_wait_threads(); @@ -85,7 +85,7 @@ static char *bmk2_gettest(void) { static void bmk2_execute(void) { uint32_t n; - threads[0] = chThdCreateFast(chThdGetPriority()+1, wa[0], STKSIZE, thread1); + threads[0] = chThdCreateFast(chThdGetPriority()+1, wa[0], WA_SIZE, thread1); n = msg_loop_test(threads[0]); chThdTerminate(threads[0]); test_wait_threads(); @@ -116,11 +116,11 @@ static char *bmk3_gettest(void) { static void bmk3_execute(void) { uint32_t n; - threads[0] = chThdCreateFast(chThdGetPriority()+1, wa[0], STKSIZE, thread1); - threads[1] = chThdCreateFast(chThdGetPriority()-2, wa[1], STKSIZE, thread2); - threads[2] = chThdCreateFast(chThdGetPriority()-3, wa[2], STKSIZE, thread2); - threads[3] = chThdCreateFast(chThdGetPriority()-4, wa[3], STKSIZE, thread2); - threads[4] = chThdCreateFast(chThdGetPriority()-5, wa[4], STKSIZE, thread2); + threads[0] = chThdCreateFast(chThdGetPriority()+1, wa[0], WA_SIZE, thread1); + threads[1] = chThdCreateFast(chThdGetPriority()-2, wa[1], WA_SIZE, thread2); + threads[2] = chThdCreateFast(chThdGetPriority()-3, wa[2], WA_SIZE, thread2); + threads[3] = chThdCreateFast(chThdGetPriority()-4, wa[3], WA_SIZE, thread2); + threads[4] = chThdCreateFast(chThdGetPriority()-5, wa[4], WA_SIZE, thread2); n = msg_loop_test(threads[0]); chThdTerminate(threads[0]); test_wait_threads(); @@ -151,7 +151,7 @@ static void bmk4_execute(void) { test_wait_tick(); test_start_timer(1000); do { - chThdWait(chThdCreateFast(prio, wap, STKSIZE, thread2)); + chThdWait(chThdCreateFast(prio, wap, WA_SIZE, thread2)); n++; #if defined(WIN32) ChkIntSources(); @@ -182,7 +182,7 @@ static void bmk5_execute(void) { test_wait_tick(); test_start_timer(1000); do { - chThdCreateFast(prio, wap, STKSIZE, thread2); + chThdCreateFast(prio, wap, WA_SIZE, thread2); n++; #if defined(WIN32) ChkIntSources(); @@ -220,11 +220,11 @@ static void bmk6_setup(void) { static void bmk6_execute(void) { uint32_t n; - threads[0] = chThdCreateFast(chThdGetPriority()+1, wa[0], STKSIZE, thread3); - threads[1] = chThdCreateFast(chThdGetPriority()+2, wa[1], STKSIZE, thread3); - threads[2] = chThdCreateFast(chThdGetPriority()+3, wa[2], STKSIZE, thread3); - threads[3] = chThdCreateFast(chThdGetPriority()+4, wa[3], STKSIZE, thread3); - threads[4] = chThdCreateFast(chThdGetPriority()+5, wa[4], STKSIZE, thread3); + threads[0] = chThdCreateFast(chThdGetPriority()+1, wa[0], WA_SIZE, thread3); + threads[1] = chThdCreateFast(chThdGetPriority()+2, wa[1], WA_SIZE, thread3); + threads[2] = chThdCreateFast(chThdGetPriority()+3, wa[2], WA_SIZE, thread3); + threads[3] = chThdCreateFast(chThdGetPriority()+4, wa[3], WA_SIZE, thread3); + threads[4] = chThdCreateFast(chThdGetPriority()+5, wa[4], WA_SIZE, thread3); n = 0; test_wait_tick(); diff --git a/test/testcond.c b/test/testcond.c index 07c2a441e..e202a0d15 100644 --- a/test/testcond.c +++ b/test/testcond.c @@ -53,11 +53,11 @@ static void cond1_execute(void) { // Bacause priority inheritance. tprio_t prio = chThdGetPriority(); - threads[0] = chThdCreate(prio+1, 0, wa[0], STKSIZE, thread1, "E"); - threads[1] = chThdCreate(prio+2, 0, wa[1], STKSIZE, thread1, "D"); - threads[2] = chThdCreate(prio+3, 0, wa[2], STKSIZE, thread1, "C"); - threads[3] = chThdCreate(prio+4, 0, wa[3], STKSIZE, thread1, "B"); - threads[4] = chThdCreate(prio+5, 0, wa[4], STKSIZE, thread1, "A"); + threads[0] = chThdCreate(prio+1, 0, wa[0], WA_SIZE, thread1, "E"); + threads[1] = chThdCreate(prio+2, 0, wa[1], WA_SIZE, thread1, "D"); + threads[2] = chThdCreate(prio+3, 0, wa[2], WA_SIZE, thread1, "C"); + threads[3] = chThdCreate(prio+4, 0, wa[3], WA_SIZE, thread1, "B"); + threads[4] = chThdCreate(prio+5, 0, wa[4], WA_SIZE, thread1, "A"); test_assert(prio == chThdGetPriority(), "priority return failure"); chCondSignal(&c1); chCondSignal(&c1); @@ -84,11 +84,11 @@ static void cond2_execute(void) { // Bacause priority inheritance. tprio_t prio = chThdGetPriority(); - threads[0] = chThdCreate(prio+1, 0, wa[0], STKSIZE, thread1, "E"); - threads[1] = chThdCreate(prio+2, 0, wa[1], STKSIZE, thread1, "D"); - threads[2] = chThdCreate(prio+3, 0, wa[2], STKSIZE, thread1, "C"); - threads[3] = chThdCreate(prio+4, 0, wa[3], STKSIZE, thread1, "B"); - threads[4] = chThdCreate(prio+5, 0, wa[4], STKSIZE, thread1, "A"); + threads[0] = chThdCreate(prio+1, 0, wa[0], WA_SIZE, thread1, "E"); + threads[1] = chThdCreate(prio+2, 0, wa[1], WA_SIZE, thread1, "D"); + threads[2] = chThdCreate(prio+3, 0, wa[2], WA_SIZE, thread1, "C"); + threads[3] = chThdCreate(prio+4, 0, wa[3], WA_SIZE, thread1, "B"); + threads[4] = chThdCreate(prio+5, 0, wa[4], WA_SIZE, thread1, "A"); test_assert(prio == chThdGetPriority(), "priority return failure"); chCondBroadcast(&c1); test_wait_threads(); diff --git a/test/testdyn.c b/test/testdyn.c index 0751e052a..37b6b9bc4 100644 --- a/test/testdyn.c +++ b/test/testdyn.c @@ -48,9 +48,9 @@ static void dyn1_execute(void) { /* Test skipped if the heap is already fragmented. */ if ((n = chHeapStatus(&sz)) == 1) { /* Starting threads from the heap. */ - threads[0] = chThdCreateFromHeap(UserStackSize(THREADS_STACK_SIZE), + threads[0] = chThdCreateFromHeap(THD_WA_SIZE(THREADS_STACK_SIZE), prio-1, thread, "A"); - threads[1] = chThdCreateFromHeap(UserStackSize(THREADS_STACK_SIZE), + threads[1] = chThdCreateFromHeap(THD_WA_SIZE(THREADS_STACK_SIZE), prio-2, thread, "B"); test_assert((threads[0] != NULL) && @@ -88,7 +88,7 @@ static char *dyn2_gettest(void) { static void dyn2_setup(void) { - chPoolInit(&mp1, UserStackSize(THREADS_STACK_SIZE)); + chPoolInit(&mp1, THD_WA_SIZE(THREADS_STACK_SIZE)); } static void dyn2_teardown(void) { diff --git a/test/testmsg.c b/test/testmsg.c index fcf811fa1..735375a16 100644 --- a/test/testmsg.c +++ b/test/testmsg.c @@ -47,7 +47,7 @@ static msg_t thread(void *p) { static void msg1_execute(void) { msg_t msg; - threads[0] = chThdCreateStatic(wa[0], STKSIZE, chThdGetPriority()-1, thread, chThdSelf()); + threads[0] = chThdCreateStatic(wa[0], WA_SIZE, chThdGetPriority()-1, thread, chThdSelf()); do { chMsgRelease(msg = chMsgWait()); if (msg) diff --git a/test/testmtx.c b/test/testmtx.c index 0bf69cbf7..4d8df7d02 100644 --- a/test/testmtx.c +++ b/test/testmtx.c @@ -52,11 +52,11 @@ static void mtx1_execute(void) { tprio_t prio = chThdGetPriority(); // Bacause priority inheritance. chMtxLock(&m1); - threads[0] = chThdCreateStatic(wa[0], STKSIZE, prio+1, thread1, "E"); - threads[1] = chThdCreateStatic(wa[1], STKSIZE, prio+2, thread1, "D"); - threads[2] = chThdCreateStatic(wa[2], STKSIZE, prio+3, thread1, "C"); - threads[3] = chThdCreateStatic(wa[3], STKSIZE, prio+4, thread1, "B"); - threads[4] = chThdCreateStatic(wa[4], STKSIZE, prio+5, thread1, "A"); + threads[0] = chThdCreateStatic(wa[0], WA_SIZE, prio+1, thread1, "E"); + threads[1] = chThdCreateStatic(wa[1], WA_SIZE, prio+2, thread1, "D"); + threads[2] = chThdCreateStatic(wa[2], WA_SIZE, prio+3, thread1, "C"); + threads[3] = chThdCreateStatic(wa[3], WA_SIZE, prio+4, thread1, "B"); + threads[4] = chThdCreateStatic(wa[4], WA_SIZE, prio+5, thread1, "A"); chMtxUnlock(); test_wait_threads(); test_assert(prio == chThdGetPriority(), "priority return failure"); @@ -117,9 +117,9 @@ static msg_t thread4(void *p) { */ static void mtx2_execute(void) { - threads[0] = chThdCreateStatic(wa[0], STKSIZE, chThdGetPriority()-1, thread2, "A"); - threads[1] = chThdCreateStatic(wa[1], STKSIZE, chThdGetPriority()-3, thread3, "C"); - threads[2] = chThdCreateStatic(wa[2], STKSIZE, chThdGetPriority()-2, thread4, "B"); + threads[0] = chThdCreateStatic(wa[0], WA_SIZE, chThdGetPriority()-1, thread2, "A"); + threads[1] = chThdCreateStatic(wa[1], WA_SIZE, chThdGetPriority()-3, thread3, "C"); + threads[2] = chThdCreateStatic(wa[2], WA_SIZE, chThdGetPriority()-2, thread4, "B"); test_wait_threads(); test_assert_sequence("ABC"); } @@ -206,11 +206,11 @@ static msg_t thread9(void *p) { */ static void mtx3_execute(void) { - threads[0] = chThdCreateStatic(wa[0], STKSIZE, chThdGetPriority()-5, thread5, "E"); - threads[1] = chThdCreateStatic(wa[1], STKSIZE, chThdGetPriority()-4, thread6, "D"); - threads[2] = chThdCreateStatic(wa[2], STKSIZE, chThdGetPriority()-3, thread7, "C"); - threads[3] = chThdCreateStatic(wa[3], STKSIZE, chThdGetPriority()-2, thread8, "B"); - threads[4] = chThdCreateStatic(wa[4], STKSIZE, chThdGetPriority()-1, thread9, "A"); + threads[0] = chThdCreateStatic(wa[0], WA_SIZE, chThdGetPriority()-5, thread5, "E"); + threads[1] = chThdCreateStatic(wa[1], WA_SIZE, chThdGetPriority()-4, thread6, "D"); + threads[2] = chThdCreateStatic(wa[2], WA_SIZE, chThdGetPriority()-3, thread7, "C"); + threads[3] = chThdCreateStatic(wa[3], WA_SIZE, chThdGetPriority()-2, thread8, "B"); + threads[4] = chThdCreateStatic(wa[4], WA_SIZE, chThdGetPriority()-1, thread9, "A"); test_wait_threads(); test_assert_sequence("ABCDE"); } diff --git a/test/testpools.c b/test/testpools.c index 2d3ee0f00..d3f451c73 100644 --- a/test/testpools.c +++ b/test/testpools.c @@ -32,7 +32,7 @@ static char *pools1_gettest(void) { static void pools1_setup(void) { - chPoolInit(&mp1, UserStackSize(THREADS_STACK_SIZE)); + chPoolInit(&mp1, THD_WA_SIZE(THREADS_STACK_SIZE)); } static void pools1_teardown(void) { diff --git a/test/testrdy.c b/test/testrdy.c index 2d39e5ff4..a9b52701e 100644 --- a/test/testrdy.c +++ b/test/testrdy.c @@ -40,11 +40,11 @@ static void rdy1_teardown(void) { static void rdy1_execute(void) { - threads[0] = chThdCreateStatic(wa[0], STKSIZE, chThdGetPriority()-5, thread, "E"); - threads[1] = chThdCreateStatic(wa[1], STKSIZE, chThdGetPriority()-4, thread, "D"); - threads[2] = chThdCreateStatic(wa[2], STKSIZE, chThdGetPriority()-3, thread, "C"); - threads[3] = chThdCreateStatic(wa[3], STKSIZE, chThdGetPriority()-2, thread, "B"); - threads[4] = chThdCreateStatic(wa[4], STKSIZE, chThdGetPriority()-1, thread, "A"); + threads[0] = chThdCreateStatic(wa[0], WA_SIZE, chThdGetPriority()-5, thread, "E"); + threads[1] = chThdCreateStatic(wa[1], WA_SIZE, chThdGetPriority()-4, thread, "D"); + threads[2] = chThdCreateStatic(wa[2], WA_SIZE, chThdGetPriority()-3, thread, "C"); + threads[3] = chThdCreateStatic(wa[3], WA_SIZE, chThdGetPriority()-2, thread, "B"); + threads[4] = chThdCreateStatic(wa[4], WA_SIZE, chThdGetPriority()-1, thread, "A"); test_wait_threads(); test_assert_sequence("ABCDE"); } @@ -69,11 +69,11 @@ static void rdy2_teardown(void) { static void rdy2_execute(void) { - threads[1] = chThdCreateStatic(wa[1], STKSIZE, chThdGetPriority()-4, thread, "D"); - threads[0] = chThdCreateStatic(wa[0], STKSIZE, chThdGetPriority()-5, thread, "E"); - threads[4] = chThdCreateStatic(wa[4], STKSIZE, chThdGetPriority()-1, thread, "A"); - threads[3] = chThdCreateStatic(wa[3], STKSIZE, chThdGetPriority()-2, thread, "B"); - threads[2] = chThdCreateStatic(wa[2], STKSIZE, chThdGetPriority()-3, thread, "C"); + threads[1] = chThdCreateStatic(wa[1], WA_SIZE, chThdGetPriority()-4, thread, "D"); + threads[0] = chThdCreateStatic(wa[0], WA_SIZE, chThdGetPriority()-5, thread, "E"); + threads[4] = chThdCreateStatic(wa[4], WA_SIZE, chThdGetPriority()-1, thread, "A"); + threads[3] = chThdCreateStatic(wa[3], WA_SIZE, chThdGetPriority()-2, thread, "B"); + threads[2] = chThdCreateStatic(wa[2], WA_SIZE, chThdGetPriority()-3, thread, "C"); test_wait_threads(); test_assert_sequence("ABCDE"); } diff --git a/test/testsem.c b/test/testsem.c index 26c5556f5..72ed6126f 100644 --- a/test/testsem.c +++ b/test/testsem.c @@ -49,11 +49,11 @@ static msg_t thread(void *p) { static void sem1_execute(void) { - threads[0] = chThdCreateStatic(wa[0], STKSIZE, chThdGetPriority()+5, thread, "A"); - threads[1] = chThdCreateStatic(wa[1], STKSIZE, chThdGetPriority()+1, thread, "B"); - threads[2] = chThdCreateStatic(wa[2], STKSIZE, chThdGetPriority()+3, thread, "C"); - threads[3] = chThdCreateStatic(wa[3], STKSIZE, chThdGetPriority()+4, thread, "D"); - threads[4] = chThdCreateStatic(wa[4], STKSIZE, chThdGetPriority()+2, thread, "E"); + threads[0] = chThdCreateStatic(wa[0], WA_SIZE, chThdGetPriority()+5, thread, "A"); + threads[1] = chThdCreateStatic(wa[1], WA_SIZE, chThdGetPriority()+1, thread, "B"); + threads[2] = chThdCreateStatic(wa[2], WA_SIZE, chThdGetPriority()+3, thread, "C"); + threads[3] = chThdCreateStatic(wa[3], WA_SIZE, chThdGetPriority()+4, thread, "D"); + threads[4] = chThdCreateStatic(wa[4], WA_SIZE, chThdGetPriority()+2, thread, "E"); chSemSignal(&sem1); chSemSignal(&sem1); chSemSignal(&sem1); -- cgit v1.2.3 From 87befad2540f95a8c38592981b7702a6fee06052 Mon Sep 17 00:00:00 2001 From: gdisirio Date: Sat, 6 Dec 2008 09:02:28 +0000 Subject: git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@528 35acf78f-673a-0410-8e92-d51de3d6d3f4 --- test/testevt.c | 104 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++ test/testevt.h | 25 ++++++++++++++ 2 files changed, 129 insertions(+) create mode 100644 test/testevt.c create mode 100644 test/testevt.h (limited to 'test') diff --git a/test/testevt.c b/test/testevt.c new file mode 100644 index 000000000..28e54cbf6 --- /dev/null +++ b/test/testevt.c @@ -0,0 +1,104 @@ +/* + ChibiOS/RT - Copyright (C) 2006-2007 Giovanni Di Sirio. + + This file is part of ChibiOS/RT. + + ChibiOS/RT is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 3 of the License, or + (at your option) any later version. + + ChibiOS/RT is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see . +*/ + +#include + +#include "test.h" + +#ifdef CH_USE_EVENTS + +#define ALLOWED_DELAY MS2ST(5) + +static EventSource es1, es2; + +static char *evt1_gettest(void) { + + return "Events, wait and broadcast"; +} + +static void evt1_setup(void) { + + chEvtClear(ALL_EVENTS); +} + +static void evt1_teardown(void) { +} + +static msg_t thread(void *p) { + + chEvtBroadcast(&es1); + chThdSleepMilliseconds(50); + chEvtBroadcast(&es2); + return 0; +} + +static void evt1_execute(void) { + eventmask_t m; + EventListener el1, el2; + systime_t target_time; + + /* + * Test on chEvtWaitOne(). + */ + chEvtPend(5); + m = chEvtWaitOne(ALL_EVENTS); + test_assert(m == 1, "chEvtWaitOne() error"); + m = chEvtWaitOne(ALL_EVENTS); + test_assert(m == 4, "chEvtWaitOne() error"); + m = chEvtClear(0); + test_assert(m == 0, "stuck event"); + + /* + * Test on chEvtWaitAny(). + */ + chEvtPend(5); + m = chEvtWaitAny(ALL_EVENTS); + test_assert(m == 5, "chEvtWaitAny() error"); + m = chEvtClear(0); + test_assert(m == 0, "stuck event"); + + /* + * Test on chEvtWaitAll(), chEvtRegisterMask() and chEvtUnregister(). + */ + chEvtInit(&es1); + chEvtInit(&es2); + chEvtRegisterMask(&es1, &el1, 1); + chEvtRegisterMask(&es2, &el2, 4); + target_time = chSysGetTime() + MS2ST(50); + threads[0] = chThdCreateStatic(wa[0], WA_SIZE, chThdGetPriority()-1, thread, "A"); + m = chEvtWaitAll(5); + test_assert_time_window(target_time, target_time + ALLOWED_DELAY); + m = chEvtClear(0); + test_assert(m == 0, "stuck event"); + + test_wait_threads(); + chEvtUnregister(&es1, &el1); + chEvtUnregister(&es2, &el2); + test_assert(!chEvtIsListening(&es1), "stuck listener"); + test_assert(!chEvtIsListening(&es2), "stuck listener"); +} + +const struct testcase testevt1 = { + evt1_gettest, + evt1_setup, + evt1_teardown, + evt1_execute +}; + +#endif /* CH_USE_EVENTS */ diff --git a/test/testevt.h b/test/testevt.h new file mode 100644 index 000000000..5c66d5924 --- /dev/null +++ b/test/testevt.h @@ -0,0 +1,25 @@ +/* + ChibiOS/RT - Copyright (C) 2006-2007 Giovanni Di Sirio. + + This file is part of ChibiOS/RT. + + ChibiOS/RT is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 3 of the License, or + (at your option) any later version. + + ChibiOS/RT is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see . +*/ + +#ifndef _TESTEVT_H_ +#define _TESTEVT_H_ + +extern const struct testcase testevt1; + +#endif /* _TESTEVT_H_ */ -- cgit v1.2.3 From 436aa85ab1c30168d6cdd64de2a4eb1ca9fee534 Mon Sep 17 00:00:00 2001 From: gdisirio Date: Sat, 13 Dec 2008 09:55:16 +0000 Subject: git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@539 35acf78f-673a-0410-8e92-d51de3d6d3f4 --- test/test.h | 2 ++ 1 file changed, 2 insertions(+) (limited to 'test') diff --git a/test/test.h b/test/test.h index fe850faf1..1ba3f0316 100644 --- a/test/test.h +++ b/test/test.h @@ -26,6 +26,8 @@ #if defined(CH_ARCHITECTURE_AVR) || defined(CH_ARCHITECTURE_MSP430) #define THREADS_STACK_SIZE 64 +#elif defined(CH_ARCHITECTURE_WIN32SIM) +#define THREADS_STACK_SIZE 512 #else #define THREADS_STACK_SIZE 128 #endif -- cgit v1.2.3 From 3e9765e2069a9faedff2721a1abf46607cf1189d Mon Sep 17 00:00:00 2001 From: gdisirio Date: Sun, 28 Dec 2008 10:07:46 +0000 Subject: git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@545 35acf78f-673a-0410-8e92-d51de3d6d3f4 --- test/testbmk.c | 28 ++++++++++++++-------------- test/testcond.c | 20 ++++++++++---------- 2 files changed, 24 insertions(+), 24 deletions(-) (limited to 'test') diff --git a/test/testbmk.c b/test/testbmk.c index 19775a2d3..3fe32df00 100644 --- a/test/testbmk.c +++ b/test/testbmk.c @@ -59,7 +59,7 @@ static char *bmk1_gettest(void) { static void bmk1_execute(void) { uint32_t n; - threads[0] = chThdCreateFast(chThdGetPriority()-1, wa[0], WA_SIZE, thread1); + threads[0] = chThdCreateStatic(wa[0], WA_SIZE, chThdGetPriority()-1, thread1, NULL); n = msg_loop_test(threads[0]); chThdTerminate(threads[0]); test_wait_threads(); @@ -85,7 +85,7 @@ static char *bmk2_gettest(void) { static void bmk2_execute(void) { uint32_t n; - threads[0] = chThdCreateFast(chThdGetPriority()+1, wa[0], WA_SIZE, thread1); + threads[0] = chThdCreateStatic(wa[0], WA_SIZE, chThdGetPriority()+1, thread1, NULL); n = msg_loop_test(threads[0]); chThdTerminate(threads[0]); test_wait_threads(); @@ -116,11 +116,11 @@ static char *bmk3_gettest(void) { static void bmk3_execute(void) { uint32_t n; - threads[0] = chThdCreateFast(chThdGetPriority()+1, wa[0], WA_SIZE, thread1); - threads[1] = chThdCreateFast(chThdGetPriority()-2, wa[1], WA_SIZE, thread2); - threads[2] = chThdCreateFast(chThdGetPriority()-3, wa[2], WA_SIZE, thread2); - threads[3] = chThdCreateFast(chThdGetPriority()-4, wa[3], WA_SIZE, thread2); - threads[4] = chThdCreateFast(chThdGetPriority()-5, wa[4], WA_SIZE, thread2); + threads[0] = chThdCreateStatic(wa[0], WA_SIZE, chThdGetPriority()+1, thread1, NULL); + threads[1] = chThdCreateStatic(wa[1], WA_SIZE, chThdGetPriority()-2, thread2, NULL); + threads[2] = chThdCreateStatic(wa[2], WA_SIZE, chThdGetPriority()-3, thread2, NULL); + threads[3] = chThdCreateStatic(wa[3], WA_SIZE, chThdGetPriority()-4, thread2, NULL); + threads[4] = chThdCreateStatic(wa[4], WA_SIZE, chThdGetPriority()-5, thread2, NULL); n = msg_loop_test(threads[0]); chThdTerminate(threads[0]); test_wait_threads(); @@ -151,7 +151,7 @@ static void bmk4_execute(void) { test_wait_tick(); test_start_timer(1000); do { - chThdWait(chThdCreateFast(prio, wap, WA_SIZE, thread2)); + chThdWait(chThdCreateStatic(wap, WA_SIZE, prio, thread2, NULL)); n++; #if defined(WIN32) ChkIntSources(); @@ -182,7 +182,7 @@ static void bmk5_execute(void) { test_wait_tick(); test_start_timer(1000); do { - chThdCreateFast(prio, wap, WA_SIZE, thread2); + chThdCreateStatic(wap, WA_SIZE, prio, thread2, NULL); n++; #if defined(WIN32) ChkIntSources(); @@ -220,11 +220,11 @@ static void bmk6_setup(void) { static void bmk6_execute(void) { uint32_t n; - threads[0] = chThdCreateFast(chThdGetPriority()+1, wa[0], WA_SIZE, thread3); - threads[1] = chThdCreateFast(chThdGetPriority()+2, wa[1], WA_SIZE, thread3); - threads[2] = chThdCreateFast(chThdGetPriority()+3, wa[2], WA_SIZE, thread3); - threads[3] = chThdCreateFast(chThdGetPriority()+4, wa[3], WA_SIZE, thread3); - threads[4] = chThdCreateFast(chThdGetPriority()+5, wa[4], WA_SIZE, thread3); + threads[0] = chThdCreateStatic(wa[0], WA_SIZE, chThdGetPriority()+1, thread3, NULL); + threads[1] = chThdCreateStatic(wa[1], WA_SIZE, chThdGetPriority()+2, thread3, NULL); + threads[2] = chThdCreateStatic(wa[2], WA_SIZE, chThdGetPriority()+3, thread3, NULL); + threads[3] = chThdCreateStatic(wa[3], WA_SIZE, chThdGetPriority()+4, thread3, NULL); + threads[4] = chThdCreateStatic(wa[4], WA_SIZE, chThdGetPriority()+5, thread3, NULL); n = 0; test_wait_tick(); diff --git a/test/testcond.c b/test/testcond.c index e202a0d15..cbc304270 100644 --- a/test/testcond.c +++ b/test/testcond.c @@ -53,11 +53,11 @@ static void cond1_execute(void) { // Bacause priority inheritance. tprio_t prio = chThdGetPriority(); - threads[0] = chThdCreate(prio+1, 0, wa[0], WA_SIZE, thread1, "E"); - threads[1] = chThdCreate(prio+2, 0, wa[1], WA_SIZE, thread1, "D"); - threads[2] = chThdCreate(prio+3, 0, wa[2], WA_SIZE, thread1, "C"); - threads[3] = chThdCreate(prio+4, 0, wa[3], WA_SIZE, thread1, "B"); - threads[4] = chThdCreate(prio+5, 0, wa[4], WA_SIZE, thread1, "A"); + threads[0] = chThdCreateStatic(wa[0], WA_SIZE, prio+1, thread1, "E"); + threads[1] = chThdCreateStatic(wa[1], WA_SIZE, prio+2, thread1, "D"); + threads[2] = chThdCreateStatic(wa[2], WA_SIZE, prio+3, thread1, "C"); + threads[3] = chThdCreateStatic(wa[3], WA_SIZE, prio+4, thread1, "B"); + threads[4] = chThdCreateStatic(wa[4], WA_SIZE, prio+5, thread1, "A"); test_assert(prio == chThdGetPriority(), "priority return failure"); chCondSignal(&c1); chCondSignal(&c1); @@ -84,11 +84,11 @@ static void cond2_execute(void) { // Bacause priority inheritance. tprio_t prio = chThdGetPriority(); - threads[0] = chThdCreate(prio+1, 0, wa[0], WA_SIZE, thread1, "E"); - threads[1] = chThdCreate(prio+2, 0, wa[1], WA_SIZE, thread1, "D"); - threads[2] = chThdCreate(prio+3, 0, wa[2], WA_SIZE, thread1, "C"); - threads[3] = chThdCreate(prio+4, 0, wa[3], WA_SIZE, thread1, "B"); - threads[4] = chThdCreate(prio+5, 0, wa[4], WA_SIZE, thread1, "A"); + threads[0] = chThdCreateStatic(wa[0], WA_SIZE, prio+1, thread1, "E"); + threads[1] = chThdCreateStatic(wa[1], WA_SIZE, prio+2, thread1, "D"); + threads[2] = chThdCreateStatic(wa[2], WA_SIZE, prio+3, thread1, "C"); + threads[3] = chThdCreateStatic(wa[3], WA_SIZE, prio+4, thread1, "B"); + threads[4] = chThdCreateStatic(wa[4], WA_SIZE, prio+5, thread1, "A"); test_assert(prio == chThdGetPriority(), "priority return failure"); chCondBroadcast(&c1); test_wait_threads(); -- cgit v1.2.3 From aa2eb80fdb2e4e3b6eedacb8426e40db255cbe68 Mon Sep 17 00:00:00 2001 From: gdisirio Date: Mon, 29 Dec 2008 12:12:53 +0000 Subject: git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@558 35acf78f-673a-0410-8e92-d51de3d6d3f4 --- test/test.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'test') diff --git a/test/test.h b/test/test.h index 1ba3f0316..4c6de614a 100644 --- a/test/test.h +++ b/test/test.h @@ -25,7 +25,7 @@ #define DELAY_BETWEEN_TESTS 200 #if defined(CH_ARCHITECTURE_AVR) || defined(CH_ARCHITECTURE_MSP430) -#define THREADS_STACK_SIZE 64 +#define THREADS_STACK_SIZE 48 #elif defined(CH_ARCHITECTURE_WIN32SIM) #define THREADS_STACK_SIZE 512 #else -- cgit v1.2.3 From 4d2e568b56607bb166c4d2dd004b1c9970c2879f Mon Sep 17 00:00:00 2001 From: gdisirio Date: Tue, 20 Jan 2009 20:11:02 +0000 Subject: git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@650 35acf78f-673a-0410-8e92-d51de3d6d3f4 --- test/testsem.c | 1 + 1 file changed, 1 insertion(+) (limited to 'test') diff --git a/test/testsem.c b/test/testsem.c index 72ed6126f..e7992d6a2 100644 --- a/test/testsem.c +++ b/test/testsem.c @@ -92,6 +92,7 @@ static void sem2_execute(void) { test_emit_token('A' + i); chSemWaitTimeout(&sem1, MS2ST(500)); } + test_assert(chSemGetCounter(&sem1) == 0, "non zero counter"); test_assert_sequence("ABCDE"); test_assert_time_window(target_time, target_time + ALLOWED_DELAY); } -- cgit v1.2.3 From 12721da8ad78b13eff38169f59ebbc4db97bfd2b Mon Sep 17 00:00:00 2001 From: gdisirio Date: Wed, 21 Jan 2009 09:31:39 +0000 Subject: git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@654 35acf78f-673a-0410-8e92-d51de3d6d3f4 --- test/testsem.c | 2 ++ 1 file changed, 2 insertions(+) (limited to 'test') diff --git a/test/testsem.c b/test/testsem.c index e7992d6a2..c9361a0bb 100644 --- a/test/testsem.c +++ b/test/testsem.c @@ -91,6 +91,8 @@ static void sem2_execute(void) { for (i = 0; i < 5; i++) { test_emit_token('A' + i); chSemWaitTimeout(&sem1, MS2ST(500)); + test_assert(isempty(&sem1.s_queue), "queue not empty"); + test_assert(&sem1.s_cnt != 0, "counter not zero"); } test_assert(chSemGetCounter(&sem1) == 0, "non zero counter"); test_assert_sequence("ABCDE"); -- cgit v1.2.3 From 22fe505a817d26c5b88dae4f602b658498a8a18e Mon Sep 17 00:00:00 2001 From: gdisirio Date: Wed, 21 Jan 2009 11:32:31 +0000 Subject: git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@655 35acf78f-673a-0410-8e92-d51de3d6d3f4 --- test/testsem.c | 1 - 1 file changed, 1 deletion(-) (limited to 'test') diff --git a/test/testsem.c b/test/testsem.c index c9361a0bb..1ec0a7a13 100644 --- a/test/testsem.c +++ b/test/testsem.c @@ -94,7 +94,6 @@ static void sem2_execute(void) { test_assert(isempty(&sem1.s_queue), "queue not empty"); test_assert(&sem1.s_cnt != 0, "counter not zero"); } - test_assert(chSemGetCounter(&sem1) == 0, "non zero counter"); test_assert_sequence("ABCDE"); test_assert_time_window(target_time, target_time + ALLOWED_DELAY); } -- cgit v1.2.3 From 87805ba16625d490475be626372a87d7c53e700c Mon Sep 17 00:00:00 2001 From: gdisirio Date: Thu, 5 Feb 2009 22:23:16 +0000 Subject: git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@724 35acf78f-673a-0410-8e92-d51de3d6d3f4 --- test/testmtx.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'test') diff --git a/test/testmtx.c b/test/testmtx.c index 4d8df7d02..52c756436 100644 --- a/test/testmtx.c +++ b/test/testmtx.c @@ -50,7 +50,7 @@ static msg_t thread1(void *p) { static void mtx1_execute(void) { - tprio_t prio = chThdGetPriority(); // Bacause priority inheritance. + tprio_t prio = chThdGetPriority(); // Because priority inheritance. chMtxLock(&m1); threads[0] = chThdCreateStatic(wa[0], WA_SIZE, prio+1, thread1, "E"); threads[1] = chThdCreateStatic(wa[1], WA_SIZE, prio+2, thread1, "D"); -- cgit v1.2.3 From 330944e658f7a74a58d0d3157af3cafa1feaa3ea Mon Sep 17 00:00:00 2001 From: gdisirio Date: Sat, 7 Feb 2009 19:14:15 +0000 Subject: git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@742 35acf78f-673a-0410-8e92-d51de3d6d3f4 --- test/test.c | 18 +++++++++--------- test/testcond.c | 2 +- test/testdyn.c | 6 +++--- test/testevt.c | 2 +- test/testheap.c | 2 +- test/testmtx.c | 2 +- test/testpools.c | 2 +- test/testsem.c | 2 +- 8 files changed, 18 insertions(+), 18 deletions(-) (limited to 'test') diff --git a/test/test.c b/test/test.c index 83be7410a..5300bce88 100644 --- a/test/test.c +++ b/test/test.c @@ -37,35 +37,35 @@ static const struct testcase *tests[] = { &testrdy1, &testrdy2, -#ifdef CH_USE_SEMAPHORES +#if CH_USE_SEMAPHORES &testsem1, &testsem2, #endif -#ifdef CH_USE_MUTEXES +#if CH_USE_MUTEXES &testmtx1, &testmtx2, &testmtx3, -#ifdef CH_USE_CONDVARS +#if CH_USE_CONDVARS &testcond1, &testcond2, #endif #endif -#ifdef CH_USE_MESSAGES +#if CH_USE_MESSAGES &testmsg1, #endif -#ifdef CH_USE_EVENTS +#if CH_USE_EVENTS &testevt1, #endif -#ifdef CH_USE_HEAP +#if CH_USE_HEAP &testheap1, #endif -#ifdef CH_USE_MEMPOOLS +#if CH_USE_MEMPOOLS &testpools1, #endif -#if defined(CH_USE_DYNAMIC) && defined(CH_USE_HEAP) +#if CH_USE_DYNAMIC && CH_USE_HEAP &testdyn1, #endif -#if defined(CH_USE_DYNAMIC) && defined(CH_USE_MEMPOOLS) +#if CH_USE_DYNAMIC && CH_USE_MEMPOOLS &testdyn2, #endif &testbmk1, diff --git a/test/testcond.c b/test/testcond.c index cbc304270..f6f390044 100644 --- a/test/testcond.c +++ b/test/testcond.c @@ -21,7 +21,7 @@ #include "test.h" -#if defined(CH_USE_CONDVARS) && defined(CH_USE_MUTEXES) +#if CH_USE_CONDVARS && CH_USE_MUTEXES static Mutex m1; static CondVar c1; diff --git a/test/testdyn.c b/test/testdyn.c index 37b6b9bc4..f59cdaa14 100644 --- a/test/testdyn.c +++ b/test/testdyn.c @@ -21,7 +21,7 @@ #include "test.h" -#ifdef CH_USE_DYNAMIC +#if CH_USE_DYNAMIC static msg_t thread(void *p) { @@ -29,7 +29,7 @@ static msg_t thread(void *p) { return 0; } -#ifdef CH_USE_HEAP +#if CH_USE_HEAP static char *dyn1_gettest(void) { return "Dynamic APIs, threads creation from heap"; @@ -78,7 +78,7 @@ const struct testcase testdyn1 = { }; #endif /* CH_USE_HEAP */ -#ifdef CH_USE_MEMPOOLS +#if CH_USE_MEMPOOLS static MemoryPool mp1; static char *dyn2_gettest(void) { diff --git a/test/testevt.c b/test/testevt.c index 28e54cbf6..706953dd6 100644 --- a/test/testevt.c +++ b/test/testevt.c @@ -21,7 +21,7 @@ #include "test.h" -#ifdef CH_USE_EVENTS +#if CH_USE_EVENTS #define ALLOWED_DELAY MS2ST(5) diff --git a/test/testheap.c b/test/testheap.c index b6468b6be..e9907baba 100644 --- a/test/testheap.c +++ b/test/testheap.c @@ -21,7 +21,7 @@ #include "test.h" -#ifdef CH_USE_HEAP +#if CH_USE_HEAP #define SIZE 16 diff --git a/test/testmtx.c b/test/testmtx.c index 52c756436..7675f3f7c 100644 --- a/test/testmtx.c +++ b/test/testmtx.c @@ -21,7 +21,7 @@ #include "test.h" -#ifdef CH_USE_MUTEXES +#if CH_USE_MUTEXES #define ALLOWED_DELAY 5 diff --git a/test/testpools.c b/test/testpools.c index d3f451c73..2165c39d1 100644 --- a/test/testpools.c +++ b/test/testpools.c @@ -21,7 +21,7 @@ #include "test.h" -#ifdef CH_USE_MEMPOOLS +#if CH_USE_MEMPOOLS static MemoryPool mp1; diff --git a/test/testsem.c b/test/testsem.c index 1ec0a7a13..c16bb0e68 100644 --- a/test/testsem.c +++ b/test/testsem.c @@ -21,7 +21,7 @@ #include "test.h" -#ifdef CH_USE_SEMAPHORES +#if CH_USE_SEMAPHORES #define ALLOWED_DELAY MS2ST(5) -- cgit v1.2.3 From 50708b39516b77397dc76195ab963aa5909e48b0 Mon Sep 17 00:00:00 2001 From: gdisirio Date: Sat, 14 Feb 2009 16:17:07 +0000 Subject: git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@764 35acf78f-673a-0410-8e92-d51de3d6d3f4 --- test/test.mk | 3 +++ 1 file changed, 3 insertions(+) (limited to 'test') diff --git a/test/test.mk b/test/test.mk index 9677d21dc..100b3d0ed 100644 --- a/test/test.mk +++ b/test/test.mk @@ -3,3 +3,6 @@ TESTSRC = ../../test/test.c ../../test/testrdy.c ../../test/testsem.c \ ../../test/testmtx.c ../../test/testcond.c ../../test/testmsg.c \ ../../test/testevt.c ../../test/testheap.c ../../test/testpools.c \ ../../test/testdyn.c ../../test/testbmk.c + +# Required include directories +TESTINC = ../../test -- cgit v1.2.3 From dd85cc143d987851bc7cc995cf6109136a16b930 Mon Sep 17 00:00:00 2001 From: gdisirio Date: Mon, 16 Feb 2009 18:22:49 +0000 Subject: git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@773 35acf78f-673a-0410-8e92-d51de3d6d3f4 --- test/test.c | 107 ++++++++++++++++++++++--------------------------------- test/test.h | 9 ++++- test/testbmk.c | 49 ++++++++++++++++--------- test/testbmk.h | 4 +-- test/testcond.c | 22 ++++++++---- test/testcond.h | 3 +- test/testdyn.c | 30 +++++++++------- test/testdyn.h | 2 +- test/testevt.c | 15 +++++--- test/testevt.h | 2 +- test/testheap.c | 20 ++++++----- test/testheap.h | 2 +- test/testmsg.c | 24 ++++++++----- test/testmsg.h | 2 +- test/testmtx.c | 27 +++++++------- test/testmtx.h | 2 +- test/testpools.c | 15 +++++--- test/testpools.h | 2 +- test/testrdy.c | 29 +++++++-------- test/testrdy.h | 2 +- test/testsem.c | 26 +++++++++----- test/testsem.h | 2 +- 22 files changed, 220 insertions(+), 176 deletions(-) (limited to 'test') diff --git a/test/test.c b/test/test.c index 5300bce88..9574a0f0e 100644 --- a/test/test.c +++ b/test/test.c @@ -32,50 +32,19 @@ #include "testbmk.h" /* - * Array of all the test cases. + * Array of all the test patterns. */ -static const struct testcase *tests[] = { - &testrdy1, - &testrdy2, -#if CH_USE_SEMAPHORES - &testsem1, - &testsem2, -#endif -#if CH_USE_MUTEXES - &testmtx1, - &testmtx2, - &testmtx3, -#if CH_USE_CONDVARS - &testcond1, - &testcond2, -#endif -#endif -#if CH_USE_MESSAGES - &testmsg1, -#endif -#if CH_USE_EVENTS - &testevt1, -#endif -#if CH_USE_HEAP - &testheap1, -#endif -#if CH_USE_MEMPOOLS - &testpools1, -#endif -#if CH_USE_DYNAMIC && CH_USE_HEAP - &testdyn1, -#endif -#if CH_USE_DYNAMIC && CH_USE_MEMPOOLS - &testdyn2, -#endif - &testbmk1, - &testbmk2, - &testbmk3, - &testbmk4, - &testbmk5, - &testbmk6, - &testbmk7, - &testbmk8, +static const struct testcase **patterns[] = { + patternrdy, + patternsem, + patternmtx, + patterncond, + patternmsg, + patternevt, + patternheap, + patternpools, + patterndyn, + patternbmk, NULL }; @@ -248,13 +217,15 @@ static void execute_test(const struct testcase *tcp) { for (i = 0; i < MAX_THREADS; i++) threads[i] = NULL; - tcp->setup(); + if (tcp->setup != NULL) + tcp->setup(); tcp->execute(); - tcp->teardown(); + if (tcp->teardown != NULL) + tcp->teardown(); } msg_t TestThread(void *p) { - int i; + int i, j; comp = p; test_println(""); @@ -265,29 +236,35 @@ msg_t TestThread(void *p) { global_fail = FALSE; i = 0; - while (tests[i]) { + while (patterns[i]) { #if DELAY_BETWEEN_TESTS > 0 - chThdSleepMilliseconds(DELAY_BETWEEN_TESTS); + chThdSleepMilliseconds(DELAY_BETWEEN_TESTS); #endif - test_println("---------------------------------------------------------------------------"); - test_print("--- Test Case "); - test_printn(i + 1); - test_print(" ("); - test_print(tests[i]->gettest()); - test_println(")"); - execute_test(tests[i]); - if (local_fail) { - test_print("--- Result: FAIL ("); - if (failmsg) - test_print(failmsg); - else { - test_print("sequence error: "); - print_tokens(); - } + j = 0; + while (patterns[i][j]) { + test_println("---------------------------------------------------------------------------"); + test_print("--- Test Case "); + test_printn(i + 1); + test_print("."); + test_printn(j + 1); + test_print(" ("); + test_print(patterns[i][j]->gettest()); test_println(")"); + execute_test(patterns[i][j]); + if (local_fail) { + test_print("--- Result: FAIL ("); + if (failmsg) + test_print(failmsg); + else { + test_print("sequence error: "); + print_tokens(); + } + test_println(")"); + } + else + test_println("--- Result: SUCCESS"); + j++; } - else - test_println("--- Result: SUCCESS"); i++; } test_println("---------------------------------------------------------------------------"); diff --git a/test/test.h b/test/test.h index 4c6de614a..a0acbd1f7 100644 --- a/test/test.h +++ b/test/test.h @@ -20,9 +20,16 @@ #ifndef _TEST_H_ #define _TEST_H_ +#ifndef DELAY_BETWEEN_TESTS +#define DELAY_BETWEEN_TESTS 200 +#endif + +#ifndef TEST_NO_BENCHMARKS +#define TEST_NO_BENCHMARKS FALSE +#endif + #define MAX_THREADS 5 #define MAX_TOKENS 16 -#define DELAY_BETWEEN_TESTS 200 #if defined(CH_ARCHITECTURE_AVR) || defined(CH_ARCHITECTURE_MSP430) #define THREADS_STACK_SIZE 48 diff --git a/test/testbmk.c b/test/testbmk.c index 3fe32df00..f6dc58f20 100644 --- a/test/testbmk.c +++ b/test/testbmk.c @@ -23,8 +23,6 @@ static Semaphore sem1; -static void empty(void) {} - static msg_t thread1(void *p) { msg_t msg; @@ -72,8 +70,8 @@ static void bmk1_execute(void) { const struct testcase testbmk1 = { bmk1_gettest, - empty, - empty, + NULL, + NULL, bmk1_execute }; @@ -98,8 +96,8 @@ static void bmk2_execute(void) { const struct testcase testbmk2 = { bmk2_gettest, - empty, - empty, + NULL, + NULL, bmk2_execute }; @@ -133,8 +131,8 @@ static void bmk3_execute(void) { const struct testcase testbmk3 = { bmk3_gettest, - empty, - empty, + NULL, + NULL, bmk3_execute }; @@ -164,8 +162,8 @@ static void bmk4_execute(void) { const struct testcase testbmk4 = { bmk4_gettest, - empty, - empty, + NULL, + NULL, bmk4_execute }; @@ -195,8 +193,8 @@ static void bmk5_execute(void) { const struct testcase testbmk5 = { bmk5_gettest, - empty, - empty, + NULL, + NULL, bmk5_execute }; @@ -250,7 +248,7 @@ static void bmk6_execute(void) { const struct testcase testbmk6 = { bmk6_gettest, bmk6_setup, - empty, + NULL, bmk6_execute }; @@ -288,8 +286,8 @@ static void bmk7_execute(void) { const struct testcase testbmk7 = { bmk7_gettest, - empty, - empty, + NULL, + NULL, bmk7_execute }; @@ -325,7 +323,24 @@ static void bmk8_execute(void) { const struct testcase testbmk8 = { bmk8_gettest, - empty, - empty, + NULL, + NULL, bmk8_execute }; + +/* + * Test sequence for benchmarks pattern. + */ +const struct testcase *patternbmk[] = { +#if TEST_NO_BENCHMARKS + &testbmk1, + &testbmk2, + &testbmk3, + &testbmk4, + &testbmk5, + &testbmk6, + &testbmk7, + &testbmk8, +#endif + NULL +}; diff --git a/test/testbmk.h b/test/testbmk.h index afa3381e4..f5e269f31 100644 --- a/test/testbmk.h +++ b/test/testbmk.h @@ -20,8 +20,6 @@ #ifndef _TESTBMK_H_ #define _TESTBMK_H_ -extern const struct testcase testbmk1, testbmk2, testbmk3, - testbmk4, testbmk5, testbmk6, - testbmk7, testbmk8; +extern const struct testcase *patternbmk[]; #endif /* _TESTBMK_H_ */ diff --git a/test/testcond.c b/test/testcond.c index f6f390044..2771b5202 100644 --- a/test/testcond.c +++ b/test/testcond.c @@ -37,9 +37,6 @@ static void cond1_setup(void) { chMtxInit(&m1); } -static void cond1_teardown(void) { -} - static msg_t thread1(void *p) { chMtxLock(&m1); @@ -71,7 +68,7 @@ static void cond1_execute(void) { const struct testcase testcond1 = { cond1_gettest, cond1_setup, - cond1_teardown, + NULL, cond1_execute }; @@ -97,9 +94,20 @@ static void cond2_execute(void) { const struct testcase testcond2 = { cond2_gettest, - cond1_setup, - cond1_teardown, + NULL, + NULL, cond2_execute }; -#endif /* defined(CH_USE_CONDVARS) && defined(CH_USE_MUTEXES) */ +#endif /* CH_USE_CONDVARS && CH_USE_MUTEXES */ + +/* + * Test sequence for condvars pattern. + */ +const struct testcase *patterncond[] = { +#if CH_USE_CONDVARS && CH_USE_MUTEXES + &testcond1, + &testcond2, +#endif + NULL +}; diff --git a/test/testcond.h b/test/testcond.h index 8e6f286b1..b07aa804e 100644 --- a/test/testcond.h +++ b/test/testcond.h @@ -20,7 +20,6 @@ #ifndef _TESTCOND_H_ #define _TESTCOND_H_ -extern const struct testcase testcond1; -extern const struct testcase testcond2; +extern const struct testcase *patterncond[]; #endif /* _TESTCOND_H_ */ diff --git a/test/testdyn.c b/test/testdyn.c index f59cdaa14..07b07594c 100644 --- a/test/testdyn.c +++ b/test/testdyn.c @@ -35,12 +35,6 @@ static char *dyn1_gettest(void) { return "Dynamic APIs, threads creation from heap"; } -static void dyn1_setup(void) { -} - -static void dyn1_teardown(void) { -} - static void dyn1_execute(void) { size_t n, sz; tprio_t prio = chThdGetPriority(); @@ -72,8 +66,8 @@ static void dyn1_execute(void) { const struct testcase testdyn1 = { dyn1_gettest, - dyn1_setup, - dyn1_teardown, + NULL, + NULL, dyn1_execute }; #endif /* CH_USE_HEAP */ @@ -91,9 +85,6 @@ static void dyn2_setup(void) { chPoolInit(&mp1, THD_WA_SIZE(THREADS_STACK_SIZE)); } -static void dyn2_teardown(void) { -} - static void dyn2_execute(void) { int i; tprio_t prio = chThdGetPriority(); @@ -129,9 +120,24 @@ static void dyn2_execute(void) { const struct testcase testdyn2 = { dyn2_gettest, dyn2_setup, - dyn2_teardown, + NULL, dyn2_execute }; #endif /* CH_USE_MEMPOOLS */ #endif /* CH_USE_DYNAMIC */ + +/* + * Test sequence for dynamic APIs pattern. + */ +const struct testcase *patterndyn[] = { +#if CH_USE_DYNAMIC +#if CH_USE_HEAP + &testdyn1, +#endif +#if CH_USE_MEMPOOLS + &testdyn2, +#endif +#endif + NULL +}; diff --git a/test/testdyn.h b/test/testdyn.h index bb2a396bb..d209c9f71 100644 --- a/test/testdyn.h +++ b/test/testdyn.h @@ -20,6 +20,6 @@ #ifndef _TESTDYN_H_ #define _TESTDYN_H_ -extern const struct testcase testdyn1, testdyn2; +extern const struct testcase *patterndyn[]; #endif /* _TESTDYN_H_ */ diff --git a/test/testevt.c b/test/testevt.c index 706953dd6..89c5cf114 100644 --- a/test/testevt.c +++ b/test/testevt.c @@ -37,9 +37,6 @@ static void evt1_setup(void) { chEvtClear(ALL_EVENTS); } -static void evt1_teardown(void) { -} - static msg_t thread(void *p) { chEvtBroadcast(&es1); @@ -97,8 +94,18 @@ static void evt1_execute(void) { const struct testcase testevt1 = { evt1_gettest, evt1_setup, - evt1_teardown, + NULL, evt1_execute }; #endif /* CH_USE_EVENTS */ + +/* + * Test sequence for events pattern. + */ +const struct testcase *patternevt[] = { +#if CH_USE_EVENTS + &testevt1, +#endif + NULL +}; diff --git a/test/testevt.h b/test/testevt.h index 5c66d5924..477b7083e 100644 --- a/test/testevt.h +++ b/test/testevt.h @@ -20,6 +20,6 @@ #ifndef _TESTEVT_H_ #define _TESTEVT_H_ -extern const struct testcase testevt1; +extern const struct testcase *patternevt[]; #endif /* _TESTEVT_H_ */ diff --git a/test/testheap.c b/test/testheap.c index e9907baba..841c084e8 100644 --- a/test/testheap.c +++ b/test/testheap.c @@ -30,12 +30,6 @@ static char *heap1_gettest(void) { return "Heap, allocation and fragmentation test"; } -static void heap1_setup(void) { -} - -static void heap1_teardown(void) { -} - static void heap1_execute(void) { void *p1, *p2, *p3; size_t n, sz; @@ -75,9 +69,19 @@ static void heap1_execute(void) { const struct testcase testheap1 = { heap1_gettest, - heap1_setup, - heap1_teardown, + NULL, + NULL, heap1_execute }; #endif /* CH_USE_HEAP */ + +/* + * Test sequence for heap pattern. + */ +const struct testcase *patternheap[] = { +#if CH_USE_HEAP + &testheap1, +#endif + NULL +}; diff --git a/test/testheap.h b/test/testheap.h index 4fc6d17ce..a310dc40c 100644 --- a/test/testheap.h +++ b/test/testheap.h @@ -20,6 +20,6 @@ #ifndef _TESTHEAP_H_ #define _TESTHEAP_H_ -extern const struct testcase testheap1; +extern const struct testcase *patternheap[]; #endif /* _TESTHEAP_H_ */ diff --git a/test/testmsg.c b/test/testmsg.c index 735375a16..8af1c29e3 100644 --- a/test/testmsg.c +++ b/test/testmsg.c @@ -21,17 +21,13 @@ #include "test.h" +#if CH_USE_MESSAGES + static char *msg1_gettest(void) { return "Messages, dispatch test"; } -static void msg1_setup(void) { -} - -static void msg1_teardown(void) { -} - static msg_t thread(void *p) { msg_t msg; int i; @@ -59,7 +55,19 @@ static void msg1_execute(void) { const struct testcase testmsg1 = { msg1_gettest, - msg1_setup, - msg1_teardown, + NULL, + NULL, msg1_execute }; + +#endif /* CH_USE_MESSAGES */ + +/* + * Test sequence for messages pattern. + */ +const struct testcase *patternmsg[] = { +#if CH_USE_MESSAGES + &testmsg1, +#endif + NULL +}; diff --git a/test/testmsg.h b/test/testmsg.h index 8c9631bb7..c3cadcafa 100644 --- a/test/testmsg.h +++ b/test/testmsg.h @@ -20,6 +20,6 @@ #ifndef _TESTMSG_H_ #define _TESTMSG_H_ -extern const struct testcase testmsg1; +extern const struct testcase *patternmsg[]; #endif /* _TESTMSG_H_ */ diff --git a/test/testmtx.c b/test/testmtx.c index 7675f3f7c..6bef57041 100644 --- a/test/testmtx.c +++ b/test/testmtx.c @@ -37,9 +37,6 @@ static void mtx1_setup(void) { chMtxInit(&m1); } -static void mtx1_teardown(void) { -} - static msg_t thread1(void *p) { chMtxLock(&m1); @@ -66,7 +63,7 @@ static void mtx1_execute(void) { const struct testcase testmtx1 = { mtx1_gettest, mtx1_setup, - mtx1_teardown, + NULL, mtx1_execute }; @@ -80,9 +77,6 @@ static void mtx2_setup(void) { chMtxInit(&m1); } -static void mtx2_teardown(void) { -} - static msg_t thread2(void *p) { chThdSleepMilliseconds(10); @@ -127,7 +121,7 @@ static void mtx2_execute(void) { const struct testcase testmtx2 = { mtx2_gettest, mtx2_setup, - mtx2_teardown, + NULL, mtx2_execute }; @@ -142,9 +136,6 @@ static void mtx3_setup(void) { chMtxInit(&m2); } -static void mtx3_teardown(void) { -} - static msg_t thread5(void *p) { chMtxLock(&m1); @@ -218,8 +209,20 @@ static void mtx3_execute(void) { const struct testcase testmtx3 = { mtx3_gettest, mtx3_setup, - mtx3_teardown, + NULL, mtx3_execute }; #endif /* CH_USE_MUTEXES */ + +/* + * Test sequence for mutexes pattern. + */ +const struct testcase *patternmtx[] = { +#if CH_USE_MUTEXES + &testmtx1, + &testmtx2, + &testmtx3, +#endif + NULL +}; diff --git a/test/testmtx.h b/test/testmtx.h index 068fbc7b8..59c49605b 100644 --- a/test/testmtx.h +++ b/test/testmtx.h @@ -20,6 +20,6 @@ #ifndef _TESTMTX_H_ #define _TESTMTX_H_ -extern const struct testcase testmtx1, testmtx2, testmtx3; +extern const struct testcase *patternmtx[]; #endif /* _TESTMTX_H_ */ diff --git a/test/testpools.c b/test/testpools.c index 2165c39d1..fae7402c3 100644 --- a/test/testpools.c +++ b/test/testpools.c @@ -35,9 +35,6 @@ static void pools1_setup(void) { chPoolInit(&mp1, THD_WA_SIZE(THREADS_STACK_SIZE)); } -static void pools1_teardown(void) { -} - static void pools1_execute(void) { int i; @@ -56,8 +53,18 @@ static void pools1_execute(void) { const struct testcase testpools1 = { pools1_gettest, pools1_setup, - pools1_teardown, + NULL, pools1_execute }; #endif /* CH_USE_MEMPOOLS */ + +/* + * Test sequence for pools pattern. + */ +const struct testcase *patternpools[] = { +#if CH_USE_MEMPOOLS + &testpools1, +#endif + NULL +}; diff --git a/test/testpools.h b/test/testpools.h index 413d1eb76..920e64da2 100644 --- a/test/testpools.h +++ b/test/testpools.h @@ -20,6 +20,6 @@ #ifndef _TESTPOOLS_H_ #define _TESTPOOLS_H_ -extern const struct testcase testpools1; +extern const struct testcase *patternpools[]; #endif /* _TESTPOOLS_H_ */ diff --git a/test/testrdy.c b/test/testrdy.c index a9b52701e..b085fde02 100644 --- a/test/testrdy.c +++ b/test/testrdy.c @@ -32,12 +32,6 @@ static char *rdy1_gettest(void) { return "Ready List, priority enqueuing test #1"; } -static void rdy1_setup(void) { -} - -static void rdy1_teardown(void) { -} - static void rdy1_execute(void) { threads[0] = chThdCreateStatic(wa[0], WA_SIZE, chThdGetPriority()-5, thread, "E"); @@ -51,8 +45,8 @@ static void rdy1_execute(void) { const struct testcase testrdy1 = { rdy1_gettest, - rdy1_setup, - rdy1_teardown, + NULL, + NULL, rdy1_execute }; @@ -61,12 +55,6 @@ static char *rdy2_gettest(void) { return "Ready List, priority enqueuing test #2"; } -static void rdy2_setup(void) { -} - -static void rdy2_teardown(void) { -} - static void rdy2_execute(void) { threads[1] = chThdCreateStatic(wa[1], WA_SIZE, chThdGetPriority()-4, thread, "D"); @@ -80,7 +68,16 @@ static void rdy2_execute(void) { const struct testcase testrdy2 = { rdy2_gettest, - rdy2_setup, - rdy2_teardown, + NULL, + NULL, rdy2_execute }; + +/* + * Test sequence for ready list pattern. + */ +const struct testcase *patternrdy[] = { + &testrdy1, + &testrdy2, + NULL +}; diff --git a/test/testrdy.h b/test/testrdy.h index 68719351f..3be545b1b 100644 --- a/test/testrdy.h +++ b/test/testrdy.h @@ -20,6 +20,6 @@ #ifndef _TESTRDY_H_ #define _TESTRDY_H_ -extern const struct testcase testrdy1, testrdy2; +extern const struct testcase *patternrdy[]; #endif /* _TESTRDY_H_ */ diff --git a/test/testsem.c b/test/testsem.c index c16bb0e68..c582d9531 100644 --- a/test/testsem.c +++ b/test/testsem.c @@ -37,9 +37,6 @@ static void sem1_setup(void) { chSemInit(&sem1, 0); } -static void sem1_teardown(void) { -} - static msg_t thread(void *p) { chSemWait(&sem1); @@ -66,10 +63,11 @@ static void sem1_execute(void) { const struct testcase testsem1 = { sem1_gettest, sem1_setup, - sem1_teardown, + NULL, sem1_execute }; +#if CH_USE_SEMAPHORES_TIMEOUT static char *sem2_gettest(void) { return "Semaphores, timeout test"; @@ -80,9 +78,6 @@ static void sem2_setup(void) { chSemInit(&sem1, 0); } -static void sem2_teardown(void) { -} - static void sem2_execute(void) { int i; systime_t target_time; @@ -101,8 +96,21 @@ static void sem2_execute(void) { const struct testcase testsem2 = { sem2_gettest, sem2_setup, - sem2_teardown, + NULL, sem2_execute }; - +#endif /* CH_USE_SEMAPHORES_TIMEOUT */ #endif /* CH_USE_SEMAPHORES */ + +/* + * Test sequence for semaphores pattern. + */ +const struct testcase *patternsem[] = { +#if CH_USE_SEMAPHORES + &testsem1, +#if CH_USE_SEMAPHORES_TIMEOUT + &testsem2, +#endif +#endif + NULL +}; diff --git a/test/testsem.h b/test/testsem.h index 8bb6b17bf..3bb19d0d9 100644 --- a/test/testsem.h +++ b/test/testsem.h @@ -20,6 +20,6 @@ #ifndef _TESTSEM_H_ #define _TESTSEM_H_ -extern const struct testcase testsem1, testsem2; +extern const struct testcase *patternsem[]; #endif /* _TESTSEM_H_ */ -- cgit v1.2.3 From 0098a8dbed098251e945fe5fb0433532e122a152 Mon Sep 17 00:00:00 2001 From: gdisirio Date: Mon, 16 Feb 2009 20:38:05 +0000 Subject: git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@774 35acf78f-673a-0410-8e92-d51de3d6d3f4 --- test/test.c | 4 ++-- test/testbmk.c | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) (limited to 'test') diff --git a/test/test.c b/test/test.c index 9574a0f0e..ed9b04b91 100644 --- a/test/test.c +++ b/test/test.c @@ -237,11 +237,11 @@ msg_t TestThread(void *p) { global_fail = FALSE; i = 0; while (patterns[i]) { + j = 0; + while (patterns[i][j]) { #if DELAY_BETWEEN_TESTS > 0 chThdSleepMilliseconds(DELAY_BETWEEN_TESTS); #endif - j = 0; - while (patterns[i][j]) { test_println("---------------------------------------------------------------------------"); test_print("--- Test Case "); test_printn(i + 1); diff --git a/test/testbmk.c b/test/testbmk.c index f6dc58f20..c3a69a5b2 100644 --- a/test/testbmk.c +++ b/test/testbmk.c @@ -332,7 +332,7 @@ const struct testcase testbmk8 = { * Test sequence for benchmarks pattern. */ const struct testcase *patternbmk[] = { -#if TEST_NO_BENCHMARKS +#if !TEST_NO_BENCHMARKS &testbmk1, &testbmk2, &testbmk3, -- cgit v1.2.3 From 4c2be4a8e9211f53e3b460de2ad5e9d3e4be70c8 Mon Sep 17 00:00:00 2001 From: gdisirio Date: Wed, 18 Feb 2009 12:58:35 +0000 Subject: git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@781 35acf78f-673a-0410-8e92-d51de3d6d3f4 --- test/test.c | 2 ++ test/test.mk | 4 +-- test/testcond.c | 4 +-- test/testdyn.c | 12 +++---- test/testevt.c | 16 ++++----- test/testheap.c | 6 ++-- test/testmbox.c | 101 +++++++++++++++++++++++++++++++++++++++++++++++++++++++ test/testmbox.h | 25 ++++++++++++++ test/testmtx.c | 2 +- test/testpools.c | 4 +-- test/testsem.c | 4 +-- 11 files changed, 154 insertions(+), 26 deletions(-) create mode 100644 test/testmbox.c create mode 100644 test/testmbox.h (limited to 'test') diff --git a/test/test.c b/test/test.c index ed9b04b91..15e23e79c 100644 --- a/test/test.c +++ b/test/test.c @@ -25,6 +25,7 @@ #include "testmtx.h" #include "testcond.h" #include "testmsg.h" +#include "testmbox.h" #include "testevt.h" #include "testheap.h" #include "testpools.h" @@ -40,6 +41,7 @@ static const struct testcase **patterns[] = { patternmtx, patterncond, patternmsg, + patternmbox, patternevt, patternheap, patternpools, diff --git a/test/test.mk b/test/test.mk index 100b3d0ed..6cce48f2a 100644 --- a/test/test.mk +++ b/test/test.mk @@ -1,8 +1,8 @@ # List of all the ChibiOS/RT test files. TESTSRC = ../../test/test.c ../../test/testrdy.c ../../test/testsem.c \ ../../test/testmtx.c ../../test/testcond.c ../../test/testmsg.c \ - ../../test/testevt.c ../../test/testheap.c ../../test/testpools.c \ - ../../test/testdyn.c ../../test/testbmk.c + ../../test/testmbox.c ../../test/testevt.c ../../test/testheap.c \ + ../../test/testpools.c ../../test/testdyn.c ../../test/testbmk.c # Required include directories TESTINC = ../../test diff --git a/test/testcond.c b/test/testcond.c index 2771b5202..692ec88d2 100644 --- a/test/testcond.c +++ b/test/testcond.c @@ -55,7 +55,7 @@ static void cond1_execute(void) { threads[2] = chThdCreateStatic(wa[2], WA_SIZE, prio+3, thread1, "C"); threads[3] = chThdCreateStatic(wa[3], WA_SIZE, prio+4, thread1, "B"); threads[4] = chThdCreateStatic(wa[4], WA_SIZE, prio+5, thread1, "A"); - test_assert(prio == chThdGetPriority(), "priority return failure"); + test_assert(prio == chThdGetPriority(), "#1"); /* Priority return failure.*/ chCondSignal(&c1); chCondSignal(&c1); chCondSignal(&c1); @@ -86,7 +86,7 @@ static void cond2_execute(void) { threads[2] = chThdCreateStatic(wa[2], WA_SIZE, prio+3, thread1, "C"); threads[3] = chThdCreateStatic(wa[3], WA_SIZE, prio+4, thread1, "B"); threads[4] = chThdCreateStatic(wa[4], WA_SIZE, prio+5, thread1, "A"); - test_assert(prio == chThdGetPriority(), "priority return failure"); + test_assert(prio == chThdGetPriority(), "#1"); /* Priority return failure.*/ chCondBroadcast(&c1); test_wait_threads(); test_assert_sequence("ABCDE"); diff --git a/test/testdyn.c b/test/testdyn.c index 07b07594c..775e3c795 100644 --- a/test/testdyn.c +++ b/test/testdyn.c @@ -52,15 +52,15 @@ static void dyn1_execute(void) { (threads[2] == NULL) && (threads[3] == NULL) && (threads[4] == NULL), - "thread creation failed"); + "#1"); /* Thread creation failed.*/ /* Claiming the memory from terminated threads. */ test_wait_threads(); test_assert_sequence("AB"); /* Heap status checked again.*/ - test_assert(chHeapStatus(&n) == 1, "heap fragmented"); - test_assert(n == sz, "heap size changed"); + test_assert(chHeapStatus(&n) == 1, "#2"); /* Heap fragmented.*/ + test_assert(n == sz, "#3"); /* Heap size changed.*/ } } @@ -105,7 +105,7 @@ static void dyn2_execute(void) { (threads[2] != NULL) && (threads[3] != NULL) && (threads[4] != NULL), - "thread creation failed"); + "#1"); /* Thread creation failed.*/ /* Claiming the memory from terminated threads. */ test_wait_threads(); @@ -113,8 +113,8 @@ static void dyn2_execute(void) { /* Now the pool must be full again. */ for (i = 0; i < 5; i++) - test_assert(chPoolAlloc(&mp1) != NULL, "pool list empty"); - test_assert(chPoolAlloc(&mp1) == NULL, "pool list not empty"); + test_assert(chPoolAlloc(&mp1) != NULL, "#2"); /* Pool list empty.*/ + test_assert(chPoolAlloc(&mp1) == NULL, "#3"); /* Pool list not empty.*/ } const struct testcase testdyn2 = { diff --git a/test/testevt.c b/test/testevt.c index 89c5cf114..7af8b7b73 100644 --- a/test/testevt.c +++ b/test/testevt.c @@ -55,20 +55,20 @@ static void evt1_execute(void) { */ chEvtPend(5); m = chEvtWaitOne(ALL_EVENTS); - test_assert(m == 1, "chEvtWaitOne() error"); + test_assert(m == 1, "#1"); /* Single bit error.*/ m = chEvtWaitOne(ALL_EVENTS); - test_assert(m == 4, "chEvtWaitOne() error"); + test_assert(m == 4, "#2"); /* Single bit error.*/ m = chEvtClear(0); - test_assert(m == 0, "stuck event"); + test_assert(m == 0, "#3"); /* Stuck event.*/ /* * Test on chEvtWaitAny(). */ chEvtPend(5); m = chEvtWaitAny(ALL_EVENTS); - test_assert(m == 5, "chEvtWaitAny() error"); + test_assert(m == 5, "#4"); /* Unexpected pending.*/ m = chEvtClear(0); - test_assert(m == 0, "stuck event"); + test_assert(m == 0, "#5"); /* Stuck event.*/ /* * Test on chEvtWaitAll(), chEvtRegisterMask() and chEvtUnregister(). @@ -82,13 +82,13 @@ static void evt1_execute(void) { m = chEvtWaitAll(5); test_assert_time_window(target_time, target_time + ALLOWED_DELAY); m = chEvtClear(0); - test_assert(m == 0, "stuck event"); + test_assert(m == 0, "#6"); /* Stuck event.*/ test_wait_threads(); chEvtUnregister(&es1, &el1); chEvtUnregister(&es2, &el2); - test_assert(!chEvtIsListening(&es1), "stuck listener"); - test_assert(!chEvtIsListening(&es2), "stuck listener"); + test_assert(!chEvtIsListening(&es1), "#7"); /* Stuck listener.*/ + test_assert(!chEvtIsListening(&es2), "#8"); /* Stuck listener.*/ } const struct testcase testevt1 = { diff --git a/test/testheap.c b/test/testheap.c index 841c084e8..0a84b7b33 100644 --- a/test/testheap.c +++ b/test/testheap.c @@ -47,7 +47,7 @@ static void heap1_execute(void) { chHeapFree(p1); /* Does not merge */ chHeapFree(p2); /* Merges backward */ chHeapFree(p3); /* Merges both sides */ - test_assert(chHeapStatus(&n) == 1, "heap fragmented #1"); + test_assert(chHeapStatus(&n) == 1, "#1"); /* Heap fragmented.*/ /* Reverse order */ p1 = chHeapAlloc(SIZE); @@ -56,9 +56,9 @@ static void heap1_execute(void) { chHeapFree(p3); /* Merges forward */ chHeapFree(p2); /* Merges forward */ chHeapFree(p1); /* Merges forward */ - test_assert(chHeapStatus(&n) == 1, "heap fragmented #2"); + test_assert(chHeapStatus(&n) == 1, "#2"); /* Heap fragmented.*/ - test_assert(n == sz, "heap size changed"); + test_assert(n == sz, "#3"); /* Heap size changed.*/ } else { test_print("--- Size : "); diff --git a/test/testmbox.c b/test/testmbox.c new file mode 100644 index 000000000..7ab3f6126 --- /dev/null +++ b/test/testmbox.c @@ -0,0 +1,101 @@ +/* + ChibiOS/RT - Copyright (C) 2006-2007 Giovanni Di Sirio. + + This file is part of ChibiOS/RT. + + ChibiOS/RT is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 3 of the License, or + (at your option) any later version. + + ChibiOS/RT is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see . +*/ + +#include + +#include "test.h" + +#if CH_USE_MAILBOXES && CH_USE_SEMAPHORES_TIMEOUT + +#define ALLOWED_DELAY MS2ST(5) +#define MB_SIZE 5 + +static msg_t mb1_buf[MB_SIZE]; +static Mailbox mb1; + +static char *mbox1_gettest(void) { + + return "Mailboxes, queuing and timeouts"; +} + +static void mbox1_setup(void) { + + chMBInit(&mb1, mb1_buf, MB_SIZE); +} + +static void mbox1_execute(void) { + msg_t msg1, msg2; + unsigned i; + + /* Testing initial space.*/ + test_assert(chMBGetEmpty(&mb1) == MB_SIZE, "#1"); + + /* Testing enqueuing.*/ + for (i = 0; i < MB_SIZE - 1; i++) { + msg1 = chMBPost(&mb1, 'B' + i, TIME_INFINITE); + test_assert(msg1 == RDY_OK, "#2"); + } + msg1 = chMBPostAhead(&mb1, 'A', TIME_INFINITE); + test_assert(msg1 == RDY_OK, "#3"); + + /* Testing post timeout.*/ + msg1 = chMBPost(&mb1, 'X', 1); + test_assert(msg1 == RDY_TIMEOUT, "#4"); + + /* Testing final conditions.*/ + test_assert(chMBGetEmpty(&mb1) == 0, "#5"); + test_assert(chMBGetFull(&mb1) == MB_SIZE, "#6"); + test_assert(mb1.mb_rdptr == mb1.mb_wrptr, "#7"); + + /* Testing dequeuing.*/ + for (i = 0; i < MB_SIZE; i++) { + msg1 = chMBFetch(&mb1, &msg2, TIME_INFINITE); + test_assert(msg1 == RDY_OK, "#8"); + test_emit_token(msg2); + } + test_assert_sequence("ABCDE"); + + /* Testing fetch timeout.*/ + msg1 = chMBFetch(&mb1, &msg2, 1); + test_assert(msg1 == RDY_TIMEOUT, "#9"); + + /* Testing final conditions.*/ + test_assert(chMBGetEmpty(&mb1) == MB_SIZE, "#10"); + test_assert(chMBGetFull(&mb1) == 0, "#11"); + test_assert(mb1.mb_rdptr == mb1.mb_wrptr, "#12"); +} + +const struct testcase testmbox1 = { + mbox1_gettest, + mbox1_setup, + NULL, + mbox1_execute +}; + +#endif /* CH_USE_MAILBOXES && CH_USE_SEMAPHORES_TIMEOUT */ + +/* + * Test sequence for mailboxes pattern. + */ +const struct testcase *patternmbox[] = { +#if CH_USE_MAILBOXES && CH_USE_SEMAPHORES_TIMEOUT + &testmbox1, +#endif + NULL +}; diff --git a/test/testmbox.h b/test/testmbox.h new file mode 100644 index 000000000..52cb7ee18 --- /dev/null +++ b/test/testmbox.h @@ -0,0 +1,25 @@ +/* + ChibiOS/RT - Copyright (C) 2006-2007 Giovanni Di Sirio. + + This file is part of ChibiOS/RT. + + ChibiOS/RT is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 3 of the License, or + (at your option) any later version. + + ChibiOS/RT is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see . +*/ + +#ifndef _TESTMBOX_H_ +#define _TESTMBOX_H_ + +extern const struct testcase *patternmbox[]; + +#endif /* _TESTMBOX_H_ */ diff --git a/test/testmtx.c b/test/testmtx.c index 6bef57041..685361bba 100644 --- a/test/testmtx.c +++ b/test/testmtx.c @@ -56,7 +56,7 @@ static void mtx1_execute(void) { threads[4] = chThdCreateStatic(wa[4], WA_SIZE, prio+5, thread1, "A"); chMtxUnlock(); test_wait_threads(); - test_assert(prio == chThdGetPriority(), "priority return failure"); + test_assert(prio == chThdGetPriority(), "#1"); /* Priority return failure.*/ test_assert_sequence("ABCDE"); } diff --git a/test/testpools.c b/test/testpools.c index fae7402c3..759a28c44 100644 --- a/test/testpools.c +++ b/test/testpools.c @@ -44,10 +44,10 @@ static void pools1_execute(void) { /* Empting the pool again. */ for (i = 0; i < MAX_THREADS; i++) - test_assert(chPoolAlloc(&mp1) != NULL, "pool list empty"); + test_assert(chPoolAlloc(&mp1) != NULL, "#1"); /* Pool list empty.*/ /* Now must be empty. */ - test_assert(chPoolAlloc(&mp1) == NULL, "pool list not empty"); + test_assert(chPoolAlloc(&mp1) == NULL, "#2"); /* Pool list not empty.*/ } const struct testcase testpools1 = { diff --git a/test/testsem.c b/test/testsem.c index c582d9531..35e37d965 100644 --- a/test/testsem.c +++ b/test/testsem.c @@ -86,8 +86,8 @@ static void sem2_execute(void) { for (i = 0; i < 5; i++) { test_emit_token('A' + i); chSemWaitTimeout(&sem1, MS2ST(500)); - test_assert(isempty(&sem1.s_queue), "queue not empty"); - test_assert(&sem1.s_cnt != 0, "counter not zero"); + test_assert(isempty(&sem1.s_queue), "#1"); /* Queue not empty */ + test_assert(&sem1.s_cnt != 0, "#2"); /* Counter not zero */ } test_assert_sequence("ABCDE"); test_assert_time_window(target_time, target_time + ALLOWED_DELAY); -- cgit v1.2.3 From eb75c053eb46cbeb4ad9c0b7b179ba1acb20eba4 Mon Sep 17 00:00:00 2001 From: gdisirio Date: Sat, 28 Feb 2009 09:39:02 +0000 Subject: Added new benchmarks about semaphores and mutexes to the test suite. git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@804 35acf78f-673a-0410-8e92-d51de3d6d3f4 --- test/testbmk.c | 89 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 89 insertions(+) (limited to 'test') diff --git a/test/testbmk.c b/test/testbmk.c index c3a69a5b2..10a4ea439 100644 --- a/test/testbmk.c +++ b/test/testbmk.c @@ -22,6 +22,7 @@ #include "test.h" static Semaphore sem1; +static Mutex mtx1; static msg_t thread1(void *p) { msg_t msg; @@ -328,6 +329,90 @@ const struct testcase testbmk8 = { bmk8_execute }; +static char *bmk9_gettest(void) { + + return "Benchmark, semaphores wait/signal"; +} + +static void bmk9_setup(void) { + + chSemInit(&sem1, 1); +} + +static void bmk9_execute(void) { + uint32_t n = 0; + + test_wait_tick(); + test_start_timer(1000); + do { + chSemWait(&sem1); + chSemSignal(&sem1); + chSemWait(&sem1); + chSemSignal(&sem1); + chSemWait(&sem1); + chSemSignal(&sem1); + chSemWait(&sem1); + chSemSignal(&sem1); + n++; +#if defined(WIN32) + ChkIntSources(); +#endif + } while (!test_timer_done); + test_print("--- Score : "); + test_printn(n * 4); + test_println(" wait+signal/S"); +} + +const struct testcase testbmk9 = { + bmk9_gettest, + bmk9_setup, + NULL, + bmk9_execute +}; + +#if CH_USE_MUTEXES +static char *bmk10_gettest(void) { + + return "Benchmark, mutexes lock/unlock"; +} + +static void bmk10_setup(void) { + + chMtxInit(&mtx1); +} + +static void bmk10_execute(void) { + uint32_t n = 0; + + test_wait_tick(); + test_start_timer(1000); + do { + chMtxLock(&mtx1); + chMtxUnlock(); + chMtxLock(&mtx1); + chMtxUnlock(); + chMtxLock(&mtx1); + chMtxUnlock(); + chMtxLock(&mtx1); + chMtxUnlock(); + n++; +#if defined(WIN32) + ChkIntSources(); +#endif + } while (!test_timer_done); + test_print("--- Score : "); + test_printn(n * 4); + test_println(" lock+unlock/S"); +} + +const struct testcase testbmk10 = { + bmk10_gettest, + bmk10_setup, + NULL, + bmk10_execute +}; +#endif + /* * Test sequence for benchmarks pattern. */ @@ -341,6 +426,10 @@ const struct testcase *patternbmk[] = { &testbmk6, &testbmk7, &testbmk8, + &testbmk9, +#if CH_USE_MUTEXES + &testbmk10, +#endif #endif NULL }; -- cgit v1.2.3 From d2b17bc167b6168c31ab478a339413d207b51800 Mon Sep 17 00:00:00 2001 From: gdisirio Date: Sat, 28 Feb 2009 10:38:32 +0000 Subject: Added the const attribute to the test pattern arrays. git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@805 35acf78f-673a-0410-8e92-d51de3d6d3f4 --- test/testbmk.c | 2 +- test/testcond.c | 2 +- test/testdyn.c | 2 +- test/testevt.c | 2 +- test/testheap.c | 2 +- test/testmbox.c | 2 +- test/testmsg.c | 2 +- test/testmtx.c | 2 +- test/testpools.c | 2 +- test/testrdy.c | 2 +- test/testsem.c | 2 +- 11 files changed, 11 insertions(+), 11 deletions(-) (limited to 'test') diff --git a/test/testbmk.c b/test/testbmk.c index 10a4ea439..76ca641be 100644 --- a/test/testbmk.c +++ b/test/testbmk.c @@ -416,7 +416,7 @@ const struct testcase testbmk10 = { /* * Test sequence for benchmarks pattern. */ -const struct testcase *patternbmk[] = { +const struct testcase * const patternbmk[] = { #if !TEST_NO_BENCHMARKS &testbmk1, &testbmk2, diff --git a/test/testcond.c b/test/testcond.c index 692ec88d2..dff5d2c29 100644 --- a/test/testcond.c +++ b/test/testcond.c @@ -104,7 +104,7 @@ const struct testcase testcond2 = { /* * Test sequence for condvars pattern. */ -const struct testcase *patterncond[] = { +const struct testcase * const patterncond[] = { #if CH_USE_CONDVARS && CH_USE_MUTEXES &testcond1, &testcond2, diff --git a/test/testdyn.c b/test/testdyn.c index 775e3c795..3653e7299 100644 --- a/test/testdyn.c +++ b/test/testdyn.c @@ -130,7 +130,7 @@ const struct testcase testdyn2 = { /* * Test sequence for dynamic APIs pattern. */ -const struct testcase *patterndyn[] = { +const struct testcase * const patterndyn[] = { #if CH_USE_DYNAMIC #if CH_USE_HEAP &testdyn1, diff --git a/test/testevt.c b/test/testevt.c index 7af8b7b73..192c6e6be 100644 --- a/test/testevt.c +++ b/test/testevt.c @@ -103,7 +103,7 @@ const struct testcase testevt1 = { /* * Test sequence for events pattern. */ -const struct testcase *patternevt[] = { +const struct testcase * const patternevt[] = { #if CH_USE_EVENTS &testevt1, #endif diff --git a/test/testheap.c b/test/testheap.c index 0a84b7b33..a72bad6bb 100644 --- a/test/testheap.c +++ b/test/testheap.c @@ -79,7 +79,7 @@ const struct testcase testheap1 = { /* * Test sequence for heap pattern. */ -const struct testcase *patternheap[] = { +const struct testcase * const patternheap[] = { #if CH_USE_HEAP &testheap1, #endif diff --git a/test/testmbox.c b/test/testmbox.c index 7ab3f6126..4a548105c 100644 --- a/test/testmbox.c +++ b/test/testmbox.c @@ -93,7 +93,7 @@ const struct testcase testmbox1 = { /* * Test sequence for mailboxes pattern. */ -const struct testcase *patternmbox[] = { +const struct testcase * const patternmbox[] = { #if CH_USE_MAILBOXES && CH_USE_SEMAPHORES_TIMEOUT &testmbox1, #endif diff --git a/test/testmsg.c b/test/testmsg.c index 8af1c29e3..69f1461e1 100644 --- a/test/testmsg.c +++ b/test/testmsg.c @@ -65,7 +65,7 @@ const struct testcase testmsg1 = { /* * Test sequence for messages pattern. */ -const struct testcase *patternmsg[] = { +const struct testcase * const patternmsg[] = { #if CH_USE_MESSAGES &testmsg1, #endif diff --git a/test/testmtx.c b/test/testmtx.c index 685361bba..e08aab5be 100644 --- a/test/testmtx.c +++ b/test/testmtx.c @@ -218,7 +218,7 @@ const struct testcase testmtx3 = { /* * Test sequence for mutexes pattern. */ -const struct testcase *patternmtx[] = { +const struct testcase * const patternmtx[] = { #if CH_USE_MUTEXES &testmtx1, &testmtx2, diff --git a/test/testpools.c b/test/testpools.c index 759a28c44..9479926d8 100644 --- a/test/testpools.c +++ b/test/testpools.c @@ -62,7 +62,7 @@ const struct testcase testpools1 = { /* * Test sequence for pools pattern. */ -const struct testcase *patternpools[] = { +const struct testcase * const patternpools[] = { #if CH_USE_MEMPOOLS &testpools1, #endif diff --git a/test/testrdy.c b/test/testrdy.c index b085fde02..d35b783c4 100644 --- a/test/testrdy.c +++ b/test/testrdy.c @@ -76,7 +76,7 @@ const struct testcase testrdy2 = { /* * Test sequence for ready list pattern. */ -const struct testcase *patternrdy[] = { +const struct testcase * const patternrdy[] = { &testrdy1, &testrdy2, NULL diff --git a/test/testsem.c b/test/testsem.c index 35e37d965..4f2943964 100644 --- a/test/testsem.c +++ b/test/testsem.c @@ -105,7 +105,7 @@ const struct testcase testsem2 = { /* * Test sequence for semaphores pattern. */ -const struct testcase *patternsem[] = { +const struct testcase * const patternsem[] = { #if CH_USE_SEMAPHORES &testsem1, #if CH_USE_SEMAPHORES_TIMEOUT -- cgit v1.2.3 From d9ff829a71d7b5723206e4923bcab6cbe3f5b715 Mon Sep 17 00:00:00 2001 From: gdisirio Date: Sat, 7 Mar 2009 15:32:40 +0000 Subject: Fixes to the zero timeout. Added a test case. git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@813 35acf78f-673a-0410-8e92-d51de3d6d3f4 --- test/testsem.c | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) (limited to 'test') diff --git a/test/testsem.c b/test/testsem.c index 4f2943964..07fd40840 100644 --- a/test/testsem.c +++ b/test/testsem.c @@ -81,13 +81,18 @@ static void sem2_setup(void) { static void sem2_execute(void) { int i; systime_t target_time; + msg_t msg; + + msg= chSemWaitTimeout(&sem1, TIME_ZERO); + test_assert(msg == RDY_TIMEOUT, "#1"); target_time = chSysGetTime() + MS2ST(5 * 500); for (i = 0; i < 5; i++) { test_emit_token('A' + i); - chSemWaitTimeout(&sem1, MS2ST(500)); - test_assert(isempty(&sem1.s_queue), "#1"); /* Queue not empty */ - test_assert(&sem1.s_cnt != 0, "#2"); /* Counter not zero */ + msg = chSemWaitTimeout(&sem1, MS2ST(500)); + test_assert(msg == RDY_TIMEOUT, "#2"); + test_assert(isempty(&sem1.s_queue), "#3"); /* Queue not empty */ + test_assert(&sem1.s_cnt != 0, "#4"); /* Counter not zero */ } test_assert_sequence("ABCDE"); test_assert_time_window(target_time, target_time + ALLOWED_DELAY); -- cgit v1.2.3 From 8588e9642d632d6d84e9c48388cfb566ecd4a36e Mon Sep 17 00:00:00 2001 From: gdisirio Date: Sun, 8 Mar 2009 08:15:23 +0000 Subject: Fixes to the documentation, swapped the values of constants TIME_INFINITE and TIME_IMMEDIATE (previously TIME_ZERO). git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@816 35acf78f-673a-0410-8e92-d51de3d6d3f4 --- test/testsem.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'test') diff --git a/test/testsem.c b/test/testsem.c index 07fd40840..2482f1295 100644 --- a/test/testsem.c +++ b/test/testsem.c @@ -83,7 +83,7 @@ static void sem2_execute(void) { systime_t target_time; msg_t msg; - msg= chSemWaitTimeout(&sem1, TIME_ZERO); + msg= chSemWaitTimeout(&sem1, TIME_IMMEDIATE); test_assert(msg == RDY_TIMEOUT, "#1"); target_time = chSysGetTime() + MS2ST(5 * 500); -- cgit v1.2.3 From a2bab9c63d848ccfce1440afd40e1eed7b2955ef Mon Sep 17 00:00:00 2001 From: gdisirio Date: Mon, 9 Mar 2009 11:17:02 +0000 Subject: git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@825 35acf78f-673a-0410-8e92-d51de3d6d3f4 --- test/test.c | 2 - test/test.mk | 6 +-- test/testcond.c | 113 ----------------------------------------------- test/testcond.h | 25 ----------- test/testmtx.c | 133 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 5 files changed, 136 insertions(+), 143 deletions(-) delete mode 100644 test/testcond.c delete mode 100644 test/testcond.h (limited to 'test') diff --git a/test/test.c b/test/test.c index 15e23e79c..be3c8d9c5 100644 --- a/test/test.c +++ b/test/test.c @@ -23,7 +23,6 @@ #include "testrdy.h" #include "testsem.h" #include "testmtx.h" -#include "testcond.h" #include "testmsg.h" #include "testmbox.h" #include "testevt.h" @@ -39,7 +38,6 @@ static const struct testcase **patterns[] = { patternrdy, patternsem, patternmtx, - patterncond, patternmsg, patternmbox, patternevt, diff --git a/test/test.mk b/test/test.mk index 6cce48f2a..9f423de64 100644 --- a/test/test.mk +++ b/test/test.mk @@ -1,8 +1,8 @@ # List of all the ChibiOS/RT test files. TESTSRC = ../../test/test.c ../../test/testrdy.c ../../test/testsem.c \ - ../../test/testmtx.c ../../test/testcond.c ../../test/testmsg.c \ - ../../test/testmbox.c ../../test/testevt.c ../../test/testheap.c \ - ../../test/testpools.c ../../test/testdyn.c ../../test/testbmk.c + ../../test/testmtx.c ../../test/testmsg.c ../../test/testmbox.c \ + ../../test/testevt.c ../../test/testheap.c ../../test/testpools.c \ + ../../test/testdyn.c ../../test/testbmk.c # Required include directories TESTINC = ../../test diff --git a/test/testcond.c b/test/testcond.c deleted file mode 100644 index dff5d2c29..000000000 --- a/test/testcond.c +++ /dev/null @@ -1,113 +0,0 @@ -/* - ChibiOS/RT - Copyright (C) 2006-2007 Giovanni Di Sirio. - - This file is part of ChibiOS/RT. - - ChibiOS/RT is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 3 of the License, or - (at your option) any later version. - - ChibiOS/RT is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program. If not, see . -*/ - -#include - -#include "test.h" - -#if CH_USE_CONDVARS && CH_USE_MUTEXES - -static Mutex m1; -static CondVar c1; - -static char *cond1_gettest(void) { - - return "CondVar, signal test"; -} - -static void cond1_setup(void) { - - chCondInit(&c1); - chMtxInit(&m1); -} - -static msg_t thread1(void *p) { - - chMtxLock(&m1); - chCondWait(&c1); - test_emit_token(*(char *)p); - chMtxUnlock(); - return 0; -} - -static void cond1_execute(void) { - - // Bacause priority inheritance. - tprio_t prio = chThdGetPriority(); - threads[0] = chThdCreateStatic(wa[0], WA_SIZE, prio+1, thread1, "E"); - threads[1] = chThdCreateStatic(wa[1], WA_SIZE, prio+2, thread1, "D"); - threads[2] = chThdCreateStatic(wa[2], WA_SIZE, prio+3, thread1, "C"); - threads[3] = chThdCreateStatic(wa[3], WA_SIZE, prio+4, thread1, "B"); - threads[4] = chThdCreateStatic(wa[4], WA_SIZE, prio+5, thread1, "A"); - test_assert(prio == chThdGetPriority(), "#1"); /* Priority return failure.*/ - chCondSignal(&c1); - chCondSignal(&c1); - chCondSignal(&c1); - chCondSignal(&c1); - chCondSignal(&c1); - test_wait_threads(); - test_assert_sequence("ABCDE"); -} - -const struct testcase testcond1 = { - cond1_gettest, - cond1_setup, - NULL, - cond1_execute -}; - -static char *cond2_gettest(void) { - - return "CondVar, broadcast test"; -} - -static void cond2_execute(void) { - - // Bacause priority inheritance. - tprio_t prio = chThdGetPriority(); - threads[0] = chThdCreateStatic(wa[0], WA_SIZE, prio+1, thread1, "E"); - threads[1] = chThdCreateStatic(wa[1], WA_SIZE, prio+2, thread1, "D"); - threads[2] = chThdCreateStatic(wa[2], WA_SIZE, prio+3, thread1, "C"); - threads[3] = chThdCreateStatic(wa[3], WA_SIZE, prio+4, thread1, "B"); - threads[4] = chThdCreateStatic(wa[4], WA_SIZE, prio+5, thread1, "A"); - test_assert(prio == chThdGetPriority(), "#1"); /* Priority return failure.*/ - chCondBroadcast(&c1); - test_wait_threads(); - test_assert_sequence("ABCDE"); -} - -const struct testcase testcond2 = { - cond2_gettest, - NULL, - NULL, - cond2_execute -}; - -#endif /* CH_USE_CONDVARS && CH_USE_MUTEXES */ - -/* - * Test sequence for condvars pattern. - */ -const struct testcase * const patterncond[] = { -#if CH_USE_CONDVARS && CH_USE_MUTEXES - &testcond1, - &testcond2, -#endif - NULL -}; diff --git a/test/testcond.h b/test/testcond.h deleted file mode 100644 index b07aa804e..000000000 --- a/test/testcond.h +++ /dev/null @@ -1,25 +0,0 @@ -/* - ChibiOS/RT - Copyright (C) 2006-2007 Giovanni Di Sirio. - - This file is part of ChibiOS/RT. - - ChibiOS/RT is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 3 of the License, or - (at your option) any later version. - - ChibiOS/RT is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program. If not, see . -*/ - -#ifndef _TESTCOND_H_ -#define _TESTCOND_H_ - -extern const struct testcase *patterncond[]; - -#endif /* _TESTCOND_H_ */ diff --git a/test/testmtx.c b/test/testmtx.c index e08aab5be..c8050e887 100644 --- a/test/testmtx.c +++ b/test/testmtx.c @@ -26,6 +26,7 @@ #define ALLOWED_DELAY 5 static Mutex m1, m2; +static CondVar c1; static char *mtx1_gettest(void) { @@ -213,6 +214,133 @@ const struct testcase testmtx3 = { mtx3_execute }; +#if CH_USE_CONDVARS +static char *mtx4_gettest(void) { + + return "CondVar, signal test"; +} + +static void mtx4_setup(void) { + + chCondInit(&c1); + chMtxInit(&m1); +} + +static msg_t thread10(void *p) { + + chMtxLock(&m1); + chCondWait(&c1); + test_emit_token(*(char *)p); + chMtxUnlock(); + return 0; +} + +static void mtx4_execute(void) { + + tprio_t prio = chThdGetPriority(); + threads[0] = chThdCreateStatic(wa[0], WA_SIZE, prio+1, thread10, "E"); + threads[1] = chThdCreateStatic(wa[1], WA_SIZE, prio+2, thread10, "D"); + threads[2] = chThdCreateStatic(wa[2], WA_SIZE, prio+3, thread10, "C"); + threads[3] = chThdCreateStatic(wa[3], WA_SIZE, prio+4, thread10, "B"); + threads[4] = chThdCreateStatic(wa[4], WA_SIZE, prio+5, thread10, "A"); + chCondSignal(&c1); + chCondSignal(&c1); + chCondSignal(&c1); + chCondSignal(&c1); + chCondSignal(&c1); + test_wait_threads(); + test_assert_sequence("ABCDE"); +} + +const struct testcase testmtx4 = { + mtx4_gettest, + mtx4_setup, + NULL, + mtx4_execute +}; + +static char *mtx5_gettest(void) { + + return "CondVar, broadcast test"; +} + +static void mtx5_setup(void) { + + chCondInit(&c1); + chMtxInit(&m1); +} + +static void mtx5_execute(void) { + + // Bacause priority inheritance. + tprio_t prio = chThdGetPriority(); + threads[0] = chThdCreateStatic(wa[0], WA_SIZE, prio+1, thread10, "E"); + threads[1] = chThdCreateStatic(wa[1], WA_SIZE, prio+2, thread10, "D"); + threads[2] = chThdCreateStatic(wa[2], WA_SIZE, prio+3, thread10, "C"); + threads[3] = chThdCreateStatic(wa[3], WA_SIZE, prio+4, thread10, "B"); + threads[4] = chThdCreateStatic(wa[4], WA_SIZE, prio+5, thread10, "A"); + chCondBroadcast(&c1); + test_wait_threads(); + test_assert_sequence("ABCDE"); +} + +const struct testcase testmtx5 = { + mtx5_gettest, + mtx5_setup, + NULL, + mtx5_execute +}; + +static char *mtx6_gettest(void) { + + return "CondVar, inheritance boost test"; +} + +static void mtx6_setup(void) { + + chCondInit(&c1); + chMtxInit(&m1); + chMtxInit(&m2); +} + +static msg_t thread11(void *p) { + + chMtxLock(&m2); + chMtxLock(&m1); + chCondWait(&c1); + test_emit_token(*(char *)p); + chMtxUnlock(); + chMtxUnlock(); + return 0; +} + +static msg_t thread12(void *p) { + + chMtxLock(&m2); + test_emit_token(*(char *)p); + chMtxUnlock(); + return 0; +} + +static void mtx6_execute(void) { + + tprio_t prio = chThdGetPriority(); + threads[0] = chThdCreateStatic(wa[0], WA_SIZE, prio+1, thread11, "A"); + threads[1] = chThdCreateStatic(wa[1], WA_SIZE, prio+2, thread10, "C"); + threads[2] = chThdCreateStatic(wa[2], WA_SIZE, prio+3, thread12, "B"); + chCondSignal(&c1); + chCondSignal(&c1); + test_wait_threads(); + test_assert_sequence("ABC"); +} + +const struct testcase testmtx6 = { + mtx6_gettest, + mtx6_setup, + NULL, + mtx6_execute +}; +#endif /* CH_USE_CONDVARS */ #endif /* CH_USE_MUTEXES */ /* @@ -223,6 +351,11 @@ const struct testcase * const patternmtx[] = { &testmtx1, &testmtx2, &testmtx3, +#if CH_USE_CONDVARS + &testmtx4, + &testmtx5, + &testmtx6, +#endif #endif NULL }; -- cgit v1.2.3 From da4f9beaee8f1f8f344012b4d9a122462a6c802e Mon Sep 17 00:00:00 2001 From: gdisirio Date: Tue, 10 Mar 2009 15:31:58 +0000 Subject: git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@827 35acf78f-673a-0410-8e92-d51de3d6d3f4 --- test/test.c | 8 ++++---- test/testevt.c | 2 +- test/testsem.c | 2 +- 3 files changed, 6 insertions(+), 6 deletions(-) (limited to 'test') diff --git a/test/test.c b/test/test.c index be3c8d9c5..3be813bb2 100644 --- a/test/test.c +++ b/test/test.c @@ -146,7 +146,7 @@ bool_t _test_assert_sequence(char *expected) { bool_t _test_assert_time_window(systime_t start, systime_t end) { - return _test_assert(chSysInTimeWindow(start, end), "time window error"); + return _test_assert(chTimeIsWithin(start, end), "time window error"); } /* @@ -171,8 +171,8 @@ void test_wait_threads(void) { void test_cpu_pulse(unsigned ms) { systime_t duration = MS2ST(ms); - systime_t start = chSysGetTime(); - while (chSysInTimeWindow(start, start + duration)) { + systime_t start = chTimeNow(); + while (chTimeIsWithin(start, start + duration)) { #if defined(WIN32) ChkIntSources(); #endif @@ -182,7 +182,7 @@ void test_cpu_pulse(unsigned ms) { systime_t test_wait_tick(void) { chThdSleep(1); - return chSysGetTime(); + return chTimeNow(); } /* diff --git a/test/testevt.c b/test/testevt.c index 192c6e6be..9c6f7bf6e 100644 --- a/test/testevt.c +++ b/test/testevt.c @@ -77,7 +77,7 @@ static void evt1_execute(void) { chEvtInit(&es2); chEvtRegisterMask(&es1, &el1, 1); chEvtRegisterMask(&es2, &el2, 4); - target_time = chSysGetTime() + MS2ST(50); + target_time = chTimeNow() + MS2ST(50); threads[0] = chThdCreateStatic(wa[0], WA_SIZE, chThdGetPriority()-1, thread, "A"); m = chEvtWaitAll(5); test_assert_time_window(target_time, target_time + ALLOWED_DELAY); diff --git a/test/testsem.c b/test/testsem.c index 2482f1295..e954871d5 100644 --- a/test/testsem.c +++ b/test/testsem.c @@ -86,7 +86,7 @@ static void sem2_execute(void) { msg= chSemWaitTimeout(&sem1, TIME_IMMEDIATE); test_assert(msg == RDY_TIMEOUT, "#1"); - target_time = chSysGetTime() + MS2ST(5 * 500); + target_time = chTimeNow() + MS2ST(5 * 500); for (i = 0; i < 5; i++) { test_emit_token('A' + i); msg = chSemWaitTimeout(&sem1, MS2ST(500)); -- cgit v1.2.3 From a5f92e68309aa5270602cb6e911c43c9bc370408 Mon Sep 17 00:00:00 2001 From: gdisirio Date: Fri, 13 Mar 2009 19:30:52 +0000 Subject: Improvements to the priority lists. git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@838 35acf78f-673a-0410-8e92-d51de3d6d3f4 --- test/test.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'test') diff --git a/test/test.c b/test/test.c index 3be813bb2..887d56ecc 100644 --- a/test/test.c +++ b/test/test.c @@ -275,5 +275,5 @@ msg_t TestThread(void *p) { else test_println("SUCCESS"); - return 0; + return (msg_t)global_fail; } -- cgit v1.2.3 From 0873929b10edf3d2e3ce9e8152bd2cfb22955674 Mon Sep 17 00:00:00 2001 From: gdisirio Date: Fri, 13 Mar 2009 20:11:53 +0000 Subject: Fixed a test case. git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@842 35acf78f-673a-0410-8e92-d51de3d6d3f4 --- test/testsem.c | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'test') diff --git a/test/testsem.c b/test/testsem.c index e954871d5..cffe8bb69 100644 --- a/test/testsem.c +++ b/test/testsem.c @@ -27,6 +27,7 @@ static Semaphore sem1; +#if !CH_USE_SEMAPHORES_PRIORITY static char *sem1_gettest(void) { return "Semaphores, FIFO enqueuing test"; @@ -66,6 +67,7 @@ const struct testcase testsem1 = { NULL, sem1_execute }; +#endif /* CH_USE_SEMAPHORES_PRIORITY */ #if CH_USE_SEMAPHORES_TIMEOUT static char *sem2_gettest(void) { @@ -112,7 +114,9 @@ const struct testcase testsem2 = { */ const struct testcase * const patternsem[] = { #if CH_USE_SEMAPHORES +#if !CH_USE_SEMAPHORES_PRIORITY &testsem1, +#endif #if CH_USE_SEMAPHORES_TIMEOUT &testsem2, #endif -- cgit v1.2.3 From b4357c2bf7e538ec6513892555c5cf0968b95efe Mon Sep 17 00:00:00 2001 From: gdisirio Date: Fri, 13 Mar 2009 20:29:04 +0000 Subject: git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@843 35acf78f-673a-0410-8e92-d51de3d6d3f4 --- test/testsem.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'test') diff --git a/test/testsem.c b/test/testsem.c index cffe8bb69..e6153fa8d 100644 --- a/test/testsem.c +++ b/test/testsem.c @@ -27,10 +27,9 @@ static Semaphore sem1; -#if !CH_USE_SEMAPHORES_PRIORITY static char *sem1_gettest(void) { - return "Semaphores, FIFO enqueuing test"; + return "Semaphores, enqueuing test"; } static void sem1_setup(void) { @@ -58,7 +57,11 @@ static void sem1_execute(void) { chSemSignal(&sem1); chSemSignal(&sem1); test_wait_threads(); +#if CH_USE_SEMAPHORES_PRIORITY + test_assert_sequence("ADCEB"); +#else test_assert_sequence("ABCDE"); +#endif } const struct testcase testsem1 = { @@ -67,7 +70,6 @@ const struct testcase testsem1 = { NULL, sem1_execute }; -#endif /* CH_USE_SEMAPHORES_PRIORITY */ #if CH_USE_SEMAPHORES_TIMEOUT static char *sem2_gettest(void) { @@ -114,9 +116,7 @@ const struct testcase testsem2 = { */ const struct testcase * const patternsem[] = { #if CH_USE_SEMAPHORES -#if !CH_USE_SEMAPHORES_PRIORITY &testsem1, -#endif #if CH_USE_SEMAPHORES_TIMEOUT &testsem2, #endif -- cgit v1.2.3 From 5ddc68fed06c0c7af0284e1bc029e1dcd93210e5 Mon Sep 17 00:00:00 2001 From: gdisirio Date: Sat, 4 Apr 2009 10:50:21 +0000 Subject: Fixed bug 2730706. git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@867 35acf78f-673a-0410-8e92-d51de3d6d3f4 --- test/testbmk.c | 2 ++ 1 file changed, 2 insertions(+) (limited to 'test') diff --git a/test/testbmk.c b/test/testbmk.c index 76ca641be..8d02b8ae5 100644 --- a/test/testbmk.c +++ b/test/testbmk.c @@ -22,7 +22,9 @@ #include "test.h" static Semaphore sem1; +#if CH_USE_MUTEXES static Mutex mtx1; +#endif static msg_t thread1(void *p) { msg_t msg; -- cgit v1.2.3 From bed6fe6ef714a1c2358f063f7553b34defbb9fb1 Mon Sep 17 00:00:00 2001 From: gdisirio Date: Sat, 11 Apr 2009 12:59:15 +0000 Subject: Added code coverage tool. git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@887 35acf78f-673a-0410-8e92-d51de3d6d3f4 --- test/coverage/Makefile | 142 +++++++++++++++ test/coverage/chconf.h | 437 +++++++++++++++++++++++++++++++++++++++++++++++ test/coverage/chcore.c | 128 ++++++++++++++ test/coverage/chcore.h | 206 ++++++++++++++++++++++ test/coverage/chtypes.h | 47 +++++ test/coverage/main.c | 43 +++++ test/coverage/readme.txt | 6 + test/coverage/simcom.c | 66 +++++++ 8 files changed, 1075 insertions(+) create mode 100644 test/coverage/Makefile create mode 100644 test/coverage/chconf.h create mode 100644 test/coverage/chcore.c create mode 100644 test/coverage/chcore.h create mode 100644 test/coverage/chtypes.h create mode 100644 test/coverage/main.c create mode 100644 test/coverage/readme.txt create mode 100644 test/coverage/simcom.c (limited to 'test') diff --git a/test/coverage/Makefile b/test/coverage/Makefile new file mode 100644 index 000000000..8910d981d --- /dev/null +++ b/test/coverage/Makefile @@ -0,0 +1,142 @@ +# +# !!!! Do NOT edit this makefile with an editor which replace tabs by spaces !!!! +# +############################################################################################## +# +# On command line: +# +# make all = Create project +# +# make clean = Clean project files. +# +# To rebuild project do "make clean" and "make all". +# + +############################################################################################## +# Start of default section +# + +TRGT = mingw32- +CC = $(TRGT)gcc +AS = $(TRGT)gcc -x assembler-with-cpp +COV = gcov + +# List all default C defines here, like -D_DEBUG=1 +DDEFS = + +# List all default ASM defines here, like -D_DEBUG=1 +DADEFS = + +# List all default directories to look for include files here +DINCDIR = + +# List the default directory to look for the libraries here +DLIBDIR = + +# List all default libraries here +DLIBS = -lws2_32 + +# +# End of default section +############################################################################################## + +############################################################################################## +# Start of user section +# + +# Define project name here +PROJECT = ch + +# Define linker script file here +LDSCRIPT= + +# List all user C define here, like -D_DEBUG=1 +UDEFS = + +# Define ASM defines here +UADEFS = + +# Imported source files +include ../../src/kernel.mk +include ../../test/test.mk + +# List C source files here +SRC = chcore.c main.c simcom.c \ + ${KERNSRC} \ + ${TESTSRC} + +# List ASM source files here +ASRC = + +# List all user directories here +UINCDIR = ../../src/include ../../test + +# List the user directory to look for the libraries here +ULIBDIR = + +# List all user libraries here +ULIBS = + +# Define optimisation level here +OPT = -ggdb -O0 -fomit-frame-pointer -fprofile-arcs -ftest-coverage + +# +# End of user defines +############################################################################################## + + +INCDIR = $(patsubst %,-I%,$(DINCDIR) $(UINCDIR)) +LIBDIR = $(patsubst %,-L%,$(DLIBDIR) $(ULIBDIR)) +DEFS = $(DDEFS) $(UDEFS) +ADEFS = $(DADEFS) $(UADEFS) +OBJS = $(ASRC:.s=.o) $(SRC:.c=.o) +LIBS = $(DLIBS) $(ULIBS) + +LDFLAGS = -Wl,-Map=$(PROJECT).map,--cref,--no-warn-mismatch -lgcov $(LIBDIR) +ASFLAGS = -Wa,-amhls=$(<:.s=.lst) $(ADEFS) +CPFLAGS = $(OPT) -Wall -Wstrict-prototypes -fverbose-asm -Wa,-alms=$(<:.c=.lst) $(DEFS) + +# Generate dependency information +CPFLAGS += -MD -MP -MF .dep/$(@F).d + +# +# makefile rules +# + +all: $(OBJS) $(PROJECT).exe + +%o : %c + $(CC) -c $(CPFLAGS) -I . $(INCDIR) $< -o $@ + +%o : %s + $(AS) -c $(ASFLAGS) $< -o $@ + +%exe: $(OBJS) + $(CC) $(OBJS) $(LDFLAGS) $(LIBS) -o $@ + +.PHONY: gcov +gcov: + -mkdir gcov + $(COV) -u $(subst /,\,$(KERNSRC)) + -mv *.gcov ./gcov + +.PHONY: clean +clean: + -rm -f $(OBJS) + -rm -f $(PROJECT).exe + -rm -f $(PROJECT).map + -rm -f $(SRC:.c=.c.bak) + -rm -f $(SRC:.c=.lst) + -rm -f $(SRC:.c=.gcno) + -rm -f $(SRC:.c=.gcda) + -rm -f $(ASRC:.s=.s.bak) + -rm -f $(ASRC:.s=.lst) + -rm -fR .dep + -rm -fR gcov + +# +# Include the dependency files, should be the last of the makefile +# +-include $(shell mkdir .dep 2>/dev/null) $(wildcard .dep/*) + +# *** EOF *** diff --git a/test/coverage/chconf.h b/test/coverage/chconf.h new file mode 100644 index 000000000..b979a9517 --- /dev/null +++ b/test/coverage/chconf.h @@ -0,0 +1,437 @@ +/* + ChibiOS/RT - Copyright (C) 2006-2007 Giovanni Di Sirio. + + This file is part of ChibiOS/RT. + + ChibiOS/RT is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 3 of the License, or + (at your option) any later version. + + ChibiOS/RT is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see . +*/ + +/** + * @file src/templates/chconf.h + * @brief Configuration file template. + * @addtogroup Config + * @{ + */ + +#ifndef _CHCONF_H_ +#define _CHCONF_H_ + +/*===========================================================================*/ +/* Kernel parameters. */ +/*===========================================================================*/ + +/** + * Frequency of the system timer that drives the system ticks. This also + * defines the system tick time unit. + */ +#if !defined(CH_FREQUENCY) || defined(__DOXYGEN__) +#define CH_FREQUENCY 1000 +#endif + +/** + * This constant is the number of system ticks allowed for the threads before + * preemption occurs. This option is only meaningful if the option + * @p CH_USE_ROUNDROBIN is also active. + */ +#if !defined(CH_TIME_QUANTUM) || defined(__DOXYGEN__) +#define CH_TIME_QUANTUM 20 +#endif + +/** + * If enabled then the use of nested @p chSysLock() / @p chSysUnlock() + * operations is allowed.
+ * For performance and code size reasons the recommended setting is to leave + * this option disabled.
+ * You can use this option if you need to merge ChibiOS/RT with external + * libraries that require nested lock/unlock operations. + * @note The default is @p FALSE. + */ +#if !defined(CH_USE_NESTED_LOCKS) || defined(__DOXYGEN__) +#define CH_USE_NESTED_LOCKS FALSE +#endif + +/** + * If specified then the kernel performs the round robin scheduling algorithm + * on threads of equal priority. + * @note The default is @p TRUE. + */ +#if !defined(CH_USE_ROUNDROBIN) || defined(__DOXYGEN__) +#define CH_USE_ROUNDROBIN TRUE +#endif + +/** + * Number of RAM bytes to use as system heap. If set to zero then the whole + * available RAM is used as system heap. + * @note In order to use the whole RAM as system heap the linker script must + * provide the @p __heap_base__ and @p __heap_end__ symbols. + * @note Requires @p CH_USE_HEAP. + */ +#if !defined(CH_HEAP_SIZE) || defined(__DOXYGEN__) +#define CH_HEAP_SIZE 0x20000 +#endif + +/*===========================================================================*/ +/* Performance options. */ +/*===========================================================================*/ + +/** + * If specified then time efficient rather than space efficient code is used + * when two possible implementations exist. + * @note This is not related to the compiler optimization options. + * @note The default is @p TRUE. + */ +#if !defined(CH_OPTIMIZE_SPEED) || defined(__DOXYGEN__) +#define CH_OPTIMIZE_SPEED FALSE +#endif + +/** + * If enabled defines a CPU register to be used as storage for the global + * @p currp variable. Caching this variable in a register can greatly + * improve both space and time efficiency of the generated code. Another side + * effect is that one less register has to be saved during the context switch + * resulting in lower RAM usage and faster code. + * @note This option is only usable with the GCC compiler and is only useful + * on processors with many registers like ARM cores. + * @note If this option is enabled then ALL the libraries linked to the + * ChibiOS/RT code must be recompiled with the GCC option @p + * -ffixed-@. + * @note This option must be enabled in the Makefile, it is listed here for + * documentation. + */ +#if defined(__DOXYGEN__) +#define CH_CURRP_REGISTER_CACHE "reg" +#endif + +/*===========================================================================*/ +/* Subsystem options. */ +/*===========================================================================*/ + +/** + * If specified then the @p chThdWait() function is included in the kernel. + * @note The default is @p TRUE. + */ +#if !defined(CH_USE_WAITEXIT) || defined(__DOXYGEN__) +#define CH_USE_WAITEXIT TRUE +#endif + +/** + * If specified then the Semaphores APIs are included in the kernel. + * @note The default is @p TRUE. + */ +#if !defined(CH_USE_SEMAPHORES) || defined(__DOXYGEN__) +#define CH_USE_SEMAPHORES TRUE +#endif + +/** + * If enabled then the threads are enqueued on semaphores by priority rather + * than FIFO order. + * @note The default is @p FALSE. Enable this if you have special requirements. + * @note Requires @p CH_USE_SEMAPHORES. + */ +#if !defined(CH_USE_SEMAPHORES_PRIORITY) || defined(__DOXYGEN__) +#define CH_USE_SEMAPHORES_PRIORITY FALSE +#endif + +/** + * If specified then the Semaphores the @p chSemWaitSignal() API is included + * in the kernel. + * @note The default is @p TRUE. + * @note Requires @p CH_USE_SEMAPHORES. + */ +#if !defined(CH_USE_SEMSW) || defined(__DOXYGEN__) +#define CH_USE_SEMSW TRUE +#endif + +/** + * If specified then the Semaphores with timeout APIs are included in the + * kernel. + * @note The default is @p TRUE. + * @note Requires @p CH_USE_SEMAPHORES. + */ +#if !defined(CH_USE_SEMAPHORES_TIMEOUT) || defined(__DOXYGEN__) +#define CH_USE_SEMAPHORES_TIMEOUT TRUE +#endif + +/** + * If specified then the Mutexes APIs are included in the kernel. + * @note The default is @p TRUE. + */ +#if !defined(CH_USE_MUTEXES) || defined(__DOXYGEN__) +#define CH_USE_MUTEXES TRUE +#endif + +/** + * If specified then the Conditional Variables APIs are included in the kernel. + * @note The default is @p TRUE. + * @note Requires @p CH_USE_MUTEXES. + */ +#if !defined(CH_USE_CONDVARS) || defined(__DOXYGEN__) +#define CH_USE_CONDVARS TRUE +#endif + +/** + * If specified then the Conditional Variables APIs are included in the kernel. + * @note The default is @p TRUE. + * @note Requires @p CH_USE_CONDVARS. + */ +#if !defined(CH_USE_CONDVARS_TIMEOUT) || defined(__DOXYGEN__) +#define CH_USE_CONDVARS_TIMEOUT TRUE +#endif + +/** + * If specified then the Event flags APIs are included in the kernel. + * @note The default is @p TRUE. + */ +#if !defined(CH_USE_EVENTS) || defined(__DOXYGEN__) +#define CH_USE_EVENTS TRUE +#endif + +/** + * If specified then the @p chEvtWaitXXXTimeout() functions are included in + * the kernel. + * @note The default is @p TRUE. + * @note Requires @p CH_USE_EVENTS. + */ +#if !defined(CH_USE_EVENTS_TIMEOUT) || defined(__DOXYGEN__) +#define CH_USE_EVENTS_TIMEOUT TRUE +#endif + +/** + * If specified then the Synchronous Messages APIs are included in the kernel. + * @note The default is @p TRUE. + */ +#if !defined(CH_USE_MESSAGES) || defined(__DOXYGEN__) +#define CH_USE_MESSAGES TRUE +#endif + +/** + * If specified then the @p chMsgSendWithEvent() function is included in the + * kernel. + * @note The default is @p TRUE. + * @note Requires @p CH_USE_MESSAGES and @p CH_USE_EVENTS. + */ +#if !defined(CH_USE_MESSAGES_EVENT) || defined(__DOXYGEN__) +#define CH_USE_MESSAGES_EVENT TRUE +#endif + +/** + * If enabled then messages are served by priority rather than in FIFO order. + * @note The default is @p FALSE. Enable this if you have special requirements. + * @note Requires @p CH_USE_MESSAGES. + */ +#if !defined(CH_USE_MESSAGES_PRIORITY) || defined(__DOXYGEN__) +#define CH_USE_MESSAGES_PRIORITY FALSE +#endif + +/** + * If specified then the Asynchronous Messages (Mailboxes) APIs are included + * in the kernel. + * @note The default is @p TRUE. + */ +#if !defined(CH_USE_MAILBOXES) || defined(__DOXYGEN__) +#define CH_USE_MAILBOXES TRUE +#endif + +/** + * If specified then the I/O queues APIs are included in the kernel. + * @note The default is @p TRUE. + * @note Requires @p CH_USE_SEMAPHORES. + */ +#if !defined(CH_USE_QUEUES) || defined(__DOXYGEN__) +#define CH_USE_QUEUES TRUE +#endif + +/** + * If specified then the half duplex queues APIs are included in the kernel. + * @note The default is @p TRUE. + * @note Requires @p CH_USE_SEMAPHORES. + */ +#if !defined(CH_USE_QUEUES_HALFDUPLEX) || defined(__DOXYGEN__) +#define CH_USE_QUEUES_HALFDUPLEX TRUE +#endif + +/** + * If specified then the I/O queues with timeout APIs are included in the + * kernel. + * @note The default is @p TRUE. + * @note Requires @p CH_USE_QUEUES and @p CH_USE_SEMAPHORES_TIMEOUT. + */ +#if !defined(CH_USE_QUEUES_TIMEOUT) || defined(__DOXYGEN__) +#define CH_USE_QUEUES_TIMEOUT TRUE +#endif + +/** + * If specified then the full duplex serial driver APIs are included in the + * kernel. + * @note The default is @p TRUE. + * @note Requires @p CH_USE_QUEUES. + */ +#if !defined(CH_USE_SERIAL_FULLDUPLEX) || defined(__DOXYGEN__) +#define CH_USE_SERIAL_FULLDUPLEX TRUE +#endif + +/** + * If specified then the half duplex serial driver APIs are included in the + * kernel. + * @note The default is @p TRUE. + * @note Requires @p CH_USE_QUEUES_HALFDUPLEX. + */ +#if !defined(CH_USE_SERIAL_HALFDUPLEX) || defined(__DOXYGEN__) +#define CH_USE_SERIAL_HALFDUPLEX TRUE +#endif + +/** + * If specified then the memory heap allocator APIs are included in the kernel. + * @note The default is @p TRUE. + * @note Requires @p CH_USE_MUTEXES or @p CH_USE_SEMAPHORES. + * @note Mutexes are recommended. + */ +#if !defined(CH_USE_HEAP) || defined(__DOXYGEN__) +#define CH_USE_HEAP TRUE +#endif + +/** + * If enabled enforces the use of the C-runtime @p malloc() and @p free() + * functions as backend for the system heap allocator. + * @note The default is @p FALSE. + * @note Requires @p CH_USE_HEAP. + */ +#if !defined(CH_USE_MALLOC_HEAP) || defined(__DOXYGEN__) +#define CH_USE_MALLOC_HEAP FALSE +#endif + +/** + * If specified then the memory pools allocator APIs are included in the + * kernel. + * @note The default is @p TRUE. + */ +#if !defined(CH_USE_MEMPOOLS) || defined(__DOXYGEN__) +#define CH_USE_MEMPOOLS TRUE +#endif + +/** + * If specified then the dynamic threads creation APIs are included in the + * kernel. + * @note The default is @p TRUE. + * @note Requires @p CH_USE_WAITEXIT. + */ +#if !defined(CH_USE_DYNAMIC) || defined(__DOXYGEN__) +#define CH_USE_DYNAMIC TRUE +#endif + +/*===========================================================================*/ +/* Debug options. */ +/*===========================================================================*/ + +/** + * Debug option, if enabled then the checks on the API functions input + * parameters are activated. + * @note The default is @p FALSE. + */ +#if !defined(CH_DBG_ENABLE_CHECKS) || defined(__DOXYGEN__) +#define CH_DBG_ENABLE_CHECKS FALSE +#endif + +/** + * Debug option, if enabled then all the assertions in the kernel code are + * activated. This includes consistency checks inside the kernel, runtime + * anomalies and port-defined checks. + * @note The default is @p FALSE. + */ +#if !defined(CH_DBG_ENABLE_ASSERTS) || defined(__DOXYGEN__) +#define CH_DBG_ENABLE_ASSERTS FALSE +#endif + +/** + * Debug option, if enabled the context switch circular trace buffer is + * activated. + * @note The default is @p FALSE. + */ +#if !defined(CH_DBG_ENABLE_TRACE) || defined(__DOXYGEN__) +#define CH_DBG_ENABLE_TRACE TRUE +#endif + +/** + * Debug option, if enabled a runtime stack check is performed. + * @note The stack check is performed in a architecture/port dependent way. It + * may not be implemented at all. + */ +#if !defined(CH_DBG_ENABLE_STACK_CHECK) || defined(__DOXYGEN__) +#define CH_DBG_ENABLE_STACK_CHECK TRUE +#endif + +/** + * Debug option, if enabled the threads working area is filled with a byte + * pattern when a thread is created. + */ +#if !defined(CH_DBG_FILL_THREADS) || defined(__DOXYGEN__) +#define CH_DBG_FILL_THREADS TRUE +#endif + +/** + * Debug option, if enabled a field is added to the @p Thread structure that + * counts the system ticks occurred while executing the thread. + */ +#if !defined(CH_DBG_THREADS_PROFILING) || defined(__DOXYGEN__) +#define CH_DBG_THREADS_PROFILING TRUE +#endif + +/*===========================================================================*/ +/* Kernel hooks. */ +/*===========================================================================*/ + +/** + * User fields added to the end of the @p Thread structure. + */ +#if !defined(THREAD_EXT_FIELDS) || defined(__DOXYGEN__) +#define THREAD_EXT_FIELDS \ +struct { \ + /* Add thread custom fields here.*/ \ + /* The thread termination \p EventSource.*/ \ +}; +#endif + +/** + * User initialization code added to the @p chThdInit() API. + * @note It is invoked from within @p chThdInit(). + */ +#if !defined(THREAD_EXT_INIT) || defined(__DOXYGEN__) +#define THREAD_EXT_INIT(tp) { \ + /* Add thread initialization code here.*/ \ +} +#endif + +/** + * User finalization code added to the @p chThdExit() API. + * @note It is inserted into lock zone. + */ +#if !defined(THREAD_EXT_EXIT) || defined(__DOXYGEN__) +#define THREAD_EXT_EXIT(tp) { \ + /* Add thread finalization code here.*/ \ +} +#endif + +/** + * Code inserted inside the idle thread loop immediately after an interrupt + * resumed execution. + */ +#if !defined(IDLE_LOOP_HOOK) || defined(__DOXYGEN__) +#define IDLE_LOOP_HOOK() { \ + /* Idle loop code here.*/ \ +} +#endif + +#endif /* _CHCONF_H_ */ + +/** @} */ diff --git a/test/coverage/chcore.c b/test/coverage/chcore.c new file mode 100644 index 000000000..cdc87ceb5 --- /dev/null +++ b/test/coverage/chcore.c @@ -0,0 +1,128 @@ +/* + ChibiOS/RT - Copyright (C) 2006-2007 Giovanni Di Sirio. + + This file is part of ChibiOS/RT. + + ChibiOS/RT is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 3 of the License, or + (at your option) any later version. + + ChibiOS/RT is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see . +*/ + +#include +#include + +#undef CDECL + +/** + * @addtogroup WIN32SIM_CORE + * @{ + */ + +#include + +static LARGE_INTEGER nextcnt; +static LARGE_INTEGER slice; + +void init_simcom1(void); +bool_t com1_conn_chkint(void); +bool_t com1_in_chkint(void); +bool_t com1_out_chkint(void); + +/* + * Simulated HW initialization. + */ +void InitCore(void) { + printf("ChibiOS/RT test simulator\n\n"); + printf("Thread structure %d bytes\n", sizeof(Thread)); + if (!QueryPerformanceFrequency(&slice)) { + fprintf(stderr, "QueryPerformanceFrequency() error"); + fflush(stderr); + exit(1); + } + printf("Core Frequency %u Hz\n", (int)slice.LowPart); + slice.QuadPart /= CH_FREQUENCY; + QueryPerformanceCounter(&nextcnt); + nextcnt.QuadPart += slice.QuadPart; + + init_simcom1(); + + fflush(stdout); +} + +/* + * Interrupt simulation. + */ +void ChkIntSources(void) { + LARGE_INTEGER n; + bool_t rflag = FALSE; + + if (com1_conn_chkint() || com1_in_chkint() || com1_out_chkint()) { + if (chSchRescRequiredI()) + rflag = TRUE; + } + + // Interrupt Timer simulation (10ms interval). + QueryPerformanceCounter(&n); + if (n.QuadPart > nextcnt.QuadPart) { + nextcnt.QuadPart += slice.QuadPart; + chSysTimerHandlerI(); + if (chSchRescRequiredI()) + rflag = TRUE; + } + + if (rflag) + chSchDoRescheduleI(); +} + +/** + * Performs a context switch between two threads. + * @param otp the thread to be switched out + * @param ntp the thread to be switched in + */ +__attribute__((used)) +static void __dummy(Thread *otp, Thread *ntp) { + asm volatile (".globl @port_switch@8 \n\t" \ + "@port_switch@8: \n\t" \ + "push %ebp \n\t" \ + "push %esi \n\t" \ + "push %edi \n\t" \ + "push %ebx \n\t" \ + "movl %esp, 16(%ecx) \n\t" \ + "movl 16(%edx), %esp \n\t" \ + "pop %ebx \n\t" \ + "pop %edi \n\t" \ + "pop %esi \n\t" \ + "pop %ebp \n\t" \ + "ret"); +} + +/** + * Halts the system. In this implementation it just exits the simulation. + */ +__attribute__((fastcall)) +void port_halt(void) { + + fprintf(stderr, "\nHalted\n"); + fflush(stderr); + exit(2); +} + +/** + * Threads return point, it just invokes @p chThdExit(). + */ +void threadexit(void) { + + asm volatile ("push %eax \n\t" \ + "call _chThdExit"); +} + +/** @} */ diff --git a/test/coverage/chcore.h b/test/coverage/chcore.h new file mode 100644 index 000000000..276b935da --- /dev/null +++ b/test/coverage/chcore.h @@ -0,0 +1,206 @@ +/* + ChibiOS/RT - Copyright (C) 2006-2007 Giovanni Di Sirio. + + This file is part of ChibiOS/RT. + + ChibiOS/RT is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 3 of the License, or + (at your option) any later version. + + ChibiOS/RT is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see . +*/ + +/** + * @addtogroup WIN32SIM_CORE + * @{ + */ + +#ifndef _CHCORE_H_ +#define _CHCORE_H_ + +/** + * Macro defining the a simulated architecture into Win32. + */ +#define CH_ARCHITECTURE_WIN32SIM + +/** + * 32 bit stack alignment. + */ +typedef uint32_t stkalign_t; + +/** + * Generic x86 register. + */ +typedef void *regx86; + +/** + * Interrupt saved context. + * This structure represents the stack frame saved during a preemption-capable + * interrupt handler. + */ +struct extctx { +}; + +/** + * System saved context. + * @note In this demo the floating point registers are not saved. + */ +struct intctx { + regx86 ebx; + regx86 edi; + regx86 esi; + regx86 ebp; + regx86 eip; +}; + +/** + * Platform dependent part of the @p Thread structure. + * This structure usually contains just the saved stack pointer defined as a + * pointer to a @p intctx structure. + */ +struct context { + struct intctx volatile *esp; +}; + +#define APUSH(p, a) (p) -= sizeof(void *), *(void **)(p) = (void*)(a) + +/** + * Platform dependent part of the @p chThdInit() API. + * This code usually setup the context switching frame represented by a + * @p intctx structure. + */ +#define SETUP_CONTEXT(workspace, wsize, pf, arg) { \ + uint8_t *esp = (uint8_t *)workspace + wsize; \ + APUSH(esp, arg); \ + APUSH(esp, threadexit); \ + esp -= sizeof(struct intctx); \ + ((struct intctx *)esp)->eip = pf; \ + ((struct intctx *)esp)->ebx = 0; \ + ((struct intctx *)esp)->edi = 0; \ + ((struct intctx *)esp)->esi = 0; \ + ((struct intctx *)esp)->ebp = 0; \ + tp->p_ctx.esp = (struct intctx *)esp; \ +} + +/** + * Stack size for the system idle thread. + */ +#ifndef IDLE_THREAD_STACK_SIZE +#define IDLE_THREAD_STACK_SIZE 256 +#endif + +/** + * Per-thread stack overhead for interrupts servicing, it is used in the + * calculation of the correct working area size. + * It requires stack space because the simulated "interrupt handlers" invoke + * Win32 APIs inside so it better have a lot of space. + */ +#ifndef INT_REQUIRED_STACK +#define INT_REQUIRED_STACK 16384 +#endif + +/** + * Enforces a correct alignment for a stack area size value. + */ +#define STACK_ALIGN(n) ((((n) - 1) | (sizeof(stkalign_t) - 1)) + 1) + + /** + * Computes the thread working area global size. + */ +#define THD_WA_SIZE(n) STACK_ALIGN(sizeof(Thread) + \ + sizeof(void *) * 2 + \ + sizeof(struct intctx) + \ + sizeof(struct extctx) + \ + (n) + (INT_REQUIRED_STACK)) + +/** + * Macro used to allocate a thread working area aligned as both position and + * size. + */ +#define WORKING_AREA(s, n) stkalign_t s[THD_WA_SIZE(n) / sizeof(stkalign_t)]; + +/** + * IRQ prologue code, inserted at the start of all IRQ handlers enabled to + * invoke system APIs. + */ +#define PORT_IRQ_PROLOGUE() + +/** + * IRQ epilogue code, inserted at the end of all IRQ handlers enabled to + * invoke system APIs. + */ +#define PORT_IRQ_EPILOGUE() + +/** + * IRQ handler function declaration. + */ +#define PORT_IRQ_HANDLER(id) void id(void) + +/** + * Simulator initialization. + */ +#define port_init() InitCore() + +/** + * Does nothing in this simulator. + */ +#define port_lock() + +/** + * Does nothing in this simulator. + */ +#define port_unlock() + +/** + * Does nothing in this simulator. + */ +#define port_lock_from_isr() + +/** + * Does nothing in this simulator. + */ +#define port_unlock_from_isr() + +/** + * Does nothing in this simulator. + */ +#define port_disable() + +/** + * Does nothing in this simulator. + */ +#define port_suspend() + +/** + * Does nothing in this simulator. + */ +#define port_enable() + +/** + * In the simulator this does a polling pass on the simulated interrupt + * sources. + */ +#define port_wait_for_interrupt() ChkIntSources() + +#ifdef __cplusplus +extern "C" { +#endif + __attribute__((fastcall)) void port_switch(Thread *otp, Thread *ntp); + __attribute__((fastcall)) void port_halt(void); + void InitCore(void); + void ChkIntSources(void); + void threadexit(void); +#ifdef __cplusplus +} +#endif + +#endif /* _CHCORE_H_ */ + +/** @} */ diff --git a/test/coverage/chtypes.h b/test/coverage/chtypes.h new file mode 100644 index 000000000..354da269e --- /dev/null +++ b/test/coverage/chtypes.h @@ -0,0 +1,47 @@ +/* + ChibiOS/RT - Copyright (C) 2006-2007 Giovanni Di Sirio. + + This file is part of ChibiOS/RT. + + ChibiOS/RT is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 3 of the License, or + (at your option) any later version. + + ChibiOS/RT is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see . +*/ + +#ifndef _CHTYPES_H_ +#define _CHTYPES_H_ + +#define __need_NULL +#define __need_size_t +#define __need_ptrdiff_t +#include + +#if !defined(_STDINT_H) && !defined(__STDINT_H_) +#include +#endif + +typedef int8_t bool_t; +typedef uint8_t tmode_t; +typedef uint8_t tstate_t; +typedef uint32_t tprio_t; +typedef int32_t msg_t; +typedef int32_t eventid_t; +typedef uint32_t eventmask_t; +typedef uint32_t systime_t; +typedef int32_t cnt_t; + +#define INLINE inline +#define PACK_STRUCT_STRUCT __attribute__((packed)) +#define PACK_STRUCT_BEGIN +#define PACK_STRUCT_END + +#endif /* _CHTYPES_H_ */ diff --git a/test/coverage/main.c b/test/coverage/main.c new file mode 100644 index 000000000..af8762562 --- /dev/null +++ b/test/coverage/main.c @@ -0,0 +1,43 @@ +/* + ChibiOS/RT - Copyright (C) 2006-2007 Giovanni Di Sirio. + + This file is part of ChibiOS/RT. + + ChibiOS/RT is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 3 of the License, or + (at your option) any later version. + + ChibiOS/RT is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see . +*/ + +#include +#include +#include + +#include +#include + +extern FullDuplexDriver COM1; + +/* + * Simulator main. + */ +int main(int argc, char *argv[]) { + msg_t result; + + chSysInit(); + result = TestThread(&COM1); + chThdSleepMilliseconds(1); /* Gives time to flush COM1 output queue */ + fflush(stdout); + if (result) + exit(1); + else + exit(0); +} diff --git a/test/coverage/readme.txt b/test/coverage/readme.txt new file mode 100644 index 000000000..fc3595112 --- /dev/null +++ b/test/coverage/readme.txt @@ -0,0 +1,6 @@ +In order to compute the code coverage: + +- Build the test application: make +- Run the test suite: ch +- Compute the code coverage: make gcov +- Clear everything: make clean diff --git a/test/coverage/simcom.c b/test/coverage/simcom.c new file mode 100644 index 000000000..e8fceb76a --- /dev/null +++ b/test/coverage/simcom.c @@ -0,0 +1,66 @@ +/* + ChibiOS/RT - Copyright (C) 2006-2007 Giovanni Di Sirio. + + This file is part of ChibiOS/RT. + + ChibiOS/RT is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 3 of the License, or + (at your option) any later version. + + ChibiOS/RT is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see . +*/ + +/* + * Win32 COM port simulator (on stdout). + */ + +#include + +#include +#include + +#undef CDECL + +#include + +FullDuplexDriver COM1; + +static uint8_t com_ib[1024]; +static uint8_t com_ob[1024]; + +void init_simcom1(void) { + + chFDDInit(&COM1, com_ib, sizeof(com_ib), NULL, com_ob, sizeof(com_ob), NULL); +} + +bool_t com1_conn_chkint(void) { + + return FALSE; +} + +bool_t com1_in_chkint(void) { + + return FALSE; +} + +bool_t com1_out_chkint(void) { + msg_t n; + bool_t rflag = FALSE; + + while (TRUE) { + n = chFDDRequestDataI(&COM1); + if (n < 0) { + fflush(stdout); + return rflag; + } + fputc(n, stdout); + rflag = TRUE; + } +} -- cgit v1.2.3 From ef22e9204dc12eb8e3289e1eb94945f3ecbaee7c Mon Sep 17 00:00:00 2001 From: gdisirio Date: Sat, 11 Apr 2009 15:03:58 +0000 Subject: Improvements to the coverage tool. git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@888 35acf78f-673a-0410-8e92-d51de3d6d3f4 --- test/coverage/chconf.h | 2 +- test/coverage/chcore.h | 18 +++++++++--------- 2 files changed, 10 insertions(+), 10 deletions(-) (limited to 'test') diff --git a/test/coverage/chconf.h b/test/coverage/chconf.h index b979a9517..ebd7c3dbd 100644 --- a/test/coverage/chconf.h +++ b/test/coverage/chconf.h @@ -58,7 +58,7 @@ * @note The default is @p FALSE. */ #if !defined(CH_USE_NESTED_LOCKS) || defined(__DOXYGEN__) -#define CH_USE_NESTED_LOCKS FALSE +#define CH_USE_NESTED_LOCKS TRUE #endif /** diff --git a/test/coverage/chcore.h b/test/coverage/chcore.h index 276b935da..321bd816e 100644 --- a/test/coverage/chcore.h +++ b/test/coverage/chcore.h @@ -130,13 +130,13 @@ struct context { * IRQ prologue code, inserted at the start of all IRQ handlers enabled to * invoke system APIs. */ -#define PORT_IRQ_PROLOGUE() +#define PORT_IRQ_PROLOGUE() asm volatile ("nop") /** * IRQ epilogue code, inserted at the end of all IRQ handlers enabled to * invoke system APIs. */ -#define PORT_IRQ_EPILOGUE() +#define PORT_IRQ_EPILOGUE() asm volatile ("nop") /** * IRQ handler function declaration. @@ -151,37 +151,37 @@ struct context { /** * Does nothing in this simulator. */ -#define port_lock() +#define port_lock() asm volatile ("nop") /** * Does nothing in this simulator. */ -#define port_unlock() +#define port_unlock() asm volatile ("nop") /** * Does nothing in this simulator. */ -#define port_lock_from_isr() +#define port_lock_from_isr() asm volatile ("nop") /** * Does nothing in this simulator. */ -#define port_unlock_from_isr() +#define port_unlock_from_isr() asm volatile ("nop") /** * Does nothing in this simulator. */ -#define port_disable() +#define port_disable() asm volatile ("nop") /** * Does nothing in this simulator. */ -#define port_suspend() +#define port_suspend() asm volatile ("nop") /** * Does nothing in this simulator. */ -#define port_enable() +#define port_enable() asm volatile ("nop") /** * In the simulator this does a polling pass on the simulated interrupt -- cgit v1.2.3 From 0e27db08794a9ce9205cf45f1b4189d89616ef05 Mon Sep 17 00:00:00 2001 From: gdisirio Date: Sun, 12 Apr 2009 08:03:50 +0000 Subject: git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@889 35acf78f-673a-0410-8e92-d51de3d6d3f4 --- test/coverage/Makefile | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'test') diff --git a/test/coverage/Makefile b/test/coverage/Makefile index 8910d981d..687d73233 100644 --- a/test/coverage/Makefile +++ b/test/coverage/Makefile @@ -118,7 +118,7 @@ all: $(OBJS) $(PROJECT).exe gcov: -mkdir gcov $(COV) -u $(subst /,\,$(KERNSRC)) - -mv *.gcov ./gcov + -mv -f *.gcov ./gcov .PHONY: clean clean: @@ -132,7 +132,6 @@ clean: -rm -f $(ASRC:.s=.s.bak) -rm -f $(ASRC:.s=.lst) -rm -fR .dep - -rm -fR gcov # # Include the dependency files, should be the last of the makefile -- cgit v1.2.3 From 2d1d900b6d11a3f7ef5ff3e0f7f02faa40d8b25f Mon Sep 17 00:00:00 2001 From: gdisirio Date: Sun, 12 Apr 2009 08:38:51 +0000 Subject: Fixed bug 2755170. git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@890 35acf78f-673a-0410-8e92-d51de3d6d3f4 --- test/testsem.c | 45 +++++++++++++++++++++++++++++++++++---------- 1 file changed, 35 insertions(+), 10 deletions(-) (limited to 'test') diff --git a/test/testsem.c b/test/testsem.c index e6153fa8d..d6e432a36 100644 --- a/test/testsem.c +++ b/test/testsem.c @@ -37,7 +37,7 @@ static void sem1_setup(void) { chSemInit(&sem1, 0); } -static msg_t thread(void *p) { +static msg_t thread1(void *p) { chSemWait(&sem1); test_emit_token(*(char *)p); @@ -46,11 +46,11 @@ static msg_t thread(void *p) { static void sem1_execute(void) { - threads[0] = chThdCreateStatic(wa[0], WA_SIZE, chThdGetPriority()+5, thread, "A"); - threads[1] = chThdCreateStatic(wa[1], WA_SIZE, chThdGetPriority()+1, thread, "B"); - threads[2] = chThdCreateStatic(wa[2], WA_SIZE, chThdGetPriority()+3, thread, "C"); - threads[3] = chThdCreateStatic(wa[3], WA_SIZE, chThdGetPriority()+4, thread, "D"); - threads[4] = chThdCreateStatic(wa[4], WA_SIZE, chThdGetPriority()+2, thread, "E"); + threads[0] = chThdCreateStatic(wa[0], WA_SIZE, chThdGetPriority()+5, thread1, "A"); + threads[1] = chThdCreateStatic(wa[1], WA_SIZE, chThdGetPriority()+1, thread1, "B"); + threads[2] = chThdCreateStatic(wa[2], WA_SIZE, chThdGetPriority()+3, thread1, "C"); + threads[3] = chThdCreateStatic(wa[3], WA_SIZE, chThdGetPriority()+4, thread1, "D"); + threads[4] = chThdCreateStatic(wa[4], WA_SIZE, chThdGetPriority()+2, thread1, "E"); chSemSignal(&sem1); chSemSignal(&sem1); chSemSignal(&sem1); @@ -82,21 +82,46 @@ static void sem2_setup(void) { chSemInit(&sem1, 0); } +static msg_t thread2(void *p) { + + chThdSleepMilliseconds(50); + chSemSignal(&sem1); + return 0; +} + static void sem2_execute(void) { int i; systime_t target_time; msg_t msg; - msg= chSemWaitTimeout(&sem1, TIME_IMMEDIATE); + /* + * Testing special case TIME_IMMEDIATE. + */ + msg = chSemWaitTimeout(&sem1, TIME_IMMEDIATE); test_assert(msg == RDY_TIMEOUT, "#1"); + test_assert(isempty(&sem1.s_queue), "#2"); /* Queue not empty */ + test_assert(sem1.s_cnt == 0, "#3"); /* Counter not zero */ + + /* + * Testing not timeout condition. + */ + threads[0] = chThdCreateStatic(wa[0], WA_SIZE, chThdGetPriority()-1, thread2, "A"); + msg = chSemWaitTimeout(&sem1, MS2ST(500)); + test_wait_threads(); + test_assert(msg == RDY_OK, "#4"); + test_assert(isempty(&sem1.s_queue), "#5"); /* Queue not empty */ + test_assert(sem1.s_cnt == 0, "#6"); /* Counter not zero */ + /* + * Testing timeout condition. + */ target_time = chTimeNow() + MS2ST(5 * 500); for (i = 0; i < 5; i++) { test_emit_token('A' + i); msg = chSemWaitTimeout(&sem1, MS2ST(500)); - test_assert(msg == RDY_TIMEOUT, "#2"); - test_assert(isempty(&sem1.s_queue), "#3"); /* Queue not empty */ - test_assert(&sem1.s_cnt != 0, "#4"); /* Counter not zero */ + test_assert(msg == RDY_TIMEOUT, "#7"); + test_assert(isempty(&sem1.s_queue), "#8"); /* Queue not empty */ + test_assert(sem1.s_cnt == 0, "#9"); /* Counter not zero */ } test_assert_sequence("ABCDE"); test_assert_time_window(target_time, target_time + ALLOWED_DELAY); -- cgit v1.2.3 From 97817eb7dcdc881e05e1d46c125a7f8db6b111d1 Mon Sep 17 00:00:00 2001 From: gdisirio Date: Sun, 12 Apr 2009 13:00:42 +0000 Subject: Added more test cases. git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@896 35acf78f-673a-0410-8e92-d51de3d6d3f4 --- test/test.c | 6 ++- test/testmtx.c | 143 ++++++++++++++++++++++++++++++++++++++++++++++++--------- 2 files changed, 126 insertions(+), 23 deletions(-) (limited to 'test') diff --git a/test/test.c b/test/test.c index 887d56ecc..5cc11f542 100644 --- a/test/test.c +++ b/test/test.c @@ -164,8 +164,10 @@ void test_wait_threads(void) { int i; for (i = 0; i < MAX_THREADS; i++) - if (threads[i]) + if (threads[i] != NULL) { chThdWait(threads[i]); + threads[i] = NULL; + } } void test_cpu_pulse(unsigned ms) { @@ -222,6 +224,8 @@ static void execute_test(const struct testcase *tcp) { tcp->execute(); if (tcp->teardown != NULL) tcp->teardown(); + + test_wait_threads(); } msg_t TestThread(void *p) { diff --git a/test/testmtx.c b/test/testmtx.c index c8050e887..feaeb2338 100644 --- a/test/testmtx.c +++ b/test/testmtx.c @@ -214,14 +214,111 @@ const struct testcase testmtx3 = { mtx3_execute }; -#if CH_USE_CONDVARS static char *mtx4_gettest(void) { - return "CondVar, signal test"; + return "Mutexes, priority return"; } static void mtx4_setup(void) { + chMtxInit(&m1); + chMtxInit(&m2); +} + +static msg_t thread13(void *p) { + + chThdSleepMilliseconds(50); + chMtxLock(&m2); + chMtxUnlock(); + return 0; +} + +static msg_t thread14(void *p) { + + chThdSleepMilliseconds(150); + chMtxLock(&m1); + chMtxUnlock(); + return 0; +} + +static void mtx4_execute(void) { + tprio_t p, p1, p2; + + p = chThdGetPriority(); + p1 = p + 1; + p2 = p + 2; + threads[0] = chThdCreateStatic(wa[0], WA_SIZE, p1, thread13, "B"); + threads[1] = chThdCreateStatic(wa[1], WA_SIZE, p2, thread14, "A"); + chMtxLock(&m2); + test_assert(chThdGetPriority() == p, "#1"); + chThdSleepMilliseconds(100); + test_assert(chThdGetPriority() == p1, "#2"); + chMtxLock(&m1); + test_assert(chThdGetPriority() == p1, "#3"); + chThdSleepMilliseconds(100); + test_assert(chThdGetPriority() == p2, "#4"); + chMtxUnlock(); + test_assert(chThdGetPriority() == p1, "#5"); + chThdSleepMilliseconds(100); + test_assert(chThdGetPriority() == p1, "#6"); + chMtxUnlockAll(); + test_assert(chThdGetPriority() == p, "#7"); + test_wait_threads(); +} + +const struct testcase testmtx4 = { + mtx4_gettest, + mtx4_setup, + NULL, + mtx4_execute +}; + +static char *mtx5_gettest(void) { + + return "Mutexes, coverage"; +} + +static void mtx5_setup(void) { + + chMtxInit(&m1); +} + +static void mtx5_execute(void) { + bool_t b; + tprio_t prio; + + prio = chThdGetPriority(); + + b = chMtxTryLock(&m1); + test_assert(b, "#1"); + + b = chMtxTryLock(&m1); + test_assert(!b, "#2"); + + chSysLock(); + chMtxUnlockS(); + chSysUnlock(); + + test_assert(isempty(&m1.m_queue), "#3"); /* Queue not empty */ + test_assert(m1.m_owner == NULL, "#4"); /* Owned */ + test_assert(chThdGetPriority() == prio, "#5"); +} + +const struct testcase testmtx5 = { + mtx5_gettest, + mtx5_setup, + NULL, + mtx5_execute +}; + +#if CH_USE_CONDVARS +static char *mtx6_gettest(void) { + + return "CondVar, signal test"; +} + +static void mtx6_setup(void) { + chCondInit(&c1); chMtxInit(&m1); } @@ -235,7 +332,7 @@ static msg_t thread10(void *p) { return 0; } -static void mtx4_execute(void) { +static void mtx6_execute(void) { tprio_t prio = chThdGetPriority(); threads[0] = chThdCreateStatic(wa[0], WA_SIZE, prio+1, thread10, "E"); @@ -252,25 +349,25 @@ static void mtx4_execute(void) { test_assert_sequence("ABCDE"); } -const struct testcase testmtx4 = { - mtx4_gettest, - mtx4_setup, +const struct testcase testmtx6 = { + mtx6_gettest, + mtx6_setup, NULL, - mtx4_execute + mtx6_execute }; -static char *mtx5_gettest(void) { +static char *mtx7_gettest(void) { return "CondVar, broadcast test"; } -static void mtx5_setup(void) { +static void mtx7_setup(void) { chCondInit(&c1); chMtxInit(&m1); } -static void mtx5_execute(void) { +static void mtx7_execute(void) { // Bacause priority inheritance. tprio_t prio = chThdGetPriority(); @@ -284,19 +381,19 @@ static void mtx5_execute(void) { test_assert_sequence("ABCDE"); } -const struct testcase testmtx5 = { - mtx5_gettest, - mtx5_setup, +const struct testcase testmtx7 = { + mtx7_gettest, + mtx7_setup, NULL, - mtx5_execute + mtx7_execute }; -static char *mtx6_gettest(void) { +static char *mtx8_gettest(void) { return "CondVar, inheritance boost test"; } -static void mtx6_setup(void) { +static void mtx8_setup(void) { chCondInit(&c1); chMtxInit(&m1); @@ -322,7 +419,7 @@ static msg_t thread12(void *p) { return 0; } -static void mtx6_execute(void) { +static void mtx8_execute(void) { tprio_t prio = chThdGetPriority(); threads[0] = chThdCreateStatic(wa[0], WA_SIZE, prio+1, thread11, "A"); @@ -334,11 +431,11 @@ static void mtx6_execute(void) { test_assert_sequence("ABC"); } -const struct testcase testmtx6 = { - mtx6_gettest, - mtx6_setup, +const struct testcase testmtx8 = { + mtx8_gettest, + mtx8_setup, NULL, - mtx6_execute + mtx8_execute }; #endif /* CH_USE_CONDVARS */ #endif /* CH_USE_MUTEXES */ @@ -351,10 +448,12 @@ const struct testcase * const patternmtx[] = { &testmtx1, &testmtx2, &testmtx3, -#if CH_USE_CONDVARS &testmtx4, &testmtx5, +#if CH_USE_CONDVARS &testmtx6, + &testmtx7, + &testmtx8, #endif #endif NULL -- cgit v1.2.3 From 3dda222a772d8178ef04205c525c3c417e2ce7ad Mon Sep 17 00:00:00 2001 From: gdisirio Date: Sun, 12 Apr 2009 16:31:59 +0000 Subject: 100% code coverage for mutexes. git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@897 35acf78f-673a-0410-8e92-d51de3d6d3f4 --- test/testmtx.c | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) (limited to 'test') diff --git a/test/testmtx.c b/test/testmtx.c index feaeb2338..e62bb0c74 100644 --- a/test/testmtx.c +++ b/test/testmtx.c @@ -264,6 +264,27 @@ static void mtx4_execute(void) { chMtxUnlockAll(); test_assert(chThdGetPriority() == p, "#7"); test_wait_threads(); + + /* Test repeated in order to cover chMtxUnlockS().*/ + threads[0] = chThdCreateStatic(wa[0], WA_SIZE, p1, thread13, "D"); + threads[1] = chThdCreateStatic(wa[1], WA_SIZE, p2, thread14, "C"); + chMtxLock(&m2); + test_assert(chThdGetPriority() == p, "#8"); + chThdSleepMilliseconds(100); + test_assert(chThdGetPriority() == p1, "#9"); + chMtxLock(&m1); + test_assert(chThdGetPriority() == p1, "#10"); + chThdSleepMilliseconds(100); + test_assert(chThdGetPriority() == p2, "#11"); + chSysLock(); + chMtxUnlockS(); + chSysUnlock(); + test_assert(chThdGetPriority() == p1, "#12"); + chThdSleepMilliseconds(100); + test_assert(chThdGetPriority() == p1, "#13"); + chMtxUnlockAll(); + test_assert(chThdGetPriority() == p, "#14"); + test_wait_threads(); } const struct testcase testmtx4 = { -- cgit v1.2.3 From 90c431b280ac0188980b43a42b11191ca2800fa8 Mon Sep 17 00:00:00 2001 From: gdisirio Date: Sun, 12 Apr 2009 16:40:44 +0000 Subject: 100% code coverage for condvars. git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@898 35acf78f-673a-0410-8e92-d51de3d6d3f4 --- test/testmtx.c | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) (limited to 'test') diff --git a/test/testmtx.c b/test/testmtx.c index e62bb0c74..421ab9536 100644 --- a/test/testmtx.c +++ b/test/testmtx.c @@ -361,11 +361,14 @@ static void mtx6_execute(void) { threads[2] = chThdCreateStatic(wa[2], WA_SIZE, prio+3, thread10, "C"); threads[3] = chThdCreateStatic(wa[3], WA_SIZE, prio+4, thread10, "B"); threads[4] = chThdCreateStatic(wa[4], WA_SIZE, prio+5, thread10, "A"); - chCondSignal(&c1); - chCondSignal(&c1); - chCondSignal(&c1); - chCondSignal(&c1); - chCondSignal(&c1); + chSysLock(); + chCondSignalI(&c1); + chCondSignalI(&c1); + chCondSignalI(&c1); + chCondSignalI(&c1); + chCondSignalI(&c1); + chSchRescheduleS(); + chSysUnlock(); test_wait_threads(); test_assert_sequence("ABCDE"); } @@ -425,7 +428,7 @@ static msg_t thread11(void *p) { chMtxLock(&m2); chMtxLock(&m1); - chCondWait(&c1); + chCondWaitTimeout(&c1, TIME_INFINITE); test_emit_token(*(char *)p); chMtxUnlock(); chMtxUnlock(); -- cgit v1.2.3 From f140302b0b3e9f7c84fede1120e3bb15c2c4322a Mon Sep 17 00:00:00 2001 From: gdisirio Date: Mon, 13 Apr 2009 08:15:51 +0000 Subject: 97.92% code coverage for threads. git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@899 35acf78f-673a-0410-8e92-d51de3d6d3f4 --- test/test.c | 4 +- test/test.mk | 2 +- test/testrdy.c | 83 --------------------------------- test/testrdy.h | 25 ---------- test/testthd.c | 145 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++ test/testthd.h | 25 ++++++++++ 6 files changed, 173 insertions(+), 111 deletions(-) delete mode 100644 test/testrdy.c delete mode 100644 test/testrdy.h create mode 100644 test/testthd.c create mode 100644 test/testthd.h (limited to 'test') diff --git a/test/test.c b/test/test.c index 5cc11f542..73fbe7381 100644 --- a/test/test.c +++ b/test/test.c @@ -20,7 +20,7 @@ #include #include "test.h" -#include "testrdy.h" +#include "testthd.h" #include "testsem.h" #include "testmtx.h" #include "testmsg.h" @@ -35,7 +35,7 @@ * Array of all the test patterns. */ static const struct testcase **patterns[] = { - patternrdy, + patternthd, patternsem, patternmtx, patternmsg, diff --git a/test/test.mk b/test/test.mk index 9f423de64..ee5128ac2 100644 --- a/test/test.mk +++ b/test/test.mk @@ -1,5 +1,5 @@ # List of all the ChibiOS/RT test files. -TESTSRC = ../../test/test.c ../../test/testrdy.c ../../test/testsem.c \ +TESTSRC = ../../test/test.c ../../test/testthd.c ../../test/testsem.c \ ../../test/testmtx.c ../../test/testmsg.c ../../test/testmbox.c \ ../../test/testevt.c ../../test/testheap.c ../../test/testpools.c \ ../../test/testdyn.c ../../test/testbmk.c diff --git a/test/testrdy.c b/test/testrdy.c deleted file mode 100644 index d35b783c4..000000000 --- a/test/testrdy.c +++ /dev/null @@ -1,83 +0,0 @@ -/* - ChibiOS/RT - Copyright (C) 2006-2007 Giovanni Di Sirio. - - This file is part of ChibiOS/RT. - - ChibiOS/RT is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 3 of the License, or - (at your option) any later version. - - ChibiOS/RT is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program. If not, see . -*/ - -#include - -#include "test.h" - -static msg_t thread(void *p) { - - test_emit_token(*(char *)p); - return 0; -} - -static char *rdy1_gettest(void) { - - return "Ready List, priority enqueuing test #1"; -} - -static void rdy1_execute(void) { - - threads[0] = chThdCreateStatic(wa[0], WA_SIZE, chThdGetPriority()-5, thread, "E"); - threads[1] = chThdCreateStatic(wa[1], WA_SIZE, chThdGetPriority()-4, thread, "D"); - threads[2] = chThdCreateStatic(wa[2], WA_SIZE, chThdGetPriority()-3, thread, "C"); - threads[3] = chThdCreateStatic(wa[3], WA_SIZE, chThdGetPriority()-2, thread, "B"); - threads[4] = chThdCreateStatic(wa[4], WA_SIZE, chThdGetPriority()-1, thread, "A"); - test_wait_threads(); - test_assert_sequence("ABCDE"); -} - -const struct testcase testrdy1 = { - rdy1_gettest, - NULL, - NULL, - rdy1_execute -}; - -static char *rdy2_gettest(void) { - - return "Ready List, priority enqueuing test #2"; -} - -static void rdy2_execute(void) { - - threads[1] = chThdCreateStatic(wa[1], WA_SIZE, chThdGetPriority()-4, thread, "D"); - threads[0] = chThdCreateStatic(wa[0], WA_SIZE, chThdGetPriority()-5, thread, "E"); - threads[4] = chThdCreateStatic(wa[4], WA_SIZE, chThdGetPriority()-1, thread, "A"); - threads[3] = chThdCreateStatic(wa[3], WA_SIZE, chThdGetPriority()-2, thread, "B"); - threads[2] = chThdCreateStatic(wa[2], WA_SIZE, chThdGetPriority()-3, thread, "C"); - test_wait_threads(); - test_assert_sequence("ABCDE"); -} - -const struct testcase testrdy2 = { - rdy2_gettest, - NULL, - NULL, - rdy2_execute -}; - -/* - * Test sequence for ready list pattern. - */ -const struct testcase * const patternrdy[] = { - &testrdy1, - &testrdy2, - NULL -}; diff --git a/test/testrdy.h b/test/testrdy.h deleted file mode 100644 index 3be545b1b..000000000 --- a/test/testrdy.h +++ /dev/null @@ -1,25 +0,0 @@ -/* - ChibiOS/RT - Copyright (C) 2006-2007 Giovanni Di Sirio. - - This file is part of ChibiOS/RT. - - ChibiOS/RT is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 3 of the License, or - (at your option) any later version. - - ChibiOS/RT is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program. If not, see . -*/ - -#ifndef _TESTRDY_H_ -#define _TESTRDY_H_ - -extern const struct testcase *patternrdy[]; - -#endif /* _TESTRDY_H_ */ diff --git a/test/testthd.c b/test/testthd.c new file mode 100644 index 000000000..92f0bfe9f --- /dev/null +++ b/test/testthd.c @@ -0,0 +1,145 @@ +/* + ChibiOS/RT - Copyright (C) 2006-2007 Giovanni Di Sirio. + + This file is part of ChibiOS/RT. + + ChibiOS/RT is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 3 of the License, or + (at your option) any later version. + + ChibiOS/RT is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see . +*/ + +#include + +#include "test.h" + +static msg_t thread(void *p) { + + test_emit_token(*(char *)p); + return 0; +} + +static char *thd1_gettest(void) { + + return "Threads, enqueuing test #1"; +} + +static void thd1_execute(void) { + + threads[0] = chThdCreateStatic(wa[0], WA_SIZE, chThdGetPriority()-5, thread, "E"); + threads[1] = chThdCreateStatic(wa[1], WA_SIZE, chThdGetPriority()-4, thread, "D"); + threads[2] = chThdCreateStatic(wa[2], WA_SIZE, chThdGetPriority()-3, thread, "C"); + threads[3] = chThdCreateStatic(wa[3], WA_SIZE, chThdGetPriority()-2, thread, "B"); + threads[4] = chThdCreateStatic(wa[4], WA_SIZE, chThdGetPriority()-1, thread, "A"); + test_wait_threads(); + test_assert_sequence("ABCDE"); +} + +const struct testcase testthd1 = { + thd1_gettest, + NULL, + NULL, + thd1_execute +}; + +static char *thd2_gettest(void) { + + return "Threads, enqueuing test #2"; +} + +static void thd2_execute(void) { + + threads[1] = chThdCreateStatic(wa[1], WA_SIZE, chThdGetPriority()-4, thread, "D"); + threads[0] = chThdCreateStatic(wa[0], WA_SIZE, chThdGetPriority()-5, thread, "E"); + threads[4] = chThdCreateStatic(wa[4], WA_SIZE, chThdGetPriority()-1, thread, "A"); + threads[3] = chThdCreateStatic(wa[3], WA_SIZE, chThdGetPriority()-2, thread, "B"); + threads[2] = chThdCreateStatic(wa[2], WA_SIZE, chThdGetPriority()-3, thread, "C"); + test_wait_threads(); + test_assert_sequence("ABCDE"); +} + +const struct testcase testthd2 = { + thd2_gettest, + NULL, + NULL, + thd2_execute +}; + +static char *thd3_gettest(void) { + + return "Threads, priority change"; +} + +static void thd3_execute(void) { + tprio_t prio, p1; + + prio = chThdGetPriority(); + p1 = chThdSetPriority(prio + 1); + test_assert(p1 == prio, "#1"); + test_assert(chThdGetPriority() == prio + 1, "#2"); + p1 = chThdSetPriority(p1); + test_assert(p1 == prio + 1, "#3"); + test_assert(chThdGetPriority() == prio, "#4"); +} + +const struct testcase testthd3 = { + thd3_gettest, + NULL, + NULL, + thd3_execute +}; + +static char *thd4_gettest(void) { + + return "Threads, delays"; +} + +static void thd4_execute(void) { + systime_t time; + + /* Timeouts in microseconds.*/ + time = chTimeNow(); + chThdSleepMicroseconds(100000); + test_assert(chTimeIsWithin(time + US2ST(100000), time + US2ST(100000) + 1), "#1"); + + /* Timeouts in milliseconds.*/ + time = chTimeNow(); + chThdSleepMilliseconds(100); + test_assert(chTimeIsWithin(time + MS2ST(100), time + MS2ST(100) + 1), "#2"); + + /* Timeouts in seconds.*/ + time = chTimeNow(); + chThdSleepSeconds(1); + test_assert(chTimeIsWithin(time + S2ST(1), time + S2ST(1) + 1), "#3"); + + /* Absolute timelines.*/ + time = chTimeNow() + MS2ST(100); + chThdSleepUntil(time); + test_assert(chTimeIsWithin(time, time + 1), "#4"); +} + +const struct testcase testthd4 = { + thd4_gettest, + NULL, + NULL, + thd4_execute +}; + +/* + * Test sequence for ready list pattern. + */ +const struct testcase * const patternthd[] = { + &testthd1, + &testthd2, + &testthd3, + &testthd4, + NULL +}; diff --git a/test/testthd.h b/test/testthd.h new file mode 100644 index 000000000..936795e56 --- /dev/null +++ b/test/testthd.h @@ -0,0 +1,25 @@ +/* + ChibiOS/RT - Copyright (C) 2006-2007 Giovanni Di Sirio. + + This file is part of ChibiOS/RT. + + ChibiOS/RT is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 3 of the License, or + (at your option) any later version. + + ChibiOS/RT is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see . +*/ + +#ifndef _TESTRDY_H_ +#define _TESTRDY_H_ + +extern const struct testcase *patternthd[]; + +#endif /* _TESTRDY_H_ */ -- cgit v1.2.3 From 339c8e993d31bc1585ade9d6b1e04d4bdceae630 Mon Sep 17 00:00:00 2001 From: gdisirio Date: Mon, 13 Apr 2009 09:56:03 +0000 Subject: New benchmark added. git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@900 35acf78f-673a-0410-8e92-d51de3d6d3f4 --- test/testbmk.c | 139 ++++++++++++++++++++++++++++++++++++++++----------------- 1 file changed, 98 insertions(+), 41 deletions(-) (limited to 'test') diff --git a/test/testbmk.c b/test/testbmk.c index 8d02b8ae5..ad7f528e4 100644 --- a/test/testbmk.c +++ b/test/testbmk.c @@ -141,26 +141,51 @@ const struct testcase testbmk3 = { static char *bmk4_gettest(void) { - return "Benchmark, threads creation/termination, worst case"; + return "Benchmark, context switch #4, naked"; +} + +msg_t thread4(void *p) { + msg_t msg; + Thread *self = chThdSelf(); + + chSysLock(); + do { + chSchGoSleepS(PRSUSPENDED); + msg = self->p_rdymsg; + } while (msg == RDY_OK); + chSysUnlock(); + return 0; } static void bmk4_execute(void) { + Thread *tp; + tp = threads[0] = chThdCreateStatic(wa[0], WA_SIZE, chThdGetPriority()+1, thread4, NULL); uint32_t n = 0; - void *wap = wa[0]; - tprio_t prio = chThdGetPriority() - 1; test_wait_tick(); test_start_timer(1000); do { - chThdWait(chThdCreateStatic(wap, WA_SIZE, prio, thread2, NULL)); - n++; + chSysLock(); + chSchWakeupS(tp, RDY_OK); + chSchWakeupS(tp, RDY_OK); + chSchWakeupS(tp, RDY_OK); + chSchWakeupS(tp, RDY_OK); + chSysUnlock(); + n += 4; #if defined(WIN32) ChkIntSources(); #endif } while (!test_timer_done); + chSysLock(); + chSchWakeupS(tp, RDY_TIMEOUT); + chSysUnlock(); + + test_wait_threads(); test_print("--- Score : "); test_printn(n); - test_println(" threads/S"); + test_print(" msgs/S, "); + test_printn(n << 1); + test_println(" ctxswc/S"); } const struct testcase testbmk4 = { @@ -172,18 +197,18 @@ const struct testcase testbmk4 = { static char *bmk5_gettest(void) { - return "Benchmark, threads creation/termination, optimal"; + return "Benchmark, threads creation/termination, worst case"; } static void bmk5_execute(void) { uint32_t n = 0; void *wap = wa[0]; - tprio_t prio = chThdGetPriority() + 1; + tprio_t prio = chThdGetPriority() - 1; test_wait_tick(); test_start_timer(1000); do { - chThdCreateStatic(wap, WA_SIZE, prio, thread2, NULL); + chThdWait(chThdCreateStatic(wap, WA_SIZE, prio, thread2, NULL)); n++; #if defined(WIN32) ChkIntSources(); @@ -201,6 +226,37 @@ const struct testcase testbmk5 = { bmk5_execute }; +static char *bmk6_gettest(void) { + + return "Benchmark, threads creation/termination, optimal"; +} + +static void bmk6_execute(void) { + + uint32_t n = 0; + void *wap = wa[0]; + tprio_t prio = chThdGetPriority() + 1; + test_wait_tick(); + test_start_timer(1000); + do { + chThdCreateStatic(wap, WA_SIZE, prio, thread2, NULL); + n++; +#if defined(WIN32) + ChkIntSources(); +#endif + } while (!test_timer_done); + test_print("--- Score : "); + test_printn(n); + test_println(" threads/S"); +} + +const struct testcase testbmk6 = { + bmk6_gettest, + NULL, + NULL, + bmk6_execute +}; + static msg_t thread3(void *p) { while (!chThdShouldTerminate()) @@ -208,17 +264,17 @@ static msg_t thread3(void *p) { return 0; } -static char *bmk6_gettest(void) { +static char *bmk7_gettest(void) { return "Benchmark, mass reschedulation, 5 threads"; } -static void bmk6_setup(void) { +static void bmk7_setup(void) { chSemInit(&sem1, 0); } -static void bmk6_execute(void) { +static void bmk7_execute(void) { uint32_t n; threads[0] = chThdCreateStatic(wa[0], WA_SIZE, chThdGetPriority()+1, thread3, NULL); @@ -248,19 +304,19 @@ static void bmk6_execute(void) { test_println(" ctxswc/S"); } -const struct testcase testbmk6 = { - bmk6_gettest, - bmk6_setup, +const struct testcase testbmk7 = { + bmk7_gettest, + bmk7_setup, NULL, - bmk6_execute + bmk7_execute }; -static char *bmk7_gettest(void) { +static char *bmk8_gettest(void) { return "Benchmark, I/O Queues throughput"; } -static void bmk7_execute(void) { +static void bmk8_execute(void) { static uint8_t ib[16]; static Queue iq; @@ -287,21 +343,21 @@ static void bmk7_execute(void) { test_println(" bytes/S"); } -const struct testcase testbmk7 = { - bmk7_gettest, +const struct testcase testbmk8 = { + bmk8_gettest, NULL, NULL, - bmk7_execute + bmk8_execute }; -static char *bmk8_gettest(void) { +static char *bmk9_gettest(void) { return "Benchmark, virtual timers set/reset"; } static void tmo(void *param) {} -static void bmk8_execute(void) { +static void bmk9_execute(void) { static VirtualTimer vt1, vt2; uint32_t n = 0; @@ -324,24 +380,24 @@ static void bmk8_execute(void) { test_println(" timers/S"); } -const struct testcase testbmk8 = { - bmk8_gettest, +const struct testcase testbmk9 = { + bmk9_gettest, NULL, NULL, - bmk8_execute + bmk9_execute }; -static char *bmk9_gettest(void) { +static char *bmk10_gettest(void) { return "Benchmark, semaphores wait/signal"; } -static void bmk9_setup(void) { +static void bmk10_setup(void) { chSemInit(&sem1, 1); } -static void bmk9_execute(void) { +static void bmk10_execute(void) { uint32_t n = 0; test_wait_tick(); @@ -365,25 +421,25 @@ static void bmk9_execute(void) { test_println(" wait+signal/S"); } -const struct testcase testbmk9 = { - bmk9_gettest, - bmk9_setup, +const struct testcase testbmk10 = { + bmk10_gettest, + bmk10_setup, NULL, - bmk9_execute + bmk10_execute }; #if CH_USE_MUTEXES -static char *bmk10_gettest(void) { +static char *bmk11_gettest(void) { return "Benchmark, mutexes lock/unlock"; } -static void bmk10_setup(void) { +static void bmk11_setup(void) { chMtxInit(&mtx1); } -static void bmk10_execute(void) { +static void bmk11_execute(void) { uint32_t n = 0; test_wait_tick(); @@ -407,11 +463,11 @@ static void bmk10_execute(void) { test_println(" lock+unlock/S"); } -const struct testcase testbmk10 = { - bmk10_gettest, - bmk10_setup, +const struct testcase testbmk11 = { + bmk11_gettest, + bmk11_setup, NULL, - bmk10_execute + bmk11_execute }; #endif @@ -429,8 +485,9 @@ const struct testcase * const patternbmk[] = { &testbmk7, &testbmk8, &testbmk9, -#if CH_USE_MUTEXES &testbmk10, +#if CH_USE_MUTEXES + &testbmk11, #endif #endif NULL -- cgit v1.2.3 From 1f5d676018f3657d687d98b5401383b884fe0630 Mon Sep 17 00:00:00 2001 From: gdisirio Date: Wed, 15 Apr 2009 20:37:27 +0000 Subject: git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@901 35acf78f-673a-0410-8e92-d51de3d6d3f4 --- test/testdyn.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) (limited to 'test') diff --git a/test/testdyn.c b/test/testdyn.c index 3653e7299..74b5fa42e 100644 --- a/test/testdyn.c +++ b/test/testdyn.c @@ -46,6 +46,8 @@ static void dyn1_execute(void) { prio-1, thread, "A"); threads[1] = chThdCreateFromHeap(THD_WA_SIZE(THREADS_STACK_SIZE), prio-2, thread, "B"); + threads[2] = chThdCreateFromHeap(THD_WA_SIZE(0x10000000), + prio-3, thread, "C"); test_assert((threads[0] != NULL) && (threads[1] != NULL) && @@ -90,7 +92,7 @@ static void dyn2_execute(void) { tprio_t prio = chThdGetPriority(); /* Adding the WAs to the pool. */ - for (i = 0; i < 5; i++) + for (i = 0; i < 4; i++) chPoolFree(&mp1, wa[i]); /* Starting threads from the memory pool. */ @@ -104,15 +106,15 @@ static void dyn2_execute(void) { (threads[1] != NULL) && (threads[2] != NULL) && (threads[3] != NULL) && - (threads[4] != NULL), + (threads[4] == NULL), "#1"); /* Thread creation failed.*/ /* Claiming the memory from terminated threads. */ test_wait_threads(); - test_assert_sequence("ABCDE"); + test_assert_sequence("ABCD"); /* Now the pool must be full again. */ - for (i = 0; i < 5; i++) + for (i = 0; i < 4; i++) test_assert(chPoolAlloc(&mp1) != NULL, "#2"); /* Pool list empty.*/ test_assert(chPoolAlloc(&mp1) == NULL, "#3"); /* Pool list not empty.*/ } -- cgit v1.2.3 From e8ae833287d6813305ac676508cb3dbaaf483eeb Mon Sep 17 00:00:00 2001 From: gdisirio Date: Thu, 16 Apr 2009 15:06:49 +0000 Subject: 100% code coverage for threads. git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@902 35acf78f-673a-0410-8e92-d51de3d6d3f4 --- test/testthd.c | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) (limited to 'test') diff --git a/test/testthd.c b/test/testthd.c index 92f0bfe9f..cac77a43a 100644 --- a/test/testthd.c +++ b/test/testthd.c @@ -88,6 +88,31 @@ static void thd3_execute(void) { p1 = chThdSetPriority(p1); test_assert(p1 == prio + 1, "#3"); test_assert(chThdGetPriority() == prio, "#4"); + +#if CH_USE_MUTEXES + /* Simulates a priority boost situation (p_prio > p_realprio).*/ + chSysLock(); + chThdSelf()->p_prio += 2; + chSysUnlock(); + test_assert(chThdGetPriority() == prio + 2, "#5"); + + /* Tries to raise but below the boost level. */ + p1 = chThdSetPriority(prio + 1); + test_assert(p1 == prio, "#6"); + test_assert(chThdSelf()->p_prio == prio + 2, "#7"); + test_assert(chThdSelf()->p_realprio == prio + 1, "#8"); + + /* Tries to raise above the boost level. */ + p1 = chThdSetPriority(prio + 3); + test_assert(p1 == prio + 1, "#9"); + test_assert(chThdSelf()->p_prio == prio + 3, "#10"); + test_assert(chThdSelf()->p_realprio == prio + 3, "#11"); + + chSysLock(); + chThdSelf()->p_prio = prio; + chThdSelf()->p_realprio = prio; + chSysUnlock(); +#endif } const struct testcase testthd3 = { -- cgit v1.2.3 From 0a37ec19f6b6c33c157f8280359e7c4468c26ae1 Mon Sep 17 00:00:00 2001 From: gdisirio Date: Fri, 17 Apr 2009 14:53:04 +0000 Subject: 100% code coverage for heap, semaphores and events. git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@903 35acf78f-673a-0410-8e92-d51de3d6d3f4 --- test/testevt.c | 159 +++++++++++++++++++++++++++++++++++++++++++++++++------- test/testheap.c | 31 ++++++++--- test/testsem.c | 47 ++++++++++++++++- test/testthd.c | 10 ++-- 4 files changed, 217 insertions(+), 30 deletions(-) (limited to 'test') diff --git a/test/testevt.c b/test/testevt.c index 9c6f7bf6e..3987a41e8 100644 --- a/test/testevt.c +++ b/test/testevt.c @@ -29,7 +29,7 @@ static EventSource es1, es2; static char *evt1_gettest(void) { - return "Events, wait and broadcast"; + return "Events, registration and dispatch"; } static void evt1_setup(void) { @@ -37,7 +37,58 @@ static void evt1_setup(void) { chEvtClear(ALL_EVENTS); } -static msg_t thread(void *p) { +static void h1(eventid_t id) {test_emit_token('A');} +static void h2(eventid_t id) {test_emit_token('B');} +static void h3(eventid_t id) {test_emit_token('C');} +static const evhandler_t evhndl[] = {h1, h2, h3}; + +static void evt1_execute(void) { + EventListener el1, el2; + + /* + * Testing chEvtRegisterMask() and chEvtUnregister(). + */ + chEvtInit(&es1); + chEvtRegisterMask(&es1, &el1, 1); + chEvtRegisterMask(&es1, &el2, 2); + test_assert(chEvtIsListening(&es1), "#1"); /* Must not be empty */ + chEvtUnregister(&es1, &el1); + test_assert(chEvtIsListening(&es1), "#2"); /* Must not be empty */ + chEvtUnregister(&es1, &el2); + test_assert(!chEvtIsListening(&es1), "#3"); /* Stuck listener.*/ + + /* + * Testing chEvtDispatch(). + */ + chEvtDispatch(evhndl, 7); + test_assert_sequence("ABC"); +} + +const struct testcase testevt1 = { + evt1_gettest, + evt1_setup, + NULL, + evt1_execute +}; + +static char *evt2_gettest(void) { + + return "Events, wait and broadcast"; +} + +static void evt2_setup(void) { + + chEvtClear(ALL_EVENTS); +} + +static msg_t thread1(void *p) { + + chThdSleepMilliseconds(50); + chEvtSignal((Thread *)p, 1); + return 0; +} + +static msg_t thread2(void *p) { chEvtBroadcast(&es1); chThdSleepMilliseconds(50); @@ -45,13 +96,13 @@ static msg_t thread(void *p) { return 0; } -static void evt1_execute(void) { +static void evt2_execute(void) { eventmask_t m; EventListener el1, el2; systime_t target_time; /* - * Test on chEvtWaitOne(). + * Test on chEvtWaitOne() without wait. */ chEvtPend(5); m = chEvtWaitOne(ALL_EVENTS); @@ -59,43 +110,111 @@ static void evt1_execute(void) { m = chEvtWaitOne(ALL_EVENTS); test_assert(m == 4, "#2"); /* Single bit error.*/ m = chEvtClear(0); - test_assert(m == 0, "#3"); /* Stuck event.*/ + test_assert(m == 0, "#3"); /* Stuck bit.*/ + + /* + * Test on chEvtWaitOne() with wait. + */ + test_wait_tick(); + target_time = chTimeNow() + MS2ST(50); + threads[0] = chThdCreateStatic(wa[0], WA_SIZE, chThdGetPriority() - 1, + thread1, chThdSelf()); + m = chEvtWaitOne(ALL_EVENTS); + test_assert_time_window(target_time, target_time + ALLOWED_DELAY); + test_assert(m == 1, "#5"); /* Single bit error.*/ + m = chEvtClear(0); + test_assert(m == 0, "#6"); /* Stuck bit.*/ + test_wait_threads(); /* - * Test on chEvtWaitAny(). + * Test on chEvtWaitAny() without wait. */ chEvtPend(5); m = chEvtWaitAny(ALL_EVENTS); - test_assert(m == 5, "#4"); /* Unexpected pending.*/ + test_assert(m == 5, "#7"); /* Unexpected pending bit.*/ m = chEvtClear(0); - test_assert(m == 0, "#5"); /* Stuck event.*/ + test_assert(m == 0, "#8"); /* Stuck bit.*/ /* - * Test on chEvtWaitAll(), chEvtRegisterMask() and chEvtUnregister(). + * Test on chEvtWaitAny() with wait. + */ + test_wait_tick(); + target_time = chTimeNow() + MS2ST(50); + threads[0] = chThdCreateStatic(wa[0], WA_SIZE, chThdGetPriority() - 1, + thread1, chThdSelf()); + m = chEvtWaitAny(ALL_EVENTS); + test_assert_time_window(target_time, target_time + ALLOWED_DELAY); + test_assert(m == 1, "#9"); /* Single bit error.*/ + m = chEvtClear(0); + test_assert(m == 0, "#10"); /* Stuck bit.*/ + test_wait_threads(); + + /* + * Test on chEvtWaitAll(). */ chEvtInit(&es1); chEvtInit(&es2); chEvtRegisterMask(&es1, &el1, 1); chEvtRegisterMask(&es2, &el2, 4); + test_wait_tick(); target_time = chTimeNow() + MS2ST(50); - threads[0] = chThdCreateStatic(wa[0], WA_SIZE, chThdGetPriority()-1, thread, "A"); + threads[0] = chThdCreateStatic(wa[0], WA_SIZE, chThdGetPriority() - 1, + thread2, "A"); m = chEvtWaitAll(5); test_assert_time_window(target_time, target_time + ALLOWED_DELAY); m = chEvtClear(0); - test_assert(m == 0, "#6"); /* Stuck event.*/ - + test_assert(m == 0, "#11"); /* Stuck event.*/ test_wait_threads(); chEvtUnregister(&es1, &el1); chEvtUnregister(&es2, &el2); - test_assert(!chEvtIsListening(&es1), "#7"); /* Stuck listener.*/ - test_assert(!chEvtIsListening(&es2), "#8"); /* Stuck listener.*/ + test_assert(!chEvtIsListening(&es1), "#12"); /* Stuck listener.*/ + test_assert(!chEvtIsListening(&es2), "#13"); /* Stuck listener.*/ } -const struct testcase testevt1 = { - evt1_gettest, - evt1_setup, +const struct testcase testevt2 = { + evt2_gettest, + evt2_setup, NULL, - evt1_execute + evt2_execute +}; + +#if CH_USE_EVENTS_TIMEOUT +static char *evt3_gettest(void) { + + return "Events, timeouts"; +} + +static void evt3_setup(void) { + + chEvtClear(ALL_EVENTS); +} + +static void evt3_execute(void) { + eventmask_t m; + + /* + * Tests various timeout situations. + */ + m = chEvtWaitOneTimeout(ALL_EVENTS, TIME_IMMEDIATE); + test_assert(m == 0, "#1"); + m = chEvtWaitAnyTimeout(ALL_EVENTS, TIME_IMMEDIATE); + test_assert(m == 0, "#2"); + m = chEvtWaitAllTimeout(ALL_EVENTS, TIME_IMMEDIATE); + test_assert(m == 0, "#3"); + m = chEvtWaitOneTimeout(ALL_EVENTS, 10); + test_assert(m == 0, "#4"); + m = chEvtWaitAnyTimeout(ALL_EVENTS, 10); + test_assert(m == 0, "#5"); + m = chEvtWaitAllTimeout(ALL_EVENTS, 10); + test_assert(m == 0, "#6"); +#endif +} + +const struct testcase testevt3 = { + evt3_gettest, + evt3_setup, + NULL, + evt3_execute }; #endif /* CH_USE_EVENTS */ @@ -106,6 +225,10 @@ const struct testcase testevt1 = { const struct testcase * const patternevt[] = { #if CH_USE_EVENTS &testevt1, + &testevt2, +#if CH_USE_EVENTS_TIMEOUT + &testevt3, +#endif #endif NULL }; diff --git a/test/testheap.c b/test/testheap.c index a72bad6bb..2740f8a9e 100644 --- a/test/testheap.c +++ b/test/testheap.c @@ -44,21 +44,38 @@ static void heap1_execute(void) { p1 = chHeapAlloc(SIZE); p2 = chHeapAlloc(SIZE); p3 = chHeapAlloc(SIZE); - chHeapFree(p1); /* Does not merge */ - chHeapFree(p2); /* Merges backward */ - chHeapFree(p3); /* Merges both sides */ + chHeapFree(p1); /* Does not merge */ + chHeapFree(p2); /* Merges backward */ + chHeapFree(p3); /* Merges both sides */ test_assert(chHeapStatus(&n) == 1, "#1"); /* Heap fragmented.*/ /* Reverse order */ p1 = chHeapAlloc(SIZE); p2 = chHeapAlloc(SIZE); p3 = chHeapAlloc(SIZE); - chHeapFree(p3); /* Merges forward */ - chHeapFree(p2); /* Merges forward */ - chHeapFree(p1); /* Merges forward */ + chHeapFree(p3); /* Merges forward */ + chHeapFree(p2); /* Merges forward */ + chHeapFree(p1); /* Merges forward */ test_assert(chHeapStatus(&n) == 1, "#2"); /* Heap fragmented.*/ - test_assert(n == sz, "#3"); /* Heap size changed.*/ + /* Small fragments handling */ + p1 = chHeapAlloc(SIZE + 1); + p2 = chHeapAlloc(SIZE); + chHeapFree(p1); + test_assert(chHeapStatus(&n) == 2, "#3"); /* Heap must contain 2 blocks.*/ + p1 = chHeapAlloc(SIZE); + test_assert(chHeapStatus(&n) == 1, "#4"); /* Heap fragmented.*/ + chHeapFree(p2); + chHeapFree(p1); + + /* Allocate all handling */ + (void)chHeapStatus(&n); + p1 = chHeapAlloc(n); + test_assert(chHeapStatus(&n) == 0, "#5"); /* Heap must be empty.*/ + chHeapFree(p1); + + test_assert(chHeapStatus(&n) == 1, "#6"); /* Heap fragmented.*/ + test_assert(n == sz, "#7"); /* Heap size changed.*/ } else { test_print("--- Size : "); diff --git a/test/testsem.c b/test/testsem.c index d6e432a36..eac0e041b 100644 --- a/test/testsem.c +++ b/test/testsem.c @@ -85,7 +85,10 @@ static void sem2_setup(void) { static msg_t thread2(void *p) { chThdSleepMilliseconds(50); - chSemSignal(&sem1); + chSysLock(); + chSemSignalI(&sem1); /* For coverage reasons */ + chSchRescheduleS(); + chSysUnlock(); return 0; } @@ -115,6 +118,7 @@ static void sem2_execute(void) { /* * Testing timeout condition. */ + test_wait_tick(); target_time = chTimeNow() + MS2ST(5 * 500); for (i = 0; i < 5; i++) { test_emit_token('A' + i); @@ -134,6 +138,44 @@ const struct testcase testsem2 = { sem2_execute }; #endif /* CH_USE_SEMAPHORES_TIMEOUT */ + +#if CH_USE_SEMSW +static char *sem3_gettest(void) { + + return "Semaphores, atomic signal-wait"; +} + +static void sem3_setup(void) { + + chSemInit(&sem1, 0); +} + +static msg_t thread3(void *p) { + + chSemWait(&sem1); + chSemSignal(&sem1); + return 0; +} + +static void sem3_execute(void) { + + threads[0] = chThdCreateStatic(wa[0], WA_SIZE, chThdGetPriority()+1, thread3, "A"); + chSemSignalWait(&sem1, &sem1); + test_assert(isempty(&sem1.s_queue), "#1"); /* Queue not empty */ + test_assert(sem1.s_cnt == 0, "#2"); /* Counter not zero */ + + chSemSignalWait(&sem1, &sem1); + test_assert(isempty(&sem1.s_queue), "#3"); /* Queue not empty */ + test_assert(sem1.s_cnt == 0, "#4"); /* Counter not zero */ +} + +const struct testcase testsem3 = { + sem3_gettest, + sem3_setup, + NULL, + sem3_execute +}; +#endif /* CH_USE_SEMSW */ #endif /* CH_USE_SEMAPHORES */ /* @@ -145,6 +187,9 @@ const struct testcase * const patternsem[] = { #if CH_USE_SEMAPHORES_TIMEOUT &testsem2, #endif +#if CH_USE_SEMSW + &testsem3, +#endif #endif NULL }; diff --git a/test/testthd.c b/test/testthd.c index cac77a43a..e5964f17f 100644 --- a/test/testthd.c +++ b/test/testthd.c @@ -130,25 +130,27 @@ static char *thd4_gettest(void) { static void thd4_execute(void) { systime_t time; + test_wait_tick(); + /* Timeouts in microseconds.*/ time = chTimeNow(); chThdSleepMicroseconds(100000); - test_assert(chTimeIsWithin(time + US2ST(100000), time + US2ST(100000) + 1), "#1"); + test_assert_time_window(time + US2ST(100000), time + US2ST(100000) + 1); /* Timeouts in milliseconds.*/ time = chTimeNow(); chThdSleepMilliseconds(100); - test_assert(chTimeIsWithin(time + MS2ST(100), time + MS2ST(100) + 1), "#2"); + test_assert_time_window(time + MS2ST(100), time + MS2ST(100) + 1); /* Timeouts in seconds.*/ time = chTimeNow(); chThdSleepSeconds(1); - test_assert(chTimeIsWithin(time + S2ST(1), time + S2ST(1) + 1), "#3"); + test_assert_time_window(time + S2ST(1), time + S2ST(1) + 1); /* Absolute timelines.*/ time = chTimeNow() + MS2ST(100); chThdSleepUntil(time); - test_assert(chTimeIsWithin(time, time + 1), "#4"); + test_assert_time_window(time, time + 1); } const struct testcase testthd4 = { -- cgit v1.2.3 From d62a644b1e910c7fccd65d768a838fcc651e4e80 Mon Sep 17 00:00:00 2001 From: gdisirio Date: Sun, 19 Apr 2009 07:15:05 +0000 Subject: Removed the chMsgSendWithEvent() function and the related configuration option. git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@914 35acf78f-673a-0410-8e92-d51de3d6d3f4 --- test/coverage/chconf.h | 10 ---------- 1 file changed, 10 deletions(-) (limited to 'test') diff --git a/test/coverage/chconf.h b/test/coverage/chconf.h index ebd7c3dbd..3666deae2 100644 --- a/test/coverage/chconf.h +++ b/test/coverage/chconf.h @@ -215,16 +215,6 @@ #define CH_USE_MESSAGES TRUE #endif -/** - * If specified then the @p chMsgSendWithEvent() function is included in the - * kernel. - * @note The default is @p TRUE. - * @note Requires @p CH_USE_MESSAGES and @p CH_USE_EVENTS. - */ -#if !defined(CH_USE_MESSAGES_EVENT) || defined(__DOXYGEN__) -#define CH_USE_MESSAGES_EVENT TRUE -#endif - /** * If enabled then messages are served by priority rather than in FIFO order. * @note The default is @p FALSE. Enable this if you have special requirements. -- cgit v1.2.3 From 8a83ae1bb9db8b0e25d6b1cc899fec54bfe8fbf8 Mon Sep 17 00:00:00 2001 From: gdisirio Date: Sun, 19 Apr 2009 08:42:58 +0000 Subject: 100% code coverage for messages. git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@915 35acf78f-673a-0410-8e92-d51de3d6d3f4 --- test/testmsg.c | 49 +++++++++++++++++++++++++++++++++---------------- 1 file changed, 33 insertions(+), 16 deletions(-) (limited to 'test') diff --git a/test/testmsg.c b/test/testmsg.c index 69f1461e1..b31f57097 100644 --- a/test/testmsg.c +++ b/test/testmsg.c @@ -25,32 +25,49 @@ static char *msg1_gettest(void) { - return "Messages, dispatch test"; + return "Messages, loop"; } static msg_t thread(void *p) { - msg_t msg; - int i; - for (i = 0; i < 5; i++) { - msg = chMsgSend(p, 'A' + i); - test_emit_token(msg); - } - chMsgSend(p, 0); + chMsgSend(p, 'A'); + chMsgSend(p, 'B'); + chMsgSend(p, 'C'); + chMsgSend(p, 'D'); return 0; } static void msg1_execute(void) { msg_t msg; - threads[0] = chThdCreateStatic(wa[0], WA_SIZE, chThdGetPriority()-1, thread, chThdSelf()); - do { - chMsgRelease(msg = chMsgWait()); - if (msg) - test_emit_token(msg); - } while (msg); - test_wait_threads(); - test_assert_sequence("AABBCCDDEE"); + /* + * Testing the whole messages loop. + */ + threads[0] = chThdCreateStatic(wa[0], WA_SIZE, chThdGetPriority() + 1, + thread, chThdSelf()); + chMsgRelease(msg = chMsgWait()); + test_emit_token(msg); + chMsgRelease(msg = chMsgWait()); + test_emit_token(msg); + chMsgRelease(msg = chMsgWait()); + test_emit_token(msg); + test_assert_sequence("ABC"); + + /* + * Testing message fetch using chMsgGet(). + * Note, the following is valid because the sender has higher priority than + * the receiver. + */ + msg = chMsgGet(); + test_assert(msg != 0, "#1"); + chMsgRelease(0); + test_assert(msg == 'D', "#2"); + + /* + * Must not have pending messages. + */ + msg = chMsgGet(); + test_assert(msg == 0, "#3"); } const struct testcase testmsg1 = { -- cgit v1.2.3 From c031b80726d1472098bb6e352eba561e3ab2e766 Mon Sep 17 00:00:00 2001 From: gdisirio Date: Sun, 19 Apr 2009 09:23:49 +0000 Subject: 100% code coverage for mailboxes. git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@916 35acf78f-673a-0410-8e92-d51de3d6d3f4 --- test/testmbox.c | 61 +++++++++++++++++++++++++++++++++++++++++++++------------ 1 file changed, 49 insertions(+), 12 deletions(-) (limited to 'test') diff --git a/test/testmbox.c b/test/testmbox.c index 4a548105c..14e594b29 100644 --- a/test/testmbox.c +++ b/test/testmbox.c @@ -43,10 +43,14 @@ static void mbox1_execute(void) { msg_t msg1, msg2; unsigned i; - /* Testing initial space.*/ + /* + * Testing initial space. + */ test_assert(chMBGetEmpty(&mb1) == MB_SIZE, "#1"); - /* Testing enqueuing.*/ + /* + * Testing enqueuing and backward circularity. + */ for (i = 0; i < MB_SIZE - 1; i++) { msg1 = chMBPost(&mb1, 'B' + i, TIME_INFINITE); test_assert(msg1 == RDY_OK, "#2"); @@ -54,16 +58,22 @@ static void mbox1_execute(void) { msg1 = chMBPostAhead(&mb1, 'A', TIME_INFINITE); test_assert(msg1 == RDY_OK, "#3"); - /* Testing post timeout.*/ + /* + * Testing post timeout. + */ msg1 = chMBPost(&mb1, 'X', 1); test_assert(msg1 == RDY_TIMEOUT, "#4"); - /* Testing final conditions.*/ + /* + * Testing final conditions. + */ test_assert(chMBGetEmpty(&mb1) == 0, "#5"); test_assert(chMBGetFull(&mb1) == MB_SIZE, "#6"); test_assert(mb1.mb_rdptr == mb1.mb_wrptr, "#7"); - /* Testing dequeuing.*/ + /* + * Testing dequeuing. + */ for (i = 0; i < MB_SIZE; i++) { msg1 = chMBFetch(&mb1, &msg2, TIME_INFINITE); test_assert(msg1 == RDY_OK, "#8"); @@ -71,14 +81,41 @@ static void mbox1_execute(void) { } test_assert_sequence("ABCDE"); - /* Testing fetch timeout.*/ - msg1 = chMBFetch(&mb1, &msg2, 1); - test_assert(msg1 == RDY_TIMEOUT, "#9"); + /* + * Testing buffer circularity. + */ + msg1 = chMBPost(&mb1, 'B' + i, TIME_INFINITE); + test_assert(msg1 == RDY_OK, "#9"); + msg1 = chMBFetch(&mb1, &msg2, TIME_INFINITE); + test_assert(msg1 == RDY_OK, "#10"); + test_assert(mb1.mb_buffer == mb1.mb_wrptr, "#11"); + test_assert(mb1.mb_buffer == mb1.mb_rdptr, "#12"); - /* Testing final conditions.*/ - test_assert(chMBGetEmpty(&mb1) == MB_SIZE, "#10"); - test_assert(chMBGetFull(&mb1) == 0, "#11"); - test_assert(mb1.mb_rdptr == mb1.mb_wrptr, "#12"); + /* + * Testing fetch timeout. + */ + msg1 = chMBFetch(&mb1, &msg2, 1); + test_assert(msg1 == RDY_TIMEOUT, "#13"); + + /* + * Testing final conditions. + */ + test_assert(chMBGetEmpty(&mb1) == MB_SIZE, "#14"); + test_assert(chMBGetFull(&mb1) == 0, "#15"); + test_assert(mb1.mb_rdptr == mb1.mb_wrptr, "#16"); + + /* + * Testing reset. + */ + chMBReset(&mb1); + + /* + * Re-testing final conditions. + */ + test_assert(chMBGetEmpty(&mb1) == MB_SIZE, "#17"); + test_assert(chMBGetFull(&mb1) == 0, "#18"); + test_assert(mb1.mb_rdptr == mb1.mb_wrptr, "#19"); + test_assert(mb1.mb_buffer == mb1.mb_wrptr, "#20"); } const struct testcase testmbox1 = { -- cgit v1.2.3 From a2a88226488db68ca8435a72ed608bf5ec9df464 Mon Sep 17 00:00:00 2001 From: gdisirio Date: Sat, 25 Apr 2009 11:12:10 +0000 Subject: Changes to the test suite in order to save RAM on AVR targets. git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@917 35acf78f-673a-0410-8e92-d51de3d6d3f4 --- test/test.c | 33 +++++++++++++++------------------ test/test.h | 24 ++++++++++++------------ test/testdyn.c | 36 ++++++++++++++++++------------------ test/testevt.c | 52 ++++++++++++++++++++++++++-------------------------- test/testheap.c | 14 +++++++------- test/testmbox.c | 42 +++++++++++++++++++++--------------------- test/testmsg.c | 8 ++++---- test/testmtx.c | 52 ++++++++++++++++++++++++++-------------------------- test/testpools.c | 4 ++-- test/testsem.c | 37 +++++++++++++++++++------------------ test/testthd.c | 47 +++++++++++++++++++++++++++++------------------ 11 files changed, 179 insertions(+), 170 deletions(-) (limited to 'test') diff --git a/test/test.c b/test/test.c index 73fbe7381..531928bbe 100644 --- a/test/test.c +++ b/test/test.c @@ -49,7 +49,7 @@ static const struct testcase **patterns[] = { }; static bool_t local_fail, global_fail; -static char *failmsg; +static unsigned failpoint; static char tokens_buffer[MAX_TOKENS]; static char *tokp; static WORKING_AREA(waT0, THREADS_STACK_SIZE); @@ -118,35 +118,35 @@ void test_emit_token(char token) { /* * Assertions. */ -bool_t _test_fail(char * msg) { +bool_t _test_fail(unsigned point) { local_fail = TRUE; global_fail = TRUE; - failmsg = msg; + failpoint = point; return TRUE; } -bool_t _test_assert(bool_t condition, char * msg) { +bool_t _test_assert(unsigned point, bool_t condition) { if (!condition) - return _test_fail(msg); + return _test_fail(point); return FALSE; } -bool_t _test_assert_sequence(char *expected) { +bool_t _test_assert_sequence(unsigned point, char *expected) { char *cp = tokens_buffer; while (cp < tokp) { if (*cp++ != *expected++) - return _test_fail(NULL); + return _test_fail(point); } if (*expected) - return _test_fail(NULL); + return _test_fail(point); return FALSE; } -bool_t _test_assert_time_window(systime_t start, systime_t end) { +bool_t _test_assert_time_window(unsigned point, systime_t start, systime_t end) { - return _test_assert(chTimeIsWithin(start, end), "time window error"); + return _test_assert(point, chTimeIsWithin(start, end)); } /* @@ -256,14 +256,11 @@ msg_t TestThread(void *p) { test_println(")"); execute_test(patterns[i][j]); if (local_fail) { - test_print("--- Result: FAIL ("); - if (failmsg) - test_print(failmsg); - else { - test_print("sequence error: "); - print_tokens(); - } - test_println(")"); + test_print("--- Result: FAIL (#"); + test_printn(failpoint); + test_print(" ["); + print_tokens(); + test_println("])"); } else test_println("--- Result: SUCCESS"); diff --git a/test/test.h b/test/test.h index a0acbd1f7..d1deaf687 100644 --- a/test/test.h +++ b/test/test.h @@ -55,10 +55,10 @@ extern "C" { void test_print(char *msgp); void test_println(char *msgp); void test_emit_token(char token); - bool_t _test_fail(char * msg); - bool_t _test_assert(bool_t condition, char * msg); - bool_t _test_assert_sequence(char *expected); - bool_t _test_assert_time_window(systime_t start, systime_t end); + bool_t _test_fail(unsigned point); + bool_t _test_assert(unsigned point, bool_t condition); + bool_t _test_assert_sequence(unsigned point, char *expected); + bool_t _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); @@ -71,23 +71,23 @@ extern "C" { } #endif -#define test_fail(msg) { \ - test_fail(msg); \ +#define test_fail(point) { \ + test_fail(point); \ return; \ } -#define test_assert(condition, msg) { \ - if (_test_assert(condition, msg)) \ +#define test_assert(point, condition, msg) { \ + if (_test_assert(point, condition)) \ return; \ } -#define test_assert_sequence(expected) { \ - if (_test_assert_sequence(expected)) \ +#define test_assert_sequence(point, expected) { \ + if (_test_assert_sequence(point, expected)) \ return; \ } -#define test_assert_time_window(start, end) { \ - if (_test_assert_time_window(start, end)) \ +#define test_assert_time_window(point, start, end) { \ + if (_test_assert_time_window(point, start, end)) \ return; \ } diff --git a/test/testdyn.c b/test/testdyn.c index 74b5fa42e..d42cbf17e 100644 --- a/test/testdyn.c +++ b/test/testdyn.c @@ -49,20 +49,20 @@ static void dyn1_execute(void) { threads[2] = chThdCreateFromHeap(THD_WA_SIZE(0x10000000), prio-3, thread, "C"); - test_assert((threads[0] != NULL) && - (threads[1] != NULL) && - (threads[2] == NULL) && - (threads[3] == NULL) && - (threads[4] == NULL), - "#1"); /* Thread creation failed.*/ + test_assert(1, (threads[0] != NULL) && + (threads[1] != NULL) && + (threads[2] == NULL) && + (threads[3] == NULL) && + (threads[4] == NULL), + "thread creation failed"); /* Claiming the memory from terminated threads. */ test_wait_threads(); - test_assert_sequence("AB"); + test_assert_sequence(2, "AB"); /* Heap status checked again.*/ - test_assert(chHeapStatus(&n) == 1, "#2"); /* Heap fragmented.*/ - test_assert(n == sz, "#3"); /* Heap size changed.*/ + test_assert(3, chHeapStatus(&n) == 1, "heap fragmented"); + test_assert(4, n == sz, "heap size changed"); } } @@ -102,21 +102,21 @@ static void dyn2_execute(void) { threads[3] = chThdCreateFromMemoryPool(&mp1, prio-4, thread, "D"); threads[4] = chThdCreateFromMemoryPool(&mp1, prio-5, thread, "E"); - test_assert((threads[0] != NULL) && - (threads[1] != NULL) && - (threads[2] != NULL) && - (threads[3] != NULL) && - (threads[4] == NULL), - "#1"); /* Thread creation failed.*/ + test_assert(1, (threads[0] != NULL) && + (threads[1] != NULL) && + (threads[2] != NULL) && + (threads[3] != NULL) && + (threads[4] == NULL), + "thread creation failed"); /* Claiming the memory from terminated threads. */ test_wait_threads(); - test_assert_sequence("ABCD"); + test_assert_sequence(2, "ABCD"); /* Now the pool must be full again. */ for (i = 0; i < 4; i++) - test_assert(chPoolAlloc(&mp1) != NULL, "#2"); /* Pool list empty.*/ - test_assert(chPoolAlloc(&mp1) == NULL, "#3"); /* Pool list not empty.*/ + test_assert(3, chPoolAlloc(&mp1) != NULL, "pool list empty"); + test_assert(4, chPoolAlloc(&mp1) == NULL, "pool list not empty"); } const struct testcase testdyn2 = { diff --git a/test/testevt.c b/test/testevt.c index 3987a41e8..1ac8b76c8 100644 --- a/test/testevt.c +++ b/test/testevt.c @@ -51,17 +51,17 @@ static void evt1_execute(void) { chEvtInit(&es1); chEvtRegisterMask(&es1, &el1, 1); chEvtRegisterMask(&es1, &el2, 2); - test_assert(chEvtIsListening(&es1), "#1"); /* Must not be empty */ + test_assert(1, chEvtIsListening(&es1), "no listener"); chEvtUnregister(&es1, &el1); - test_assert(chEvtIsListening(&es1), "#2"); /* Must not be empty */ + test_assert(2, chEvtIsListening(&es1), "no listener"); chEvtUnregister(&es1, &el2); - test_assert(!chEvtIsListening(&es1), "#3"); /* Stuck listener.*/ + test_assert(3, !chEvtIsListening(&es1), "stuck listener"); /* * Testing chEvtDispatch(). */ chEvtDispatch(evhndl, 7); - test_assert_sequence("ABC"); + test_assert_sequence(4, "ABC"); } const struct testcase testevt1 = { @@ -106,12 +106,12 @@ static void evt2_execute(void) { */ chEvtPend(5); m = chEvtWaitOne(ALL_EVENTS); - test_assert(m == 1, "#1"); /* Single bit error.*/ + test_assert(1, m == 1, "single event error"); m = chEvtWaitOne(ALL_EVENTS); - test_assert(m == 4, "#2"); /* Single bit error.*/ + test_assert(2, m == 4, "single event error"); m = chEvtClear(0); - test_assert(m == 0, "#3"); /* Stuck bit.*/ - + test_assert(3, m == 0, "stuck event"); + /* * Test on chEvtWaitOne() with wait. */ @@ -120,10 +120,10 @@ static void evt2_execute(void) { threads[0] = chThdCreateStatic(wa[0], WA_SIZE, chThdGetPriority() - 1, thread1, chThdSelf()); m = chEvtWaitOne(ALL_EVENTS); - test_assert_time_window(target_time, target_time + ALLOWED_DELAY); - test_assert(m == 1, "#5"); /* Single bit error.*/ + test_assert_time_window(4, target_time, target_time + ALLOWED_DELAY); + test_assert(5, m == 1, "single event error"); m = chEvtClear(0); - test_assert(m == 0, "#6"); /* Stuck bit.*/ + test_assert(6, m == 0, "stuck event"); test_wait_threads(); /* @@ -131,9 +131,9 @@ static void evt2_execute(void) { */ chEvtPend(5); m = chEvtWaitAny(ALL_EVENTS); - test_assert(m == 5, "#7"); /* Unexpected pending bit.*/ + test_assert(7, m == 5, "unexpected pending bit"); m = chEvtClear(0); - test_assert(m == 0, "#8"); /* Stuck bit.*/ + test_assert(8, m == 0, "stuck event"); /* * Test on chEvtWaitAny() with wait. @@ -143,10 +143,10 @@ static void evt2_execute(void) { threads[0] = chThdCreateStatic(wa[0], WA_SIZE, chThdGetPriority() - 1, thread1, chThdSelf()); m = chEvtWaitAny(ALL_EVENTS); - test_assert_time_window(target_time, target_time + ALLOWED_DELAY); - test_assert(m == 1, "#9"); /* Single bit error.*/ + test_assert_time_window(9, target_time, target_time + ALLOWED_DELAY); + test_assert(10, m == 1, "single event error"); m = chEvtClear(0); - test_assert(m == 0, "#10"); /* Stuck bit.*/ + test_assert(11, m == 0, "stuck event"); test_wait_threads(); /* @@ -161,14 +161,14 @@ static void evt2_execute(void) { threads[0] = chThdCreateStatic(wa[0], WA_SIZE, chThdGetPriority() - 1, thread2, "A"); m = chEvtWaitAll(5); - test_assert_time_window(target_time, target_time + ALLOWED_DELAY); + test_assert_time_window(12, target_time, target_time + ALLOWED_DELAY); m = chEvtClear(0); - test_assert(m == 0, "#11"); /* Stuck event.*/ + test_assert(13, m == 0, "stuck event"); test_wait_threads(); chEvtUnregister(&es1, &el1); chEvtUnregister(&es2, &el2); - test_assert(!chEvtIsListening(&es1), "#12"); /* Stuck listener.*/ - test_assert(!chEvtIsListening(&es2), "#13"); /* Stuck listener.*/ + test_assert(14, !chEvtIsListening(&es1), "stuck listener"); + test_assert(15, !chEvtIsListening(&es2), "stuck listener"); } const struct testcase testevt2 = { @@ -196,17 +196,17 @@ static void evt3_execute(void) { * Tests various timeout situations. */ m = chEvtWaitOneTimeout(ALL_EVENTS, TIME_IMMEDIATE); - test_assert(m == 0, "#1"); + test_assert(1, m == 0, "spurious event"); m = chEvtWaitAnyTimeout(ALL_EVENTS, TIME_IMMEDIATE); - test_assert(m == 0, "#2"); + test_assert(2, m == 0, "spurious event"); m = chEvtWaitAllTimeout(ALL_EVENTS, TIME_IMMEDIATE); - test_assert(m == 0, "#3"); + test_assert(3, m == 0, "spurious event"); m = chEvtWaitOneTimeout(ALL_EVENTS, 10); - test_assert(m == 0, "#4"); + test_assert(4, m == 0, "spurious event"); m = chEvtWaitAnyTimeout(ALL_EVENTS, 10); - test_assert(m == 0, "#5"); + test_assert(5, m == 0, "spurious event"); m = chEvtWaitAllTimeout(ALL_EVENTS, 10); - test_assert(m == 0, "#6"); + test_assert(6, m == 0, "spurious event"); #endif } diff --git a/test/testheap.c b/test/testheap.c index 2740f8a9e..d71b5563c 100644 --- a/test/testheap.c +++ b/test/testheap.c @@ -47,7 +47,7 @@ static void heap1_execute(void) { chHeapFree(p1); /* Does not merge */ chHeapFree(p2); /* Merges backward */ chHeapFree(p3); /* Merges both sides */ - test_assert(chHeapStatus(&n) == 1, "#1"); /* Heap fragmented.*/ + test_assert(1, chHeapStatus(&n) == 1, "heap fragmented"); /* Reverse order */ p1 = chHeapAlloc(SIZE); @@ -56,26 +56,26 @@ static void heap1_execute(void) { chHeapFree(p3); /* Merges forward */ chHeapFree(p2); /* Merges forward */ chHeapFree(p1); /* Merges forward */ - test_assert(chHeapStatus(&n) == 1, "#2"); /* Heap fragmented.*/ + test_assert(2, chHeapStatus(&n) == 1, "heap fragmented"); /* Small fragments handling */ p1 = chHeapAlloc(SIZE + 1); p2 = chHeapAlloc(SIZE); chHeapFree(p1); - test_assert(chHeapStatus(&n) == 2, "#3"); /* Heap must contain 2 blocks.*/ + test_assert(3, chHeapStatus(&n) == 2, "invalid state"); p1 = chHeapAlloc(SIZE); - test_assert(chHeapStatus(&n) == 1, "#4"); /* Heap fragmented.*/ + test_assert(4, chHeapStatus(&n) == 1, "heap fragmented"); chHeapFree(p2); chHeapFree(p1); /* Allocate all handling */ (void)chHeapStatus(&n); p1 = chHeapAlloc(n); - test_assert(chHeapStatus(&n) == 0, "#5"); /* Heap must be empty.*/ + test_assert(5, chHeapStatus(&n) == 0, "not empty"); chHeapFree(p1); - test_assert(chHeapStatus(&n) == 1, "#6"); /* Heap fragmented.*/ - test_assert(n == sz, "#7"); /* Heap size changed.*/ + test_assert(6, chHeapStatus(&n) == 1, "heap fragmented"); + test_assert(7, n == sz, "size changed"); } else { test_print("--- Size : "); diff --git a/test/testmbox.c b/test/testmbox.c index 14e594b29..9e3462ad4 100644 --- a/test/testmbox.c +++ b/test/testmbox.c @@ -46,63 +46,63 @@ static void mbox1_execute(void) { /* * Testing initial space. */ - test_assert(chMBGetEmpty(&mb1) == MB_SIZE, "#1"); + test_assert(1, chMBGetEmpty(&mb1) == MB_SIZE, "wrong size"); /* * Testing enqueuing and backward circularity. */ for (i = 0; i < MB_SIZE - 1; i++) { msg1 = chMBPost(&mb1, 'B' + i, TIME_INFINITE); - test_assert(msg1 == RDY_OK, "#2"); + test_assert(2, msg1 == RDY_OK, "wrong wake-up message"); } msg1 = chMBPostAhead(&mb1, 'A', TIME_INFINITE); - test_assert(msg1 == RDY_OK, "#3"); + test_assert(3, msg1 == RDY_OK, "wrong wake-up message"); /* * Testing post timeout. */ msg1 = chMBPost(&mb1, 'X', 1); - test_assert(msg1 == RDY_TIMEOUT, "#4"); + test_assert(4, msg1 == RDY_TIMEOUT, "wrong wake-up message"); /* * Testing final conditions. */ - test_assert(chMBGetEmpty(&mb1) == 0, "#5"); - test_assert(chMBGetFull(&mb1) == MB_SIZE, "#6"); - test_assert(mb1.mb_rdptr == mb1.mb_wrptr, "#7"); + test_assert(5, chMBGetEmpty(&mb1) == 0, "still empty"); + test_assert(6, chMBGetFull(&mb1) == MB_SIZE, "not full"); + test_assert(7, mb1.mb_rdptr == mb1.mb_wrptr, "pointers not aligned"); /* * Testing dequeuing. */ for (i = 0; i < MB_SIZE; i++) { msg1 = chMBFetch(&mb1, &msg2, TIME_INFINITE); - test_assert(msg1 == RDY_OK, "#8"); + test_assert(8, msg1 == RDY_OK, "wrong wake-up message"); test_emit_token(msg2); } - test_assert_sequence("ABCDE"); + test_assert_sequence(9, "ABCDE"); /* * Testing buffer circularity. */ msg1 = chMBPost(&mb1, 'B' + i, TIME_INFINITE); - test_assert(msg1 == RDY_OK, "#9"); + test_assert(10, msg1 == RDY_OK, "wrong wake-up message"); msg1 = chMBFetch(&mb1, &msg2, TIME_INFINITE); - test_assert(msg1 == RDY_OK, "#10"); - test_assert(mb1.mb_buffer == mb1.mb_wrptr, "#11"); - test_assert(mb1.mb_buffer == mb1.mb_rdptr, "#12"); + test_assert(11, msg1 == RDY_OK, "wrong wake-up message"); + test_assert(12, mb1.mb_buffer == mb1.mb_wrptr, "write pointer not aligned to base"); + test_assert(13, mb1.mb_buffer == mb1.mb_rdptr, "read pointer not aligned to base"); /* * Testing fetch timeout. */ msg1 = chMBFetch(&mb1, &msg2, 1); - test_assert(msg1 == RDY_TIMEOUT, "#13"); + test_assert(14, msg1 == RDY_TIMEOUT, "wrong wake-up message"); /* * Testing final conditions. */ - test_assert(chMBGetEmpty(&mb1) == MB_SIZE, "#14"); - test_assert(chMBGetFull(&mb1) == 0, "#15"); - test_assert(mb1.mb_rdptr == mb1.mb_wrptr, "#16"); + test_assert(15, chMBGetEmpty(&mb1) == MB_SIZE, "not empty"); + test_assert(16, chMBGetFull(&mb1) == 0, "still full"); + test_assert(17, mb1.mb_rdptr == mb1.mb_wrptr, "pointers not aligned"); /* * Testing reset. @@ -112,10 +112,10 @@ static void mbox1_execute(void) { /* * Re-testing final conditions. */ - test_assert(chMBGetEmpty(&mb1) == MB_SIZE, "#17"); - test_assert(chMBGetFull(&mb1) == 0, "#18"); - test_assert(mb1.mb_rdptr == mb1.mb_wrptr, "#19"); - test_assert(mb1.mb_buffer == mb1.mb_wrptr, "#20"); + test_assert(18, chMBGetEmpty(&mb1) == MB_SIZE, "not empty"); + test_assert(19, chMBGetFull(&mb1) == 0, "still full"); + test_assert(20, mb1.mb_buffer == mb1.mb_wrptr, "write pointer not aligned to base"); + test_assert(21, mb1.mb_buffer == mb1.mb_rdptr, "read pointer not aligned to base"); } const struct testcase testmbox1 = { diff --git a/test/testmsg.c b/test/testmsg.c index b31f57097..978ec0d7e 100644 --- a/test/testmsg.c +++ b/test/testmsg.c @@ -51,7 +51,7 @@ static void msg1_execute(void) { test_emit_token(msg); chMsgRelease(msg = chMsgWait()); test_emit_token(msg); - test_assert_sequence("ABC"); + test_assert_sequence(1, "ABC"); /* * Testing message fetch using chMsgGet(). @@ -59,15 +59,15 @@ static void msg1_execute(void) { * the receiver. */ msg = chMsgGet(); - test_assert(msg != 0, "#1"); + test_assert(1, msg != 0, "no message"); chMsgRelease(0); - test_assert(msg == 'D', "#2"); + test_assert(2, msg == 'D', "wrong message"); /* * Must not have pending messages. */ msg = chMsgGet(); - test_assert(msg == 0, "#3"); + test_assert(3, msg == 0, "unknown message"); } const struct testcase testmsg1 = { diff --git a/test/testmtx.c b/test/testmtx.c index 421ab9536..f3023b87d 100644 --- a/test/testmtx.c +++ b/test/testmtx.c @@ -57,8 +57,8 @@ static void mtx1_execute(void) { threads[4] = chThdCreateStatic(wa[4], WA_SIZE, prio+5, thread1, "A"); chMtxUnlock(); test_wait_threads(); - test_assert(prio == chThdGetPriority(), "#1"); /* Priority return failure.*/ - test_assert_sequence("ABCDE"); + test_assert(1, prio == chThdGetPriority(), "wrong priority level"); + test_assert_sequence(2, "ABCDE"); } const struct testcase testmtx1 = { @@ -116,7 +116,7 @@ static void mtx2_execute(void) { threads[1] = chThdCreateStatic(wa[1], WA_SIZE, chThdGetPriority()-3, thread3, "C"); threads[2] = chThdCreateStatic(wa[2], WA_SIZE, chThdGetPriority()-2, thread4, "B"); test_wait_threads(); - test_assert_sequence("ABC"); + test_assert_sequence(1, "ABC"); } const struct testcase testmtx2 = { @@ -204,7 +204,7 @@ static void mtx3_execute(void) { threads[3] = chThdCreateStatic(wa[3], WA_SIZE, chThdGetPriority()-2, thread8, "B"); threads[4] = chThdCreateStatic(wa[4], WA_SIZE, chThdGetPriority()-1, thread9, "A"); test_wait_threads(); - test_assert_sequence("ABCDE"); + test_assert_sequence(1, "ABCDE"); } const struct testcase testmtx3 = { @@ -250,40 +250,40 @@ static void mtx4_execute(void) { threads[0] = chThdCreateStatic(wa[0], WA_SIZE, p1, thread13, "B"); threads[1] = chThdCreateStatic(wa[1], WA_SIZE, p2, thread14, "A"); chMtxLock(&m2); - test_assert(chThdGetPriority() == p, "#1"); + test_assert(1, chThdGetPriority() == p, "wrong priority level"); chThdSleepMilliseconds(100); - test_assert(chThdGetPriority() == p1, "#2"); + test_assert(2, chThdGetPriority() == p1, "wrong priority level"); chMtxLock(&m1); - test_assert(chThdGetPriority() == p1, "#3"); + test_assert(3, chThdGetPriority() == p1, "wrong priority level"); chThdSleepMilliseconds(100); - test_assert(chThdGetPriority() == p2, "#4"); + test_assert(4, chThdGetPriority() == p2, "wrong priority level"); chMtxUnlock(); - test_assert(chThdGetPriority() == p1, "#5"); + test_assert(5, chThdGetPriority() == p1, "wrong priority level"); chThdSleepMilliseconds(100); - test_assert(chThdGetPriority() == p1, "#6"); + test_assert(6, chThdGetPriority() == p1, "wrong priority level"); chMtxUnlockAll(); - test_assert(chThdGetPriority() == p, "#7"); + test_assert(7, chThdGetPriority() == p, "wrong priority level"); test_wait_threads(); /* Test repeated in order to cover chMtxUnlockS().*/ threads[0] = chThdCreateStatic(wa[0], WA_SIZE, p1, thread13, "D"); threads[1] = chThdCreateStatic(wa[1], WA_SIZE, p2, thread14, "C"); chMtxLock(&m2); - test_assert(chThdGetPriority() == p, "#8"); + test_assert(8, chThdGetPriority() == p, "wrong priority level"); chThdSleepMilliseconds(100); - test_assert(chThdGetPriority() == p1, "#9"); + test_assert(9, chThdGetPriority() == p1, "wrong priority level"); chMtxLock(&m1); - test_assert(chThdGetPriority() == p1, "#10"); + test_assert(10, chThdGetPriority() == p1, "wrong priority level"); chThdSleepMilliseconds(100); - test_assert(chThdGetPriority() == p2, "#11"); + test_assert(11, chThdGetPriority() == p2, "wrong priority level"); chSysLock(); chMtxUnlockS(); chSysUnlock(); - test_assert(chThdGetPriority() == p1, "#12"); + test_assert(12, chThdGetPriority() == p1, "wrong priority level"); chThdSleepMilliseconds(100); - test_assert(chThdGetPriority() == p1, "#13"); + test_assert(13, chThdGetPriority() == p1, "wrong priority level"); chMtxUnlockAll(); - test_assert(chThdGetPriority() == p, "#14"); + test_assert(14, chThdGetPriority() == p, "wrong priority level"); test_wait_threads(); } @@ -311,18 +311,18 @@ static void mtx5_execute(void) { prio = chThdGetPriority(); b = chMtxTryLock(&m1); - test_assert(b, "#1"); + test_assert(1, b, "already locked"); b = chMtxTryLock(&m1); - test_assert(!b, "#2"); + test_assert(2, !b, "not locked"); chSysLock(); chMtxUnlockS(); chSysUnlock(); - test_assert(isempty(&m1.m_queue), "#3"); /* Queue not empty */ - test_assert(m1.m_owner == NULL, "#4"); /* Owned */ - test_assert(chThdGetPriority() == prio, "#5"); + test_assert(3, isempty(&m1.m_queue), "queue not empty"); + test_assert(4, m1.m_owner == NULL, "still owned"); + test_assert(5, chThdGetPriority() == prio, "wrong priority level"); } const struct testcase testmtx5 = { @@ -370,7 +370,7 @@ static void mtx6_execute(void) { chSchRescheduleS(); chSysUnlock(); test_wait_threads(); - test_assert_sequence("ABCDE"); + test_assert_sequence(1, "ABCDE"); } const struct testcase testmtx6 = { @@ -402,7 +402,7 @@ static void mtx7_execute(void) { threads[4] = chThdCreateStatic(wa[4], WA_SIZE, prio+5, thread10, "A"); chCondBroadcast(&c1); test_wait_threads(); - test_assert_sequence("ABCDE"); + test_assert_sequence(1, "ABCDE"); } const struct testcase testmtx7 = { @@ -452,7 +452,7 @@ static void mtx8_execute(void) { chCondSignal(&c1); chCondSignal(&c1); test_wait_threads(); - test_assert_sequence("ABC"); + test_assert_sequence(1, "ABC"); } const struct testcase testmtx8 = { diff --git a/test/testpools.c b/test/testpools.c index 9479926d8..abf63d700 100644 --- a/test/testpools.c +++ b/test/testpools.c @@ -44,10 +44,10 @@ static void pools1_execute(void) { /* Empting the pool again. */ for (i = 0; i < MAX_THREADS; i++) - test_assert(chPoolAlloc(&mp1) != NULL, "#1"); /* Pool list empty.*/ + test_assert(1, chPoolAlloc(&mp1) != NULL, "list empty"); /* Now must be empty. */ - test_assert(chPoolAlloc(&mp1) == NULL, "#2"); /* Pool list not empty.*/ + test_assert(2, chPoolAlloc(&mp1) == NULL, "list not empty"); } const struct testcase testpools1 = { diff --git a/test/testsem.c b/test/testsem.c index eac0e041b..a0f94dcb0 100644 --- a/test/testsem.c +++ b/test/testsem.c @@ -58,9 +58,9 @@ static void sem1_execute(void) { chSemSignal(&sem1); test_wait_threads(); #if CH_USE_SEMAPHORES_PRIORITY - test_assert_sequence("ADCEB"); + test_assert_sequence(1, "ADCEB"); #else - test_assert_sequence("ABCDE"); + test_assert_sequence(1, "ABCDE"); #endif } @@ -101,19 +101,20 @@ static void sem2_execute(void) { * Testing special case TIME_IMMEDIATE. */ msg = chSemWaitTimeout(&sem1, TIME_IMMEDIATE); - test_assert(msg == RDY_TIMEOUT, "#1"); - test_assert(isempty(&sem1.s_queue), "#2"); /* Queue not empty */ - test_assert(sem1.s_cnt == 0, "#3"); /* Counter not zero */ + test_assert(1, msg == RDY_TIMEOUT, "wrong wake-up message"); + test_assert(2, isempty(&sem1.s_queue), "queue not empty"); + test_assert(3, sem1.s_cnt == 0, "counter not zero"); /* * Testing not timeout condition. */ - threads[0] = chThdCreateStatic(wa[0], WA_SIZE, chThdGetPriority()-1, thread2, "A"); + threads[0] = chThdCreateStatic(wa[0], WA_SIZE, chThdGetPriority() - 1, + thread2, "A"); msg = chSemWaitTimeout(&sem1, MS2ST(500)); test_wait_threads(); - test_assert(msg == RDY_OK, "#4"); - test_assert(isempty(&sem1.s_queue), "#5"); /* Queue not empty */ - test_assert(sem1.s_cnt == 0, "#6"); /* Counter not zero */ + test_assert(4, msg == RDY_OK, "wrong wake-up message"); + test_assert(5, isempty(&sem1.s_queue), "queue not empty"); + test_assert(6, sem1.s_cnt == 0, "counter not zero"); /* * Testing timeout condition. @@ -123,12 +124,12 @@ static void sem2_execute(void) { for (i = 0; i < 5; i++) { test_emit_token('A' + i); msg = chSemWaitTimeout(&sem1, MS2ST(500)); - test_assert(msg == RDY_TIMEOUT, "#7"); - test_assert(isempty(&sem1.s_queue), "#8"); /* Queue not empty */ - test_assert(sem1.s_cnt == 0, "#9"); /* Counter not zero */ + test_assert(7, msg == RDY_TIMEOUT, "wrong wake-up message"); + test_assert(8, isempty(&sem1.s_queue), "queue not empty"); + test_assert(9, sem1.s_cnt == 0, "counter not zero"); } - test_assert_sequence("ABCDE"); - test_assert_time_window(target_time, target_time + ALLOWED_DELAY); + test_assert_sequence(10, "ABCDE"); + test_assert_time_window(11, target_time, target_time + ALLOWED_DELAY); } const struct testcase testsem2 = { @@ -161,12 +162,12 @@ static void sem3_execute(void) { threads[0] = chThdCreateStatic(wa[0], WA_SIZE, chThdGetPriority()+1, thread3, "A"); chSemSignalWait(&sem1, &sem1); - test_assert(isempty(&sem1.s_queue), "#1"); /* Queue not empty */ - test_assert(sem1.s_cnt == 0, "#2"); /* Counter not zero */ + test_assert(1, isempty(&sem1.s_queue), "queue not empty"); + test_assert(2, sem1.s_cnt == 0, "counter not zero"); chSemSignalWait(&sem1, &sem1); - test_assert(isempty(&sem1.s_queue), "#3"); /* Queue not empty */ - test_assert(sem1.s_cnt == 0, "#4"); /* Counter not zero */ + test_assert(3, isempty(&sem1.s_queue), "queue not empty"); + test_assert(4, sem1.s_cnt == 0, "counter not zero"); } const struct testcase testsem3 = { diff --git a/test/testthd.c b/test/testthd.c index e5964f17f..e4e15be52 100644 --- a/test/testthd.c +++ b/test/testthd.c @@ -40,7 +40,7 @@ static void thd1_execute(void) { threads[3] = chThdCreateStatic(wa[3], WA_SIZE, chThdGetPriority()-2, thread, "B"); threads[4] = chThdCreateStatic(wa[4], WA_SIZE, chThdGetPriority()-1, thread, "A"); test_wait_threads(); - test_assert_sequence("ABCDE"); + test_assert_sequence(1, "ABCDE"); } const struct testcase testthd1 = { @@ -63,7 +63,7 @@ static void thd2_execute(void) { threads[3] = chThdCreateStatic(wa[3], WA_SIZE, chThdGetPriority()-2, thread, "B"); threads[2] = chThdCreateStatic(wa[2], WA_SIZE, chThdGetPriority()-3, thread, "C"); test_wait_threads(); - test_assert_sequence("ABCDE"); + test_assert_sequence(1, "ABCDE"); } const struct testcase testthd2 = { @@ -83,30 +83,41 @@ static void thd3_execute(void) { prio = chThdGetPriority(); p1 = chThdSetPriority(prio + 1); - test_assert(p1 == prio, "#1"); - test_assert(chThdGetPriority() == prio + 1, "#2"); + test_assert(1, p1 == prio, + "unexpected returned priority level"); + test_assert(2, chThdGetPriority() == prio + 1, + "unexpected priority level"); p1 = chThdSetPriority(p1); - test_assert(p1 == prio + 1, "#3"); - test_assert(chThdGetPriority() == prio, "#4"); + test_assert(3, p1 == prio + 1, + "unexpected returned priority level"); + test_assert(4, chThdGetPriority() == prio, + "unexpected priority level"); #if CH_USE_MUTEXES /* Simulates a priority boost situation (p_prio > p_realprio).*/ chSysLock(); chThdSelf()->p_prio += 2; chSysUnlock(); - test_assert(chThdGetPriority() == prio + 2, "#5"); - + test_assert(5, chThdGetPriority() == prio + 2, + "unexpected priority level"); + /* Tries to raise but below the boost level. */ p1 = chThdSetPriority(prio + 1); - test_assert(p1 == prio, "#6"); - test_assert(chThdSelf()->p_prio == prio + 2, "#7"); - test_assert(chThdSelf()->p_realprio == prio + 1, "#8"); + test_assert(6, p1 == prio, + "unexpected returned priority level"); + test_assert(7, chThdSelf()->p_prio == prio + 2, + "unexpected priority level"); + test_assert(8, chThdSelf()->p_realprio == prio + 1, + "unexpected returned real priority level"); /* Tries to raise above the boost level. */ p1 = chThdSetPriority(prio + 3); - test_assert(p1 == prio + 1, "#9"); - test_assert(chThdSelf()->p_prio == prio + 3, "#10"); - test_assert(chThdSelf()->p_realprio == prio + 3, "#11"); + test_assert(9, p1 == prio + 1, + "unexpected returned priority level"); + test_assert(10, chThdSelf()->p_prio == prio + 3, + "unexpected priority level"); + test_assert(11, chThdSelf()->p_realprio == prio + 3, + "unexpected real priority level"); chSysLock(); chThdSelf()->p_prio = prio; @@ -135,22 +146,22 @@ static void thd4_execute(void) { /* Timeouts in microseconds.*/ time = chTimeNow(); chThdSleepMicroseconds(100000); - test_assert_time_window(time + US2ST(100000), time + US2ST(100000) + 1); + test_assert_time_window(1, time + US2ST(100000), time + US2ST(100000) + 1); /* Timeouts in milliseconds.*/ time = chTimeNow(); chThdSleepMilliseconds(100); - test_assert_time_window(time + MS2ST(100), time + MS2ST(100) + 1); + test_assert_time_window(2, time + MS2ST(100), time + MS2ST(100) + 1); /* Timeouts in seconds.*/ time = chTimeNow(); chThdSleepSeconds(1); - test_assert_time_window(time + S2ST(1), time + S2ST(1) + 1); + test_assert_time_window(3, time + S2ST(1), time + S2ST(1) + 1); /* Absolute timelines.*/ time = chTimeNow() + MS2ST(100); chThdSleepUntil(time); - test_assert_time_window(time, time + 1); + test_assert_time_window(4, time, time + 1); } const struct testcase testthd4 = { -- cgit v1.2.3 From 756658a69a1abca61281b4dbd84a6dada9fc91b5 Mon Sep 17 00:00:00 2001 From: gdisirio Date: Sat, 25 Apr 2009 14:56:16 +0000 Subject: Improved test code, architecture names added to the port code. git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@918 35acf78f-673a-0410-8e92-d51de3d6d3f4 --- test/coverage/chcore.h | 5 +++++ test/test.c | 22 +++++++++++++++++----- 2 files changed, 22 insertions(+), 5 deletions(-) (limited to 'test') diff --git a/test/coverage/chcore.h b/test/coverage/chcore.h index 321bd816e..9347a7d5e 100644 --- a/test/coverage/chcore.h +++ b/test/coverage/chcore.h @@ -30,6 +30,11 @@ */ #define CH_ARCHITECTURE_WIN32SIM +/** + * Name of the implemented architecture. + */ +#define CH_ARCHITECTURE_NAME "WIN32 Simulator" + /** * 32 bit stack alignment. */ diff --git a/test/test.c b/test/test.c index 531928bbe..d64ec06bd 100644 --- a/test/test.c +++ b/test/test.c @@ -228,14 +228,26 @@ static void execute_test(const struct testcase *tcp) { test_wait_threads(); } +static void print_line(void) { + unsigned i; + + for (i = 0; i < 76; i++) + chFDDPut(comp, '-'); + chFDDPut(comp, '\r'); + chFDDPut(comp, '\n'); +} + msg_t TestThread(void *p) { int i, j; comp = p; test_println(""); - test_println("*****************************"); - test_println("*** ChibiOS/RT test suite ***"); - test_println("*****************************"); + test_println("*** ChibiOS/RT test suite"); + test_println("***"); + test_print("*** Kernel: "); + test_println(CH_KERNEL_VERSION); + test_print("*** Architecture: "); + test_println(CH_ARCHITECTURE_NAME); test_println(""); global_fail = FALSE; @@ -246,7 +258,7 @@ msg_t TestThread(void *p) { #if DELAY_BETWEEN_TESTS > 0 chThdSleepMilliseconds(DELAY_BETWEEN_TESTS); #endif - test_println("---------------------------------------------------------------------------"); + print_line(); test_print("--- Test Case "); test_printn(i + 1); test_print("."); @@ -268,7 +280,7 @@ msg_t TestThread(void *p) { } i++; } - test_println("---------------------------------------------------------------------------"); + print_line(); test_println(""); test_print("Final result: "); if (global_fail) -- cgit v1.2.3 From 7a1b60e3317bf693d4ae45f5ce8d4a5c047d14aa Mon Sep 17 00:00:00 2001 From: gdisirio Date: Sat, 25 Apr 2009 15:00:43 +0000 Subject: git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@919 35acf78f-673a-0410-8e92-d51de3d6d3f4 --- test/test.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'test') diff --git a/test/test.c b/test/test.c index d64ec06bd..15e044647 100644 --- a/test/test.c +++ b/test/test.c @@ -268,7 +268,7 @@ msg_t TestThread(void *p) { test_println(")"); execute_test(patterns[i][j]); if (local_fail) { - test_print("--- Result: FAIL (#"); + test_print("--- Result: FAILURE (#"); test_printn(failpoint); test_print(" ["); print_tokens(); @@ -284,7 +284,7 @@ msg_t TestThread(void *p) { test_println(""); test_print("Final result: "); if (global_fail) - test_println("FAIL"); + test_println("FAILURE"); else test_println("SUCCESS"); -- cgit v1.2.3 From 40db2266808fdca55abf8ce41b4af25b39d66688 Mon Sep 17 00:00:00 2001 From: gdisirio Date: Sat, 25 Apr 2009 15:12:34 +0000 Subject: Fixed bug 2781176. git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@921 35acf78f-673a-0410-8e92-d51de3d6d3f4 --- test/test.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'test') diff --git a/test/test.h b/test/test.h index d1deaf687..c74610c95 100644 --- a/test/test.h +++ b/test/test.h @@ -72,7 +72,7 @@ extern "C" { #endif #define test_fail(point) { \ - test_fail(point); \ + _test_fail(point); \ return; \ } -- cgit v1.2.3 From 2b3bb8642b7fa795428d2e1d26e847a9e77d5a71 Mon Sep 17 00:00:00 2001 From: gdisirio Date: Sat, 25 Apr 2009 15:32:28 +0000 Subject: Added compiler version to the test report (GCC only). git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@922 35acf78f-673a-0410-8e92-d51de3d6d3f4 --- test/test.c | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'test') diff --git a/test/test.c b/test/test.c index 15e044647..3beb3e59a 100644 --- a/test/test.c +++ b/test/test.c @@ -248,6 +248,10 @@ msg_t TestThread(void *p) { test_println(CH_KERNEL_VERSION); test_print("*** Architecture: "); test_println(CH_ARCHITECTURE_NAME); +#ifdef __GNUC__ + test_print("*** GCC Version: "); + test_println(__VERSION__); +#endif test_println(""); global_fail = FALSE; -- cgit v1.2.3 From 46e56d73491d9141b7ed3f79f2a26d3d9addc8ef Mon Sep 17 00:00:00 2001 From: gdisirio Date: Fri, 1 May 2009 12:58:05 +0000 Subject: I/O queues improvements, removed half duplex queues. git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@926 35acf78f-673a-0410-8e92-d51de3d6d3f4 --- test/testbmk.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'test') diff --git a/test/testbmk.c b/test/testbmk.c index ad7f528e4..258608c9f 100644 --- a/test/testbmk.c +++ b/test/testbmk.c @@ -318,7 +318,7 @@ static char *bmk8_gettest(void) { static void bmk8_execute(void) { static uint8_t ib[16]; - static Queue iq; + static InputQueue iq; chIQInit(&iq, ib, sizeof(ib), NULL); uint32_t n = 0; -- cgit v1.2.3 From c989a8967cdcbd54109d686678936a3581fd2c70 Mon Sep 17 00:00:00 2001 From: gdisirio Date: Fri, 1 May 2009 13:11:26 +0000 Subject: Removed the CH_USE_SERIAL_HALFDUPLEX, CH_USE_QUEUES_TIMEOUT and CH_USE_QUEUES_HALFDUPLEX configuration options. git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@927 35acf78f-673a-0410-8e92-d51de3d6d3f4 --- test/coverage/chconf.h | 29 ----------------------------- 1 file changed, 29 deletions(-) (limited to 'test') diff --git a/test/coverage/chconf.h b/test/coverage/chconf.h index 3666deae2..e739fa365 100644 --- a/test/coverage/chconf.h +++ b/test/coverage/chconf.h @@ -242,25 +242,6 @@ #define CH_USE_QUEUES TRUE #endif -/** - * If specified then the half duplex queues APIs are included in the kernel. - * @note The default is @p TRUE. - * @note Requires @p CH_USE_SEMAPHORES. - */ -#if !defined(CH_USE_QUEUES_HALFDUPLEX) || defined(__DOXYGEN__) -#define CH_USE_QUEUES_HALFDUPLEX TRUE -#endif - -/** - * If specified then the I/O queues with timeout APIs are included in the - * kernel. - * @note The default is @p TRUE. - * @note Requires @p CH_USE_QUEUES and @p CH_USE_SEMAPHORES_TIMEOUT. - */ -#if !defined(CH_USE_QUEUES_TIMEOUT) || defined(__DOXYGEN__) -#define CH_USE_QUEUES_TIMEOUT TRUE -#endif - /** * If specified then the full duplex serial driver APIs are included in the * kernel. @@ -271,16 +252,6 @@ #define CH_USE_SERIAL_FULLDUPLEX TRUE #endif -/** - * If specified then the half duplex serial driver APIs are included in the - * kernel. - * @note The default is @p TRUE. - * @note Requires @p CH_USE_QUEUES_HALFDUPLEX. - */ -#if !defined(CH_USE_SERIAL_HALFDUPLEX) || defined(__DOXYGEN__) -#define CH_USE_SERIAL_HALFDUPLEX TRUE -#endif - /** * If specified then the memory heap allocator APIs are included in the kernel. * @note The default is @p TRUE. -- cgit v1.2.3 From 0d7787542b2754010de8b4d0419f3b7ab85422f6 Mon Sep 17 00:00:00 2001 From: gdisirio Date: Fri, 1 May 2009 13:34:51 +0000 Subject: Small fixes to the test suite. git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@928 35acf78f-673a-0410-8e92-d51de3d6d3f4 --- test/testevt.c | 6 +++--- test/testmtx.c | 4 ++++ 2 files changed, 7 insertions(+), 3 deletions(-) (limited to 'test') diff --git a/test/testevt.c b/test/testevt.c index 1ac8b76c8..db486601e 100644 --- a/test/testevt.c +++ b/test/testevt.c @@ -207,7 +207,6 @@ static void evt3_execute(void) { test_assert(5, m == 0, "spurious event"); m = chEvtWaitAllTimeout(ALL_EVENTS, 10); test_assert(6, m == 0, "spurious event"); -#endif } const struct testcase testevt3 = { @@ -216,8 +215,7 @@ const struct testcase testevt3 = { NULL, evt3_execute }; - -#endif /* CH_USE_EVENTS */ +#endif /* CH_USE_EVENTS_TIMEOUT */ /* * Test sequence for events pattern. @@ -232,3 +230,5 @@ const struct testcase * const patternevt[] = { #endif NULL }; + +#endif /* CH_USE_EVENTS */ diff --git a/test/testmtx.c b/test/testmtx.c index f3023b87d..ddc32e7d5 100644 --- a/test/testmtx.c +++ b/test/testmtx.c @@ -428,7 +428,11 @@ static msg_t thread11(void *p) { chMtxLock(&m2); chMtxLock(&m1); +#if CH_USE_CONDVARS_TIMEOUT chCondWaitTimeout(&c1, TIME_INFINITE); +#else + chCondWait(&c1); +#endif test_emit_token(*(char *)p); chMtxUnlock(); chMtxUnlock(); -- cgit v1.2.3 From 81507dcbe7336d523b42afeeb422bd9c983dbf6f Mon Sep 17 00:00:00 2001 From: gdisirio Date: Sat, 2 May 2009 16:05:13 +0000 Subject: Now the serial driver subsystem is a descendant class of a BaseChannel. git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@936 35acf78f-673a-0410-8e92-d51de3d6d3f4 --- test/test.c | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) (limited to 'test') diff --git a/test/test.c b/test/test.c index 3beb3e59a..79b2202ac 100644 --- a/test/test.c +++ b/test/test.c @@ -70,27 +70,27 @@ void test_printn(uint32_t n) { char buf[16], *p; if (!n) - chFDDPut(comp, '0'); + chIOPut(comp, '0'); else { p = buf; while (n) *p++ = (n % 10) + '0', n /= 10; while (p > buf) - chFDDPut(comp, *--p); + chIOPut(comp, *--p); } } void test_print(char *msgp) { while (*msgp) - chFDDPut(comp, *msgp++); + chIOPut(comp, *msgp++); } void test_println(char *msgp) { test_print(msgp); - chFDDPut(comp, '\r'); - chFDDPut(comp, '\n'); + chIOPut(comp, '\r'); + chIOPut(comp, '\n'); } /* @@ -105,7 +105,7 @@ static void print_tokens(void) { char *cp = tokens_buffer; while (cp < tokp) - chFDDPut(comp, *cp++); + chIOPut(comp, *cp++); } void test_emit_token(char token) { @@ -232,9 +232,9 @@ static void print_line(void) { unsigned i; for (i = 0; i < 76; i++) - chFDDPut(comp, '-'); - chFDDPut(comp, '\r'); - chFDDPut(comp, '\n'); + chIOPut(comp, '-'); + chIOPut(comp, '\r'); + chIOPut(comp, '\n'); } msg_t TestThread(void *p) { -- cgit v1.2.3 From a8df5dfb84dc37224222520ead47d4cef40ebd9f Mon Sep 17 00:00:00 2001 From: gdisirio Date: Sat, 2 May 2009 20:15:04 +0000 Subject: Modified the test suite to work with a generic channel rather than with a serial driver. git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@939 35acf78f-673a-0410-8e92-d51de3d6d3f4 --- test/test.c | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) (limited to 'test') diff --git a/test/test.c b/test/test.c index 79b2202ac..071641274 100644 --- a/test/test.c +++ b/test/test.c @@ -64,33 +64,33 @@ Thread *threads[MAX_THREADS]; /* * Console output. */ -static FullDuplexDriver *comp; +static BaseChannel *chp; void test_printn(uint32_t n) { char buf[16], *p; if (!n) - chIOPut(comp, '0'); + chIOPut(chp, '0'); else { p = buf; while (n) *p++ = (n % 10) + '0', n /= 10; while (p > buf) - chIOPut(comp, *--p); + chIOPut(chp, *--p); } } void test_print(char *msgp) { while (*msgp) - chIOPut(comp, *msgp++); + chIOPut(chp, *msgp++); } void test_println(char *msgp) { test_print(msgp); - chIOPut(comp, '\r'); - chIOPut(comp, '\n'); + chIOPut(chp, '\r'); + chIOPut(chp, '\n'); } /* @@ -105,7 +105,7 @@ static void print_tokens(void) { char *cp = tokens_buffer; while (cp < tokp) - chIOPut(comp, *cp++); + chIOPut(chp, *cp++); } void test_emit_token(char token) { @@ -232,15 +232,15 @@ static void print_line(void) { unsigned i; for (i = 0; i < 76; i++) - chIOPut(comp, '-'); - chIOPut(comp, '\r'); - chIOPut(comp, '\n'); + chIOPut(chp, '-'); + chIOPut(chp, '\r'); + chIOPut(chp, '\n'); } msg_t TestThread(void *p) { int i, j; - comp = p; + chp = p; test_println(""); test_println("*** ChibiOS/RT test suite"); test_println("***"); -- cgit v1.2.3 From 2713bd19c5ba6d454f0dafe2df8ab310a62536ef Mon Sep 17 00:00:00 2001 From: gdisirio Date: Sun, 3 May 2009 10:49:34 +0000 Subject: Small fix to the test suite. git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@943 35acf78f-673a-0410-8e92-d51de3d6d3f4 --- test/testdyn.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'test') diff --git a/test/testdyn.c b/test/testdyn.c index d42cbf17e..bd32064e1 100644 --- a/test/testdyn.c +++ b/test/testdyn.c @@ -37,6 +37,7 @@ static char *dyn1_gettest(void) { static void dyn1_execute(void) { size_t n, sz; + void *p1; tprio_t prio = chThdGetPriority(); /* Test skipped if the heap is already fragmented. */ @@ -46,8 +47,12 @@ static void dyn1_execute(void) { prio-1, thread, "A"); threads[1] = chThdCreateFromHeap(THD_WA_SIZE(THREADS_STACK_SIZE), prio-2, thread, "B"); - threads[2] = chThdCreateFromHeap(THD_WA_SIZE(0x10000000), + /* Allocating the whole heap in order to make the thread creation fail.*/ + (void)chHeapStatus(&n); + p1 = chHeapAlloc(n); + threads[2] = chThdCreateFromHeap(THD_WA_SIZE(THREADS_STACK_SIZE), prio-3, thread, "C"); + chHeapFree(p1); test_assert(1, (threads[0] != NULL) && (threads[1] != NULL) && -- cgit v1.2.3 From 62beef8720971259545e9df90b182e1a94280c09 Mon Sep 17 00:00:00 2001 From: gdisirio Date: Sun, 3 May 2009 12:15:53 +0000 Subject: Heap test coverage 100% again. git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@945 35acf78f-673a-0410-8e92-d51de3d6d3f4 --- test/testheap.c | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) (limited to 'test') diff --git a/test/testheap.c b/test/testheap.c index d71b5563c..fd04353e5 100644 --- a/test/testheap.c +++ b/test/testheap.c @@ -67,15 +67,26 @@ static void heap1_execute(void) { test_assert(4, chHeapStatus(&n) == 1, "heap fragmented"); chHeapFree(p2); chHeapFree(p1); + test_assert(5, chHeapStatus(&n) == 1, "heap fragmented"); + + /* Skip fragment handling */ + p1 = chHeapAlloc(SIZE); + p2 = chHeapAlloc(SIZE); + chHeapFree(p1); + test_assert(6, chHeapStatus(&n) == 2, "invalid state"); + p1 = chHeapAlloc(SIZE * 2); /* Skips first fragment */ + chHeapFree(p1); + chHeapFree(p2); + test_assert(7, chHeapStatus(&n) == 1, "heap fragmented"); /* Allocate all handling */ (void)chHeapStatus(&n); p1 = chHeapAlloc(n); - test_assert(5, chHeapStatus(&n) == 0, "not empty"); + test_assert(8, chHeapStatus(&n) == 0, "not empty"); chHeapFree(p1); - test_assert(6, chHeapStatus(&n) == 1, "heap fragmented"); - test_assert(7, n == sz, "size changed"); + test_assert(9, chHeapStatus(&n) == 1, "heap fragmented"); + test_assert(10, n == sz, "size changed"); } else { test_print("--- Size : "); -- cgit v1.2.3 From f6394ab13af22044ab8009a09b68053bec0f130b Mon Sep 17 00:00:00 2001 From: gdisirio Date: Sun, 3 May 2009 16:42:52 +0000 Subject: 100% code coverage for queues. git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@946 35acf78f-673a-0410-8e92-d51de3d6d3f4 --- test/test.c | 2 + test/test.mk | 10 ++-- test/testqueues.c | 146 ++++++++++++++++++++++++++++++++++++++++++++++++++++++ test/testqueues.h | 25 ++++++++++ 4 files changed, 179 insertions(+), 4 deletions(-) create mode 100644 test/testqueues.c create mode 100644 test/testqueues.h (limited to 'test') diff --git a/test/test.c b/test/test.c index 071641274..3ca3d8a8a 100644 --- a/test/test.c +++ b/test/test.c @@ -29,6 +29,7 @@ #include "testheap.h" #include "testpools.h" #include "testdyn.h" +#include "testqueues.h" #include "testbmk.h" /* @@ -44,6 +45,7 @@ static const struct testcase **patterns[] = { patternheap, patternpools, patterndyn, + patternqueues, patternbmk, NULL }; diff --git a/test/test.mk b/test/test.mk index ee5128ac2..2a3e1a4f9 100644 --- a/test/test.mk +++ b/test/test.mk @@ -1,8 +1,10 @@ # List of all the ChibiOS/RT test files. -TESTSRC = ../../test/test.c ../../test/testthd.c ../../test/testsem.c \ - ../../test/testmtx.c ../../test/testmsg.c ../../test/testmbox.c \ - ../../test/testevt.c ../../test/testheap.c ../../test/testpools.c \ - ../../test/testdyn.c ../../test/testbmk.c +TESTSRC = ../../test/test.c ../../test/testthd.c \ + ../../test/testsem.c ../../test/testmtx.c \ + ../../test/testmsg.c ../../test/testmbox.c \ + ../../test/testevt.c ../../test/testheap.c \ + ../../test/testpools.c ../../test/testdyn.c \ + ../../test/testqueues.c ../../test/testbmk.c # Required include directories TESTINC = ../../test diff --git a/test/testqueues.c b/test/testqueues.c new file mode 100644 index 000000000..e3faf71f0 --- /dev/null +++ b/test/testqueues.c @@ -0,0 +1,146 @@ +/* + ChibiOS/RT - Copyright (C) 2006-2007 Giovanni Di Sirio. + + This file is part of ChibiOS/RT. + + ChibiOS/RT is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 3 of the License, or + (at your option) any later version. + + ChibiOS/RT is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see . +*/ + +#include + +#include "test.h" + +#if CH_USE_QUEUES + +#define TEST_QUEUES_SIZE 4 + +static void notify(void) {} + +static char *queues1_gettest(void) { + + return "Queues, input queues"; +} + +static void queues1_execute(void) { + InputQueue iq; + unsigned i; + + chIQInit(&iq, wa[0], TEST_QUEUES_SIZE, notify); + + /* Initial empty state */ + test_assert(1, chIQIsEmpty(&iq), "not empty"); + + /* Queue filling */ + for (i = 0; i < TEST_QUEUES_SIZE; i++) + chIQPutI(&iq, 'A' + i); + test_assert(2, chIQIsFull(&iq), "still has space"); + test_assert(3, chIQPutI(&iq, 0) == Q_FULL, "failed to report Q_FULL"); + + /* Queue emptying */ + for (i = 0; i < TEST_QUEUES_SIZE; i++) + test_emit_token(chIQGet(&iq)); + test_assert(4, chIQIsEmpty(&iq), "still full"); + test_assert_sequence(5, "ABCD"); + + /* Queue filling again */ + for (i = 0; i < TEST_QUEUES_SIZE; i++) + chIQPutI(&iq, 'A' + i); + + /* Reading the whole thing */ + test_assert(6, + chIQRead(&iq, wa[1], TEST_QUEUES_SIZE * 2) == TEST_QUEUES_SIZE, + "wrong returned size"); + test_assert(7, chIQIsEmpty(&iq), "still full"); + + /* Testing reset */ + chIQPutI(&iq, 0); + chIQResetI(&iq); + test_assert(8, chIQIsEmpty(&iq), "still full"); + +#if CH_USE_SEMAPHORES_TIMEOUT + /* Timeout */ + test_assert(9, chIQGetTimeout(&iq, 10) == Q_TIMEOUT, "wrong timeout return"); +#endif +} + +const struct testcase testqueues1 = { + queues1_gettest, + NULL, + NULL, + queues1_execute +}; + +static char *queues2_gettest(void) { + + return "Queues, output queues"; +} + +static void queues2_execute(void) { + OutputQueue oq; + unsigned i; + + chOQInit(&oq, wa[0], TEST_QUEUES_SIZE, notify); + + /* Initial empty state */ + test_assert(1, chOQIsEmpty(&oq), "not empty"); + + /* Queue filling */ + for (i = 0; i < TEST_QUEUES_SIZE; i++) + chOQPut(&oq, 'A' + i); + test_assert(2, chOQIsFull(&oq), "still has space"); + + /* Queue emptying */ + for (i = 0; i < TEST_QUEUES_SIZE; i++) + test_emit_token(chOQGetI(&oq)); + test_assert(3, chOQIsEmpty(&oq), "still full"); + test_assert_sequence(4, "ABCD"); + test_assert(5, chOQGetI(&oq) == Q_EMPTY, "failed to report Q_EMPTY"); + + /* Writing the whole thing */ + test_assert(6, + chOQWrite(&oq, wa[1], TEST_QUEUES_SIZE * 2) == TEST_QUEUES_SIZE, + "wrong returned size"); + test_assert(7, chOQIsFull(&oq), "not full"); + + /* Testing reset */ + chOQResetI(&oq); + test_assert(8, chOQIsEmpty(&oq), "still full"); + +#if CH_USE_SEMAPHORES_TIMEOUT + /* Timeout */ + for (i = 0; i < TEST_QUEUES_SIZE; i++) + chOQPut(&oq, 'A' + i); + test_assert(9, chOQIsFull(&oq), "still has space"); + test_assert(10, chOQPutTimeout(&oq, 0, 10) == Q_TIMEOUT, "wrong timeout return"); +#endif +} + +const struct testcase testqueues2 = { + queues2_gettest, + NULL, + NULL, + queues2_execute +}; +#endif /* CH_USE_QUEUES */ + +/* + * Test sequence for queues pattern. + */ +const struct testcase * const patternqueues[] = { +#if CH_USE_QUEUES + &testqueues1, + &testqueues2, +#endif + NULL +}; diff --git a/test/testqueues.h b/test/testqueues.h new file mode 100644 index 000000000..69b96dfb0 --- /dev/null +++ b/test/testqueues.h @@ -0,0 +1,25 @@ +/* + ChibiOS/RT - Copyright (C) 2006-2007 Giovanni Di Sirio. + + This file is part of ChibiOS/RT. + + ChibiOS/RT is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 3 of the License, or + (at your option) any later version. + + ChibiOS/RT is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see . +*/ + +#ifndef _TESTQUEUES_H_ +#define _TESTQUEUES_H_ + +extern const struct testcase *patternqueues[]; + +#endif /* _TESTQUEUES_H_ */ -- cgit v1.2.3 From aea323e12179301b00e7766fc97dc3d3b51576d9 Mon Sep 17 00:00:00 2001 From: gdisirio Date: Thu, 7 May 2009 15:24:47 +0000 Subject: git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@949 35acf78f-673a-0410-8e92-d51de3d6d3f4 --- test/test.c | 2 ++ test/test.mk | 3 ++- test/testqueues.c | 49 ++++++++++++++++++++++++++++++++++++++ test/testserial.c | 65 ++++++++++++++++++++++++++++++++++++++++++++++++++ test/testserial.h | 25 ++++++++++++++++++++ test/testthd.c | 71 ++++++++++++++++++++++++++++++++++++++++++++++++++++++- 6 files changed, 213 insertions(+), 2 deletions(-) create mode 100644 test/testserial.c create mode 100644 test/testserial.h (limited to 'test') diff --git a/test/test.c b/test/test.c index 3ca3d8a8a..02e56788a 100644 --- a/test/test.c +++ b/test/test.c @@ -30,6 +30,7 @@ #include "testpools.h" #include "testdyn.h" #include "testqueues.h" +#include "testserial.h" #include "testbmk.h" /* @@ -46,6 +47,7 @@ static const struct testcase **patterns[] = { patternpools, patterndyn, patternqueues, + patternserial, patternbmk, NULL }; diff --git a/test/test.mk b/test/test.mk index 2a3e1a4f9..f80237f8a 100644 --- a/test/test.mk +++ b/test/test.mk @@ -4,7 +4,8 @@ TESTSRC = ../../test/test.c ../../test/testthd.c \ ../../test/testmsg.c ../../test/testmbox.c \ ../../test/testevt.c ../../test/testheap.c \ ../../test/testpools.c ../../test/testdyn.c \ - ../../test/testqueues.c ../../test/testbmk.c + ../../test/testqueues.c ../../test/testserial.c \ + ../../test/testbmk.c # Required include directories TESTINC = ../../test diff --git a/test/testqueues.c b/test/testqueues.c index e3faf71f0..2781b3479 100644 --- a/test/testqueues.c +++ b/test/testqueues.c @@ -21,10 +21,51 @@ #include "test.h" +/** + * @page test_queues I/O Queues test + * + *

Description

+ * This module implements the test sequence for the @ref IOQueues subsystem. + * The tests are performed by inserting and removing data from queues and by + * checking both the queues status and the correct sequence of the extracted + * data. + * + *

Objective

+ * Objective of the test module is to cover 100% of the @ref IOQueues code + * as a necessary step in order to assess its readyness.
+ * Note that the @ref IOQueues subsystem depends on the @ref Semaphores + * subsystem that has to met its testing objectives as well. + * + *

Preconditions

+ * The module requires the following kernel options: + * - @p CH_USE_QUEUES (and dependent options) + * . + * In case of the required options are not enabled some or all tests may be + * skipped. + * + *

Waivers

+ * None. + * + *

Test Cases

+ * - @subpage test_queues_001 + * - @subpage test_queues_002 + * . + * @file testqueues.c + * @file testqueues.h + */ + #if CH_USE_QUEUES #define TEST_QUEUES_SIZE 4 +/** + * @page test_queues_001 Input Queues functionality and APIs + * + *

Description

+ * This test case tests sysnchronos and asynchronous operations on an + * @p InputQueue object including timeouts. The queue state must remain + * consistent through the whole test. + */ static void notify(void) {} static char *queues1_gettest(void) { @@ -81,6 +122,14 @@ const struct testcase testqueues1 = { queues1_execute }; +/** + * @page test_queues_002 Output Queues functionality and APIs + * + *

Description

+ * This test case tests sysnchronos and asynchronous operations on an + * @p OutputQueue object including timeouts. The queue state must remain + * consistent through the whole test. + */ static char *queues2_gettest(void) { return "Queues, output queues"; diff --git a/test/testserial.c b/test/testserial.c new file mode 100644 index 000000000..a10529493 --- /dev/null +++ b/test/testserial.c @@ -0,0 +1,65 @@ +/* + ChibiOS/RT - Copyright (C) 2006-2007 Giovanni Di Sirio. + + This file is part of ChibiOS/RT. + + ChibiOS/RT is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 3 of the License, or + (at your option) any later version. + + ChibiOS/RT is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see . +*/ + +#include + +#include "test.h" + +/** + * @page test_serial Serial Driver test + * + *

Description

+ * This module implements the test sequence for the @ref Serial subsystem. + * The tests are performed on a loopback software serial driver where a + * dedicated thread echoes back in the input queue the data read from the + * output queue at a fixed rate. + * + *

Objective

+ * Objective of the test module is to cover 100% of the @ref Serial code + * as a necessary step in order to assess its readyness.
+ * Note that the @ref Serial subsystem depends on the @ref Semaphores and + * @ref Events subsystems that have to met their testing objectives as well. + * + *

Preconditions

+ * The module requires the following kernel options: + * - @p CH_USE_SERIAL_FULLDUPLEX (and dependent options) + * . + * In case of the required options are not enabled some or all tests may be + * skipped. + * + *

Waivers

+ * None. + * + * @file testserial.c + * @file testserial.h + */ + +#if CH_USE_SERIAL_FULLDUPLEX + +#endif /* CH_USE_SERIAL_FULLDUPLEX */ + +/* + * Test sequence for queues pattern. + */ +const struct testcase * const patternserial[] = { +#if CH_USE_SERIAL_FULLDUPLEX + &testserial1, +#endif + NULL +}; diff --git a/test/testserial.h b/test/testserial.h new file mode 100644 index 000000000..3e68dd9c7 --- /dev/null +++ b/test/testserial.h @@ -0,0 +1,25 @@ +/* + ChibiOS/RT - Copyright (C) 2006-2007 Giovanni Di Sirio. + + This file is part of ChibiOS/RT. + + ChibiOS/RT is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 3 of the License, or + (at your option) any later version. + + ChibiOS/RT is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see . +*/ + +#ifndef _TESTSERIAL_H_ +#define _TESTSERIAL_H_ + +extern const struct testcase *patternserial[]; + +#endif /* _TESTSERIAL_H_ */ diff --git a/test/testthd.c b/test/testthd.c index e4e15be52..e44531868 100644 --- a/test/testthd.c +++ b/test/testthd.c @@ -21,6 +21,47 @@ #include "test.h" +/** + * @page test_threads Threads and Scheduler test + * + *

Description

+ * This module implements the test sequence for the @ref Scheduler, + * @ref Threads and @ref Time subsystems.
+ * Note that the tests on those subsystems are formally required but most of + * their functionality is already demostrated because the test suite itself + * depends on them, anyway doublecheck is good. + * + *

Objective

+ * Objective of the test module is to cover 100% of the subsystems code + * as a necessary step in order to assess their readyness.
+ * + *

Preconditions

+ * None. + * + *

Waivers

+ * - The @p chThdExit() API is not code 100% covered because it cannot return. + * It must work this way by design. + * . + *

Test Cases

+ * - @subpage test_threads_001 + * - @subpage test_threads_002 + * - @subpage test_threads_003 + * - @subpage test_threads_004 + * . + * @file testthd.c + * @file testthd.h + */ + +/** + * @page test_threads_001 Ready List functionality #1 + * + *

Description

+ * Five threads, with increasing priority, are enqueued in the ready list + * and atomically executed.
+ * The test expects the threads to perform their operations in increasing + * priority order redardless of the initial order. + */ + static msg_t thread(void *p) { test_emit_token(*(char *)p); @@ -50,6 +91,16 @@ const struct testcase testthd1 = { thd1_execute }; +/** + * @page test_threads_002 Ready List functionality #2 + * + *

Description

+ * Five threads, with pseudo-random priority, are enqueued in the ready list + * and atomically executed.
+ * The test expects the threads to perform their operations in increasing + * priority order redardless of the initial order. + */ + static char *thd2_gettest(void) { return "Threads, enqueuing test #2"; @@ -73,6 +124,16 @@ const struct testcase testthd2 = { thd2_execute }; +/** + * @page test_threads_003 Threads priority change test + * + *

Description

+ * A series of priority changes are performed on the current thread in order + * to verify that the priority change happens as expected.
+ * If the @p CH_USE_MUTEXES option is enabled then the priority changes are + * also tested under priority inheritance boosted priority state. + */ + static char *thd3_gettest(void) { return "Threads, priority change"; @@ -133,6 +194,14 @@ const struct testcase testthd3 = { thd3_execute }; +/** + * @page test_threads_004 Threads delays test + * + *

Description

+ * Delay APIs and associated macros are tested, the invoking thread is verified + * to wake up at the exact expected time. + */ + static char *thd4_gettest(void) { return "Threads, delays"; @@ -172,7 +241,7 @@ const struct testcase testthd4 = { }; /* - * Test sequence for ready list pattern. + * Test sequence for threads patterns. */ const struct testcase * const patternthd[] = { &testthd1, -- cgit v1.2.3 From b37209d196026ba07f687c487d53dcbeef1f9223 Mon Sep 17 00:00:00 2001 From: gdisirio Date: Thu, 7 May 2009 20:36:26 +0000 Subject: Started adding documentation tags to the test suite. git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@950 35acf78f-673a-0410-8e92-d51de3d6d3f4 --- test/testbmk.c | 170 ++++++++++++++++++++++++++++++++++++++++++++++++++---- test/testqueues.c | 2 + test/testserial.c | 4 +- test/testthd.c | 8 ++- 4 files changed, 170 insertions(+), 14 deletions(-) (limited to 'test') diff --git a/test/testbmk.c b/test/testbmk.c index 258608c9f..90f49ae5d 100644 --- a/test/testbmk.c +++ b/test/testbmk.c @@ -21,6 +21,44 @@ #include "test.h" +/** + * @page test_benchmarks Kernel Benchmarks + * + *

Description

+ * This module implements a series of system benchmarks. The benchmarks are + * useful as a stress test and as a reference when comparing ChibiOS/RT + * with similar systems. + * + *

Objective

+ * Objective of the test module is to provide a performance index for the + * most critical system subsystems. The performance numbers allow to + * discover performance regressions between successive ChibiOS/RT releases. + * + *

Preconditions

+ * None. + * + *

Waivers

+ * Not applicable. + * + *

Test Cases

+ * - @subpage test_benchmarks_001 + * - @subpage test_benchmarks_002 + * - @subpage test_benchmarks_003 + * - @subpage test_benchmarks_004 + * - @subpage test_benchmarks_005 + * - @subpage test_benchmarks_006 + * - @subpage test_benchmarks_007 + * - @subpage test_benchmarks_008 + * - @subpage test_benchmarks_009 + * - @subpage test_benchmarks_010 + * - @subpage test_benchmarks_011 + * . + * @file testbmk.c Kernel Benchmarks + * @brief Kernel Benchmarks source file + * @file testbmk.h + * @brief Kernel Benchmarks header file + */ + static Semaphore sem1; #if CH_USE_MUTEXES static Mutex mtx1; @@ -52,9 +90,18 @@ static unsigned int msg_loop_test(Thread *tp) { return n; } +/** + * @page test_benchmarks_001 Messages performance #1 + * + *

Description

+ * A message server thread is created with a lower priority than the client + * thread, the messages throughput per second is measured and the result + * printed in the output log. + */ + static char *bmk1_gettest(void) { - return "Benchmark, context switch #1, optimal"; + return "Benchmark, messages, immediate wakeup"; } static void bmk1_execute(void) { @@ -78,9 +125,18 @@ const struct testcase testbmk1 = { bmk1_execute }; +/** + * @page test_benchmarks_002 Messages performance #2 + * + *

Description

+ * A message server thread is created with an higher priority than the client + * thread, the messages throughput per second is measured and the result + * printed in the output log. + */ + static char *bmk2_gettest(void) { - return "Benchmark, context switch #2, empty ready list"; + return "Benchmark, messages, late wakeup"; } static void bmk2_execute(void) { @@ -109,9 +165,19 @@ static msg_t thread2(void *p) { return (msg_t)p; } +/** + * @page test_benchmarks_003 Messages performance #3 + * + *

Description

+ * A message server thread is created with an higher priority than the client + * thread, four lower priority threads crowd the ready list, the messages + * throughput per second is measured while the ready list and the result + * printed in the output log. + */ + static char *bmk3_gettest(void) { - return "Benchmark, context switch #3, 4 threads in ready list"; + return "Benchmark, messages, 4 threads in ready list"; } static void bmk3_execute(void) { @@ -139,9 +205,19 @@ const struct testcase testbmk3 = { bmk3_execute }; +/** + * @page test_benchmarks_004 Context Switch performance + * + *

Description

+ * A thread is created that just performs a @p chSchGoSleepS() into a loop, + * the thread is awakened as fast is possible by the tester thread.
+ * The Context Switch performance is calculated by measuring the number of + * interactions after a second of continuous operations. + */ + static char *bmk4_gettest(void) { - return "Benchmark, context switch #4, naked"; + return "Benchmark, context switch"; } msg_t thread4(void *p) { @@ -195,9 +271,20 @@ const struct testcase testbmk4 = { bmk4_execute }; +/** + * @page test_benchmarks_005 Threads performance, full cycle + * + *

Description

+ * Threads are continuously created and terminated into a loop. A full + * @p chThdCreateStatic() / @p chThdExit() / @p chThdWait() cycle is performed + * in each interaction.
+ * The performance is calculated by measuring the number of interactions after + * a second of continuous operations. + */ + static char *bmk5_gettest(void) { - return "Benchmark, threads creation/termination, worst case"; + return "Benchmark, threads, full cycle"; } static void bmk5_execute(void) { @@ -226,9 +313,22 @@ const struct testcase testbmk5 = { bmk5_execute }; +/** + * @page test_benchmarks_006 Threads performance, create/exit only + * + *

Description

+ * Threads are continuously created and terminated into a loop. A partial + * @p chThdCreateStatic() / @p chThdExit() cycle is performed in each + * interaction, the @p chThdWait() is not necessary because the thread is + * created at an higher priority so there is no need to wait for it to + * terminate.
+ * The performance is calculated by measuring the number of interactions after + * a second of continuous operations. + */ + static char *bmk6_gettest(void) { - return "Benchmark, threads creation/termination, optimal"; + return "Benchmark, threads, create only"; } static void bmk6_execute(void) { @@ -257,6 +357,17 @@ const struct testcase testbmk6 = { bmk6_execute }; +/** + * @page test_benchmarks_007 Mass reschedulation performance + * + *

Description

+ * Five threads are created and atomically reschedulated by resetting the + * semaphore where they are waiting on. The operation is performed into a + * continuous loop.
+ * The performance is calculated by measuring the number of interactions after + * a second of continuous operations. + */ + static msg_t thread3(void *p) { while (!chThdShouldTerminate()) @@ -277,11 +388,11 @@ static void bmk7_setup(void) { static void bmk7_execute(void) { uint32_t n; - threads[0] = chThdCreateStatic(wa[0], WA_SIZE, chThdGetPriority()+1, thread3, NULL); - threads[1] = chThdCreateStatic(wa[1], WA_SIZE, chThdGetPriority()+2, thread3, NULL); + threads[0] = chThdCreateStatic(wa[0], WA_SIZE, chThdGetPriority()+5, thread3, NULL); + threads[1] = chThdCreateStatic(wa[1], WA_SIZE, chThdGetPriority()+4, thread3, NULL); threads[2] = chThdCreateStatic(wa[2], WA_SIZE, chThdGetPriority()+3, thread3, NULL); - threads[3] = chThdCreateStatic(wa[3], WA_SIZE, chThdGetPriority()+4, thread3, NULL); - threads[4] = chThdCreateStatic(wa[4], WA_SIZE, chThdGetPriority()+5, thread3, NULL); + threads[3] = chThdCreateStatic(wa[3], WA_SIZE, chThdGetPriority()+2, thread3, NULL); + threads[4] = chThdCreateStatic(wa[4], WA_SIZE, chThdGetPriority()+1, thread3, NULL); n = 0; test_wait_tick(); @@ -311,6 +422,16 @@ const struct testcase testbmk7 = { bmk7_execute }; +/** + * @page test_benchmarks_008 I/O Queues throughput + * + *

Description

+ * Four bytes are written and then read from an @p InputQueue into a continuous + * loop.
+ * The performance is calculated by measuring the number of interactions after + * a second of continuous operations. + */ + static char *bmk8_gettest(void) { return "Benchmark, I/O Queues throughput"; @@ -350,6 +471,15 @@ const struct testcase testbmk8 = { bmk8_execute }; +/** + * @page test_benchmarks_009 Virtual Timers set/reset performance + * + *

Description

+ * A virtual timer is set and immediately reset into a continuous loop.
+ * The performance is calculated by measuring the number of interactions after + * a second of continuous operations. + */ + static char *bmk9_gettest(void) { return "Benchmark, virtual timers set/reset"; @@ -387,6 +517,16 @@ const struct testcase testbmk9 = { bmk9_execute }; +/** + * @page test_benchmarks_010 Semaphores wait/signal performance + * + *

Description

+ * A counting semaphore is taken/released into a continuous loop, no Context + * Switch happens because the counter is always non negative.
+ * The performance is calculated by measuring the number of interactions after + * a second of continuous operations. + */ + static char *bmk10_gettest(void) { return "Benchmark, semaphores wait/signal"; @@ -429,6 +569,16 @@ const struct testcase testbmk10 = { }; #if CH_USE_MUTEXES +/** + * @page test_benchmarks_011 Mutexes lock/unlock performance + * + *

Description

+ * A mutex is locked/unlocked into a continuous loop, no Context Switch happens + * because there are no other threads asking for the mutex.
+ * The performance is calculated by measuring the number of interactions after + * a second of continuous operations. + */ + static char *bmk11_gettest(void) { return "Benchmark, mutexes lock/unlock"; diff --git a/test/testqueues.c b/test/testqueues.c index 2781b3479..53f6d3840 100644 --- a/test/testqueues.c +++ b/test/testqueues.c @@ -51,7 +51,9 @@ * - @subpage test_queues_002 * . * @file testqueues.c + * @brief I/O Queues test source file * @file testqueues.h + * @brief I/O Queues test header file */ #if CH_USE_QUEUES diff --git a/test/testserial.c b/test/testserial.c index a10529493..61fc0315a 100644 --- a/test/testserial.c +++ b/test/testserial.c @@ -47,7 +47,9 @@ * None. * * @file testserial.c + * @brief Kernel Serial Driver test source file * @file testserial.h + * @brief Kernel Serial Driver test header file */ #if CH_USE_SERIAL_FULLDUPLEX @@ -59,7 +61,7 @@ */ const struct testcase * const patternserial[] = { #if CH_USE_SERIAL_FULLDUPLEX - &testserial1, +// &testserial1, #endif NULL }; diff --git a/test/testthd.c b/test/testthd.c index e44531868..54db5430e 100644 --- a/test/testthd.c +++ b/test/testthd.c @@ -33,7 +33,7 @@ * *

Objective

* Objective of the test module is to cover 100% of the subsystems code - * as a necessary step in order to assess their readyness.
+ * as a necessary step in order to assess their readyness. * *

Preconditions

* None. @@ -49,7 +49,9 @@ * - @subpage test_threads_004 * . * @file testthd.c + * @brief Threads and Scheduler test source file * @file testthd.h + * @brief Threads and Scheduler test header file */ /** @@ -59,7 +61,7 @@ * Five threads, with increasing priority, are enqueued in the ready list * and atomically executed.
* The test expects the threads to perform their operations in increasing - * priority order redardless of the initial order. + * priority order regardless of the initial order. */ static msg_t thread(void *p) { @@ -98,7 +100,7 @@ const struct testcase testthd1 = { * Five threads, with pseudo-random priority, are enqueued in the ready list * and atomically executed.
* The test expects the threads to perform their operations in increasing - * priority order redardless of the initial order. + * priority order regardless of the initial order. */ static char *thd2_gettest(void) { -- cgit v1.2.3 From 3d2fd8eb545182334b672c52acd7b8a06193bedf Mon Sep 17 00:00:00 2001 From: gdisirio Date: Fri, 8 May 2009 14:06:45 +0000 Subject: git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@951 35acf78f-673a-0410-8e92-d51de3d6d3f4 --- test/testbmk.c | 3 --- test/testdyn.c | 51 +++++++++++++++++++++++++++++++++++++++ test/testevt.c | 71 +++++++++++++++++++++++++++++++++++++++++++++++++++++++ test/testheap.c | 37 +++++++++++++++++++++++++++++ test/testmbox.c | 36 ++++++++++++++++++++++++++++ test/testmsg.c | 35 +++++++++++++++++++++++++++ test/testqueues.c | 7 ++---- test/testserial.c | 9 +++---- test/testthd.c | 8 ++----- 9 files changed, 237 insertions(+), 20 deletions(-) (limited to 'test') diff --git a/test/testbmk.c b/test/testbmk.c index 90f49ae5d..3c82c5e0d 100644 --- a/test/testbmk.c +++ b/test/testbmk.c @@ -37,9 +37,6 @@ *

Preconditions

* None. * - *

Waivers

- * Not applicable. - * *

Test Cases

* - @subpage test_benchmarks_001 * - @subpage test_benchmarks_002 diff --git a/test/testdyn.c b/test/testdyn.c index bd32064e1..536bcadda 100644 --- a/test/testdyn.c +++ b/test/testdyn.c @@ -21,8 +21,49 @@ #include "test.h" +/** + * @page test_dynamic Dynamic Thread APIs test + * + *

Description

+ * This module implements the test sequence for the dynamic thread creation + * APIs. + * + *

Objective

+ * Objective of the test module is to cover 100% of the dynamic APIs code + * as a necessary step in order to assess their readyness. + * + *

Preconditions

+ * The module requires the following kernel options: + * - @p CH_USE_DYNAMIC + * - @p CH_USE_HEAP + * - @p CH_USE_MEMPOOLS + * . + * In case some of the required options are not enabled then some or all tests + * may be skipped. + * + *

Test Cases

+ * - @subpage test_dynamic_001 + * - @subpage test_dynamic_002 + * . + * @file testdyn.c + * @brief Dynamic thread APIs test source file + * @file testdyn.h + * @brief Dynamic thread APIs test header file + */ + #if CH_USE_DYNAMIC +/** + * @page test_dynamic_001 Threads creation from Memory Heap + * + *

Description

+ * Two threads are started by allocating the memory from the Memory Heap then + * the remaining heap space is arbitrarily allocated and a third tread startup + * is attempted.
+ * The test expects the first two threads to successfully start and the last + * one to fail. + */ + static msg_t thread(void *p) { test_emit_token(*(char *)p); @@ -80,6 +121,16 @@ const struct testcase testdyn1 = { #endif /* CH_USE_HEAP */ #if CH_USE_MEMPOOLS +/** + * @page test_dynamic_002 Threads creation from Memory Pool + * + *

Description

+ * Five thread creation are attempted from a pool containing only four + * elements.
+ * The test expects the first four threads to successfully start and the last + * one to fail. + */ + static MemoryPool mp1; static char *dyn2_gettest(void) { diff --git a/test/testevt.c b/test/testevt.c index db486601e..aa0a00da6 100644 --- a/test/testevt.c +++ b/test/testevt.c @@ -21,12 +21,54 @@ #include "test.h" +/** + * @page test_events Events test + * + *

Description

+ * This module implements the test sequence for the @ref Events subsystem. + * + *

Objective

+ * Objective of the test module is to cover 100% of the @ref Events subsystem + * code as a necessary step in order to assess its readyness. + * + *

Preconditions

+ * The module requires the following kernel options: + * - @p CH_USE_EVENTS + * - @p CH_USE_EVENTS_TIMEOUT + * . + * In case some of the required options are not enabled then some or all tests + * may be skipped. + * + *

Test Cases

+ * - @subpage test_events_001 + * - @subpage test_events_002 + * - @subpage test_events_003 + * . + * @file testevt.c + * @brief Events test source file + * @file testevt.h + * @brief Events test header file + */ + #if CH_USE_EVENTS #define ALLOWED_DELAY MS2ST(5) static EventSource es1, es2; +/** + * @page test_events_001 Events registration and dispatch + * + *

Description

+ * Two event listeners are registered on an event source and then unregistered + * in the same order.
+ * The test expects that the even source has listeners after the registrations + * and after the first unregistration, then, after the second unegistration, + * the test expects no more listeners.
+ * In the second part the test dispatches three event flags and verifies that + * the associated event handlers are invoked in LSb-first order. + */ + static char *evt1_gettest(void) { return "Events, registration and dispatch"; @@ -71,6 +113,20 @@ const struct testcase testevt1 = { evt1_execute }; +/** + * @page test_events_002 Events wait and broadcast + * + *

Description

+ * In this test the following APIs are indipently tested by starting threads + * that signal/broadcast events after fixed delays: + * - @p chEvtWaitOne() + * - @p chEvtWaitAny() + * - @p chEvtWaitAll() + * . + * After each test phase the test verifies that the events have been served at + * the expected time and that there are no stuck event flags. + */ + static char *evt2_gettest(void) { return "Events, wait and broadcast"; @@ -179,6 +235,21 @@ const struct testcase testevt2 = { }; #if CH_USE_EVENTS_TIMEOUT +/** + * @page test_events_003 Events timeout + * + *

Description

+ * In this test the following APIs are let to timeout twice: immediatly and + * after 10ms: + * In this test the following APIs are indipently tested by starting threads + * that broadcast events after fixed delays: + * - @p chEvtWaitOneTimeout() + * - @p chEvtWaitAnyTimeout() + * - @p chEvtWaitAllTimeout() + * . + * After each test phase the test verifies that there are no stuck event flags. + */ + static char *evt3_gettest(void) { return "Events, timeouts"; diff --git a/test/testheap.c b/test/testheap.c index fd04353e5..a617c4b68 100644 --- a/test/testheap.c +++ b/test/testheap.c @@ -21,10 +21,47 @@ #include "test.h" +/** + * @page test_heap Memory Heap test + * + *

Description

+ * This module implements the test sequence for the @ref Heap subsystem. + * + *

Objective

+ * Objective of the test module is to cover 100% of the @ref Heap subsystem + * code as a necessary step in order to assess its readyness. + * + *

Preconditions

+ * The module requires the following kernel options: + * - @p CH_USE_HEAP + * . + * In case some of the required options are not enabled then some or all tests + * may be skipped. + * + *

Test Cases

+ * - @subpage test_heap_001 + * . + * @file testheap.c + * @brief Heap test source file + * @file testevt.h + * @brief Heap header file + */ + #if CH_USE_HEAP #define SIZE 16 +/** + * @page test_heap_001 Allocation and fragmentation test + * + *

Description

+ * Series of allocations/deallocations are performed in carefully designed + * sequences in order to stimulate all the possible code paths inside the + * allocator.
+ * The test expects to find the heap back to the initial status after each + * sequence. + */ + static char *heap1_gettest(void) { return "Heap, allocation and fragmentation test"; diff --git a/test/testmbox.c b/test/testmbox.c index 9e3462ad4..2fe88b2b9 100644 --- a/test/testmbox.c +++ b/test/testmbox.c @@ -21,6 +21,33 @@ #include "test.h" +/** + * @page test_mbox Mailboxes test + * + *

Description

+ * This module implements the test sequence for the @ref Mailboxes subsystem. + * + *

Objective

+ * Objective of the test module is to cover 100% of the @ref Mailboxes + * subsystem code as a necessary step in order to assess its readyness. + * + *

Preconditions

+ * The module requires the following kernel options: + * - @p CH_USE_MAILBOXES + * - @p CH_USE_SEMAPHORES_TIMEOUT + * . + * In case some of the required options are not enabled then some or all tests + * may be skipped. + * + *

Test Cases

+ * - @subpage test_mbox_001 + * . + * @file testmbox.c + * @brief Mailboxes test source file + * @file testmbox.h + * @brief Mailboxes header file + */ + #if CH_USE_MAILBOXES && CH_USE_SEMAPHORES_TIMEOUT #define ALLOWED_DELAY MS2ST(5) @@ -29,6 +56,15 @@ static msg_t mb1_buf[MB_SIZE]; static Mailbox mb1; +/** + * @page test_mbox_001 Queuing and timeouts + * + *

Description

+ * Messages are posted/fetched from a mailbox in carefully designed sequences + * in order to stimulate all the possible code paths inside the mailbox.
+ * The test expects to find a consistent mailbox status after each operation. + */ + static char *mbox1_gettest(void) { return "Mailboxes, queuing and timeouts"; diff --git a/test/testmsg.c b/test/testmsg.c index 978ec0d7e..87ee64231 100644 --- a/test/testmsg.c +++ b/test/testmsg.c @@ -21,8 +21,43 @@ #include "test.h" +/** + * @page test_msg Messages test + * + *

Description

+ * This module implements the test sequence for the @ref Messages subsystem. + * + *

Objective

+ * Objective of the test module is to cover 100% of the @ref Messages + * subsystem code as a necessary step in order to assess its readyness. + * + *

Preconditions

+ * The module requires the following kernel options: + * - @p CH_USE_MESSAGES + * . + * In case some of the required options are not enabled then some or all tests + * may be skipped. + * + *

Test Cases

+ * - @subpage test_msg_001 + * . + * @file testmsg.c + * @brief Messages test source file + * @file testmsg.h + * @brief Messages header file + */ + #if CH_USE_MESSAGES +/** + * @page test_msg_001 Messages Server loop + * + *

Description

+ * A thread is spawned that sends four messages back to the tester thread.
+ * The test expect to receive the messages in the correct sequence and to + * not find a fifth message waiting. + */ + static char *msg1_gettest(void) { return "Messages, loop"; diff --git a/test/testqueues.c b/test/testqueues.c index 53f6d3840..af0ade6e6 100644 --- a/test/testqueues.c +++ b/test/testqueues.c @@ -40,11 +40,8 @@ * The module requires the following kernel options: * - @p CH_USE_QUEUES (and dependent options) * . - * In case of the required options are not enabled some or all tests may be - * skipped. - * - *

Waivers

- * None. + * In case some of the required options are not enabled then some or all tests + * may be skipped. * *

Test Cases

* - @subpage test_queues_001 diff --git a/test/testserial.c b/test/testserial.c index 61fc0315a..818d09e21 100644 --- a/test/testserial.c +++ b/test/testserial.c @@ -22,7 +22,7 @@ #include "test.h" /** - * @page test_serial Serial Driver test + * @page test_serial Serial Drivers test * *

Description

* This module implements the test sequence for the @ref Serial subsystem. @@ -40,11 +40,8 @@ * The module requires the following kernel options: * - @p CH_USE_SERIAL_FULLDUPLEX (and dependent options) * . - * In case of the required options are not enabled some or all tests may be - * skipped. - * - *

Waivers

- * None. + * In case some of the required options are not enabled then some or all tests + * may be skipped. * * @file testserial.c * @brief Kernel Serial Driver test source file diff --git a/test/testthd.c b/test/testthd.c index 54db5430e..daf3e2063 100644 --- a/test/testthd.c +++ b/test/testthd.c @@ -38,10 +38,6 @@ *

Preconditions

* None. * - *

Waivers

- * - The @p chThdExit() API is not code 100% covered because it cannot return. - * It must work this way by design. - * . *

Test Cases

* - @subpage test_threads_001 * - @subpage test_threads_002 @@ -49,9 +45,9 @@ * - @subpage test_threads_004 * . * @file testthd.c - * @brief Threads and Scheduler test source file + * @brief Threads and @ref Scheduler test source file * @file testthd.h - * @brief Threads and Scheduler test header file + * @brief Threads and @ref Scheduler test header file */ /** -- cgit v1.2.3 From 824e30be80c79d866ac444b4eed7f4df0cf154c1 Mon Sep 17 00:00:00 2001 From: gdisirio Date: Sat, 9 May 2009 13:06:30 +0000 Subject: Fixed bugs 2789377 and 2789383. git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@956 35acf78f-673a-0410-8e92-d51de3d6d3f4 --- test/test.c | 10 ++-- test/test.h | 6 ++- test/testdyn.c | 2 +- test/testevt.c | 2 +- test/testheap.c | 2 +- test/testmbox.c | 5 +- test/testmsg.c | 2 +- test/testmtx.c | 156 ++++++++++++++++++++++++++++++++++++++++++++++-------- test/testqueues.c | 2 +- test/testserial.c | 2 +- test/testthd.c | 6 +-- 11 files changed, 158 insertions(+), 37 deletions(-) (limited to 'test') diff --git a/test/test.c b/test/test.c index 02e56788a..aeb2b4058 100644 --- a/test/test.c +++ b/test/test.c @@ -145,6 +145,7 @@ bool_t _test_assert_sequence(unsigned point, char *expected) { } if (*expected) return _test_fail(point); + clear_tokens(); return FALSE; } @@ -174,16 +175,17 @@ void test_wait_threads(void) { } } -void test_cpu_pulse(unsigned ms) { +#if CH_DBG_THREADS_PROFILING +void test_cpu_pulse(unsigned duration) { - systime_t duration = MS2ST(ms); - systime_t start = chTimeNow(); - while (chTimeIsWithin(start, start + duration)) { + systime_t end = chThdSelf()->p_time + MS2ST(duration); + while (chThdSelf()->p_time < end) { #if defined(WIN32) ChkIntSources(); #endif } } +#endif systime_t test_wait_tick(void) { diff --git a/test/test.h b/test/test.h index c74610c95..761ee08b9 100644 --- a/test/test.h +++ b/test/test.h @@ -62,8 +62,10 @@ extern "C" { void test_terminate_threads(void); void test_wait_threads(void); systime_t test_wait_tick(void); - void test_cpu_pulse(unsigned ms); void test_start_timer(unsigned ms); +#if CH_DBG_THREADS_PROFILING + void test_cpu_pulse(unsigned duration); +#endif #if defined(WIN32) void ChkIntSources(void); #endif @@ -72,7 +74,7 @@ extern "C" { #endif #define test_fail(point) { \ - _test_fail(point); \ + _test_fail(point); \ return; \ } diff --git a/test/testdyn.c b/test/testdyn.c index 536bcadda..e881781f9 100644 --- a/test/testdyn.c +++ b/test/testdyn.c @@ -30,7 +30,7 @@ * *

Objective

* Objective of the test module is to cover 100% of the dynamic APIs code - * as a necessary step in order to assess their readyness. + * as a necessary step in order to assess their maturity. * *

Preconditions

* The module requires the following kernel options: diff --git a/test/testevt.c b/test/testevt.c index aa0a00da6..31f8870b0 100644 --- a/test/testevt.c +++ b/test/testevt.c @@ -29,7 +29,7 @@ * *

Objective

* Objective of the test module is to cover 100% of the @ref Events subsystem - * code as a necessary step in order to assess its readyness. + * code as a necessary step in order to assess its maturity level. * *

Preconditions

* The module requires the following kernel options: diff --git a/test/testheap.c b/test/testheap.c index a617c4b68..7c5b97918 100644 --- a/test/testheap.c +++ b/test/testheap.c @@ -29,7 +29,7 @@ * *

Objective

* Objective of the test module is to cover 100% of the @ref Heap subsystem - * code as a necessary step in order to assess its readyness. + * code as a necessary step in order to assess its maturity level. * *

Preconditions

* The module requires the following kernel options: diff --git a/test/testmbox.c b/test/testmbox.c index 2fe88b2b9..92897b1dc 100644 --- a/test/testmbox.c +++ b/test/testmbox.c @@ -29,7 +29,10 @@ * *

Objective

* Objective of the test module is to cover 100% of the @ref Mailboxes - * subsystem code as a necessary step in order to assess its readyness. + * subsystem code as a necessary step in order to assess its maturity + * level.
+ * Note that the @ref Mailboxes subsystem depends on the @ref Semaphores + * subsystem that has to met its testing objectives as well. * *

Preconditions

* The module requires the following kernel options: diff --git a/test/testmsg.c b/test/testmsg.c index 87ee64231..a44686ba6 100644 --- a/test/testmsg.c +++ b/test/testmsg.c @@ -29,7 +29,7 @@ * *

Objective

* Objective of the test module is to cover 100% of the @ref Messages - * subsystem code as a necessary step in order to assess its readyness. + * subsystem code as a necessary step in order to assess its maturity level. * *

Preconditions

* The module requires the following kernel options: diff --git a/test/testmtx.c b/test/testmtx.c index ddc32e7d5..59e18fa4e 100644 --- a/test/testmtx.c +++ b/test/testmtx.c @@ -21,6 +21,44 @@ #include "test.h" +/** + * @page test_mtx Mutexes test + * + *

Description

+ * This module implements the test sequence for the @ref Mutexes and + * @ref CondVars subsystems.
+ * Tests on those subsystems are particularly critical because the system-wide + * implications of the Priority Inheritance mechanism. + * + *

Objective

+ * Objective of the test module is to cover 100% of the subsystem code + * as a necessary step in order to assess their maturity level. + * + *

Preconditions

+ * The module requires the following kernel options: + * - @p CH_USE_MUTEXES + * - @p CH_USE_CONDVARS + * - @p CH_DBG_THREADS_PROFILING + * . + * In case some of the required options are not enabled then some or all tests + * may be skipped. + * + *

Test Cases

+ * - @subpage test_mtx_001 + * - @subpage test_mtx_002 + * - @subpage test_mtx_003 + * - @subpage test_mtx_004 + * - @subpage test_mtx_005 + * - @subpage test_mtx_006 + * - @subpage test_mtx_007 + * - @subpage test_mtx_008 + * . + * @file testmtx.c + * @brief @ref Mutexes and @ref CondVars test source file + * @file testmtx.h + * @brief @ref Mutexes and @ref CondVars test header file + */ + #if CH_USE_MUTEXES #define ALLOWED_DELAY 5 @@ -28,6 +66,15 @@ static Mutex m1, m2; static CondVar c1; +/** + * @page test_mtx_001 Priority enqueuing test + * + *

Description

+ * Five threads, with increasing priority, are enqueued on a locked mutex then + * the mutex is unlocked.
+ * The test expects the threads to perform their operations in increasing + * priority order regardless of the initial order. + */ static char *mtx1_gettest(void) { return "Mutexes, priority enqueuing test"; @@ -68,6 +115,38 @@ const struct testcase testmtx1 = { mtx1_execute }; +/** + * @page test_mtx_002 Priority inheritance, simple case + * + *

Description

+ * Three threads are involved in the classic priority inversion scenario, a + * medium priority thread tries to starve an high priority thread by + * blocking a low priority thread into a mutex lock zone.
+ * The test expects the threads to perform their operations in increasing + * priority order by rearranging their priorities in order to avoid the + * priority inversion trap. + * + *

Scenario

+ * This weird looking diagram should explain what happens in the test case: + * @code + * Time ----> 0 10 20 30 40 50 60 70 80 90 100 + * 0 ......AL++++++++++............2+++++++++++AU0---------------++++++G... + * 1 ..................++++++++++++------------------++++++++++++G......... + * 2 .............................AL..........++++++AUG................... + * ^ ^ + * + * Legend: + * 0..2 - Priority levels + * +++ - Running + * --- - Ready + * ... - Waiting + * AL - Lock operation on mutex A + * AUn - Unlock operation on mutex A with priority going to level 'n' + * G - Goal + * ^ - Priority transition (boost or return). + * @endcode + */ + static char *mtx2_gettest(void) { return "Mutexes, priority inheritance, simple case"; @@ -78,45 +157,48 @@ static void mtx2_setup(void) { chMtxInit(&m1); } -static msg_t thread2(void *p) { +/* Low priority thread */ +static msg_t thread2L(void *p) { - chThdSleepMilliseconds(10); chMtxLock(&m1); + test_cpu_pulse(40); chMtxUnlock(); - test_emit_token(*(char *)p); + test_cpu_pulse(10); + test_emit_token('C'); return 0; } -static msg_t thread3(void *p) { +/* Medium priority thread */ +static msg_t thread2M(void *p) { - chMtxLock(&m1); - chThdSleepMilliseconds(40); - chMtxUnlock(); - test_emit_token(*(char *)p); + chThdSleepMilliseconds(20); + test_cpu_pulse(40); + test_emit_token('B'); return 0; } -static msg_t thread4(void *p) { +/* High priority thread */ +static msg_t thread2H(void *p) { - chThdSleepMilliseconds(20); - test_cpu_pulse(50); - test_emit_token(*(char *)p); + chThdSleepMilliseconds(40); + chMtxLock(&m1); + test_cpu_pulse(10); + chMtxUnlock(); + test_emit_token('A'); return 0; } -/* - * Time - * 0 ++++++++++++++++++AL+....2++++++++++++++AU0------------------------------ - * 1 .....................++-------------------------------------------------- - * 2 .......................++AL.............+++++++++AU++++++++++++++++++++++ - */ static void mtx2_execute(void) { + systime_t time; - threads[0] = chThdCreateStatic(wa[0], WA_SIZE, chThdGetPriority()-1, thread2, "A"); - threads[1] = chThdCreateStatic(wa[1], WA_SIZE, chThdGetPriority()-3, thread3, "C"); - threads[2] = chThdCreateStatic(wa[2], WA_SIZE, chThdGetPriority()-2, thread4, "B"); + test_wait_tick(); + time = chTimeNow(); + threads[0] = chThdCreateStatic(wa[0], WA_SIZE, chThdGetPriority()-1, thread2H, 0); + threads[1] = chThdCreateStatic(wa[1], WA_SIZE, chThdGetPriority()-3, thread2L, 0); + threads[2] = chThdCreateStatic(wa[2], WA_SIZE, chThdGetPriority()-2, thread2M, 0); test_wait_threads(); test_assert_sequence(1, "ABC"); + test_assert_time_window(2, time + MS2ST(100), time + MS2ST(100) + ALLOWED_DELAY); } const struct testcase testmtx2 = { @@ -126,6 +208,38 @@ const struct testcase testmtx2 = { mtx2_execute }; +/** + * @page test_mtx_003 Priority inheritance, complex case + * + *

Description

+ * Five threads are involved in the complex priority inversion scenario, + * please refer to the diagram below for the complete scenario.
+ * The test expects the threads to perform their operations in increasing + * priority order by rearranging their priorities in order to avoid the + * priority inversion trap. + * + *

Scenario

+ * This weird looking diagram should explain what happens in the test case: + * @code + * Time ----> + * 0 10 20 30 40 50 + * 0 +++BL++------------------2++++------4+++++BU0-------------------------- + * 1 .......++AL++--2+++++++++BL.........4.....++++++++BU4++++AU1----------- + * 2 .............++AL............................................------++AU + * 3 ..............................++++-------------------------------++.... + * 4 ..................................++AL...................++++AU++...... + * ^ ^ + * + * Legend: + * 0..2 - Priority levels + * +++ - Running + * --- - Ready + * ... - Waiting + * AL - Lock operation on mutex A + * AUn - Unlock operation on mutex A with priority going to level 'n' + * ^ - Priority transition (boost or return). + * @endcode + */ static char *mtx3_gettest(void) { return "Mutexes, priority inheritance, complex case"; diff --git a/test/testqueues.c b/test/testqueues.c index af0ade6e6..be8d6fc62 100644 --- a/test/testqueues.c +++ b/test/testqueues.c @@ -32,7 +32,7 @@ * *

Objective

* Objective of the test module is to cover 100% of the @ref IOQueues code - * as a necessary step in order to assess its readyness.
+ * as a necessary step in order to assess its maturity level.
* Note that the @ref IOQueues subsystem depends on the @ref Semaphores * subsystem that has to met its testing objectives as well. * diff --git a/test/testserial.c b/test/testserial.c index 818d09e21..2da4b428b 100644 --- a/test/testserial.c +++ b/test/testserial.c @@ -32,7 +32,7 @@ * *

Objective

* Objective of the test module is to cover 100% of the @ref Serial code - * as a necessary step in order to assess its readyness.
+ * as a necessary step in order to assess its maturity level.
* Note that the @ref Serial subsystem depends on the @ref Semaphores and * @ref Events subsystems that have to met their testing objectives as well. * diff --git a/test/testthd.c b/test/testthd.c index daf3e2063..5ec9079d9 100644 --- a/test/testthd.c +++ b/test/testthd.c @@ -28,12 +28,12 @@ * This module implements the test sequence for the @ref Scheduler, * @ref Threads and @ref Time subsystems.
* Note that the tests on those subsystems are formally required but most of - * their functionality is already demostrated because the test suite itself - * depends on them, anyway doublecheck is good. + * their functionality is already demonstrated because the test suite itself + * depends on them, anyway double check is good. * *

Objective

* Objective of the test module is to cover 100% of the subsystems code - * as a necessary step in order to assess their readyness. + * as a necessary step in order to assess their maturity level. * *

Preconditions

* None. -- cgit v1.2.3 From f3ca042618b9b1f5fa877b68e89ec31fe66497eb Mon Sep 17 00:00:00 2001 From: gdisirio Date: Sat, 9 May 2009 14:42:26 +0000 Subject: Added more documentation to the test suite. git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@957 35acf78f-673a-0410-8e92-d51de3d6d3f4 --- test/testmtx.c | 168 +++++++++++++++++++++++++++++++++++------------------- test/testserial.c | 4 +- test/testthd.c | 4 +- 3 files changed, 112 insertions(+), 64 deletions(-) (limited to 'test') diff --git a/test/testmtx.c b/test/testmtx.c index 59e18fa4e..2665ac76d 100644 --- a/test/testmtx.c +++ b/test/testmtx.c @@ -54,9 +54,9 @@ * - @subpage test_mtx_008 * . * @file testmtx.c - * @brief @ref Mutexes and @ref CondVars test source file + * @brief Mutexes and CondVars test source file * @file testmtx.h - * @brief @ref Mutexes and @ref CondVars test header file + * @brief Mutexes and CondVars test header file */ #if CH_USE_MUTEXES @@ -115,6 +115,7 @@ const struct testcase testmtx1 = { mtx1_execute }; +#if CH_DBG_THREADS_PROFILING /** * @page test_mtx_002 Priority inheritance, simple case * @@ -122,9 +123,9 @@ const struct testcase testmtx1 = { * Three threads are involved in the classic priority inversion scenario, a * medium priority thread tries to starve an high priority thread by * blocking a low priority thread into a mutex lock zone.
- * The test expects the threads to perform their operations in increasing - * priority order by rearranging their priorities in order to avoid the - * priority inversion trap. + * The test expects the threads to reach their goal in increasing priority + * order by rearranging their priorities in order to avoid the priority + * inversion trap. * *

Scenario

* This weird looking diagram should explain what happens in the test case: @@ -134,14 +135,13 @@ const struct testcase testmtx1 = { * 1 ..................++++++++++++------------------++++++++++++G......... * 2 .............................AL..........++++++AUG................... * ^ ^ - * * Legend: * 0..2 - Priority levels * +++ - Running * --- - Ready * ... - Waiting - * AL - Lock operation on mutex A - * AUn - Unlock operation on mutex A with priority going to level 'n' + * xL - Lock operation on mutex 'x' + * xUn - Unlock operation on mutex 'x' with priority returning to level 'n' * G - Goal * ^ - Priority transition (boost or return). * @endcode @@ -194,8 +194,8 @@ static void mtx2_execute(void) { test_wait_tick(); time = chTimeNow(); threads[0] = chThdCreateStatic(wa[0], WA_SIZE, chThdGetPriority()-1, thread2H, 0); - threads[1] = chThdCreateStatic(wa[1], WA_SIZE, chThdGetPriority()-3, thread2L, 0); - threads[2] = chThdCreateStatic(wa[2], WA_SIZE, chThdGetPriority()-2, thread2M, 0); + threads[1] = chThdCreateStatic(wa[1], WA_SIZE, chThdGetPriority()-2, thread2M, 0); + threads[2] = chThdCreateStatic(wa[2], WA_SIZE, chThdGetPriority()-3, thread2L, 0); test_wait_threads(); test_assert_sequence(1, "ABC"); test_assert_time_window(2, time + MS2ST(100), time + MS2ST(100) + ALLOWED_DELAY); @@ -221,22 +221,20 @@ const struct testcase testmtx2 = { *

Scenario

* This weird looking diagram should explain what happens in the test case: * @code - * Time ----> - * 0 10 20 30 40 50 - * 0 +++BL++------------------2++++------4+++++BU0-------------------------- - * 1 .......++AL++--2+++++++++BL.........4.....++++++++BU4++++AU1----------- - * 2 .............++AL............................................------++AU - * 3 ..............................++++-------------------------------++.... - * 4 ..................................++AL...................++++AU++...... - * ^ ^ - * + * Time ----> 0 10 20 30 40 50 60 70 80 90 100 110 + * 0 ......BL++++------------2+++++------4+++++BU0---------------------------G..... + * 1 ............AL++++2+++++BL----------4-----++++++BU4+++AU1---------------G..... + * 2 ..................AL----------------------------------------------++++++AUG... + * 3 ..............................+++++++-----------------------++++++G........... + * 4 ....................................AL................++++++AUG............... + * ^ ^ ^ ^ ^ ^ * Legend: * 0..2 - Priority levels * +++ - Running * --- - Ready * ... - Waiting - * AL - Lock operation on mutex A - * AUn - Unlock operation on mutex A with priority going to level 'n' + * xL - Lock operation on mutex 'x' + * xUn - Unlock operation on mutex 'x' with priority returning to level 'n' * ^ - Priority transition (boost or return). * @endcode */ @@ -247,78 +245,79 @@ static char *mtx3_gettest(void) { static void mtx3_setup(void) { - chMtxInit(&m1); - chMtxInit(&m2); + chMtxInit(&m1); // Mutex B + chMtxInit(&m2); // Mutex A } -static msg_t thread5(void *p) { +/* Lowest priority thread */ +static msg_t thread3LL(void *p) { chMtxLock(&m1); - test_cpu_pulse(50); + test_cpu_pulse(30); chMtxUnlock(); - test_emit_token(*(char *)p); + test_emit_token('E'); return 0; } -static msg_t thread6(void *p) { +/* Low priority thread */ +static msg_t thread3L(void *p) { chThdSleepMilliseconds(10); chMtxLock(&m2); test_cpu_pulse(20); chMtxLock(&m1); - test_cpu_pulse(50); + test_cpu_pulse(10); chMtxUnlock(); - test_cpu_pulse(20); + test_cpu_pulse(10); chMtxUnlock(); - test_emit_token(*(char *)p); + test_emit_token('D'); return 0; } -static msg_t thread7(void *p) { +/* Medium priority thread */ +static msg_t thread3M(void *p) { chThdSleepMilliseconds(20); chMtxLock(&m2); - test_cpu_pulse(50); + test_cpu_pulse(10); chMtxUnlock(); - test_emit_token(*(char *)p); + test_emit_token('C'); return 0; } -static msg_t thread8(void *p) { +/* High priority thread */ +static msg_t thread3H(void *p) { chThdSleepMilliseconds(40); - test_cpu_pulse(200); - test_emit_token(*(char *)p); + test_cpu_pulse(20); + test_emit_token('B'); return 0; } -static msg_t thread9(void *p) { +/* Highest priority thread */ +static msg_t thread3HH(void *p) { chThdSleepMilliseconds(50); chMtxLock(&m2); - test_cpu_pulse(50); + test_cpu_pulse(10); chMtxUnlock(); - test_emit_token(*(char *)p); + test_emit_token('A'); return 0; } -/* - * Time 0 10 20 30 40 50 - * 0 +++BL++------------------2++++------4+++++BU0-------------------------- - * 1 .......++AL++--2+++++++++BL.........4.....++++++++BU4++++AU1----------- - * 2 .............++AL............................................------++AU - * 3 ..............................++++-------------------------------++.... - * 4 ..................................++AL...................++++AU++...... - */ static void mtx3_execute(void) { + systime_t time; - threads[0] = chThdCreateStatic(wa[0], WA_SIZE, chThdGetPriority()-5, thread5, "E"); - threads[1] = chThdCreateStatic(wa[1], WA_SIZE, chThdGetPriority()-4, thread6, "D"); - threads[2] = chThdCreateStatic(wa[2], WA_SIZE, chThdGetPriority()-3, thread7, "C"); - threads[3] = chThdCreateStatic(wa[3], WA_SIZE, chThdGetPriority()-2, thread8, "B"); - threads[4] = chThdCreateStatic(wa[4], WA_SIZE, chThdGetPriority()-1, thread9, "A"); + test_wait_tick(); + time = chTimeNow(); + threads[0] = chThdCreateStatic(wa[0], WA_SIZE, chThdGetPriority()-5, thread3LL, 0); + threads[1] = chThdCreateStatic(wa[1], WA_SIZE, chThdGetPriority()-4, thread3L, 0); + threads[2] = chThdCreateStatic(wa[2], WA_SIZE, chThdGetPriority()-3, thread3M, 0); + threads[3] = chThdCreateStatic(wa[3], WA_SIZE, chThdGetPriority()-2, thread3H, 0); + threads[4] = chThdCreateStatic(wa[4], WA_SIZE, chThdGetPriority()-1, thread3HH, 0); test_wait_threads(); test_assert_sequence(1, "ABCDE"); + test_assert_time_window(2, time + MS2ST(110), time + MS2ST(110) + ALLOWED_DELAY); } const struct testcase testmtx3 = { @@ -327,7 +326,17 @@ const struct testcase testmtx3 = { NULL, mtx3_execute }; +#endif /* CH_DBG_THREADS_PROFILING */ +/** + * @page test_mtx_004 Priority return verification + * + *

Description

+ * Two threads are spawned that try to lock the mutexes locked by the tester + * thread with precise timing.
+ * The test expects that the priority changes caused by the priority + * inheritance algorithm happen at the right moment and with the right values. + */ static char *mtx4_gettest(void) { return "Mutexes, priority return"; @@ -339,7 +348,7 @@ static void mtx4_setup(void) { chMtxInit(&m2); } -static msg_t thread13(void *p) { +static msg_t thread4a(void *p) { chThdSleepMilliseconds(50); chMtxLock(&m2); @@ -347,7 +356,7 @@ static msg_t thread13(void *p) { return 0; } -static msg_t thread14(void *p) { +static msg_t thread4b(void *p) { chThdSleepMilliseconds(150); chMtxLock(&m1); @@ -361,8 +370,8 @@ static void mtx4_execute(void) { p = chThdGetPriority(); p1 = p + 1; p2 = p + 2; - threads[0] = chThdCreateStatic(wa[0], WA_SIZE, p1, thread13, "B"); - threads[1] = chThdCreateStatic(wa[1], WA_SIZE, p2, thread14, "A"); + threads[0] = chThdCreateStatic(wa[0], WA_SIZE, p1, thread4a, "B"); + threads[1] = chThdCreateStatic(wa[1], WA_SIZE, p2, thread4b, "A"); chMtxLock(&m2); test_assert(1, chThdGetPriority() == p, "wrong priority level"); chThdSleepMilliseconds(100); @@ -380,8 +389,8 @@ static void mtx4_execute(void) { test_wait_threads(); /* Test repeated in order to cover chMtxUnlockS().*/ - threads[0] = chThdCreateStatic(wa[0], WA_SIZE, p1, thread13, "D"); - threads[1] = chThdCreateStatic(wa[1], WA_SIZE, p2, thread14, "C"); + threads[0] = chThdCreateStatic(wa[0], WA_SIZE, p1, thread4a, "D"); + threads[1] = chThdCreateStatic(wa[1], WA_SIZE, p2, thread4b, "C"); chMtxLock(&m2); test_assert(8, chThdGetPriority() == p, "wrong priority level"); chThdSleepMilliseconds(100); @@ -408,9 +417,18 @@ const struct testcase testmtx4 = { mtx4_execute }; +/** + * @page test_mtx_005 Mutex status + * + *

Description

+ * Various tests on the mutex structure status after performing some lock and + * unlock operations.
+ * The test expects that the internal mutex status is consistent after each + * operation. + */ static char *mtx5_gettest(void) { - return "Mutexes, coverage"; + return "Mutexes, status"; } static void mtx5_setup(void) { @@ -447,6 +465,16 @@ const struct testcase testmtx5 = { }; #if CH_USE_CONDVARS +/** + * @page test_mtx_006 Signal test + * + *

Description

+ * Five threads take a mutex and then enter a conditional variable queue, the + * tester thread then proceeds to signal the conditional variable five times + * atomically.
+ * The test expects the threads to reach their goal in increasing priority + * order regardless of the initial order. + */ static char *mtx6_gettest(void) { return "CondVar, signal test"; @@ -494,6 +522,15 @@ const struct testcase testmtx6 = { mtx6_execute }; +/** + * @page test_mtx_007 Broadcast test + * + *

Description

+ * Five threads take a mutex and then enter a conditional variable queue, the + * tester thread then proceeds to broadcast the conditional variable.
+ * The test expects the threads to reach their goal in increasing priority + * order regardless of the initial order. + */ static char *mtx7_gettest(void) { return "CondVar, broadcast test"; @@ -526,9 +563,18 @@ const struct testcase testmtx7 = { mtx7_execute }; +/** + * @page test_mtx_008 Priority Inheritance boost test + * + *

Description

+ * Five threads take a mutex and then enter a conditional variable queue, the + * tester thread then proceeds to broadcast the conditional variable.
+ * The test expects the threads to reach their goal in increasing priority + * order regardless of the initial order. + */ static char *mtx8_gettest(void) { - return "CondVar, inheritance boost test"; + return "CondVar, boost test"; } static void mtx8_setup(void) { @@ -588,8 +634,10 @@ const struct testcase testmtx8 = { const struct testcase * const patternmtx[] = { #if CH_USE_MUTEXES &testmtx1, +#if CH_DBG_THREADS_PROFILING &testmtx2, &testmtx3, +#endif &testmtx4, &testmtx5, #if CH_USE_CONDVARS diff --git a/test/testserial.c b/test/testserial.c index 2da4b428b..19d7265ab 100644 --- a/test/testserial.c +++ b/test/testserial.c @@ -44,9 +44,9 @@ * may be skipped. * * @file testserial.c - * @brief Kernel Serial Driver test source file + * @brief Serial Driver test source file * @file testserial.h - * @brief Kernel Serial Driver test header file + * @brief Serial Driver test header file */ #if CH_USE_SERIAL_FULLDUPLEX diff --git a/test/testthd.c b/test/testthd.c index 5ec9079d9..2758e5223 100644 --- a/test/testthd.c +++ b/test/testthd.c @@ -45,9 +45,9 @@ * - @subpage test_threads_004 * . * @file testthd.c - * @brief Threads and @ref Scheduler test source file + * @brief Threads and Scheduler test source file * @file testthd.h - * @brief Threads and @ref Scheduler test header file + * @brief Threads and Scheduler test header file */ /** -- cgit v1.2.3 From f0302498b7a67c59d224acc6e57627989f2dd51c Mon Sep 17 00:00:00 2001 From: gdisirio Date: Sat, 9 May 2009 14:55:18 +0000 Subject: Fixed bug 2789383. git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@959 35acf78f-673a-0410-8e92-d51de3d6d3f4 --- test/testmtx.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) (limited to 'test') diff --git a/test/testmtx.c b/test/testmtx.c index 2665ac76d..72865e7f8 100644 --- a/test/testmtx.c +++ b/test/testmtx.c @@ -567,10 +567,9 @@ const struct testcase testmtx7 = { * @page test_mtx_008 Priority Inheritance boost test * *

Description

- * Five threads take a mutex and then enter a conditional variable queue, the - * tester thread then proceeds to broadcast the conditional variable.
- * The test expects the threads to reach their goal in increasing priority - * order regardless of the initial order. + * This test case verifies the priority boost of a thread waiting on a + * conditional variable queue. It tests this very specific situation in order + * to complete the code coverage. */ static char *mtx8_gettest(void) { -- cgit v1.2.3 From a6feec221cd3050e0f2d56950abd39677790d79f Mon Sep 17 00:00:00 2001 From: gdisirio Date: Sat, 9 May 2009 16:05:41 +0000 Subject: Removed the CH_USE_SEMAPHORES_TIMEOUT configuration option. git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@962 35acf78f-673a-0410-8e92-d51de3d6d3f4 --- test/coverage/chconf.h | 10 ---------- test/testmbox.c | 7 +++---- test/testqueues.c | 4 ---- test/testsem.c | 4 ---- 4 files changed, 3 insertions(+), 22 deletions(-) (limited to 'test') diff --git a/test/coverage/chconf.h b/test/coverage/chconf.h index e739fa365..88528e834 100644 --- a/test/coverage/chconf.h +++ b/test/coverage/chconf.h @@ -153,16 +153,6 @@ #define CH_USE_SEMSW TRUE #endif -/** - * If specified then the Semaphores with timeout APIs are included in the - * kernel. - * @note The default is @p TRUE. - * @note Requires @p CH_USE_SEMAPHORES. - */ -#if !defined(CH_USE_SEMAPHORES_TIMEOUT) || defined(__DOXYGEN__) -#define CH_USE_SEMAPHORES_TIMEOUT TRUE -#endif - /** * If specified then the Mutexes APIs are included in the kernel. * @note The default is @p TRUE. diff --git a/test/testmbox.c b/test/testmbox.c index 92897b1dc..2403afce6 100644 --- a/test/testmbox.c +++ b/test/testmbox.c @@ -37,7 +37,6 @@ *

Preconditions

* The module requires the following kernel options: * - @p CH_USE_MAILBOXES - * - @p CH_USE_SEMAPHORES_TIMEOUT * . * In case some of the required options are not enabled then some or all tests * may be skipped. @@ -51,7 +50,7 @@ * @brief Mailboxes header file */ -#if CH_USE_MAILBOXES && CH_USE_SEMAPHORES_TIMEOUT +#if CH_USE_MAILBOXES #define ALLOWED_DELAY MS2ST(5) #define MB_SIZE 5 @@ -164,13 +163,13 @@ const struct testcase testmbox1 = { mbox1_execute }; -#endif /* CH_USE_MAILBOXES && CH_USE_SEMAPHORES_TIMEOUT */ +#endif /* CH_USE_MAILBOXES */ /* * Test sequence for mailboxes pattern. */ const struct testcase * const patternmbox[] = { -#if CH_USE_MAILBOXES && CH_USE_SEMAPHORES_TIMEOUT +#if CH_USE_MAILBOXES &testmbox1, #endif NULL diff --git a/test/testqueues.c b/test/testqueues.c index be8d6fc62..6c460becf 100644 --- a/test/testqueues.c +++ b/test/testqueues.c @@ -108,10 +108,8 @@ static void queues1_execute(void) { chIQResetI(&iq); test_assert(8, chIQIsEmpty(&iq), "still full"); -#if CH_USE_SEMAPHORES_TIMEOUT /* Timeout */ test_assert(9, chIQGetTimeout(&iq, 10) == Q_TIMEOUT, "wrong timeout return"); -#endif } const struct testcase testqueues1 = { @@ -165,13 +163,11 @@ static void queues2_execute(void) { chOQResetI(&oq); test_assert(8, chOQIsEmpty(&oq), "still full"); -#if CH_USE_SEMAPHORES_TIMEOUT /* Timeout */ for (i = 0; i < TEST_QUEUES_SIZE; i++) chOQPut(&oq, 'A' + i); test_assert(9, chOQIsFull(&oq), "still has space"); test_assert(10, chOQPutTimeout(&oq, 0, 10) == Q_TIMEOUT, "wrong timeout return"); -#endif } const struct testcase testqueues2 = { diff --git a/test/testsem.c b/test/testsem.c index a0f94dcb0..9471de643 100644 --- a/test/testsem.c +++ b/test/testsem.c @@ -71,7 +71,6 @@ const struct testcase testsem1 = { sem1_execute }; -#if CH_USE_SEMAPHORES_TIMEOUT static char *sem2_gettest(void) { return "Semaphores, timeout test"; @@ -138,7 +137,6 @@ const struct testcase testsem2 = { NULL, sem2_execute }; -#endif /* CH_USE_SEMAPHORES_TIMEOUT */ #if CH_USE_SEMSW static char *sem3_gettest(void) { @@ -185,9 +183,7 @@ const struct testcase testsem3 = { const struct testcase * const patternsem[] = { #if CH_USE_SEMAPHORES &testsem1, -#if CH_USE_SEMAPHORES_TIMEOUT &testsem2, -#endif #if CH_USE_SEMSW &testsem3, #endif -- cgit v1.2.3 From 83d50f08219d05f65b55f686e74e5cb4e7352092 Mon Sep 17 00:00:00 2001 From: gdisirio Date: Sat, 9 May 2009 16:46:49 +0000 Subject: Finished adding tests documentation to the general documentation. git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@963 35acf78f-673a-0410-8e92-d51de3d6d3f4 --- test/testmtx.c | 6 ++--- test/testpools.c | 37 +++++++++++++++++++++++++++++- test/testsem.c | 68 +++++++++++++++++++++++++++++++++++++++++++++++++++---- test/testserial.c | 2 +- 4 files changed, 104 insertions(+), 9 deletions(-) (limited to 'test') diff --git a/test/testmtx.c b/test/testmtx.c index 72865e7f8..9ecf62f30 100644 --- a/test/testmtx.c +++ b/test/testmtx.c @@ -466,7 +466,7 @@ const struct testcase testmtx5 = { #if CH_USE_CONDVARS /** - * @page test_mtx_006 Signal test + * @page test_mtx_006 Condition Variable signal test * *

Description

* Five threads take a mutex and then enter a conditional variable queue, the @@ -523,7 +523,7 @@ const struct testcase testmtx6 = { }; /** - * @page test_mtx_007 Broadcast test + * @page test_mtx_007 Condition Variable broadcast test * *

Description

* Five threads take a mutex and then enter a conditional variable queue, the @@ -564,7 +564,7 @@ const struct testcase testmtx7 = { }; /** - * @page test_mtx_008 Priority Inheritance boost test + * @page test_mtx_008 Condition Variable priority boost test * *

Description

* This test case verifies the priority boost of a thread waiting on a diff --git a/test/testpools.c b/test/testpools.c index abf63d700..78f19a91c 100644 --- a/test/testpools.c +++ b/test/testpools.c @@ -21,13 +21,48 @@ #include "test.h" +/** + * @page test_pools Memory Pools test + * + *

Description

+ * This module implements the test sequence for the @ref MemoryPools subsystem. + * + *

Objective

+ * Objective of the test module is to cover 100% of the @ref MemoryPools + * code as a necessary step in order to assess its maturity level.
+ * + *

Preconditions

+ * The module requires the following kernel options: + * - @p CH_USE_MEMPOOLS + * . + * In case some of the required options are not enabled then some or all tests + * may be skipped. + * + *

Test Cases

+ * - @subpage test_pools_001 + * . + * @file testpools.c + * @brief Memory Pools test source file + * @file testpools.h + * @brief Memory Pools test header file + */ + #if CH_USE_MEMPOOLS static MemoryPool mp1; +/** + * @page test_pools_001 Allocation and enqueuing test + * + *

Description

+ * Five memory blocks are added to a memory pool then removed.
+ * The test expects to find the pool queue in the proper status after each + * operation. + */ + static char *pools1_gettest(void) { - return "Memory Pools, allocation and enqueuing test"; + return "Memory Pools, queue/dequeue"; } static void pools1_setup(void) { diff --git a/test/testsem.c b/test/testsem.c index 9471de643..7cb103789 100644 --- a/test/testsem.c +++ b/test/testsem.c @@ -21,15 +21,53 @@ #include "test.h" +/** + * @page test_sem Semaphores test + * + *

Description

+ * This module implements the test sequence for the @ref Semaphores subsystem. + * + *

Objective

+ * Objective of the test module is to cover 100% of the @ref Semaphores + * code as a necessary step in order to assess its maturity level.
+ * + *

Preconditions

+ * The module requires the following kernel options: + * - @p CH_USE_SEMAPHORES + * . + * In case some of the required options are not enabled then some or all tests + * may be skipped. + * + *

Test Cases

+ * - @subpage test_sem_001 + * - @subpage test_sem_002 + * - @subpage test_sem_003 + * . + * @file testsem.c + * @brief Semaphores test source file + * @file testsem.h + * @brief Semaphores test header file + */ + #if CH_USE_SEMAPHORES #define ALLOWED_DELAY MS2ST(5) static Semaphore sem1; +/** + * @page test_sem_001 Enqueuing test + * + *

Description

+ * Five threads with randomized priorities are enqueued to a semaphore then + * awakened one at time.
+ * The test expects that the threads reach their goal in FIFO order or + * priority order depending on the CH_USE_SEMAPHORES_PRIORITY configuration + * setting. + */ static char *sem1_gettest(void) { - return "Semaphores, enqueuing test"; + return "Semaphores, enqueuing"; } static void sem1_setup(void) { @@ -64,6 +102,16 @@ static void sem1_execute(void) { #endif } +/** + * @page test_sem_002 Timeout test + * + *

Description

+ * The three possible semaphore waiting modes (do not wait, wait with timeout, + * wait without timeout) are explored.
+ * The test expects that the semaphore wait function returns the correct value + * in each of the above scenario and that the semaphore structure status is + * correct after each operation. + */ const struct testcase testsem1 = { sem1_gettest, sem1_setup, @@ -73,7 +121,7 @@ const struct testcase testsem1 = { static char *sem2_gettest(void) { - return "Semaphores, timeout test"; + return "Semaphores, timeout"; } static void sem2_setup(void) { @@ -108,7 +156,7 @@ static void sem2_execute(void) { * Testing not timeout condition. */ threads[0] = chThdCreateStatic(wa[0], WA_SIZE, chThdGetPriority() - 1, - thread2, "A"); + thread2, 0); msg = chSemWaitTimeout(&sem1, MS2ST(500)); test_wait_threads(); test_assert(4, msg == RDY_OK, "wrong wake-up message"); @@ -139,6 +187,18 @@ const struct testcase testsem2 = { }; #if CH_USE_SEMSW +/** + * @page test_sem_003 Atomic signal-wait test + * + *

Description

+ * This test case explicitly address the @p chSemWaitSignal() function. A + * thread is created that performs a wait and a signal operations. + * The tester thread is awakened from an atomic wait/signal operation.
+ * The test expects that the semaphore wait function returns the correct value + * in each of the above scenario and that the semaphore structure status is + * correct after each operation. + */ + static char *sem3_gettest(void) { return "Semaphores, atomic signal-wait"; @@ -158,7 +218,7 @@ static msg_t thread3(void *p) { static void sem3_execute(void) { - threads[0] = chThdCreateStatic(wa[0], WA_SIZE, chThdGetPriority()+1, thread3, "A"); + threads[0] = chThdCreateStatic(wa[0], WA_SIZE, chThdGetPriority()+1, thread3, 0); chSemSignalWait(&sem1, &sem1); test_assert(1, isempty(&sem1.s_queue), "queue not empty"); test_assert(2, sem1.s_cnt == 0, "counter not zero"); diff --git a/test/testserial.c b/test/testserial.c index 19d7265ab..84db657ec 100644 --- a/test/testserial.c +++ b/test/testserial.c @@ -38,7 +38,7 @@ * *

Preconditions

* The module requires the following kernel options: - * - @p CH_USE_SERIAL_FULLDUPLEX (and dependent options) + * - @p CH_USE_SERIAL_FULLDUPLEX * . * In case some of the required options are not enabled then some or all tests * may be skipped. -- cgit v1.2.3 From 6d3145c04b2f6be505c44589fdb8ecbe952b4b85 Mon Sep 17 00:00:00 2001 From: gdisirio Date: Sat, 9 May 2009 19:36:30 +0000 Subject: Fixed more troubles with test_cpu_pulse(). git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@964 35acf78f-673a-0410-8e92-d51de3d6d3f4 --- test/test.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) (limited to 'test') diff --git a/test/test.c b/test/test.c index aeb2b4058..7d4e3f2b0 100644 --- a/test/test.c +++ b/test/test.c @@ -177,13 +177,18 @@ void test_wait_threads(void) { #if CH_DBG_THREADS_PROFILING void test_cpu_pulse(unsigned duration) { + systime_t start, end, now; - systime_t end = chThdSelf()->p_time + MS2ST(duration); - while (chThdSelf()->p_time < end) { + start = chThdSelf()->p_time; + end = start + MS2ST(duration); + do { + now = chThdSelf()->p_time; #if defined(WIN32) ChkIntSources(); #endif } + while (end > start ? (now >= start) && (now < end) : + (now >= start) || (now < end)); } #endif -- cgit v1.2.3 From 8650eff40037843143da80e56db72dd60e0e0de1 Mon Sep 17 00:00:00 2001 From: gdisirio Date: Sat, 9 May 2009 20:03:19 +0000 Subject: git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@967 35acf78f-673a-0410-8e92-d51de3d6d3f4 --- test/testbmk.c | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) (limited to 'test') diff --git a/test/testbmk.c b/test/testbmk.c index 3c82c5e0d..151088b6b 100644 --- a/test/testbmk.c +++ b/test/testbmk.c @@ -98,7 +98,7 @@ static unsigned int msg_loop_test(Thread *tp) { static char *bmk1_gettest(void) { - return "Benchmark, messages, immediate wakeup"; + return "Benchmark, messages throughput"; } static void bmk1_execute(void) { @@ -133,7 +133,7 @@ const struct testcase testbmk1 = { static char *bmk2_gettest(void) { - return "Benchmark, messages, late wakeup"; + return "Benchmark, messages, empty RL"; } static void bmk2_execute(void) { @@ -174,7 +174,7 @@ static msg_t thread2(void *p) { static char *bmk3_gettest(void) { - return "Benchmark, messages, 4 threads in ready list"; + return "Benchmark, messages, 4 in RL"; } static void bmk3_execute(void) { @@ -255,9 +255,7 @@ static void bmk4_execute(void) { test_wait_threads(); test_print("--- Score : "); - test_printn(n); - test_print(" msgs/S, "); - test_printn(n << 1); + test_printn(n * 2); test_println(" ctxswc/S"); } -- cgit v1.2.3 From 04faaf563c8c86f21ccfe85690ed6de33070e9fb Mon Sep 17 00:00:00 2001 From: gdisirio Date: Sat, 9 May 2009 20:06:52 +0000 Subject: git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@968 35acf78f-673a-0410-8e92-d51de3d6d3f4 --- test/testbmk.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'test') diff --git a/test/testbmk.c b/test/testbmk.c index 151088b6b..cb6ce9da7 100644 --- a/test/testbmk.c +++ b/test/testbmk.c @@ -98,7 +98,7 @@ static unsigned int msg_loop_test(Thread *tp) { static char *bmk1_gettest(void) { - return "Benchmark, messages throughput"; + return "Benchmark, messages #1"; } static void bmk1_execute(void) { @@ -133,7 +133,7 @@ const struct testcase testbmk1 = { static char *bmk2_gettest(void) { - return "Benchmark, messages, empty RL"; + return "Benchmark, messages #2"; } static void bmk2_execute(void) { @@ -174,7 +174,7 @@ static msg_t thread2(void *p) { static char *bmk3_gettest(void) { - return "Benchmark, messages, 4 in RL"; + return "Benchmark, messages #3"; } static void bmk3_execute(void) { -- cgit v1.2.3 From 1c3d2376a653b643d40b09ba0298e0420e0e3140 Mon Sep 17 00:00:00 2001 From: gdisirio Date: Fri, 15 May 2009 14:20:14 +0000 Subject: git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@971 35acf78f-673a-0410-8e92-d51de3d6d3f4 --- test/testserial.c | 101 +++++++++++++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 100 insertions(+), 1 deletion(-) (limited to 'test') diff --git a/test/testserial.c b/test/testserial.c index 84db657ec..3144f81eb 100644 --- a/test/testserial.c +++ b/test/testserial.c @@ -51,6 +51,105 @@ #if CH_USE_SERIAL_FULLDUPLEX +#define TEST_QUEUES_SIZE 8 + +static FullDuplexDriver fdd; + +/* Loopback thread, it simulates a low level driver. The thread terminates by + sending a zero through the loopback driver.*/ +static msg_t thread1(void *p) { + + while (TRUE) { + chEvtWaitAny(1); + chSysLock(); + while (TRUE) { + msg_t b = chFDDRequestDataI(&fdd); + if (b < Q_OK) + break; + if (b == 0) { + chSchRescheduleS(); + chSysUnlock(); + return 0; + } + chFDDIncomingDataI(&fdd, (uint8_t)b); + chSchRescheduleS(); + } + chSysUnlock(); + } +} + +static void infy(void) {} + +static void onfy(void) { + + chEvtSignalI(threads[0], 1); + chSchRescheduleS(); +} + +/** + * @page test_serial_001 Loopback test + * + *

Description

+ * A sequence of characters are sent to the loopback driver and read back. The + * test is performed twice using both the direct APIs and the channels API + * implementations.
+ * The test expects to read all the characters back and in the correct + * sequence. + */ + +static char *serial1_gettest(void) { + + return "Serial driver, loopback"; +} + +static void serial1_setup(void) { + + chFDDInit(&fdd, wa[3], 8, infy, wa[4], 8, onfy); +} + +static void serial1_execute(void) { + unsigned i; + msg_t b; + + /* Loopback test using the direct APIs.*/ + threads[0] = chThdCreateStatic(wa[0], WA_SIZE, chThdGetPriority() + 1, + thread1, 0); + for (i = 0; i < 4; i++) { + chFDDPut(&fdd, 'A' + i); + b = chFDDGetTimeout(&fdd, S2ST(1)); + if (b < Q_OK) + break; + test_emit_token(b); + } + chFDDPut(&fdd, 0); + test_assert_sequence(1, "ABCD"); + test_assert(2, chFDDPutWouldBlock(&fdd) == FALSE, "output would block"); + test_assert(3, chFDDGetWouldBlock(&fdd) == TRUE, "input would not block"); + test_wait_threads(); + + /* Loopback test using the channel APIs.*/ + threads[0] = chThdCreateStatic(wa[0], WA_SIZE, chThdGetPriority() + 1, + thread1, 0); + for (i = 0; i < 4; i++) { + chIOPut(&fdd, 'A' + i); + b = chIOGetTimeout(&fdd, S2ST(1)); + if (b < Q_OK) + break; + test_emit_token(b); + } + chIOPut(&fdd, 0); + test_assert_sequence(4, "ABCD"); + test_assert(5, chIOPutWouldBlock(&fdd) == FALSE, "output would block"); + test_assert(6, chIOGetWouldBlock(&fdd) == TRUE, "input would not block"); + test_wait_threads(); +} + +const struct testcase testserial1 = { + serial1_gettest, + serial1_setup, + NULL, + serial1_execute +}; #endif /* CH_USE_SERIAL_FULLDUPLEX */ /* @@ -58,7 +157,7 @@ */ const struct testcase * const patternserial[] = { #if CH_USE_SERIAL_FULLDUPLEX -// &testserial1, + &testserial1, #endif NULL }; -- cgit v1.2.3 From ee8d2845c643af5f1e8baa2104e6b1b4a4ddd25f Mon Sep 17 00:00:00 2001 From: gdisirio Date: Sat, 16 May 2009 06:15:21 +0000 Subject: Doc.fix. git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@972 35acf78f-673a-0410-8e92-d51de3d6d3f4 --- test/testserial.c | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'test') diff --git a/test/testserial.c b/test/testserial.c index 3144f81eb..11fd7f634 100644 --- a/test/testserial.c +++ b/test/testserial.c @@ -43,6 +43,10 @@ * In case some of the required options are not enabled then some or all tests * may be skipped. * + * + *

Test Cases

+ * - @subpage test_serial_001 + * . * @file testserial.c * @brief Serial Driver test source file * @file testserial.h -- cgit v1.2.3 From ff73cf2783b99f190d72010d04114a77f5a8d90a Mon Sep 17 00:00:00 2001 From: gdisirio Date: Sat, 16 May 2009 07:52:12 +0000 Subject: 100% code coverage for the serial driver and channels. git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@973 35acf78f-673a-0410-8e92-d51de3d6d3f4 --- test/testdyn.c | 2 +- test/testmtx.c | 6 ++-- test/testserial.c | 102 +++++++++++++++++++++++++++++++++++++++++++++++------- 3 files changed, 94 insertions(+), 16 deletions(-) (limited to 'test') diff --git a/test/testdyn.c b/test/testdyn.c index e881781f9..a7c685623 100644 --- a/test/testdyn.c +++ b/test/testdyn.c @@ -22,7 +22,7 @@ #include "test.h" /** - * @page test_dynamic Dynamic Thread APIs test + * @page test_dynamic Dynamic APIs test * *

Description

* This module implements the test sequence for the dynamic thread creation diff --git a/test/testmtx.c b/test/testmtx.c index 9ecf62f30..030b8ab87 100644 --- a/test/testmtx.c +++ b/test/testmtx.c @@ -139,7 +139,7 @@ const struct testcase testmtx1 = { * 0..2 - Priority levels * +++ - Running * --- - Ready - * ... - Waiting + * ... - Waiting or Terminated * xL - Lock operation on mutex 'x' * xUn - Unlock operation on mutex 'x' with priority returning to level 'n' * G - Goal @@ -229,10 +229,10 @@ const struct testcase testmtx2 = { * 4 ....................................AL................++++++AUG............... * ^ ^ ^ ^ ^ ^ * Legend: - * 0..2 - Priority levels + * 0..4 - Priority levels * +++ - Running * --- - Ready - * ... - Waiting + * ... - Waiting or Terminated * xL - Lock operation on mutex 'x' * xUn - Unlock operation on mutex 'x' with priority returning to level 'n' * ^ - Priority transition (boost or return). diff --git a/test/testserial.c b/test/testserial.c index 11fd7f634..fe92ebe2b 100644 --- a/test/testserial.c +++ b/test/testserial.c @@ -28,7 +28,8 @@ * This module implements the test sequence for the @ref Serial subsystem. * The tests are performed on a loopback software serial driver where a * dedicated thread echoes back in the input queue the data read from the - * output queue at a fixed rate. + * output queue at a fixed rate. The test module also tests implicitly the + * channels code. * *

Objective

* Objective of the test module is to cover 100% of the @ref Serial code @@ -46,6 +47,7 @@ * *

Test Cases

* - @subpage test_serial_001 + * - @subpage test_serial_002 * . * @file testserial.c * @brief Serial Driver test source file @@ -91,7 +93,7 @@ static void onfy(void) { } /** - * @page test_serial_001 Loopback test + * @page test_serial_001 Synchronous loopback test * *

Description

* A sequence of characters are sent to the loopback driver and read back. The @@ -103,12 +105,22 @@ static void onfy(void) { static char *serial1_gettest(void) { - return "Serial driver, loopback"; + return "Serial driver, synchronous"; } static void serial1_setup(void) { + /* Initializes the loopback driver.*/ chFDDInit(&fdd, wa[3], 8, infy, wa[4], 8, onfy); + /* Starts the loopback thread.*/ + threads[0] = chThdCreateStatic(wa[0], WA_SIZE, chThdGetPriority() + 1, + thread1, 0); +} + +static void serial1_teardown(void) { + + /* Terminates the loopback thread.*/ + chFDDPut(&fdd, 0); } static void serial1_execute(void) { @@ -116,8 +128,6 @@ static void serial1_execute(void) { msg_t b; /* Loopback test using the direct APIs.*/ - threads[0] = chThdCreateStatic(wa[0], WA_SIZE, chThdGetPriority() + 1, - thread1, 0); for (i = 0; i < 4; i++) { chFDDPut(&fdd, 'A' + i); b = chFDDGetTimeout(&fdd, S2ST(1)); @@ -125,15 +135,11 @@ static void serial1_execute(void) { break; test_emit_token(b); } - chFDDPut(&fdd, 0); test_assert_sequence(1, "ABCD"); test_assert(2, chFDDPutWouldBlock(&fdd) == FALSE, "output would block"); test_assert(3, chFDDGetWouldBlock(&fdd) == TRUE, "input would not block"); - test_wait_threads(); /* Loopback test using the channel APIs.*/ - threads[0] = chThdCreateStatic(wa[0], WA_SIZE, chThdGetPriority() + 1, - thread1, 0); for (i = 0; i < 4; i++) { chIOPut(&fdd, 'A' + i); b = chIOGetTimeout(&fdd, S2ST(1)); @@ -141,19 +147,90 @@ static void serial1_execute(void) { break; test_emit_token(b); } - chIOPut(&fdd, 0); test_assert_sequence(4, "ABCD"); test_assert(5, chIOPutWouldBlock(&fdd) == FALSE, "output would block"); test_assert(6, chIOGetWouldBlock(&fdd) == TRUE, "input would not block"); - test_wait_threads(); } const struct testcase testserial1 = { serial1_gettest, serial1_setup, - NULL, + serial1_teardown, serial1_execute }; + +/** + * @page test_serial_002 Asynchronous loopback test + * + *

Description

+ * A sequence of characters are sent to the loopback driver using the + * asynchronous APIs and then read back. The test is performed twice using + * both the direct APIs and the channels API. An input queue overflow test + * is performed too.
+ * The test expects that the queues are filled and emptied as expected and that + * the overflow error condition is reported when expected. + */ + +static char *serial2_gettest(void) { + + return "Serial driver, asynchronous"; +} + +static void serial2_setup(void) { + + /* Initializes the loopback driver.*/ + chFDDInit(&fdd, wa[3], 8, infy, wa[4], 8, onfy); + /* Starts the loopback thread.*/ + threads[0] = chThdCreateStatic(wa[0], WA_SIZE, chThdGetPriority() + 1, + thread1, 0); +} + +static void serial2_teardown(void) { + + /* Terminates the loopback thread.*/ + chFDDPut(&fdd, 0); +} + +static void serial2_execute(void) { + size_t n; + dflags_t flags; + + /* Asynchronous test using the direct APIs.*/ + n = chFDDWrite(&fdd, "ABCDEFGH", TEST_QUEUES_SIZE); + test_assert(1, n == TEST_QUEUES_SIZE, "unexpected write condition"); + n = chFDDRead(&fdd, wa[1], TEST_QUEUES_SIZE); + test_assert(2, n == TEST_QUEUES_SIZE, "unexpected read condition"); + test_assert(2, chFDDPutWouldBlock(&fdd) == FALSE, "output would block"); + test_assert(3, chFDDGetWouldBlock(&fdd) == TRUE, "input would not block"); + flags = chFDDGetAndClearFlags(&fdd); + test_assert(4, flags == 0, "unexpected error condition"); + + /* Input overflow testing.*/ + n = chFDDWrite(&fdd, "ABCDEFGH", TEST_QUEUES_SIZE); + test_assert(5, n == TEST_QUEUES_SIZE, "unexpected write condition"); + /* The following operation will fail to loopback because the input queue + * is full.*/ + chFDDPut(&fdd, 'Z'); + flags = chFDDGetAndClearFlags(&fdd); + test_assert(6, flags == SD_OVERRUN_ERROR, "unexpected error condition"); + n = chFDDRead(&fdd, wa[1], TEST_QUEUES_SIZE); + test_assert(7, n == TEST_QUEUES_SIZE, "unexpected read condition"); + + /* Asynchronous test using the channel APIs.*/ + n = chIOWrite(&fdd, "ABCDEFGH", TEST_QUEUES_SIZE); + test_assert(8, n == TEST_QUEUES_SIZE, "unexpected write condition"); + n = chIORead(&fdd, wa[1], TEST_QUEUES_SIZE); + test_assert(9, n == TEST_QUEUES_SIZE, "unexpected read condition"); + test_assert(10, chIOPutWouldBlock(&fdd) == FALSE, "output would block"); + test_assert(11, chIOGetWouldBlock(&fdd) == TRUE, "input would not block"); +} + +const struct testcase testserial2 = { + serial2_gettest, + serial2_setup, + serial2_teardown, + serial2_execute +}; #endif /* CH_USE_SERIAL_FULLDUPLEX */ /* @@ -162,6 +239,7 @@ const struct testcase testserial1 = { const struct testcase * const patternserial[] = { #if CH_USE_SERIAL_FULLDUPLEX &testserial1, + &testserial2, #endif NULL }; -- cgit v1.2.3 From 2f39b6e6b5bd6383c125fbf151ffd0d7e488a1de Mon Sep 17 00:00:00 2001 From: gdisirio Date: Sat, 16 May 2009 07:54:00 +0000 Subject: Typo. git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@974 35acf78f-673a-0410-8e92-d51de3d6d3f4 --- test/testserial.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'test') diff --git a/test/testserial.c b/test/testserial.c index fe92ebe2b..ca9174698 100644 --- a/test/testserial.c +++ b/test/testserial.c @@ -93,7 +93,7 @@ static void onfy(void) { } /** - * @page test_serial_001 Synchronous loopback test + * @page test_serial_001 Synchronous loopback * *

Description

* A sequence of characters are sent to the loopback driver and read back. The @@ -160,7 +160,7 @@ const struct testcase testserial1 = { }; /** - * @page test_serial_002 Asynchronous loopback test + * @page test_serial_002 Asynchronous loopback * *

Description

* A sequence of characters are sent to the loopback driver using the -- cgit v1.2.3 From 2706d240bbea25b21dac8e0bc123de9cb2080a13 Mon Sep 17 00:00:00 2001 From: gdisirio Date: Sat, 16 May 2009 10:57:16 +0000 Subject: Added static initializers to thread queues, semaphores, mutexes, condvars and event sources. git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@975 35acf78f-673a-0410-8e92-d51de3d6d3f4 --- test/testevt.c | 8 +++++++- test/testmtx.c | 10 ++++++++-- test/testsem.c | 7 ++++++- 3 files changed, 21 insertions(+), 4 deletions(-) (limited to 'test') diff --git a/test/testevt.c b/test/testevt.c index 31f8870b0..e053737a5 100644 --- a/test/testevt.c +++ b/test/testevt.c @@ -54,7 +54,13 @@ #define ALLOWED_DELAY MS2ST(5) -static EventSource es1, es2; +/* + * Note, the static initializers are not really required because the + * variables are explicitly initialized in each test case. It is done in order + * to test the macros. + */ +static EVENTSOURCE_DECL(es1); +static EVENTSOURCE_DECL(es2); /** * @page test_events_001 Events registration and dispatch diff --git a/test/testmtx.c b/test/testmtx.c index 030b8ab87..6027aca7e 100644 --- a/test/testmtx.c +++ b/test/testmtx.c @@ -63,8 +63,14 @@ #define ALLOWED_DELAY 5 -static Mutex m1, m2; -static CondVar c1; +/* + * Note, the static initializers are not really required because the + * variables are explicitly initialized in each test case. It is done in order + * to test the macros. + */ +static MUTEX_DECL(m1); +static MUTEX_DECL(m2); +static CONDVAR_DECL(c1); /** * @page test_mtx_001 Priority enqueuing test diff --git a/test/testsem.c b/test/testsem.c index 7cb103789..46c6a7941 100644 --- a/test/testsem.c +++ b/test/testsem.c @@ -53,7 +53,12 @@ #define ALLOWED_DELAY MS2ST(5) -static Semaphore sem1; +/* + * Note, the static initializers are not really required because the + * variables are explicitly initialized in each test case. It is done in order + * to test the macros. + */ +static SEMAPHORE_DECL(sem1, 0); /** * @page test_sem_001 Enqueuing test -- cgit v1.2.3 From dd6e2f3911e6bdd4905bd2173492be3119a3e491 Mon Sep 17 00:00:00 2001 From: gdisirio Date: Sat, 16 May 2009 11:53:48 +0000 Subject: Added static initializers to input and output queues. git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@976 35acf78f-673a-0410-8e92-d51de3d6d3f4 --- test/test.c | 11 ++++++----- test/test.h | 5 +++++ test/testqueues.c | 31 ++++++++++++++++++++++--------- 3 files changed, 33 insertions(+), 14 deletions(-) (limited to 'test') diff --git a/test/test.c b/test/test.c index 7d4e3f2b0..abbc1f0eb 100644 --- a/test/test.c +++ b/test/test.c @@ -56,11 +56,12 @@ static bool_t local_fail, global_fail; static unsigned failpoint; static char tokens_buffer[MAX_TOKENS]; static char *tokp; -static WORKING_AREA(waT0, THREADS_STACK_SIZE); -static WORKING_AREA(waT1, THREADS_STACK_SIZE); -static WORKING_AREA(waT2, THREADS_STACK_SIZE); -static WORKING_AREA(waT3, THREADS_STACK_SIZE); -static WORKING_AREA(waT4, THREADS_STACK_SIZE); + +WORKING_AREA(waT0, THREADS_STACK_SIZE); +WORKING_AREA(waT1, THREADS_STACK_SIZE); +WORKING_AREA(waT2, THREADS_STACK_SIZE); +WORKING_AREA(waT3, THREADS_STACK_SIZE); +WORKING_AREA(waT4, THREADS_STACK_SIZE); void *wa[MAX_THREADS] = {waT0, waT1, waT2, waT3, waT4}; Thread *threads[MAX_THREADS]; diff --git a/test/test.h b/test/test.h index 761ee08b9..17972b5c6 100644 --- a/test/test.h +++ b/test/test.h @@ -95,6 +95,11 @@ extern "C" { extern Thread *threads[MAX_THREADS]; extern void *wa[MAX_THREADS]; +extern WORKING_AREA(waT0, THREADS_STACK_SIZE); +extern WORKING_AREA(waT1, THREADS_STACK_SIZE); +extern WORKING_AREA(waT2, THREADS_STACK_SIZE); +extern WORKING_AREA(waT3, THREADS_STACK_SIZE); +extern WORKING_AREA(waT4, THREADS_STACK_SIZE); extern bool_t test_timer_done; #endif /* _TEST_H_ */ diff --git a/test/testqueues.c b/test/testqueues.c index 6c460becf..36c90402b 100644 --- a/test/testqueues.c +++ b/test/testqueues.c @@ -57,6 +57,16 @@ #define TEST_QUEUES_SIZE 4 +static void notify(void) {} + +/* + * Note, the static initializers are not really required because the + * variables are explicitly initialized in each test case. It is done in order + * to test the macros. + */ +static INPUTQUEUE_DECL(iq, (uint8_t *)waT0, TEST_QUEUES_SIZE, notify); +static OUTPUTQUEUE_DECL(oq, (uint8_t *)waT0, TEST_QUEUES_SIZE, notify); + /** * @page test_queues_001 Input Queues functionality and APIs * @@ -65,18 +75,19 @@ * @p InputQueue object including timeouts. The queue state must remain * consistent through the whole test. */ -static void notify(void) {} static char *queues1_gettest(void) { return "Queues, input queues"; } -static void queues1_execute(void) { - InputQueue iq; - unsigned i; +static void queues1_setup(void) { chIQInit(&iq, wa[0], TEST_QUEUES_SIZE, notify); +} + +static void queues1_execute(void) { + unsigned i; /* Initial empty state */ test_assert(1, chIQIsEmpty(&iq), "not empty"); @@ -114,7 +125,7 @@ static void queues1_execute(void) { const struct testcase testqueues1 = { queues1_gettest, - NULL, + queues1_setup, NULL, queues1_execute }; @@ -132,11 +143,13 @@ static char *queues2_gettest(void) { return "Queues, output queues"; } -static void queues2_execute(void) { - OutputQueue oq; - unsigned i; +static void queues2_setup(void) { chOQInit(&oq, wa[0], TEST_QUEUES_SIZE, notify); +} + +static void queues2_execute(void) { + unsigned i; /* Initial empty state */ test_assert(1, chOQIsEmpty(&oq), "not empty"); @@ -172,7 +185,7 @@ static void queues2_execute(void) { const struct testcase testqueues2 = { queues2_gettest, - NULL, + queues2_setup, NULL, queues2_execute }; -- cgit v1.2.3 From b20088a8cb72e3f3e694e309671cd7f96fb552dc Mon Sep 17 00:00:00 2001 From: gdisirio Date: Sat, 16 May 2009 12:37:01 +0000 Subject: git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@977 35acf78f-673a-0410-8e92-d51de3d6d3f4 --- test/test.c | 13 ++++++++++++- test/test.h | 2 +- test/testserial.c | 6 +++--- 3 files changed, 16 insertions(+), 5 deletions(-) (limited to 'test') diff --git a/test/test.c b/test/test.c index abbc1f0eb..8d709a5b2 100644 --- a/test/test.c +++ b/test/test.c @@ -57,15 +57,26 @@ static unsigned failpoint; static char tokens_buffer[MAX_TOKENS]; static char *tokp; +/* + * Static working areas, the following areas can be used for threads or + * used as temporary buffers. + */ WORKING_AREA(waT0, THREADS_STACK_SIZE); WORKING_AREA(waT1, THREADS_STACK_SIZE); WORKING_AREA(waT2, THREADS_STACK_SIZE); WORKING_AREA(waT3, THREADS_STACK_SIZE); WORKING_AREA(waT4, THREADS_STACK_SIZE); -void *wa[MAX_THREADS] = {waT0, waT1, waT2, waT3, waT4}; +/* + * Pointers to the spawned threads. + */ Thread *threads[MAX_THREADS]; +/* + * Pointers to the working areas. + */ +void * const wa[5] = {waT0, waT1, waT2, waT3, waT4}; + /* * Console output. */ diff --git a/test/test.h b/test/test.h index 17972b5c6..fca9da8b1 100644 --- a/test/test.h +++ b/test/test.h @@ -94,12 +94,12 @@ extern "C" { } extern Thread *threads[MAX_THREADS]; -extern void *wa[MAX_THREADS]; extern WORKING_AREA(waT0, THREADS_STACK_SIZE); extern WORKING_AREA(waT1, THREADS_STACK_SIZE); extern WORKING_AREA(waT2, THREADS_STACK_SIZE); extern WORKING_AREA(waT3, THREADS_STACK_SIZE); extern WORKING_AREA(waT4, THREADS_STACK_SIZE); +extern void * const wa[]; extern bool_t test_timer_done; #endif /* _TEST_H_ */ diff --git a/test/testserial.c b/test/testserial.c index ca9174698..6781a3785 100644 --- a/test/testserial.c +++ b/test/testserial.c @@ -196,7 +196,7 @@ static void serial2_execute(void) { dflags_t flags; /* Asynchronous test using the direct APIs.*/ - n = chFDDWrite(&fdd, "ABCDEFGH", TEST_QUEUES_SIZE); + n = chFDDWrite(&fdd, (uint8_t *)"ABCDEFGH", TEST_QUEUES_SIZE); test_assert(1, n == TEST_QUEUES_SIZE, "unexpected write condition"); n = chFDDRead(&fdd, wa[1], TEST_QUEUES_SIZE); test_assert(2, n == TEST_QUEUES_SIZE, "unexpected read condition"); @@ -206,7 +206,7 @@ static void serial2_execute(void) { test_assert(4, flags == 0, "unexpected error condition"); /* Input overflow testing.*/ - n = chFDDWrite(&fdd, "ABCDEFGH", TEST_QUEUES_SIZE); + n = chFDDWrite(&fdd, (uint8_t *)"ABCDEFGH", TEST_QUEUES_SIZE); test_assert(5, n == TEST_QUEUES_SIZE, "unexpected write condition"); /* The following operation will fail to loopback because the input queue * is full.*/ @@ -217,7 +217,7 @@ static void serial2_execute(void) { test_assert(7, n == TEST_QUEUES_SIZE, "unexpected read condition"); /* Asynchronous test using the channel APIs.*/ - n = chIOWrite(&fdd, "ABCDEFGH", TEST_QUEUES_SIZE); + n = chIOWrite(&fdd, (uint8_t *)"ABCDEFGH", TEST_QUEUES_SIZE); test_assert(8, n == TEST_QUEUES_SIZE, "unexpected write condition"); n = chIORead(&fdd, wa[1], TEST_QUEUES_SIZE); test_assert(9, n == TEST_QUEUES_SIZE, "unexpected read condition"); -- cgit v1.2.3 From 53f1b747726d85020beca994f6fe67a5e9af7b8e Mon Sep 17 00:00:00 2001 From: gdisirio Date: Sat, 16 May 2009 14:49:41 +0000 Subject: Added static initializers for mailboxes and memory pools. git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@978 35acf78f-673a-0410-8e92-d51de3d6d3f4 --- test/testmbox.c | 10 +++++++--- test/testpools.c | 2 +- test/testqueues.c | 4 ++-- 3 files changed, 10 insertions(+), 6 deletions(-) (limited to 'test') diff --git a/test/testmbox.c b/test/testmbox.c index 2403afce6..a485c3a4e 100644 --- a/test/testmbox.c +++ b/test/testmbox.c @@ -55,8 +55,12 @@ #define ALLOWED_DELAY MS2ST(5) #define MB_SIZE 5 -static msg_t mb1_buf[MB_SIZE]; -static Mailbox mb1; +/* + * Note, the static initializers are not really required because the + * variables are explicitly initialized in each test case. It is done in order + * to test the macros. + */ +static MAILBOX_DECL(mb1, waT0, MB_SIZE); /** * @page test_mbox_001 Queuing and timeouts @@ -74,7 +78,7 @@ static char *mbox1_gettest(void) { static void mbox1_setup(void) { - chMBInit(&mb1, mb1_buf, MB_SIZE); + chMBInit(&mb1, (msg_t *)waT0, MB_SIZE); } static void mbox1_execute(void) { diff --git a/test/testpools.c b/test/testpools.c index 78f19a91c..ce6716444 100644 --- a/test/testpools.c +++ b/test/testpools.c @@ -49,7 +49,7 @@ #if CH_USE_MEMPOOLS -static MemoryPool mp1; +static MEMORYPOOL_DECL(mp1, THD_WA_SIZE(THREADS_STACK_SIZE)); /** * @page test_pools_001 Allocation and enqueuing test diff --git a/test/testqueues.c b/test/testqueues.c index 36c90402b..fe79712eb 100644 --- a/test/testqueues.c +++ b/test/testqueues.c @@ -64,8 +64,8 @@ static void notify(void) {} * variables are explicitly initialized in each test case. It is done in order * to test the macros. */ -static INPUTQUEUE_DECL(iq, (uint8_t *)waT0, TEST_QUEUES_SIZE, notify); -static OUTPUTQUEUE_DECL(oq, (uint8_t *)waT0, TEST_QUEUES_SIZE, notify); +static INPUTQUEUE_DECL(iq, waT0, TEST_QUEUES_SIZE, notify); +static OUTPUTQUEUE_DECL(oq, waT0, TEST_QUEUES_SIZE, notify); /** * @page test_queues_001 Input Queues functionality and APIs -- cgit v1.2.3 From d6eb57b8ea6c73a694cff33ded801af9e25ecff7 Mon Sep 17 00:00:00 2001 From: gdisirio Date: Sun, 24 May 2009 13:38:16 +0000 Subject: Fixed bugs 2796065, 2796069 and 2796081. Updated ARM test reports. git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@987 35acf78f-673a-0410-8e92-d51de3d6d3f4 --- test/testevt.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'test') diff --git a/test/testevt.c b/test/testevt.c index e053737a5..3eb3d71b3 100644 --- a/test/testevt.c +++ b/test/testevt.c @@ -171,7 +171,7 @@ static void evt2_execute(void) { test_assert(1, m == 1, "single event error"); m = chEvtWaitOne(ALL_EVENTS); test_assert(2, m == 4, "single event error"); - m = chEvtClear(0); + m = chEvtClear(ALL_EVENTS); test_assert(3, m == 0, "stuck event"); /* @@ -184,7 +184,7 @@ static void evt2_execute(void) { m = chEvtWaitOne(ALL_EVENTS); test_assert_time_window(4, target_time, target_time + ALLOWED_DELAY); test_assert(5, m == 1, "single event error"); - m = chEvtClear(0); + m = chEvtClear(ALL_EVENTS); test_assert(6, m == 0, "stuck event"); test_wait_threads(); @@ -194,7 +194,7 @@ static void evt2_execute(void) { chEvtPend(5); m = chEvtWaitAny(ALL_EVENTS); test_assert(7, m == 5, "unexpected pending bit"); - m = chEvtClear(0); + m = chEvtClear(ALL_EVENTS); test_assert(8, m == 0, "stuck event"); /* @@ -207,7 +207,7 @@ static void evt2_execute(void) { m = chEvtWaitAny(ALL_EVENTS); test_assert_time_window(9, target_time, target_time + ALLOWED_DELAY); test_assert(10, m == 1, "single event error"); - m = chEvtClear(0); + m = chEvtClear(ALL_EVENTS); test_assert(11, m == 0, "stuck event"); test_wait_threads(); @@ -224,7 +224,7 @@ static void evt2_execute(void) { thread2, "A"); m = chEvtWaitAll(5); test_assert_time_window(12, target_time, target_time + ALLOWED_DELAY); - m = chEvtClear(0); + m = chEvtClear(ALL_EVENTS); test_assert(13, m == 0, "stuck event"); test_wait_threads(); chEvtUnregister(&es1, &el1); -- cgit v1.2.3 From 791f412ad66a36fb6dc530149024acb4bcbfaed6 Mon Sep 17 00:00:00 2001 From: gdisirio Date: Tue, 26 May 2009 13:08:40 +0000 Subject: git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@991 35acf78f-673a-0410-8e92-d51de3d6d3f4 --- test/testbmk.c | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) (limited to 'test') diff --git a/test/testbmk.c b/test/testbmk.c index cb6ce9da7..7a99c37af 100644 --- a/test/testbmk.c +++ b/test/testbmk.c @@ -209,7 +209,7 @@ const struct testcase testbmk3 = { * A thread is created that just performs a @p chSchGoSleepS() into a loop, * the thread is awakened as fast is possible by the tester thread.
* The Context Switch performance is calculated by measuring the number of - * interactions after a second of continuous operations. + * iterations after a second of continuous operations. */ static char *bmk4_gettest(void) { @@ -272,8 +272,8 @@ const struct testcase testbmk4 = { *

Description

* Threads are continuously created and terminated into a loop. A full * @p chThdCreateStatic() / @p chThdExit() / @p chThdWait() cycle is performed - * in each interaction.
- * The performance is calculated by measuring the number of interactions after + * in each iteration.
+ * The performance is calculated by measuring the number of iterations after * a second of continuous operations. */ @@ -314,10 +314,10 @@ const struct testcase testbmk5 = { *

Description

* Threads are continuously created and terminated into a loop. A partial * @p chThdCreateStatic() / @p chThdExit() cycle is performed in each - * interaction, the @p chThdWait() is not necessary because the thread is + * iteration, the @p chThdWait() is not necessary because the thread is * created at an higher priority so there is no need to wait for it to * terminate.
- * The performance is calculated by measuring the number of interactions after + * The performance is calculated by measuring the number of iterations after * a second of continuous operations. */ @@ -359,7 +359,7 @@ const struct testcase testbmk6 = { * Five threads are created and atomically reschedulated by resetting the * semaphore where they are waiting on. The operation is performed into a * continuous loop.
- * The performance is calculated by measuring the number of interactions after + * The performance is calculated by measuring the number of iterations after * a second of continuous operations. */ @@ -423,7 +423,7 @@ const struct testcase testbmk7 = { *

Description

* Four bytes are written and then read from an @p InputQueue into a continuous * loop.
- * The performance is calculated by measuring the number of interactions after + * The performance is calculated by measuring the number of iterations after * a second of continuous operations. */ @@ -471,7 +471,7 @@ const struct testcase testbmk8 = { * *

Description

* A virtual timer is set and immediately reset into a continuous loop.
- * The performance is calculated by measuring the number of interactions after + * The performance is calculated by measuring the number of iterations after * a second of continuous operations. */ @@ -518,7 +518,7 @@ const struct testcase testbmk9 = { *

Description

* A counting semaphore is taken/released into a continuous loop, no Context * Switch happens because the counter is always non negative.
- * The performance is calculated by measuring the number of interactions after + * The performance is calculated by measuring the number of iterations after * a second of continuous operations. */ @@ -570,7 +570,7 @@ const struct testcase testbmk10 = { *

Description

* A mutex is locked/unlocked into a continuous loop, no Context Switch happens * because there are no other threads asking for the mutex.
- * The performance is calculated by measuring the number of interactions after + * The performance is calculated by measuring the number of iterations after * a second of continuous operations. */ -- cgit v1.2.3 From d9d8d0bc90fa38243946a19aec789ea7d2280fbf Mon Sep 17 00:00:00 2001 From: gdisirio Date: Mon, 1 Jun 2009 18:05:38 +0000 Subject: More documentation fixes. git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@1005 35acf78f-673a-0410-8e92-d51de3d6d3f4 --- test/testheap.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'test') diff --git a/test/testheap.c b/test/testheap.c index 7c5b97918..3a684f415 100644 --- a/test/testheap.c +++ b/test/testheap.c @@ -43,7 +43,7 @@ * . * @file testheap.c * @brief Heap test source file - * @file testevt.h + * @file testheap.h * @brief Heap header file */ -- cgit v1.2.3 From 1ea7355d85e316aadfd90468b3e808bb3dc95ee9 Mon Sep 17 00:00:00 2001 From: gdisirio Date: Sun, 16 Aug 2009 13:07:24 +0000 Subject: git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@1073 35acf78f-673a-0410-8e92-d51de3d6d3f4 --- test/coverage/Makefile | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) (limited to 'test') diff --git a/test/coverage/Makefile b/test/coverage/Makefile index 687d73233..a00e5015a 100644 --- a/test/coverage/Makefile +++ b/test/coverage/Makefile @@ -57,19 +57,21 @@ UDEFS = UADEFS = # Imported source files -include ../../src/kernel.mk +include ../../os/kernel/kernel.mk include ../../test/test.mk # List C source files here -SRC = chcore.c main.c simcom.c \ - ${KERNSRC} \ - ${TESTSRC} +SRC = ${KERNSRC} \ + ${TESTSRC} \ + chcore.c \ + simcom.c \ + main.c # List ASM source files here ASRC = # List all user directories here -UINCDIR = ../../src/include ../../test +UINCDIR = $(KERNINC) $(TESTINC) # List the user directory to look for the libraries here ULIBDIR = -- cgit v1.2.3 From 45a6b7dc5a1758cb2bc49b0d76effa381043d297 Mon Sep 17 00:00:00 2001 From: gdisirio Date: Wed, 19 Aug 2009 13:11:25 +0000 Subject: git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@1082 35acf78f-673a-0410-8e92-d51de3d6d3f4 --- test/test.c | 2 - test/test.mk | 3 +- test/testserial.c | 245 ------------------------------------------------------ test/testserial.h | 25 ------ 4 files changed, 1 insertion(+), 274 deletions(-) delete mode 100644 test/testserial.c delete mode 100644 test/testserial.h (limited to 'test') diff --git a/test/test.c b/test/test.c index 8d709a5b2..434ef1b8c 100644 --- a/test/test.c +++ b/test/test.c @@ -30,7 +30,6 @@ #include "testpools.h" #include "testdyn.h" #include "testqueues.h" -#include "testserial.h" #include "testbmk.h" /* @@ -47,7 +46,6 @@ static const struct testcase **patterns[] = { patternpools, patterndyn, patternqueues, - patternserial, patternbmk, NULL }; diff --git a/test/test.mk b/test/test.mk index f80237f8a..2a3e1a4f9 100644 --- a/test/test.mk +++ b/test/test.mk @@ -4,8 +4,7 @@ TESTSRC = ../../test/test.c ../../test/testthd.c \ ../../test/testmsg.c ../../test/testmbox.c \ ../../test/testevt.c ../../test/testheap.c \ ../../test/testpools.c ../../test/testdyn.c \ - ../../test/testqueues.c ../../test/testserial.c \ - ../../test/testbmk.c + ../../test/testqueues.c ../../test/testbmk.c # Required include directories TESTINC = ../../test diff --git a/test/testserial.c b/test/testserial.c deleted file mode 100644 index 6781a3785..000000000 --- a/test/testserial.c +++ /dev/null @@ -1,245 +0,0 @@ -/* - ChibiOS/RT - Copyright (C) 2006-2007 Giovanni Di Sirio. - - This file is part of ChibiOS/RT. - - ChibiOS/RT is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 3 of the License, or - (at your option) any later version. - - ChibiOS/RT is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program. If not, see . -*/ - -#include - -#include "test.h" - -/** - * @page test_serial Serial Drivers test - * - *

Description

- * This module implements the test sequence for the @ref Serial subsystem. - * The tests are performed on a loopback software serial driver where a - * dedicated thread echoes back in the input queue the data read from the - * output queue at a fixed rate. The test module also tests implicitly the - * channels code. - * - *

Objective

- * Objective of the test module is to cover 100% of the @ref Serial code - * as a necessary step in order to assess its maturity level.
- * Note that the @ref Serial subsystem depends on the @ref Semaphores and - * @ref Events subsystems that have to met their testing objectives as well. - * - *

Preconditions

- * The module requires the following kernel options: - * - @p CH_USE_SERIAL_FULLDUPLEX - * . - * In case some of the required options are not enabled then some or all tests - * may be skipped. - * - * - *

Test Cases

- * - @subpage test_serial_001 - * - @subpage test_serial_002 - * . - * @file testserial.c - * @brief Serial Driver test source file - * @file testserial.h - * @brief Serial Driver test header file - */ - -#if CH_USE_SERIAL_FULLDUPLEX - -#define TEST_QUEUES_SIZE 8 - -static FullDuplexDriver fdd; - -/* Loopback thread, it simulates a low level driver. The thread terminates by - sending a zero through the loopback driver.*/ -static msg_t thread1(void *p) { - - while (TRUE) { - chEvtWaitAny(1); - chSysLock(); - while (TRUE) { - msg_t b = chFDDRequestDataI(&fdd); - if (b < Q_OK) - break; - if (b == 0) { - chSchRescheduleS(); - chSysUnlock(); - return 0; - } - chFDDIncomingDataI(&fdd, (uint8_t)b); - chSchRescheduleS(); - } - chSysUnlock(); - } -} - -static void infy(void) {} - -static void onfy(void) { - - chEvtSignalI(threads[0], 1); - chSchRescheduleS(); -} - -/** - * @page test_serial_001 Synchronous loopback - * - *

Description

- * A sequence of characters are sent to the loopback driver and read back. The - * test is performed twice using both the direct APIs and the channels API - * implementations.
- * The test expects to read all the characters back and in the correct - * sequence. - */ - -static char *serial1_gettest(void) { - - return "Serial driver, synchronous"; -} - -static void serial1_setup(void) { - - /* Initializes the loopback driver.*/ - chFDDInit(&fdd, wa[3], 8, infy, wa[4], 8, onfy); - /* Starts the loopback thread.*/ - threads[0] = chThdCreateStatic(wa[0], WA_SIZE, chThdGetPriority() + 1, - thread1, 0); -} - -static void serial1_teardown(void) { - - /* Terminates the loopback thread.*/ - chFDDPut(&fdd, 0); -} - -static void serial1_execute(void) { - unsigned i; - msg_t b; - - /* Loopback test using the direct APIs.*/ - for (i = 0; i < 4; i++) { - chFDDPut(&fdd, 'A' + i); - b = chFDDGetTimeout(&fdd, S2ST(1)); - if (b < Q_OK) - break; - test_emit_token(b); - } - test_assert_sequence(1, "ABCD"); - test_assert(2, chFDDPutWouldBlock(&fdd) == FALSE, "output would block"); - test_assert(3, chFDDGetWouldBlock(&fdd) == TRUE, "input would not block"); - - /* Loopback test using the channel APIs.*/ - for (i = 0; i < 4; i++) { - chIOPut(&fdd, 'A' + i); - b = chIOGetTimeout(&fdd, S2ST(1)); - if (b < Q_OK) - break; - test_emit_token(b); - } - test_assert_sequence(4, "ABCD"); - test_assert(5, chIOPutWouldBlock(&fdd) == FALSE, "output would block"); - test_assert(6, chIOGetWouldBlock(&fdd) == TRUE, "input would not block"); -} - -const struct testcase testserial1 = { - serial1_gettest, - serial1_setup, - serial1_teardown, - serial1_execute -}; - -/** - * @page test_serial_002 Asynchronous loopback - * - *

Description

- * A sequence of characters are sent to the loopback driver using the - * asynchronous APIs and then read back. The test is performed twice using - * both the direct APIs and the channels API. An input queue overflow test - * is performed too.
- * The test expects that the queues are filled and emptied as expected and that - * the overflow error condition is reported when expected. - */ - -static char *serial2_gettest(void) { - - return "Serial driver, asynchronous"; -} - -static void serial2_setup(void) { - - /* Initializes the loopback driver.*/ - chFDDInit(&fdd, wa[3], 8, infy, wa[4], 8, onfy); - /* Starts the loopback thread.*/ - threads[0] = chThdCreateStatic(wa[0], WA_SIZE, chThdGetPriority() + 1, - thread1, 0); -} - -static void serial2_teardown(void) { - - /* Terminates the loopback thread.*/ - chFDDPut(&fdd, 0); -} - -static void serial2_execute(void) { - size_t n; - dflags_t flags; - - /* Asynchronous test using the direct APIs.*/ - n = chFDDWrite(&fdd, (uint8_t *)"ABCDEFGH", TEST_QUEUES_SIZE); - test_assert(1, n == TEST_QUEUES_SIZE, "unexpected write condition"); - n = chFDDRead(&fdd, wa[1], TEST_QUEUES_SIZE); - test_assert(2, n == TEST_QUEUES_SIZE, "unexpected read condition"); - test_assert(2, chFDDPutWouldBlock(&fdd) == FALSE, "output would block"); - test_assert(3, chFDDGetWouldBlock(&fdd) == TRUE, "input would not block"); - flags = chFDDGetAndClearFlags(&fdd); - test_assert(4, flags == 0, "unexpected error condition"); - - /* Input overflow testing.*/ - n = chFDDWrite(&fdd, (uint8_t *)"ABCDEFGH", TEST_QUEUES_SIZE); - test_assert(5, n == TEST_QUEUES_SIZE, "unexpected write condition"); - /* The following operation will fail to loopback because the input queue - * is full.*/ - chFDDPut(&fdd, 'Z'); - flags = chFDDGetAndClearFlags(&fdd); - test_assert(6, flags == SD_OVERRUN_ERROR, "unexpected error condition"); - n = chFDDRead(&fdd, wa[1], TEST_QUEUES_SIZE); - test_assert(7, n == TEST_QUEUES_SIZE, "unexpected read condition"); - - /* Asynchronous test using the channel APIs.*/ - n = chIOWrite(&fdd, (uint8_t *)"ABCDEFGH", TEST_QUEUES_SIZE); - test_assert(8, n == TEST_QUEUES_SIZE, "unexpected write condition"); - n = chIORead(&fdd, wa[1], TEST_QUEUES_SIZE); - test_assert(9, n == TEST_QUEUES_SIZE, "unexpected read condition"); - test_assert(10, chIOPutWouldBlock(&fdd) == FALSE, "output would block"); - test_assert(11, chIOGetWouldBlock(&fdd) == TRUE, "input would not block"); -} - -const struct testcase testserial2 = { - serial2_gettest, - serial2_setup, - serial2_teardown, - serial2_execute -}; -#endif /* CH_USE_SERIAL_FULLDUPLEX */ - -/* - * Test sequence for queues pattern. - */ -const struct testcase * const patternserial[] = { -#if CH_USE_SERIAL_FULLDUPLEX - &testserial1, - &testserial2, -#endif - NULL -}; diff --git a/test/testserial.h b/test/testserial.h deleted file mode 100644 index 3e68dd9c7..000000000 --- a/test/testserial.h +++ /dev/null @@ -1,25 +0,0 @@ -/* - ChibiOS/RT - Copyright (C) 2006-2007 Giovanni Di Sirio. - - This file is part of ChibiOS/RT. - - ChibiOS/RT is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 3 of the License, or - (at your option) any later version. - - ChibiOS/RT is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program. If not, see . -*/ - -#ifndef _TESTSERIAL_H_ -#define _TESTSERIAL_H_ - -extern const struct testcase *patternserial[]; - -#endif /* _TESTSERIAL_H_ */ -- cgit v1.2.3 From 397ccffac55ffd139d0e3e82add83e51413c1347 Mon Sep 17 00:00:00 2001 From: gdisirio Date: Sun, 30 Aug 2009 06:59:43 +0000 Subject: Documentation reorganization. git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@1133 35acf78f-673a-0410-8e92-d51de3d6d3f4 --- test/testdyn.c | 3 +-- test/testevt.c | 5 ++--- test/testheap.c | 5 ++--- test/testmbox.c | 9 ++++----- test/testmsg.c | 6 +++--- test/testmtx.c | 7 +++---- test/testpools.c | 5 ++--- test/testqueues.c | 7 +++---- test/testsem.c | 5 ++--- test/testthd.c | 7 +++---- 10 files changed, 25 insertions(+), 34 deletions(-) (limited to 'test') diff --git a/test/testdyn.c b/test/testdyn.c index a7c685623..44e6ffaa4 100644 --- a/test/testdyn.c +++ b/test/testdyn.c @@ -29,8 +29,7 @@ * APIs. * *

Objective

- * Objective of the test module is to cover 100% of the dynamic APIs code - * as a necessary step in order to assess their maturity. + * Objective of the test module is to cover 100% of the dynamic APIs code. * *

Preconditions

* The module requires the following kernel options: diff --git a/test/testevt.c b/test/testevt.c index 3eb3d71b3..eb7e9275c 100644 --- a/test/testevt.c +++ b/test/testevt.c @@ -25,11 +25,10 @@ * @page test_events Events test * *

Description

- * This module implements the test sequence for the @ref Events subsystem. + * This module implements the test sequence for the @ref events subsystem. * *

Objective

- * Objective of the test module is to cover 100% of the @ref Events subsystem - * code as a necessary step in order to assess its maturity level. + * Objective of the test module is to cover 100% of the @ref events subsystem. * *

Preconditions

* The module requires the following kernel options: diff --git a/test/testheap.c b/test/testheap.c index 3a684f415..6e68c11be 100644 --- a/test/testheap.c +++ b/test/testheap.c @@ -25,11 +25,10 @@ * @page test_heap Memory Heap test * *

Description

- * This module implements the test sequence for the @ref Heap subsystem. + * This module implements the test sequence for the @ref heap subsystem. * *

Objective

- * Objective of the test module is to cover 100% of the @ref Heap subsystem - * code as a necessary step in order to assess its maturity level. + * Objective of the test module is to cover 100% of the @ref heap subsystem. * *

Preconditions

* The module requires the following kernel options: diff --git a/test/testmbox.c b/test/testmbox.c index a485c3a4e..96cf543ce 100644 --- a/test/testmbox.c +++ b/test/testmbox.c @@ -25,13 +25,12 @@ * @page test_mbox Mailboxes test * *

Description

- * This module implements the test sequence for the @ref Mailboxes subsystem. + * This module implements the test sequence for the @ref mailboxes subsystem. * *

Objective

- * Objective of the test module is to cover 100% of the @ref Mailboxes - * subsystem code as a necessary step in order to assess its maturity - * level.
- * Note that the @ref Mailboxes subsystem depends on the @ref Semaphores + * Objective of the test module is to cover 100% of the @ref mailboxes + * subsystem code.
+ * Note that the @ref mailboxes subsystem depends on the @ref semaphores * subsystem that has to met its testing objectives as well. * *

Preconditions

diff --git a/test/testmsg.c b/test/testmsg.c index a44686ba6..015639d16 100644 --- a/test/testmsg.c +++ b/test/testmsg.c @@ -25,11 +25,11 @@ * @page test_msg Messages test * *

Description

- * This module implements the test sequence for the @ref Messages subsystem. + * This module implements the test sequence for the @ref messages subsystem. * *

Objective

- * Objective of the test module is to cover 100% of the @ref Messages - * subsystem code as a necessary step in order to assess its maturity level. + * Objective of the test module is to cover 100% of the @ref messages + * subsystem code. * *

Preconditions

* The module requires the following kernel options: diff --git a/test/testmtx.c b/test/testmtx.c index 6027aca7e..368b98fd9 100644 --- a/test/testmtx.c +++ b/test/testmtx.c @@ -25,14 +25,13 @@ * @page test_mtx Mutexes test * *

Description

- * This module implements the test sequence for the @ref Mutexes and - * @ref CondVars subsystems.
+ * This module implements the test sequence for the @ref mutexes and + * @ref condvars subsystems.
* Tests on those subsystems are particularly critical because the system-wide * implications of the Priority Inheritance mechanism. * *

Objective

- * Objective of the test module is to cover 100% of the subsystem code - * as a necessary step in order to assess their maturity level. + * Objective of the test module is to cover 100% of the subsystems code. * *

Preconditions

* The module requires the following kernel options: diff --git a/test/testpools.c b/test/testpools.c index ce6716444..97356126e 100644 --- a/test/testpools.c +++ b/test/testpools.c @@ -25,11 +25,10 @@ * @page test_pools Memory Pools test * *

Description

- * This module implements the test sequence for the @ref MemoryPools subsystem. + * This module implements the test sequence for the @ref pools subsystem. * *

Objective

- * Objective of the test module is to cover 100% of the @ref MemoryPools - * code as a necessary step in order to assess its maturity level.
+ * Objective of the test module is to cover 100% of the @ref pools code. * *

Preconditions

* The module requires the following kernel options: diff --git a/test/testqueues.c b/test/testqueues.c index fe79712eb..aff42334c 100644 --- a/test/testqueues.c +++ b/test/testqueues.c @@ -25,15 +25,14 @@ * @page test_queues I/O Queues test * *

Description

- * This module implements the test sequence for the @ref IOQueues subsystem. + * This module implements the test sequence for the @ref io_queues subsystem. * The tests are performed by inserting and removing data from queues and by * checking both the queues status and the correct sequence of the extracted * data. * *

Objective

- * Objective of the test module is to cover 100% of the @ref IOQueues code - * as a necessary step in order to assess its maturity level.
- * Note that the @ref IOQueues subsystem depends on the @ref Semaphores + * Objective of the test module is to cover 100% of the @ref io_queues code.
+ * Note that the @ref io_queues subsystem depends on the @ref semaphores * subsystem that has to met its testing objectives as well. * *

Preconditions

diff --git a/test/testsem.c b/test/testsem.c index 46c6a7941..77025fc71 100644 --- a/test/testsem.c +++ b/test/testsem.c @@ -25,11 +25,10 @@ * @page test_sem Semaphores test * *

Description

- * This module implements the test sequence for the @ref Semaphores subsystem. + * This module implements the test sequence for the @ref semaphores subsystem. * *

Objective

- * Objective of the test module is to cover 100% of the @ref Semaphores - * code as a necessary step in order to assess its maturity level.
+ * Objective of the test module is to cover 100% of the @ref semaphores code. * *

Preconditions

* The module requires the following kernel options: diff --git a/test/testthd.c b/test/testthd.c index 2758e5223..bc9b40cd1 100644 --- a/test/testthd.c +++ b/test/testthd.c @@ -25,15 +25,14 @@ * @page test_threads Threads and Scheduler test * *

Description

- * This module implements the test sequence for the @ref Scheduler, - * @ref Threads and @ref Time subsystems.
+ * This module implements the test sequence for the @ref scheduler, + * @ref threads and @ref time subsystems.
* Note that the tests on those subsystems are formally required but most of * their functionality is already demonstrated because the test suite itself * depends on them, anyway double check is good. * *

Objective

- * Objective of the test module is to cover 100% of the subsystems code - * as a necessary step in order to assess their maturity level. + * Objective of the test module is to cover 100% of the subsystems code. * *

Preconditions

* None. -- cgit v1.2.3 From 49c40ba106e8fbea8e67157591eab7bf0c9e9a01 Mon Sep 17 00:00:00 2001 From: gdisirio Date: Sun, 30 Aug 2009 08:49:10 +0000 Subject: git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@1136 35acf78f-673a-0410-8e92-d51de3d6d3f4 --- test/test.dox | 47 +++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 47 insertions(+) create mode 100644 test/test.dox (limited to 'test') diff --git a/test/test.dox b/test/test.dox new file mode 100644 index 000000000..ad3c03927 --- /dev/null +++ b/test/test.dox @@ -0,0 +1,47 @@ +/* + ChibiOS/RT - Copyright (C) 2006-2007 Giovanni Di Sirio. + + This file is part of ChibiOS/RT. + + ChibiOS/RT is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 3 of the License, or + (at your option) any later version. + + ChibiOS/RT is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see . +*/ + +/** + * @page testsuite Test Suite + *

Description

+ * Most of the ChibiOS/RT demos link a set of software modules (test suite) in + * order to verify the proper working of the kernel, the port and the demo + * itself.
+ * Each Test Module performs a series of tests on a specified subsystem or + * subsystems and can report a failure/success status and/or a performance + * index as the test suite output.
+ * The test suite is usually activated in the demo applications by pressing a + * button on the target board, see the readme into the various demos + * directories. The test suite output is usually sent through a serial port and + * can be examined by using a terminal emulator program. + * + *

Test Modules

+ * - @subpage test_threads + * - @subpage test_dynamic + * - @subpage test_msg + * - @subpage test_sem + * - @subpage test_mtx + * - @subpage test_events + * - @subpage test_mbox + * - @subpage test_queues + * - @subpage test_heap + * - @subpage test_pools + * - @subpage test_benchmarks + * . + */ -- cgit v1.2.3 From d88897bf4d4a5d5436277814d76f0991ecbf4489 Mon Sep 17 00:00:00 2001 From: gdisirio Date: Sun, 30 Aug 2009 17:21:10 +0000 Subject: Updated the coverage tool. git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@1145 35acf78f-673a-0410-8e92-d51de3d6d3f4 --- test/coverage/Makefile | 7 ++- test/coverage/chconf.h | 10 ---- test/coverage/chcore.c | 12 ++--- test/coverage/main.c | 10 ++-- test/coverage/serial_lld.c | 116 ++++++++++++++++++++++++++++++++++++++++++ test/coverage/serial_lld.h | 124 +++++++++++++++++++++++++++++++++++++++++++++ test/coverage/simcom.c | 66 ------------------------ 7 files changed, 251 insertions(+), 94 deletions(-) create mode 100644 test/coverage/serial_lld.c create mode 100644 test/coverage/serial_lld.h delete mode 100644 test/coverage/simcom.c (limited to 'test') diff --git a/test/coverage/Makefile b/test/coverage/Makefile index a00e5015a..69f55884e 100644 --- a/test/coverage/Makefile +++ b/test/coverage/Makefile @@ -63,15 +63,14 @@ include ../../test/test.mk # List C source files here SRC = ${KERNSRC} \ ${TESTSRC} \ - chcore.c \ - simcom.c \ - main.c + ../../os/io/serial.c \ + chcore.c serial_lld.c main.c # List ASM source files here ASRC = # List all user directories here -UINCDIR = $(KERNINC) $(TESTINC) +UINCDIR = $(KERNINC) $(TESTINC) ../../os/io # List the user directory to look for the libraries here ULIBDIR = diff --git a/test/coverage/chconf.h b/test/coverage/chconf.h index 88528e834..a45650258 100644 --- a/test/coverage/chconf.h +++ b/test/coverage/chconf.h @@ -232,16 +232,6 @@ #define CH_USE_QUEUES TRUE #endif -/** - * If specified then the full duplex serial driver APIs are included in the - * kernel. - * @note The default is @p TRUE. - * @note Requires @p CH_USE_QUEUES. - */ -#if !defined(CH_USE_SERIAL_FULLDUPLEX) || defined(__DOXYGEN__) -#define CH_USE_SERIAL_FULLDUPLEX TRUE -#endif - /** * If specified then the memory heap allocator APIs are included in the kernel. * @note The default is @p TRUE. diff --git a/test/coverage/chcore.c b/test/coverage/chcore.c index cdc87ceb5..b5191aa6c 100644 --- a/test/coverage/chcore.c +++ b/test/coverage/chcore.c @@ -20,23 +20,17 @@ #include #include -#undef CDECL - /** * @addtogroup WIN32SIM_CORE * @{ */ #include +#include static LARGE_INTEGER nextcnt; static LARGE_INTEGER slice; -void init_simcom1(void); -bool_t com1_conn_chkint(void); -bool_t com1_in_chkint(void); -bool_t com1_out_chkint(void); - /* * Simulated HW initialization. */ @@ -53,7 +47,7 @@ void InitCore(void) { QueryPerformanceCounter(&nextcnt); nextcnt.QuadPart += slice.QuadPart; - init_simcom1(); + sdInit(); fflush(stdout); } @@ -65,7 +59,7 @@ void ChkIntSources(void) { LARGE_INTEGER n; bool_t rflag = FALSE; - if (com1_conn_chkint() || com1_in_chkint() || com1_out_chkint()) { + if (sd_lld_interrupt_pending()) { if (chSchRescRequiredI()) rflag = TRUE; } diff --git a/test/coverage/main.c b/test/coverage/main.c index af8762562..893747546 100644 --- a/test/coverage/main.c +++ b/test/coverage/main.c @@ -17,15 +17,13 @@ along with this program. If not, see . */ -#include #include #include #include +#include #include -extern FullDuplexDriver COM1; - /* * Simulator main. */ @@ -33,8 +31,10 @@ int main(int argc, char *argv[]) { msg_t result; chSysInit(); - result = TestThread(&COM1); - chThdSleepMilliseconds(1); /* Gives time to flush COM1 output queue */ + sdStart(&SD1, NULL); + + result = TestThread(&SD1); + chThdSleepMilliseconds(1); /* Gives time to flush SD1 output queue */ fflush(stdout); if (result) exit(1); diff --git a/test/coverage/serial_lld.c b/test/coverage/serial_lld.c new file mode 100644 index 000000000..70c073648 --- /dev/null +++ b/test/coverage/serial_lld.c @@ -0,0 +1,116 @@ +/* + ChibiOS/RT - Copyright (C) 2006-2007 Giovanni Di Sirio. + + This file is part of ChibiOS/RT. + + ChibiOS/RT is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 3 of the License, or + (at your option) any later version. + + ChibiOS/RT is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see . +*/ + +/** + * @file Win32/serial_lld.c + * @brief Win32 low level simulated serial driver code + * @addtogroup WIN32_SERIAL + * @{ + */ + +#include +#include + +#include +#include + +/** @brief Test serial driver identifier.*/ +SerialDriver SD1; + +/** @brief Driver default configuration.*/ +static const SerialDriverConfig default_config = { +}; + +/*===========================================================================*/ +/* Low Level Driver local functions. */ +/*===========================================================================*/ + +static bool_t sd1_conn_chkint(void) { + + return FALSE; +} + +static bool_t sd1_in_chkint(void) { + + return FALSE; +} + +static bool_t sd1_out_chkint(void) { + msg_t n; + bool_t rflag = FALSE; + + while (TRUE) { + n = sdRequestDataI(&SD1); + if (n < 0) { + fflush(stdout); + return rflag; + } + fputc(n, stdout); + rflag = TRUE; + } +} + +/*===========================================================================*/ +/* Low Level Driver interrupt handlers. */ +/*===========================================================================*/ + +/*===========================================================================*/ +/* Low Level Driver exported functions. */ +/*===========================================================================*/ + +/** + * Low level serial driver initialization. + */ +void sd_lld_init(void) { + + sdObjectInit(&SD1, NULL, NULL); +} + +/** + * @brief Low level serial driver configuration and (re)start. + * + * @param[in] sdp pointer to a @p SerialDriver object + * @param[in] config the architecture-dependent serial driver configuration. + * If this parameter is set to @p NULL then a default + * configuration is used. + */ +void sd_lld_start(SerialDriver *sdp, const SerialDriverConfig *config) { + + if (config == NULL) + config = &default_config; + +} + +/** + * @brief Low level serial driver stop. + * @details De-initializes the USART, stops the associated clock, resets the + * interrupt vector. + * + * @param[in] sdp pointer to a @p SerialDriver object + */ +void sd_lld_stop(SerialDriver *sdp) { + +} + +bool_t sd_lld_interrupt_pending(void) { + + return sd1_conn_chkint() || sd1_in_chkint() || sd1_out_chkint(); +} + +/** @} */ diff --git a/test/coverage/serial_lld.h b/test/coverage/serial_lld.h new file mode 100644 index 000000000..ba3a27b87 --- /dev/null +++ b/test/coverage/serial_lld.h @@ -0,0 +1,124 @@ +/* + ChibiOS/RT - Copyright (C) 2006-2007 Giovanni Di Sirio. + + This file is part of ChibiOS/RT. + + ChibiOS/RT is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 3 of the License, or + (at your option) any later version. + + ChibiOS/RT is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see . +*/ + +/** + * @file Win32/serial_lld.h + * @brief Win32 low level simulated serial driver header + * @addtogroup WIN32_SERIAL + * @{ + */ + +#ifndef _SERIAL_LLD_H_ +#define _SERIAL_LLD_H_ + +#include + +/*===========================================================================*/ +/* Driver pre-compile time settings. */ +/*===========================================================================*/ + +/** + * @brief Serial buffers size. + * @details Configuration parameter, you can change the depth of the queue + * buffers depending on the requirements of your application. + */ +#if !defined(SERIAL_BUFFERS_SIZE) || defined(__DOXYGEN__) +#define SERIAL_BUFFERS_SIZE 1024 +#endif + +/*===========================================================================*/ +/* Unsupported event flags and custom events. */ +/*===========================================================================*/ + +/*===========================================================================*/ +/* Driver data structures and types. */ +/*===========================================================================*/ + +/** + * Serial Driver condition flags type. + */ +typedef uint32_t sdflags_t; + +/** + * @brief @p SerialDriver specific data. + */ +struct _serial_driver_data { + /** + * Input queue, incoming data can be read from this input queue by + * using the queues APIs. + */ + InputQueue iqueue; + /** + * Output queue, outgoing data can be written to this output queue by + * using the queues APIs. + */ + OutputQueue oqueue; + /** + * Status Change @p EventSource. This event is generated when one or more + * condition flags change. + */ + EventSource sevent; + /** + * I/O driver status flags. + */ + sdflags_t flags; + /** + * Input circular buffer. + */ + uint8_t ib[SERIAL_BUFFERS_SIZE]; + /** + * Output circular buffer. + */ + uint8_t ob[SERIAL_BUFFERS_SIZE]; +}; + +/** + * @brief Generic Serial Driver configuration structure. + * @details An instance of this structure must be passed to @p sdStart() + * in order to configure and start a serial driver operations. + * + * @note This structure content is architecture dependent, each driver + * implementation defines its own version and the custom static + * initializers. + */ +typedef struct { +} SerialDriverConfig; + +/*===========================================================================*/ +/* External declarations. */ +/*===========================================================================*/ + +/** @cond never*/ +extern SerialDriver SD1; + +#ifdef __cplusplus +extern "C" { +#endif + void sd_lld_init(void); + void sd_lld_start(SerialDriver *sdp, const SerialDriverConfig *config); + void sd_lld_stop(SerialDriver *sdp); + bool_t sd_lld_interrupt_pending(void); +#ifdef __cplusplus +} +#endif +/** @endcond*/ + +#endif /* _SERIAL_LLD_H_ */ + +/** @} */ diff --git a/test/coverage/simcom.c b/test/coverage/simcom.c deleted file mode 100644 index e8fceb76a..000000000 --- a/test/coverage/simcom.c +++ /dev/null @@ -1,66 +0,0 @@ -/* - ChibiOS/RT - Copyright (C) 2006-2007 Giovanni Di Sirio. - - This file is part of ChibiOS/RT. - - ChibiOS/RT is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 3 of the License, or - (at your option) any later version. - - ChibiOS/RT is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program. If not, see . -*/ - -/* - * Win32 COM port simulator (on stdout). - */ - -#include - -#include -#include - -#undef CDECL - -#include - -FullDuplexDriver COM1; - -static uint8_t com_ib[1024]; -static uint8_t com_ob[1024]; - -void init_simcom1(void) { - - chFDDInit(&COM1, com_ib, sizeof(com_ib), NULL, com_ob, sizeof(com_ob), NULL); -} - -bool_t com1_conn_chkint(void) { - - return FALSE; -} - -bool_t com1_in_chkint(void) { - - return FALSE; -} - -bool_t com1_out_chkint(void) { - msg_t n; - bool_t rflag = FALSE; - - while (TRUE) { - n = chFDDRequestDataI(&COM1); - if (n < 0) { - fflush(stdout); - return rflag; - } - fputc(n, stdout); - rflag = TRUE; - } -} -- cgit v1.2.3 From 7dfa36f86d896cdb824a9137a81f324c8243c4d9 Mon Sep 17 00:00:00 2001 From: gdisirio Date: Sat, 5 Sep 2009 15:31:27 +0000 Subject: git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@1148 35acf78f-673a-0410-8e92-d51de3d6d3f4 --- test/testbmk.c | 120 +++++++++++++++++++++++++++++++++++++++++++-------------- 1 file changed, 91 insertions(+), 29 deletions(-) (limited to 'test') diff --git a/test/testbmk.c b/test/testbmk.c index 7a99c37af..f44ae0b8b 100644 --- a/test/testbmk.c +++ b/test/testbmk.c @@ -418,7 +418,66 @@ const struct testcase testbmk7 = { }; /** - * @page test_benchmarks_008 I/O Queues throughput + * @page test_benchmarks_009 I/O Round-Robin voluntary rescedulation. + * + *

Description

+ * Five threads are created at equal priority, each thread just increases a + * variable and yields.
+ * The performance is calculated by measuring the number of iterations after + * a second of continuous operations. + */ + +#if CH_USE_ROUNDROBIN +static msg_t thread8(void *p) { + + do { + chThdYield(); + chThdYield(); + chThdYield(); + chThdYield(); + (*(uint32_t *)p) += 4; + } while(!chThdShouldTerminate()); + return 0; +} + +static char *bmk8_gettest(void) { + + return "Benchmark, round robin context switching"; +} + +static void bmk8_execute(void) { + uint32_t n; + + n = 0; + test_wait_tick(); + + threads[0] = chThdCreateStatic(wa[0], WA_SIZE, chThdGetPriority()-1, thread8, (void *)&n); + threads[1] = chThdCreateStatic(wa[1], WA_SIZE, chThdGetPriority()-1, thread8, (void *)&n); + threads[2] = chThdCreateStatic(wa[2], WA_SIZE, chThdGetPriority()-1, thread8, (void *)&n); + threads[3] = chThdCreateStatic(wa[3], WA_SIZE, chThdGetPriority()-1, thread8, (void *)&n); + threads[4] = chThdCreateStatic(wa[4], WA_SIZE, chThdGetPriority()-1, thread8, (void *)&n); + + chThdSleepSeconds(1); + test_terminate_threads(); + test_wait_threads(); + + test_print("--- Score : "); + test_printn(n); + test_print(" reschedulations/S, "); + test_printn(n); + test_println(" ctxswc/S"); +} + +const struct testcase testbmk8 = { + bmk8_gettest, + NULL, + NULL, + bmk8_execute +}; +#endif + +/** + * @page test_benchmarks_009 I/O Queues throughput * *

Description

* Four bytes are written and then read from an @p InputQueue into a continuous @@ -427,12 +486,12 @@ const struct testcase testbmk7 = { * a second of continuous operations. */ -static char *bmk8_gettest(void) { +static char *bmk9_gettest(void) { return "Benchmark, I/O Queues throughput"; } -static void bmk8_execute(void) { +static void bmk9_execute(void) { static uint8_t ib[16]; static InputQueue iq; @@ -459,15 +518,15 @@ static void bmk8_execute(void) { test_println(" bytes/S"); } -const struct testcase testbmk8 = { - bmk8_gettest, +const struct testcase testbmk9 = { + bmk9_gettest, NULL, NULL, - bmk8_execute + bmk9_execute }; /** - * @page test_benchmarks_009 Virtual Timers set/reset performance + * @page test_benchmarks_010 Virtual Timers set/reset performance * *

Description

* A virtual timer is set and immediately reset into a continuous loop.
@@ -475,14 +534,14 @@ const struct testcase testbmk8 = { * a second of continuous operations. */ -static char *bmk9_gettest(void) { +static char *bmk10_gettest(void) { return "Benchmark, virtual timers set/reset"; } static void tmo(void *param) {} -static void bmk9_execute(void) { +static void bmk10_execute(void) { static VirtualTimer vt1, vt2; uint32_t n = 0; @@ -505,15 +564,15 @@ static void bmk9_execute(void) { test_println(" timers/S"); } -const struct testcase testbmk9 = { - bmk9_gettest, +const struct testcase testbmk10 = { + bmk10_gettest, NULL, NULL, - bmk9_execute + bmk10_execute }; /** - * @page test_benchmarks_010 Semaphores wait/signal performance + * @page test_benchmarks_011 Semaphores wait/signal performance * *

Description

* A counting semaphore is taken/released into a continuous loop, no Context @@ -522,17 +581,17 @@ const struct testcase testbmk9 = { * a second of continuous operations. */ -static char *bmk10_gettest(void) { +static char *bmk11_gettest(void) { return "Benchmark, semaphores wait/signal"; } -static void bmk10_setup(void) { +static void bmk11_setup(void) { chSemInit(&sem1, 1); } -static void bmk10_execute(void) { +static void bmk11_execute(void) { uint32_t n = 0; test_wait_tick(); @@ -556,16 +615,16 @@ static void bmk10_execute(void) { test_println(" wait+signal/S"); } -const struct testcase testbmk10 = { - bmk10_gettest, - bmk10_setup, +const struct testcase testbmk11 = { + bmk11_gettest, + bmk11_setup, NULL, - bmk10_execute + bmk11_execute }; #if CH_USE_MUTEXES /** - * @page test_benchmarks_011 Mutexes lock/unlock performance + * @page test_benchmarks_012 Mutexes lock/unlock performance * *

Description

* A mutex is locked/unlocked into a continuous loop, no Context Switch happens @@ -574,17 +633,17 @@ const struct testcase testbmk10 = { * a second of continuous operations. */ -static char *bmk11_gettest(void) { +static char *bmk12_gettest(void) { return "Benchmark, mutexes lock/unlock"; } -static void bmk11_setup(void) { +static void bmk12_setup(void) { chMtxInit(&mtx1); } -static void bmk11_execute(void) { +static void bmk12_execute(void) { uint32_t n = 0; test_wait_tick(); @@ -608,11 +667,11 @@ static void bmk11_execute(void) { test_println(" lock+unlock/S"); } -const struct testcase testbmk11 = { - bmk11_gettest, - bmk11_setup, +const struct testcase testbmk12 = { + bmk12_gettest, + bmk12_setup, NULL, - bmk11_execute + bmk12_execute }; #endif @@ -628,11 +687,14 @@ const struct testcase * const patternbmk[] = { &testbmk5, &testbmk6, &testbmk7, +#if CH_USE_ROUNDROBIN &testbmk8, +#endif &testbmk9, &testbmk10, -#if CH_USE_MUTEXES &testbmk11, +#if CH_USE_MUTEXES + &testbmk12, #endif #endif NULL -- cgit v1.2.3 From 2a4b6ba47eaadaf209ea46aa4a706b6af6dab53f Mon Sep 17 00:00:00 2001 From: gdisirio Date: Sun, 6 Sep 2009 10:11:12 +0000 Subject: git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@1153 35acf78f-673a-0410-8e92-d51de3d6d3f4 --- test/testbmk.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'test') diff --git a/test/testbmk.c b/test/testbmk.c index f44ae0b8b..39bcdbaa5 100644 --- a/test/testbmk.c +++ b/test/testbmk.c @@ -49,6 +49,7 @@ * - @subpage test_benchmarks_009 * - @subpage test_benchmarks_010 * - @subpage test_benchmarks_011 + * - @subpage test_benchmarks_012 * . * @file testbmk.c Kernel Benchmarks * @brief Kernel Benchmarks source file @@ -418,7 +419,7 @@ const struct testcase testbmk7 = { }; /** - * @page test_benchmarks_009 I/O Round-Robin voluntary rescedulation. + * @page test_benchmarks_008 I/O Round-Robin voluntary reschedulation. * *

Description

* Five threads are created at equal priority, each thread just increases a -- cgit v1.2.3 From fd62110684aed51cca43fa21f725fb88c3fd8887 Mon Sep 17 00:00:00 2001 From: gdisirio Date: Sun, 13 Sep 2009 08:21:02 +0000 Subject: git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@1159 35acf78f-673a-0410-8e92-d51de3d6d3f4 --- test/testbmk.c | 67 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 67 insertions(+) (limited to 'test') diff --git a/test/testbmk.c b/test/testbmk.c index 39bcdbaa5..03531d028 100644 --- a/test/testbmk.c +++ b/test/testbmk.c @@ -50,6 +50,7 @@ * - @subpage test_benchmarks_010 * - @subpage test_benchmarks_011 * - @subpage test_benchmarks_012 + * - @subpage test_benchmarks_013 * . * @file testbmk.c Kernel Benchmarks * @brief Kernel Benchmarks source file @@ -676,6 +677,71 @@ const struct testcase testbmk12 = { }; #endif +/** + * @page test_benchmarks_013 RAM Footprint + * + *

Description

+ * The memory size of the various kernel objects is printed. + */ + +static char *bmk13_gettest(void) { + + return "Benchmark, RAM footprint"; +} + +static void bmk13_execute(void) { + + test_print("--- System: "); + test_printn(sizeof(ReadyList) + sizeof(VTList) + IDLE_THREAD_STACK_SIZE + + (sizeof(Thread) + sizeof(struct intctx) + sizeof(struct extctx) + + INT_REQUIRED_STACK) * 2); + test_println(" bytes"); + test_print("--- Thread: "); + test_printn(sizeof(Thread)); + test_println(" bytes"); + test_print("--- Timer : "); + test_printn(sizeof(VirtualTimer)); + test_println(" bytes"); + test_print("--- Semaph: "); + test_printn(sizeof(Semaphore)); + test_println(" bytes"); +#if CH_USE_EVENTS + test_print("--- EventS: "); + test_printn(sizeof(EventSource)); + test_println(" bytes"); + test_print("--- EventL: "); + test_printn(sizeof(EventListener)); + test_println(" bytes"); +#endif +#if CH_USE_MUTEXES + test_print("--- Mutex : "); + test_printn(sizeof(Mutex)); + test_println(" bytes"); +#endif +#if CH_USE_CONDVARS + test_print("--- CondV.: "); + test_printn(sizeof(CondVar)); + test_println(" bytes"); +#endif +#if CH_USE_QUEUES + test_print("--- Queue : "); + test_printn(sizeof(GenericQueue)); + test_println(" bytes"); +#endif +#if CH_USE_MAILBOXES + test_print("--- MailB.: "); + test_printn(sizeof(Mailbox)); + test_println(" bytes"); +#endif +} + +const struct testcase testbmk13 = { + bmk13_gettest, + NULL, + NULL, + bmk13_execute +}; + /* * Test sequence for benchmarks pattern. */ @@ -697,6 +763,7 @@ const struct testcase * const patternbmk[] = { #if CH_USE_MUTEXES &testbmk12, #endif + &testbmk13, #endif NULL }; -- cgit v1.2.3 From 5c75ead6a5bfb30df949f69e2fd3c90c62ac233f Mon Sep 17 00:00:00 2001 From: gdisirio Date: Sun, 13 Sep 2009 12:25:29 +0000 Subject: git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@1163 35acf78f-673a-0410-8e92-d51de3d6d3f4 --- test/coverage/chcore.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'test') diff --git a/test/coverage/chcore.c b/test/coverage/chcore.c index b5191aa6c..9ec3dd9f5 100644 --- a/test/coverage/chcore.c +++ b/test/coverage/chcore.c @@ -60,7 +60,7 @@ void ChkIntSources(void) { bool_t rflag = FALSE; if (sd_lld_interrupt_pending()) { - if (chSchRescRequiredI()) + if (chSchIsRescRequiredExI()) rflag = TRUE; } @@ -69,7 +69,7 @@ void ChkIntSources(void) { if (n.QuadPart > nextcnt.QuadPart) { nextcnt.QuadPart += slice.QuadPart; chSysTimerHandlerI(); - if (chSchRescRequiredI()) + if (chSchIsRescRequiredExI()) rflag = TRUE; } -- cgit v1.2.3 From 9b59b00627e0e068d6e63da7f21ee54d709a46c2 Mon Sep 17 00:00:00 2001 From: gdisirio Date: Sat, 19 Sep 2009 08:00:34 +0000 Subject: Improved makefiles. git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@1166 35acf78f-673a-0410-8e92-d51de3d6d3f4 --- test/coverage/Makefile | 9 +++++---- test/test.mk | 20 +++++++++++++------- 2 files changed, 18 insertions(+), 11 deletions(-) (limited to 'test') diff --git a/test/coverage/Makefile b/test/coverage/Makefile index 69f55884e..fb069123c 100644 --- a/test/coverage/Makefile +++ b/test/coverage/Makefile @@ -57,20 +57,21 @@ UDEFS = UADEFS = # Imported source files -include ../../os/kernel/kernel.mk -include ../../test/test.mk +CHIBIOS = ../.. +include ${CHIBIOS}/os/kernel/kernel.mk +include ${CHIBIOS}/test/test.mk # List C source files here SRC = ${KERNSRC} \ ${TESTSRC} \ - ../../os/io/serial.c \ + ${CHIBIOS}/os/io/serial.c \ chcore.c serial_lld.c main.c # List ASM source files here ASRC = # List all user directories here -UINCDIR = $(KERNINC) $(TESTINC) ../../os/io +UINCDIR = $(KERNINC) $(TESTINC) ${CHIBIOS}/os/io # List the user directory to look for the libraries here ULIBDIR = diff --git a/test/test.mk b/test/test.mk index 2a3e1a4f9..3f740288c 100644 --- a/test/test.mk +++ b/test/test.mk @@ -1,10 +1,16 @@ # List of all the ChibiOS/RT test files. -TESTSRC = ../../test/test.c ../../test/testthd.c \ - ../../test/testsem.c ../../test/testmtx.c \ - ../../test/testmsg.c ../../test/testmbox.c \ - ../../test/testevt.c ../../test/testheap.c \ - ../../test/testpools.c ../../test/testdyn.c \ - ../../test/testqueues.c ../../test/testbmk.c +TESTSRC = ${CHIBIOS}/test/test.c \ + ${CHIBIOS}/test/testthd.c \ + ${CHIBIOS}/test/testsem.c \ + ${CHIBIOS}/test/testmtx.c \ + ${CHIBIOS}/test/testmsg.c \ + ${CHIBIOS}/test/testmbox.c \ + ${CHIBIOS}/test/testevt.c \ + ${CHIBIOS}/test/testheap.c \ + ${CHIBIOS}/test/testpools.c \ + ${CHIBIOS}/test/testdyn.c \ + ${CHIBIOS}/test/testqueues.c \ + ${CHIBIOS}/test/testbmk.c # Required include directories -TESTINC = ../../test +TESTINC = ${CHIBIOS}/test -- cgit v1.2.3 From ff9c595c546a254a25c84827d99f7f4f6d1b7101 Mon Sep 17 00:00:00 2001 From: gdisirio Date: Sat, 19 Sep 2009 09:20:22 +0000 Subject: git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@1168 35acf78f-673a-0410-8e92-d51de3d6d3f4 --- test/testbmk.c | 3 +++ 1 file changed, 3 insertions(+) (limited to 'test') diff --git a/test/testbmk.c b/test/testbmk.c index 03531d028..0e5c482f8 100644 --- a/test/testbmk.c +++ b/test/testbmk.c @@ -438,6 +438,9 @@ static msg_t thread8(void *p) { chThdYield(); chThdYield(); (*(uint32_t *)p) += 4; +#if defined(WIN32) + ChkIntSources(); +#endif } while(!chThdShouldTerminate()); return 0; } -- cgit v1.2.3 From 2c46df1916a25b7880416aee974a518cc607717a Mon Sep 17 00:00:00 2001 From: gdisirio Date: Fri, 16 Oct 2009 17:45:19 +0000 Subject: New heap manager. git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@1221 35acf78f-673a-0410-8e92-d51de3d6d3f4 --- test/test.c | 8 +--- test/test.h | 17 +++++--- test/testdyn.c | 66 ++++++++++++++++-------------- test/testheap.c | 119 +++++++++++++++++++++++++++--------------------------- test/testmbox.c | 4 +- test/testqueues.c | 4 +- 6 files changed, 114 insertions(+), 104 deletions(-) (limited to 'test') diff --git a/test/test.c b/test/test.c index 434ef1b8c..bbeb9adc4 100644 --- a/test/test.c +++ b/test/test.c @@ -59,11 +59,7 @@ static char *tokp; * Static working areas, the following areas can be used for threads or * used as temporary buffers. */ -WORKING_AREA(waT0, THREADS_STACK_SIZE); -WORKING_AREA(waT1, THREADS_STACK_SIZE); -WORKING_AREA(waT2, THREADS_STACK_SIZE); -WORKING_AREA(waT3, THREADS_STACK_SIZE); -WORKING_AREA(waT4, THREADS_STACK_SIZE); +union test_buffers test; /* * Pointers to the spawned threads. @@ -73,7 +69,7 @@ Thread *threads[MAX_THREADS]; /* * Pointers to the working areas. */ -void * const wa[5] = {waT0, waT1, waT2, waT3, waT4}; +void * const wa[5] = {test.waT0, test.waT1, test.waT2, test.waT3, test.waT4}; /* * Console output. diff --git a/test/test.h b/test/test.h index fca9da8b1..7b261b553 100644 --- a/test/test.h +++ b/test/test.h @@ -47,6 +47,17 @@ struct testcase { void (*execute)(void); }; +union test_buffers { + struct { + WORKING_AREA(waT0, THREADS_STACK_SIZE); + WORKING_AREA(waT1, THREADS_STACK_SIZE); + WORKING_AREA(waT2, THREADS_STACK_SIZE); + WORKING_AREA(waT3, THREADS_STACK_SIZE); + WORKING_AREA(waT4, THREADS_STACK_SIZE); + }; + uint8_t buffer[WA_SIZE * 5]; +}; + #ifdef __cplusplus extern "C" { #endif @@ -94,11 +105,7 @@ extern "C" { } extern Thread *threads[MAX_THREADS]; -extern WORKING_AREA(waT0, THREADS_STACK_SIZE); -extern WORKING_AREA(waT1, THREADS_STACK_SIZE); -extern WORKING_AREA(waT2, THREADS_STACK_SIZE); -extern WORKING_AREA(waT3, THREADS_STACK_SIZE); -extern WORKING_AREA(waT4, THREADS_STACK_SIZE); +extern union test_buffers test; extern void * const wa[]; extern bool_t test_timer_done; diff --git a/test/testdyn.c b/test/testdyn.c index 44e6ffaa4..07c3f92a0 100644 --- a/test/testdyn.c +++ b/test/testdyn.c @@ -70,50 +70,56 @@ static msg_t thread(void *p) { } #if CH_USE_HEAP + +static MemoryHeap heap1; + static char *dyn1_gettest(void) { return "Dynamic APIs, threads creation from heap"; } +static void dyn1_setup(void) { + + chHeapInit(&heap1, test.buffer, sizeof(union test_buffers)); +} + static void dyn1_execute(void) { size_t n, sz; void *p1; tprio_t prio = chThdGetPriority(); - /* Test skipped if the heap is already fragmented. */ - if ((n = chHeapStatus(&sz)) == 1) { - /* Starting threads from the heap. */ - threads[0] = chThdCreateFromHeap(THD_WA_SIZE(THREADS_STACK_SIZE), - prio-1, thread, "A"); - threads[1] = chThdCreateFromHeap(THD_WA_SIZE(THREADS_STACK_SIZE), - prio-2, thread, "B"); - /* Allocating the whole heap in order to make the thread creation fail.*/ - (void)chHeapStatus(&n); - p1 = chHeapAlloc(n); - threads[2] = chThdCreateFromHeap(THD_WA_SIZE(THREADS_STACK_SIZE), - prio-3, thread, "C"); - chHeapFree(p1); - - test_assert(1, (threads[0] != NULL) && - (threads[1] != NULL) && - (threads[2] == NULL) && - (threads[3] == NULL) && - (threads[4] == NULL), - "thread creation failed"); - - /* Claiming the memory from terminated threads. */ - test_wait_threads(); - test_assert_sequence(2, "AB"); - - /* Heap status checked again.*/ - test_assert(3, chHeapStatus(&n) == 1, "heap fragmented"); - test_assert(4, n == sz, "heap size changed"); - } + (void)chHeapStatus(&heap1, &sz); + /* Starting threads from the heap. */ + threads[0] = chThdCreateFromHeap(&heap1, THD_WA_SIZE(THREADS_STACK_SIZE), + prio-1, thread, "A"); + threads[1] = chThdCreateFromHeap(&heap1, THD_WA_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); + threads[2] = chThdCreateFromHeap(&heap1, THD_WA_SIZE(THREADS_STACK_SIZE), + prio-3, thread, "C"); + chHeapFree(p1); + + test_assert(1, (threads[0] != NULL) && + (threads[1] != NULL) && + (threads[2] == NULL) && + (threads[3] == NULL) && + (threads[4] == NULL), + "thread creation failed"); + + /* Claiming the memory from terminated threads. */ + test_wait_threads(); + test_assert_sequence(2, "AB"); + + /* Heap status checked again.*/ + test_assert(3, chHeapStatus(&heap1, &n) == 1, "heap fragmented"); + test_assert(4, n == sz, "heap size changed"); } const struct testcase testdyn1 = { dyn1_gettest, - NULL, + dyn1_setup, NULL, dyn1_execute }; diff --git a/test/testheap.c b/test/testheap.c index 6e68c11be..6545893ce 100644 --- a/test/testheap.c +++ b/test/testheap.c @@ -50,6 +50,8 @@ #define SIZE 16 +static MemoryHeap test_heap; + /** * @page test_heap_001 Allocation and fragmentation test * @@ -66,74 +68,73 @@ static char *heap1_gettest(void) { return "Heap, allocation and fragmentation test"; } +static void heap1_setup(void) { + + chHeapInit(&test_heap, test.buffer, sizeof(union test_buffers)); +} + static void heap1_execute(void) { void *p1, *p2, *p3; size_t n, sz; /* Test skipped if the heap is already fragmented. */ - if ((n = chHeapStatus(&sz)) == 1) { - test_print("--- Size : "); - test_printn(sz); - test_println(" bytes, not fragmented"); - - /* Same order */ - p1 = chHeapAlloc(SIZE); - p2 = chHeapAlloc(SIZE); - p3 = chHeapAlloc(SIZE); - chHeapFree(p1); /* Does not merge */ - chHeapFree(p2); /* Merges backward */ - chHeapFree(p3); /* Merges both sides */ - test_assert(1, chHeapStatus(&n) == 1, "heap fragmented"); - - /* Reverse order */ - p1 = chHeapAlloc(SIZE); - p2 = chHeapAlloc(SIZE); - p3 = chHeapAlloc(SIZE); - chHeapFree(p3); /* Merges forward */ - chHeapFree(p2); /* Merges forward */ - chHeapFree(p1); /* Merges forward */ - test_assert(2, chHeapStatus(&n) == 1, "heap fragmented"); - - /* Small fragments handling */ - p1 = chHeapAlloc(SIZE + 1); - p2 = chHeapAlloc(SIZE); - chHeapFree(p1); - test_assert(3, chHeapStatus(&n) == 2, "invalid state"); - p1 = chHeapAlloc(SIZE); - test_assert(4, chHeapStatus(&n) == 1, "heap fragmented"); - chHeapFree(p2); - chHeapFree(p1); - test_assert(5, chHeapStatus(&n) == 1, "heap fragmented"); - - /* Skip fragment handling */ - p1 = chHeapAlloc(SIZE); - p2 = chHeapAlloc(SIZE); - chHeapFree(p1); - test_assert(6, chHeapStatus(&n) == 2, "invalid state"); - p1 = chHeapAlloc(SIZE * 2); /* Skips first fragment */ - chHeapFree(p1); - chHeapFree(p2); - test_assert(7, chHeapStatus(&n) == 1, "heap fragmented"); - - /* Allocate all handling */ - (void)chHeapStatus(&n); - p1 = chHeapAlloc(n); - test_assert(8, chHeapStatus(&n) == 0, "not empty"); - chHeapFree(p1); - - test_assert(9, chHeapStatus(&n) == 1, "heap fragmented"); - test_assert(10, n == sz, "size changed"); - } - else { - test_print("--- Size : "); - test_printn(sz); - test_println(" bytes, fragmented, test skipped"); - } + (void)chHeapStatus(&test_heap, &sz); + test_print("--- Size : "); + test_printn(sz); + test_println(" bytes"); + + /* Same order */ + p1 = chHeapAlloc(&test_heap, SIZE); + p2 = chHeapAlloc(&test_heap, SIZE); + p3 = chHeapAlloc(&test_heap, SIZE); + chHeapFree(p1); /* Does not merge */ + chHeapFree(p2); /* Merges backward */ + chHeapFree(p3); /* Merges both sides */ + test_assert(1, chHeapStatus(&test_heap, &n) == 1, "heap fragmented"); + + /* Reverse order */ + p1 = chHeapAlloc(&test_heap, SIZE); + p2 = chHeapAlloc(&test_heap, SIZE); + p3 = chHeapAlloc(&test_heap, SIZE); + chHeapFree(p3); /* Merges forward */ + chHeapFree(p2); /* Merges forward */ + chHeapFree(p1); /* Merges forward */ + test_assert(2, chHeapStatus(&test_heap, &n) == 1, "heap fragmented"); + + /* Small fragments handling */ + p1 = chHeapAlloc(&test_heap, SIZE + 1); + p2 = chHeapAlloc(&test_heap, SIZE); + chHeapFree(p1); + test_assert(3, chHeapStatus(&test_heap, &n) == 2, "invalid state"); + p1 = chHeapAlloc(&test_heap, SIZE); + test_assert(4, chHeapStatus(&test_heap, &n) == 1, "heap fragmented"); + chHeapFree(p2); + chHeapFree(p1); + test_assert(5, chHeapStatus(&test_heap, &n) == 1, "heap fragmented"); + + /* Skip fragment handling */ + p1 = chHeapAlloc(&test_heap, SIZE); + p2 = chHeapAlloc(&test_heap, SIZE); + chHeapFree(p1); + test_assert(6, chHeapStatus(&test_heap, &n) == 2, "invalid state"); + p1 = chHeapAlloc(&test_heap, SIZE * 2); /* Skips first fragment */ + chHeapFree(p1); + chHeapFree(p2); + test_assert(7, chHeapStatus(&test_heap, &n) == 1, "heap fragmented"); + + /* Allocate all handling */ + (void)chHeapStatus(&test_heap, &n); + p1 = chHeapAlloc(&test_heap, n); + test_assert(8, chHeapStatus(&test_heap, &n) == 0, "not empty"); + chHeapFree(p1); + + test_assert(9, chHeapStatus(&test_heap, &n) == 1, "heap fragmented"); + test_assert(10, n == sz, "size changed"); } const struct testcase testheap1 = { heap1_gettest, - NULL, + heap1_setup, NULL, heap1_execute }; diff --git a/test/testmbox.c b/test/testmbox.c index 96cf543ce..3c23cf937 100644 --- a/test/testmbox.c +++ b/test/testmbox.c @@ -59,7 +59,7 @@ * variables are explicitly initialized in each test case. It is done in order * to test the macros. */ -static MAILBOX_DECL(mb1, waT0, MB_SIZE); +static MAILBOX_DECL(mb1, test.waT0, MB_SIZE); /** * @page test_mbox_001 Queuing and timeouts @@ -77,7 +77,7 @@ static char *mbox1_gettest(void) { static void mbox1_setup(void) { - chMBInit(&mb1, (msg_t *)waT0, MB_SIZE); + chMBInit(&mb1, (msg_t *)test.waT0, MB_SIZE); } static void mbox1_execute(void) { diff --git a/test/testqueues.c b/test/testqueues.c index aff42334c..e5e3a4c0b 100644 --- a/test/testqueues.c +++ b/test/testqueues.c @@ -63,8 +63,8 @@ static void notify(void) {} * variables are explicitly initialized in each test case. It is done in order * to test the macros. */ -static INPUTQUEUE_DECL(iq, waT0, TEST_QUEUES_SIZE, notify); -static OUTPUTQUEUE_DECL(oq, waT0, TEST_QUEUES_SIZE, notify); +static INPUTQUEUE_DECL(iq, test.waT0, TEST_QUEUES_SIZE, notify); +static OUTPUTQUEUE_DECL(oq, test.waT1, TEST_QUEUES_SIZE, notify); /** * @page test_queues_001 Input Queues functionality and APIs -- cgit v1.2.3 From a7cfbdaf10a03aa10236958bdba38479b301fc4f Mon Sep 17 00:00:00 2001 From: gdisirio Date: Sat, 17 Oct 2009 08:05:52 +0000 Subject: Coverage for the new modules. git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@1225 35acf78f-673a-0410-8e92-d51de3d6d3f4 --- test/coverage/chconf.h | 254 +++++++++++++++++++++++++++++++++---------------- test/testheap.c | 62 ++++++------ 2 files changed, 205 insertions(+), 111 deletions(-) (limited to 'test') diff --git a/test/coverage/chconf.h b/test/coverage/chconf.h index a45650258..50aa1a98b 100644 --- a/test/coverage/chconf.h +++ b/test/coverage/chconf.h @@ -18,9 +18,9 @@ */ /** - * @file src/templates/chconf.h + * @file templates/chconf.h * @brief Configuration file template. - * @addtogroup Config + * @addtogroup config * @{ */ @@ -32,29 +32,36 @@ /*===========================================================================*/ /** - * Frequency of the system timer that drives the system ticks. This also - * defines the system tick time unit. + * @brief System tick frequency. + * @details Frequency of the system timer that drives the system ticks. This + * setting also defines the system tick time unit. */ #if !defined(CH_FREQUENCY) || defined(__DOXYGEN__) #define CH_FREQUENCY 1000 #endif /** - * This constant is the number of system ticks allowed for the threads before - * preemption occurs. This option is only meaningful if the option - * @p CH_USE_ROUNDROBIN is also active. + * @brief Round robin interval. + * @details This constant is the number of system ticks allowed for the + * threads before preemption occurs. Setting this value to zero + * disables the round robin mechanism. + * + * @note Disabling round robin makes the kernel more compact and generally + * faster but forbids multiple threads at the same priority level. */ #if !defined(CH_TIME_QUANTUM) || defined(__DOXYGEN__) #define CH_TIME_QUANTUM 20 #endif /** - * If enabled then the use of nested @p chSysLock() / @p chSysUnlock() - * operations is allowed.
- * For performance and code size reasons the recommended setting is to leave - * this option disabled.
- * You can use this option if you need to merge ChibiOS/RT with external - * libraries that require nested lock/unlock operations. + * @brief Nested locks. + * @details If enabled then the use of nested @p chSysLock() / @p chSysUnlock() + * operations is allowed.
+ * For performance and code size reasons the recommended setting + * is to leave this option disabled.
+ * You may use this option if you need to merge ChibiOS/RT with + * external libraries that require nested lock/unlock operations. + * * @note The default is @p FALSE. */ #if !defined(CH_USE_NESTED_LOCKS) || defined(__DOXYGEN__) @@ -62,23 +69,18 @@ #endif /** - * If specified then the kernel performs the round robin scheduling algorithm - * on threads of equal priority. - * @note The default is @p TRUE. - */ -#if !defined(CH_USE_ROUNDROBIN) || defined(__DOXYGEN__) -#define CH_USE_ROUNDROBIN TRUE -#endif - -/** - * Number of RAM bytes to use as system heap. If set to zero then the whole - * available RAM is used as system heap. - * @note In order to use the whole RAM as system heap the linker script must + * @brief Managed RAM size. + * @details Size of the RAM area to be managed by the OS. If set to zero + * then the whole available RAM is used. The core memory is made + * available to the heap allocator and/or can be used directly through + * the simplified core memory allocator. + * + * @note In order to let the OS manage the whole RAM the linker script must * provide the @p __heap_base__ and @p __heap_end__ symbols. - * @note Requires @p CH_USE_HEAP. + * @note Requires @p CH_USE_COREMEM. */ -#if !defined(CH_HEAP_SIZE) || defined(__DOXYGEN__) -#define CH_HEAP_SIZE 0x20000 +#if !defined(CH_MEMCORE_SIZE) || defined(__DOXYGEN__) +#define CH_MEMCORE_SIZE 0x20000 #endif /*===========================================================================*/ @@ -86,8 +88,10 @@ /*===========================================================================*/ /** - * If specified then time efficient rather than space efficient code is used - * when two possible implementations exist. + * @brief OS optimization. + * @details If enabled then time efficient rather than space efficient code + * is used when two possible implementations exist. + * * @note This is not related to the compiler optimization options. * @note The default is @p TRUE. */ @@ -96,18 +100,20 @@ #endif /** - * If enabled defines a CPU register to be used as storage for the global - * @p currp variable. Caching this variable in a register can greatly - * improve both space and time efficiency of the generated code. Another side - * effect is that one less register has to be saved during the context switch - * resulting in lower RAM usage and faster code. + * @brief Exotic optimization. + * @details If defined then a CPU register is used as storage for the global + * @p currp variable. Caching this variable in a register greatly + * improves both space and time OS efficiency. A side effect is that + * one less register has to be saved during the context switch + * resulting in lower RAM usage and faster context switch. + * * @note This option is only usable with the GCC compiler and is only useful * on processors with many registers like ARM cores. * @note If this option is enabled then ALL the libraries linked to the * ChibiOS/RT code must be recompiled with the GCC option @p * -ffixed-@. * @note This option must be enabled in the Makefile, it is listed here for - * documentation. + * documentation only. */ #if defined(__DOXYGEN__) #define CH_CURRP_REGISTER_CACHE "reg" @@ -118,7 +124,10 @@ /*===========================================================================*/ /** - * If specified then the @p chThdWait() function is included in the kernel. + * @brief Threads synchronization APIs. + * @details If enabled then the @p chThdWait() function is included in + * the kernel. + * * @note The default is @p TRUE. */ #if !defined(CH_USE_WAITEXIT) || defined(__DOXYGEN__) @@ -126,7 +135,9 @@ #endif /** - * If specified then the Semaphores APIs are included in the kernel. + * @brief Semaphores APIs. + * @details If enabled then the Semaphores APIs are included in the kernel. + * * @note The default is @p TRUE. */ #if !defined(CH_USE_SEMAPHORES) || defined(__DOXYGEN__) @@ -134,8 +145,10 @@ #endif /** - * If enabled then the threads are enqueued on semaphores by priority rather - * than FIFO order. + * @brief Semaphores queuing mode. + * @details If enabled then the threads are enqueued on semaphores by + * priority rather than in FIFO order. + * * @note The default is @p FALSE. Enable this if you have special requirements. * @note Requires @p CH_USE_SEMAPHORES. */ @@ -144,8 +157,10 @@ #endif /** - * If specified then the Semaphores the @p chSemWaitSignal() API is included - * in the kernel. + * @brief Atomic semaphore API. + * @details If enabled then the semaphores the @p chSemWaitSignal() API + * is included in the kernel. + * * @note The default is @p TRUE. * @note Requires @p CH_USE_SEMAPHORES. */ @@ -154,7 +169,9 @@ #endif /** - * If specified then the Mutexes APIs are included in the kernel. + * @brief Mutexes APIs. + * @details If enabled then the mutexes APIs are included in the kernel. + * * @note The default is @p TRUE. */ #if !defined(CH_USE_MUTEXES) || defined(__DOXYGEN__) @@ -162,7 +179,10 @@ #endif /** - * If specified then the Conditional Variables APIs are included in the kernel. + * @brief Conditional Variables APIs. + * @details If enabled then the conditional variables APIs are included + * in the kernel. + * * @note The default is @p TRUE. * @note Requires @p CH_USE_MUTEXES. */ @@ -171,7 +191,10 @@ #endif /** - * If specified then the Conditional Variables APIs are included in the kernel. + * @brief Conditional Variables APIs with timeout. + * @details If enabled then the conditional variables APIs with timeout + * specification are included in the kernel. + * * @note The default is @p TRUE. * @note Requires @p CH_USE_CONDVARS. */ @@ -180,7 +203,9 @@ #endif /** - * If specified then the Event flags APIs are included in the kernel. + * @brief Events Flags APIs. + * @details If enabled then the event flags APIs are included in the kernel. + * * @note The default is @p TRUE. */ #if !defined(CH_USE_EVENTS) || defined(__DOXYGEN__) @@ -188,8 +213,10 @@ #endif /** - * If specified then the @p chEvtWaitXXXTimeout() functions are included in - * the kernel. + * @brief Events Flags APIs with timeout. + * @details If enabled then the events APIs with timeout specification + * are included in the kernel. + * * @note The default is @p TRUE. * @note Requires @p CH_USE_EVENTS. */ @@ -198,7 +225,10 @@ #endif /** - * If specified then the Synchronous Messages APIs are included in the kernel. + * @brief Synchronous Messages APIs. + * @details If enabled then the synchronous messages APIs are included + * in the kernel. + * * @note The default is @p TRUE. */ #if !defined(CH_USE_MESSAGES) || defined(__DOXYGEN__) @@ -206,7 +236,10 @@ #endif /** - * If enabled then messages are served by priority rather than in FIFO order. + * @brief Synchronous Messages queuing mode. + * @details If enabled then messages are served by priority rather than in + * FIFO order. + * * @note The default is @p FALSE. Enable this if you have special requirements. * @note Requires @p CH_USE_MESSAGES. */ @@ -215,16 +248,21 @@ #endif /** - * If specified then the Asynchronous Messages (Mailboxes) APIs are included - * in the kernel. + * @brief Mailboxes APIs. + * @details If enabled then the asynchronous messages (mailboxes) APIs are + * included in the kernel. + * * @note The default is @p TRUE. + * @note Requires @p CH_USE_SEMAPHORES. */ #if !defined(CH_USE_MAILBOXES) || defined(__DOXYGEN__) #define CH_USE_MAILBOXES TRUE #endif /** - * If specified then the I/O queues APIs are included in the kernel. + * @brief I/O Queues APIs. + * @details If enabled then the I/O queues APIs are included in the kernel. + * * @note The default is @p TRUE. * @note Requires @p CH_USE_SEMAPHORES. */ @@ -233,9 +271,24 @@ #endif /** - * If specified then the memory heap allocator APIs are included in the kernel. + * @brief Core Memory Manager APIs. + * @details If enabled then the core memory manager APIs are included + * in the kernel. + * + * @note The default is @p TRUE. + */ +#if !defined(CH_USE_HEAP) || defined(__DOXYGEN__) +#define CH_USE_MEMCORE TRUE +#endif + +/** + * @brief Heap Allocator APIs. + * @details If enabled then the memory heap allocator APIs are included + * in the kernel. + * * @note The default is @p TRUE. - * @note Requires @p CH_USE_MUTEXES or @p CH_USE_SEMAPHORES. + * @note Requires @p CH_USE_COREMEM and either @p CH_USE_MUTEXES or + * @p CH_USE_SEMAPHORES. * @note Mutexes are recommended. */ #if !defined(CH_USE_HEAP) || defined(__DOXYGEN__) @@ -243,18 +296,24 @@ #endif /** - * If enabled enforces the use of the C-runtime @p malloc() and @p free() - * functions as backend for the system heap allocator. + * @brief C-runtime allocator. + * @details If enabled the the heap allocator APIs just wrap the C-runtime + * @p malloc() and @p free() functions. + * * @note The default is @p FALSE. * @note Requires @p CH_USE_HEAP. + * @note The C-runtime may or may not require @p CH_USE_COREMEM, see the + * appropriate documentation. */ #if !defined(CH_USE_MALLOC_HEAP) || defined(__DOXYGEN__) #define CH_USE_MALLOC_HEAP FALSE #endif /** - * If specified then the memory pools allocator APIs are included in the - * kernel. + * @brief Memory Pools Allocator APIs. + * @details If enabled then the memory pools allocator APIs are included + * in the kernel. + * * @note The default is @p TRUE. */ #if !defined(CH_USE_MEMPOOLS) || defined(__DOXYGEN__) @@ -262,8 +321,10 @@ #endif /** - * If specified then the dynamic threads creation APIs are included in the - * kernel. + * @brief Dynamic Threads APIs. + * @details If enabled then the dynamic threads creation APIs are included + * in the kernel. + * * @note The default is @p TRUE. * @note Requires @p CH_USE_WAITEXIT. */ @@ -276,8 +337,10 @@ /*===========================================================================*/ /** - * Debug option, if enabled then the checks on the API functions input - * parameters are activated. + * @brief Debug option, parameters checks. + * @details If enabled then the checks on the API functions input + * parameters are activated. + * * @note The default is @p FALSE. */ #if !defined(CH_DBG_ENABLE_CHECKS) || defined(__DOXYGEN__) @@ -285,9 +348,11 @@ #endif /** - * Debug option, if enabled then all the assertions in the kernel code are - * activated. This includes consistency checks inside the kernel, runtime - * anomalies and port-defined checks. + * @brief Debug option, consistency checks. + * @details If enabled then all the assertions in the kernel code are + * activated. This includes consistency checks inside the kernel, + * runtime anomalies and port-defined checks. + * * @note The default is @p FALSE. */ #if !defined(CH_DBG_ENABLE_ASSERTS) || defined(__DOXYGEN__) @@ -295,8 +360,10 @@ #endif /** - * Debug option, if enabled the context switch circular trace buffer is - * activated. + * @brief Debug option, trace buffer. + * @details If enabled then the context switch circular trace buffer is + * activated. + * * @note The default is @p FALSE. */ #if !defined(CH_DBG_ENABLE_TRACE) || defined(__DOXYGEN__) @@ -304,25 +371,37 @@ #endif /** - * Debug option, if enabled a runtime stack check is performed. + * @brief Debug option, stack checks. + * @details If enabled then a runtime stack check is performed. + * + * @note The default is @p FALSE. * @note The stack check is performed in a architecture/port dependent way. It - * may not be implemented at all. + * may not be implemented or some ports. */ #if !defined(CH_DBG_ENABLE_STACK_CHECK) || defined(__DOXYGEN__) #define CH_DBG_ENABLE_STACK_CHECK TRUE #endif /** - * Debug option, if enabled the threads working area is filled with a byte - * pattern when a thread is created. + * @brief Debug option, stacks initialization. + * @details If enabled then the threads working area is filled with a byte + * value when a thread is created. This can be useful for the + * runtime measurement of the used stack. + * + * @note The default is @p FALSE. */ #if !defined(CH_DBG_FILL_THREADS) || defined(__DOXYGEN__) #define CH_DBG_FILL_THREADS TRUE #endif /** - * Debug option, if enabled a field is added to the @p Thread structure that - * counts the system ticks occurred while executing the thread. + * @brief Debug option, threads profiling. + * @details If enabled then a field is added to the @p Thread structure that + * counts the system ticks occurred while executing the thread. + * + * @note The default is @p TRUE. + * @note This debug option is defaulted to TRUE because it is required by + * some test cases into the test suite. */ #if !defined(CH_DBG_THREADS_PROFILING) || defined(__DOXYGEN__) #define CH_DBG_THREADS_PROFILING TRUE @@ -333,39 +412,46 @@ /*===========================================================================*/ /** - * User fields added to the end of the @p Thread structure. + * @brief Threads descriptor structure hook. + * @details User fields added to the end of the @p Thread structure. */ #if !defined(THREAD_EXT_FIELDS) || defined(__DOXYGEN__) #define THREAD_EXT_FIELDS \ struct { \ - /* Add thread custom fields here.*/ \ - /* The thread termination \p EventSource.*/ \ + /* Add threads custom fields here.*/ \ }; #endif /** - * User initialization code added to the @p chThdInit() API. - * @note It is invoked from within @p chThdInit(). + * @brief Threads initialization hook. + * @details User initialization code added to the @p chThdInit() API. + * + * @note It is invoked from within @p chThdInit() and implicitily from all + * the threads creation APIs. */ #if !defined(THREAD_EXT_INIT) || defined(__DOXYGEN__) #define THREAD_EXT_INIT(tp) { \ - /* Add thread initialization code here.*/ \ + /* Add threads initialization code here.*/ \ } #endif /** - * User finalization code added to the @p chThdExit() API. + * @brief Threads finalization hook. + * @details User finalization code added to the @p chThdExit() API. + * * @note It is inserted into lock zone. + * @note It is also invoked when the threads simply return in order to + * terminate. */ #if !defined(THREAD_EXT_EXIT) || defined(__DOXYGEN__) #define THREAD_EXT_EXIT(tp) { \ - /* Add thread finalization code here.*/ \ + /* Add threads finalization code here.*/ \ } #endif /** - * Code inserted inside the idle thread loop immediately after an interrupt - * resumed execution. + * @brief Idle Loop hook. + * @details This hook is continuously invoked by the idle thread loop. */ #if !defined(IDLE_LOOP_HOOK) || defined(__DOXYGEN__) #define IDLE_LOOP_HOOK() { \ diff --git a/test/testheap.c b/test/testheap.c index 6545893ce..ba839e6d4 100644 --- a/test/testheap.c +++ b/test/testheap.c @@ -77,59 +77,67 @@ static void heap1_execute(void) { void *p1, *p2, *p3; size_t n, sz; - /* Test skipped if the heap is already fragmented. */ + /* + * Test on the default heap in order to cover the core allocator at + * least one time. + */ + (void)chHeapStatus(NULL, &sz); + p1 = chHeapAlloc(NULL, SIZE); + test_assert(1, p1 != NULL, "allocation failed"); + chHeapFree(p1); + p1 = chHeapAlloc(NULL, 0x1000000); + test_assert(2, p1 == NULL, "allocation not failed"); + + /* Initial local heap state.*/ (void)chHeapStatus(&test_heap, &sz); - test_print("--- Size : "); - test_printn(sz); - test_println(" bytes"); - /* Same order */ + /* Same order.*/ p1 = chHeapAlloc(&test_heap, SIZE); p2 = chHeapAlloc(&test_heap, SIZE); p3 = chHeapAlloc(&test_heap, SIZE); - chHeapFree(p1); /* Does not merge */ - chHeapFree(p2); /* Merges backward */ - chHeapFree(p3); /* Merges both sides */ - test_assert(1, chHeapStatus(&test_heap, &n) == 1, "heap fragmented"); + chHeapFree(p1); /* Does not merge.*/ + chHeapFree(p2); /* Merges backward.*/ + chHeapFree(p3); /* Merges both sides.*/ + test_assert(3, chHeapStatus(&test_heap, &n) == 1, "heap fragmented"); - /* Reverse order */ + /* Reverse order.*/ p1 = chHeapAlloc(&test_heap, SIZE); p2 = chHeapAlloc(&test_heap, SIZE); p3 = chHeapAlloc(&test_heap, SIZE); - chHeapFree(p3); /* Merges forward */ - chHeapFree(p2); /* Merges forward */ - chHeapFree(p1); /* Merges forward */ - test_assert(2, chHeapStatus(&test_heap, &n) == 1, "heap fragmented"); + chHeapFree(p3); /* Merges forward.*/ + chHeapFree(p2); /* Merges forward.*/ + chHeapFree(p1); /* Merges forward.*/ + test_assert(4, chHeapStatus(&test_heap, &n) == 1, "heap fragmented"); - /* Small fragments handling */ + /* Small fragments handling.*/ p1 = chHeapAlloc(&test_heap, SIZE + 1); p2 = chHeapAlloc(&test_heap, SIZE); chHeapFree(p1); - test_assert(3, chHeapStatus(&test_heap, &n) == 2, "invalid state"); + test_assert(5, chHeapStatus(&test_heap, &n) == 2, "invalid state"); p1 = chHeapAlloc(&test_heap, SIZE); - test_assert(4, chHeapStatus(&test_heap, &n) == 1, "heap fragmented"); + test_assert(6, chHeapStatus(&test_heap, &n) == 1, "heap fragmented"); chHeapFree(p2); chHeapFree(p1); - test_assert(5, chHeapStatus(&test_heap, &n) == 1, "heap fragmented"); + test_assert(7, chHeapStatus(&test_heap, &n) == 1, "heap fragmented"); - /* Skip fragment handling */ + /* Skip fragment handling.*/ p1 = chHeapAlloc(&test_heap, SIZE); p2 = chHeapAlloc(&test_heap, SIZE); chHeapFree(p1); - test_assert(6, chHeapStatus(&test_heap, &n) == 2, "invalid state"); - p1 = chHeapAlloc(&test_heap, SIZE * 2); /* Skips first fragment */ + test_assert(8, chHeapStatus(&test_heap, &n) == 2, "invalid state"); + p1 = chHeapAlloc(&test_heap, SIZE * 2); /* Skips first fragment.*/ chHeapFree(p1); chHeapFree(p2); - test_assert(7, chHeapStatus(&test_heap, &n) == 1, "heap fragmented"); + test_assert(9, chHeapStatus(&test_heap, &n) == 1, "heap fragmented"); - /* Allocate all handling */ + /* Allocate all handling.*/ (void)chHeapStatus(&test_heap, &n); p1 = chHeapAlloc(&test_heap, n); - test_assert(8, chHeapStatus(&test_heap, &n) == 0, "not empty"); + test_assert(10, chHeapStatus(&test_heap, &n) == 0, "not empty"); chHeapFree(p1); - test_assert(9, chHeapStatus(&test_heap, &n) == 1, "heap fragmented"); - test_assert(10, n == sz, "size changed"); + test_assert(11, chHeapStatus(&test_heap, &n) == 1, "heap fragmented"); + test_assert(12, n == sz, "size changed"); } const struct testcase testheap1 = { @@ -139,7 +147,7 @@ const struct testcase testheap1 = { heap1_execute }; -#endif /* CH_USE_HEAP */ +#endif /* CH_USE_HEAP.*/ /* * Test sequence for heap pattern. -- cgit v1.2.3 From 34fd822f84d409fa649934251fae01994de7888b Mon Sep 17 00:00:00 2001 From: gdisirio Date: Sat, 17 Oct 2009 09:21:59 +0000 Subject: git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@1226 35acf78f-673a-0410-8e92-d51de3d6d3f4 --- test/test.h | 2 ++ test/testheap.c | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) (limited to 'test') diff --git a/test/test.h b/test/test.h index 7b261b553..c31caf633 100644 --- a/test/test.h +++ b/test/test.h @@ -47,6 +47,7 @@ struct testcase { void (*execute)(void); }; +#ifndef __DOXYGEN__ union test_buffers { struct { WORKING_AREA(waT0, THREADS_STACK_SIZE); @@ -57,6 +58,7 @@ union test_buffers { }; uint8_t buffer[WA_SIZE * 5]; }; +#endif #ifdef __cplusplus extern "C" { diff --git a/test/testheap.c b/test/testheap.c index ba839e6d4..ce127d2be 100644 --- a/test/testheap.c +++ b/test/testheap.c @@ -85,7 +85,7 @@ static void heap1_execute(void) { p1 = chHeapAlloc(NULL, SIZE); test_assert(1, p1 != NULL, "allocation failed"); chHeapFree(p1); - p1 = chHeapAlloc(NULL, 0x1000000); + p1 = chHeapAlloc(NULL, (size_t)-256); test_assert(2, p1 == NULL, "allocation not failed"); /* Initial local heap state.*/ -- cgit v1.2.3 From 26ed3732876a649fb02a83e768e4392034d65653 Mon Sep 17 00:00:00 2001 From: gdisirio Date: Sat, 17 Oct 2009 10:33:37 +0000 Subject: git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@1229 35acf78f-673a-0410-8e92-d51de3d6d3f4 --- test/test.c | 1 + test/testbmk.c | 5 ++++- test/testevt.c | 7 ++++--- test/testmtx.c | 10 ++++++++++ test/testsem.c | 2 ++ 5 files changed, 21 insertions(+), 4 deletions(-) (limited to 'test') diff --git a/test/test.c b/test/test.c index bbeb9adc4..7a9ad51fc 100644 --- a/test/test.c +++ b/test/test.c @@ -211,6 +211,7 @@ static VirtualTimer vt; bool_t test_timer_done; static void tmr(void *p) { + (void)p; test_timer_done = TRUE; } diff --git a/test/testbmk.c b/test/testbmk.c index 0e5c482f8..dd92dcbf6 100644 --- a/test/testbmk.c +++ b/test/testbmk.c @@ -66,6 +66,7 @@ static Mutex mtx1; static msg_t thread1(void *p) { msg_t msg; + (void)p; do { chMsgRelease(msg = chMsgWait()); } while (msg); @@ -223,6 +224,7 @@ msg_t thread4(void *p) { msg_t msg; Thread *self = chThdSelf(); + (void)p; chSysLock(); do { chSchGoSleepS(PRSUSPENDED); @@ -367,6 +369,7 @@ const struct testcase testbmk6 = { static msg_t thread3(void *p) { + (void)p; while (!chThdShouldTerminate()) chSemWait(&sem1); return 0; @@ -544,7 +547,7 @@ static char *bmk10_gettest(void) { return "Benchmark, virtual timers set/reset"; } -static void tmo(void *param) {} +static void tmo(void *param) {(void)param;} static void bmk10_execute(void) { static VirtualTimer vt1, vt2; diff --git a/test/testevt.c b/test/testevt.c index eb7e9275c..ab9b999ca 100644 --- a/test/testevt.c +++ b/test/testevt.c @@ -84,9 +84,9 @@ static void evt1_setup(void) { chEvtClear(ALL_EVENTS); } -static void h1(eventid_t id) {test_emit_token('A');} -static void h2(eventid_t id) {test_emit_token('B');} -static void h3(eventid_t id) {test_emit_token('C');} +static void h1(eventid_t id) {(void)id;test_emit_token('A');} +static void h2(eventid_t id) {(void)id;test_emit_token('B');} +static void h3(eventid_t id) {(void)id;test_emit_token('C');} static const evhandler_t evhndl[] = {h1, h2, h3}; static void evt1_execute(void) { @@ -151,6 +151,7 @@ static msg_t thread1(void *p) { static msg_t thread2(void *p) { + (void)p; chEvtBroadcast(&es1); chThdSleepMilliseconds(50); chEvtBroadcast(&es2); diff --git a/test/testmtx.c b/test/testmtx.c index 368b98fd9..e2101ae4d 100644 --- a/test/testmtx.c +++ b/test/testmtx.c @@ -165,6 +165,7 @@ static void mtx2_setup(void) { /* Low priority thread */ static msg_t thread2L(void *p) { + (void)p; chMtxLock(&m1); test_cpu_pulse(40); chMtxUnlock(); @@ -176,6 +177,7 @@ static msg_t thread2L(void *p) { /* Medium priority thread */ static msg_t thread2M(void *p) { + (void)p; chThdSleepMilliseconds(20); test_cpu_pulse(40); test_emit_token('B'); @@ -185,6 +187,7 @@ static msg_t thread2M(void *p) { /* High priority thread */ static msg_t thread2H(void *p) { + (void)p; chThdSleepMilliseconds(40); chMtxLock(&m1); test_cpu_pulse(10); @@ -257,6 +260,7 @@ static void mtx3_setup(void) { /* Lowest priority thread */ static msg_t thread3LL(void *p) { + (void)p; chMtxLock(&m1); test_cpu_pulse(30); chMtxUnlock(); @@ -267,6 +271,7 @@ static msg_t thread3LL(void *p) { /* Low priority thread */ static msg_t thread3L(void *p) { + (void)p; chThdSleepMilliseconds(10); chMtxLock(&m2); test_cpu_pulse(20); @@ -282,6 +287,7 @@ static msg_t thread3L(void *p) { /* Medium priority thread */ static msg_t thread3M(void *p) { + (void)p; chThdSleepMilliseconds(20); chMtxLock(&m2); test_cpu_pulse(10); @@ -293,6 +299,7 @@ static msg_t thread3M(void *p) { /* High priority thread */ static msg_t thread3H(void *p) { + (void)p; chThdSleepMilliseconds(40); test_cpu_pulse(20); test_emit_token('B'); @@ -302,6 +309,7 @@ static msg_t thread3H(void *p) { /* Highest priority thread */ static msg_t thread3HH(void *p) { + (void)p; chThdSleepMilliseconds(50); chMtxLock(&m2); test_cpu_pulse(10); @@ -355,6 +363,7 @@ static void mtx4_setup(void) { static msg_t thread4a(void *p) { + (void)p; chThdSleepMilliseconds(50); chMtxLock(&m2); chMtxUnlock(); @@ -363,6 +372,7 @@ static msg_t thread4a(void *p) { static msg_t thread4b(void *p) { + (void)p; chThdSleepMilliseconds(150); chMtxLock(&m1); chMtxUnlock(); diff --git a/test/testsem.c b/test/testsem.c index 77025fc71..a49509a91 100644 --- a/test/testsem.c +++ b/test/testsem.c @@ -135,6 +135,7 @@ static void sem2_setup(void) { static msg_t thread2(void *p) { + (void)p; chThdSleepMilliseconds(50); chSysLock(); chSemSignalI(&sem1); /* For coverage reasons */ @@ -215,6 +216,7 @@ static void sem3_setup(void) { static msg_t thread3(void *p) { + (void)p; chSemWait(&sem1); chSemSignal(&sem1); return 0; -- cgit v1.2.3 From e9d7b9de5705a3b5c0b822077fbd165c86087481 Mon Sep 17 00:00:00 2001 From: gdisirio Date: Sat, 17 Oct 2009 11:07:15 +0000 Subject: git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@1230 35acf78f-673a-0410-8e92-d51de3d6d3f4 --- test/coverage/Makefile | 2 +- test/coverage/chcore.c | 3 ++- test/coverage/main.c | 3 +++ test/coverage/serial_lld.c | 2 ++ 4 files changed, 8 insertions(+), 2 deletions(-) (limited to 'test') diff --git a/test/coverage/Makefile b/test/coverage/Makefile index fb069123c..adefad74b 100644 --- a/test/coverage/Makefile +++ b/test/coverage/Makefile @@ -96,7 +96,7 @@ LIBS = $(DLIBS) $(ULIBS) LDFLAGS = -Wl,-Map=$(PROJECT).map,--cref,--no-warn-mismatch -lgcov $(LIBDIR) ASFLAGS = -Wa,-amhls=$(<:.s=.lst) $(ADEFS) -CPFLAGS = $(OPT) -Wall -Wstrict-prototypes -fverbose-asm -Wa,-alms=$(<:.c=.lst) $(DEFS) +CPFLAGS = $(OPT) -Wall -Wextra -Wstrict-prototypes -fverbose-asm -Wa,-alms=$(<:.c=.lst) $(DEFS) # Generate dependency information CPFLAGS += -MD -MP -MF .dep/$(@F).d diff --git a/test/coverage/chcore.c b/test/coverage/chcore.c index 9ec3dd9f5..6b934ad9a 100644 --- a/test/coverage/chcore.c +++ b/test/coverage/chcore.c @@ -84,8 +84,9 @@ void ChkIntSources(void) { */ __attribute__((used)) static void __dummy(Thread *otp, Thread *ntp) { + (void)otp; (void)ntp; asm volatile (".globl @port_switch@8 \n\t" \ - "@port_switch@8: \n\t" \ + "@port_switch@8: \n\t" \ "push %ebp \n\t" \ "push %esi \n\t" \ "push %edi \n\t" \ diff --git a/test/coverage/main.c b/test/coverage/main.c index 893747546..923fb12c2 100644 --- a/test/coverage/main.c +++ b/test/coverage/main.c @@ -30,6 +30,9 @@ int main(int argc, char *argv[]) { msg_t result; + (void)argc; + (void)argv; + chSysInit(); sdStart(&SD1, NULL); diff --git a/test/coverage/serial_lld.c b/test/coverage/serial_lld.c index 70c073648..e1f3897a1 100644 --- a/test/coverage/serial_lld.c +++ b/test/coverage/serial_lld.c @@ -92,6 +92,7 @@ void sd_lld_init(void) { */ void sd_lld_start(SerialDriver *sdp, const SerialDriverConfig *config) { + (void)sdp; if (config == NULL) config = &default_config; @@ -106,6 +107,7 @@ void sd_lld_start(SerialDriver *sdp, const SerialDriverConfig *config) { */ void sd_lld_stop(SerialDriver *sdp) { + (void)sdp; } bool_t sd_lld_interrupt_pending(void) { -- cgit v1.2.3 From 404fe109397d80016f71c57f42ee6cd0cbfe96d1 Mon Sep 17 00:00:00 2001 From: gdisirio Date: Sat, 17 Oct 2009 15:42:19 +0000 Subject: git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@1236 35acf78f-673a-0410-8e92-d51de3d6d3f4 --- test/testbmk.c | 4 ---- 1 file changed, 4 deletions(-) (limited to 'test') diff --git a/test/testbmk.c b/test/testbmk.c index dd92dcbf6..534ac8a81 100644 --- a/test/testbmk.c +++ b/test/testbmk.c @@ -432,7 +432,6 @@ const struct testcase testbmk7 = { * a second of continuous operations. */ -#if CH_USE_ROUNDROBIN static msg_t thread8(void *p) { do { @@ -482,7 +481,6 @@ const struct testcase testbmk8 = { NULL, bmk8_execute }; -#endif /** * @page test_benchmarks_009 I/O Queues throughput @@ -760,9 +758,7 @@ const struct testcase * const patternbmk[] = { &testbmk5, &testbmk6, &testbmk7, -#if CH_USE_ROUNDROBIN &testbmk8, -#endif &testbmk9, &testbmk10, &testbmk11, -- cgit v1.2.3 From 7d689a5fae4f0950c8cb8e291744465ea5d2ca93 Mon Sep 17 00:00:00 2001 From: gdisirio Date: Tue, 20 Oct 2009 17:26:27 +0000 Subject: git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@1242 35acf78f-673a-0410-8e92-d51de3d6d3f4 --- test/testdyn.c | 2 +- test/testheap.c | 4 ++-- test/testpools.c | 4 ++-- 3 files changed, 5 insertions(+), 5 deletions(-) (limited to 'test') diff --git a/test/testdyn.c b/test/testdyn.c index 07c3f92a0..5b024544f 100644 --- a/test/testdyn.c +++ b/test/testdyn.c @@ -145,7 +145,7 @@ static char *dyn2_gettest(void) { static void dyn2_setup(void) { - chPoolInit(&mp1, THD_WA_SIZE(THREADS_STACK_SIZE)); + chPoolInit(&mp1, THD_WA_SIZE(THREADS_STACK_SIZE), NULL); } static void dyn2_execute(void) { diff --git a/test/testheap.c b/test/testheap.c index ce127d2be..fe06a0cf5 100644 --- a/test/testheap.c +++ b/test/testheap.c @@ -25,10 +25,10 @@ * @page test_heap Memory Heap test * *

Description

- * This module implements the test sequence for the @ref heap subsystem. + * This module implements the test sequence for the @ref heaps subsystem. * *

Objective

- * Objective of the test module is to cover 100% of the @ref heap subsystem. + * Objective of the test module is to cover 100% of the @ref heaps subsystem. * *

Preconditions

* The module requires the following kernel options: diff --git a/test/testpools.c b/test/testpools.c index 97356126e..b48290b87 100644 --- a/test/testpools.c +++ b/test/testpools.c @@ -48,7 +48,7 @@ #if CH_USE_MEMPOOLS -static MEMORYPOOL_DECL(mp1, THD_WA_SIZE(THREADS_STACK_SIZE)); +static MEMORYPOOL_DECL(mp1, THD_WA_SIZE(THREADS_STACK_SIZE), NULL); /** * @page test_pools_001 Allocation and enqueuing test @@ -66,7 +66,7 @@ static char *pools1_gettest(void) { static void pools1_setup(void) { - chPoolInit(&mp1, THD_WA_SIZE(THREADS_STACK_SIZE)); + chPoolInit(&mp1, THD_WA_SIZE(THREADS_STACK_SIZE), NULL); } static void pools1_execute(void) { -- cgit v1.2.3 From bdb7f4ab20bd3daf261ab93dfe733e0ff11dca0f Mon Sep 17 00:00:00 2001 From: gdisirio Date: Tue, 8 Dec 2009 17:37:49 +0000 Subject: git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@1397 35acf78f-673a-0410-8e92-d51de3d6d3f4 --- test/coverage/chcore.c | 4 ++-- test/coverage/main.c | 6 +++--- test/coverage/serial_lld.c | 4 ++-- test/test.c | 2 +- test/testbmk.c | 3 +-- test/testdyn.c | 3 +-- test/testevt.c | 3 +-- test/testheap.c | 3 +-- test/testmbox.c | 3 +-- test/testmsg.c | 3 +-- test/testmtx.c | 3 +-- test/testpools.c | 3 +-- test/testqueues.c | 3 +-- test/testsem.c | 3 +-- test/testthd.c | 3 +-- 15 files changed, 19 insertions(+), 30 deletions(-) (limited to 'test') diff --git a/test/coverage/chcore.c b/test/coverage/chcore.c index 6b934ad9a..3863a9b83 100644 --- a/test/coverage/chcore.c +++ b/test/coverage/chcore.c @@ -25,8 +25,8 @@ * @{ */ -#include -#include +#include "ch.h" +#include "hal.h" static LARGE_INTEGER nextcnt; static LARGE_INTEGER slice; diff --git a/test/coverage/main.c b/test/coverage/main.c index 923fb12c2..929ed622e 100644 --- a/test/coverage/main.c +++ b/test/coverage/main.c @@ -20,9 +20,9 @@ #include #include -#include -#include -#include +#include "ch.h" +#include "hal.h" +#include "test.h" /* * Simulator main. diff --git a/test/coverage/serial_lld.c b/test/coverage/serial_lld.c index e1f3897a1..512a6ebc1 100644 --- a/test/coverage/serial_lld.c +++ b/test/coverage/serial_lld.c @@ -27,8 +27,8 @@ #include #include -#include -#include +#include "ch.h" +#include "hal.h" /** @brief Test serial driver identifier.*/ SerialDriver SD1; diff --git a/test/test.c b/test/test.c index 7a9ad51fc..f4272ca14 100644 --- a/test/test.c +++ b/test/test.c @@ -17,7 +17,7 @@ along with this program. If not, see . */ -#include +#include "ch.h" #include "test.h" #include "testthd.h" diff --git a/test/testbmk.c b/test/testbmk.c index 534ac8a81..35a193221 100644 --- a/test/testbmk.c +++ b/test/testbmk.c @@ -17,8 +17,7 @@ along with this program. If not, see . */ -#include - +#include "ch.h" #include "test.h" /** diff --git a/test/testdyn.c b/test/testdyn.c index 5b024544f..943662e0d 100644 --- a/test/testdyn.c +++ b/test/testdyn.c @@ -17,8 +17,7 @@ along with this program. If not, see . */ -#include - +#include "ch.h" #include "test.h" /** diff --git a/test/testevt.c b/test/testevt.c index ab9b999ca..2bd704696 100644 --- a/test/testevt.c +++ b/test/testevt.c @@ -17,8 +17,7 @@ along with this program. If not, see . */ -#include - +#include "ch.h" #include "test.h" /** diff --git a/test/testheap.c b/test/testheap.c index fe06a0cf5..e157d1c54 100644 --- a/test/testheap.c +++ b/test/testheap.c @@ -17,8 +17,7 @@ along with this program. If not, see . */ -#include - +#include "ch.h" #include "test.h" /** diff --git a/test/testmbox.c b/test/testmbox.c index 3c23cf937..a8947e4ce 100644 --- a/test/testmbox.c +++ b/test/testmbox.c @@ -17,8 +17,7 @@ along with this program. If not, see . */ -#include - +#include "ch.h" #include "test.h" /** diff --git a/test/testmsg.c b/test/testmsg.c index 015639d16..0c920670a 100644 --- a/test/testmsg.c +++ b/test/testmsg.c @@ -17,8 +17,7 @@ along with this program. If not, see . */ -#include - +#include "ch.h" #include "test.h" /** diff --git a/test/testmtx.c b/test/testmtx.c index e2101ae4d..755545593 100644 --- a/test/testmtx.c +++ b/test/testmtx.c @@ -17,8 +17,7 @@ along with this program. If not, see . */ -#include - +#include "ch.h" #include "test.h" /** diff --git a/test/testpools.c b/test/testpools.c index b48290b87..71b1dd230 100644 --- a/test/testpools.c +++ b/test/testpools.c @@ -17,8 +17,7 @@ along with this program. If not, see . */ -#include - +#include "ch.h" #include "test.h" /** diff --git a/test/testqueues.c b/test/testqueues.c index e5e3a4c0b..6989442c4 100644 --- a/test/testqueues.c +++ b/test/testqueues.c @@ -17,8 +17,7 @@ along with this program. If not, see . */ -#include - +#include "ch.h" #include "test.h" /** diff --git a/test/testsem.c b/test/testsem.c index a49509a91..79c42c52f 100644 --- a/test/testsem.c +++ b/test/testsem.c @@ -17,8 +17,7 @@ along with this program. If not, see . */ -#include - +#include "ch.h" #include "test.h" /** diff --git a/test/testthd.c b/test/testthd.c index bc9b40cd1..76110f444 100644 --- a/test/testthd.c +++ b/test/testthd.c @@ -17,8 +17,7 @@ along with this program. If not, see . */ -#include - +#include "ch.h" #include "test.h" /** -- cgit v1.2.3 From 74328c0fc0a8d46c97b954ab153d44ac2891ed04 Mon Sep 17 00:00:00 2001 From: gdisirio Date: Tue, 8 Dec 2009 21:38:05 +0000 Subject: git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@1404 35acf78f-673a-0410-8e92-d51de3d6d3f4 --- test/coverage/Makefile | 14 ++- test/coverage/board.h | 23 +++++ test/coverage/chcore.c | 123 -------------------------- test/coverage/chcore.h | 211 --------------------------------------------- test/coverage/chtypes.h | 47 ---------- test/coverage/console.c | 77 +++++++++++++++++ test/coverage/console.h | 41 +++++++++ test/coverage/halconf.h | 96 +++++++++++++++++++++ test/coverage/main.c | 8 +- test/coverage/serial_lld.c | 118 ------------------------- test/coverage/serial_lld.h | 124 -------------------------- 11 files changed, 251 insertions(+), 631 deletions(-) create mode 100644 test/coverage/board.h delete mode 100644 test/coverage/chcore.c delete mode 100644 test/coverage/chcore.h delete mode 100644 test/coverage/chtypes.h create mode 100644 test/coverage/console.c create mode 100644 test/coverage/console.h create mode 100644 test/coverage/halconf.h delete mode 100644 test/coverage/serial_lld.c delete mode 100644 test/coverage/serial_lld.h (limited to 'test') diff --git a/test/coverage/Makefile b/test/coverage/Makefile index adefad74b..37d0de1ef 100644 --- a/test/coverage/Makefile +++ b/test/coverage/Makefile @@ -58,20 +58,26 @@ UADEFS = # Imported source files CHIBIOS = ../.. +include ${CHIBIOS}/os/hal/hal.mk +include ${CHIBIOS}/os/hal/platforms/Win32/platform.mk +include ${CHIBIOS}/os/ports/GCC/SIMIA32/port.mk include ${CHIBIOS}/os/kernel/kernel.mk include ${CHIBIOS}/test/test.mk # List C source files here -SRC = ${KERNSRC} \ +SRC = ${PORTSRC} \ + ${KERNSRC} \ ${TESTSRC} \ - ${CHIBIOS}/os/io/serial.c \ - chcore.c serial_lld.c main.c + ${HALSRC} \ + ${PLATFORMSRC} \ + console.c main.c # List ASM source files here ASRC = # List all user directories here -UINCDIR = $(KERNINC) $(TESTINC) ${CHIBIOS}/os/io +UINCDIR = $(PORTINC) $(KERNINC) $(TESTINC) $(HALINC) $(PLATFORMINC) \ + ${CHIBIOS}/os/various # List the user directory to look for the libraries here ULIBDIR = diff --git a/test/coverage/board.h b/test/coverage/board.h new file mode 100644 index 000000000..a6e056d58 --- /dev/null +++ b/test/coverage/board.h @@ -0,0 +1,23 @@ +/* + ChibiOS/RT - Copyright (C) 2006-2007 Giovanni Di Sirio. + + This file is part of ChibiOS/RT. + + ChibiOS/RT is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 3 of the License, or + (at your option) any later version. + + ChibiOS/RT is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see . +*/ + +#ifndef _BOARD_H_ +#define _BOARD_H_ + +#endif /* _BOARD_H_ */ diff --git a/test/coverage/chcore.c b/test/coverage/chcore.c deleted file mode 100644 index 3863a9b83..000000000 --- a/test/coverage/chcore.c +++ /dev/null @@ -1,123 +0,0 @@ -/* - ChibiOS/RT - Copyright (C) 2006-2007 Giovanni Di Sirio. - - This file is part of ChibiOS/RT. - - ChibiOS/RT is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 3 of the License, or - (at your option) any later version. - - ChibiOS/RT is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program. If not, see . -*/ - -#include -#include - -/** - * @addtogroup WIN32SIM_CORE - * @{ - */ - -#include "ch.h" -#include "hal.h" - -static LARGE_INTEGER nextcnt; -static LARGE_INTEGER slice; - -/* - * Simulated HW initialization. - */ -void InitCore(void) { - printf("ChibiOS/RT test simulator\n\n"); - printf("Thread structure %d bytes\n", sizeof(Thread)); - if (!QueryPerformanceFrequency(&slice)) { - fprintf(stderr, "QueryPerformanceFrequency() error"); - fflush(stderr); - exit(1); - } - printf("Core Frequency %u Hz\n", (int)slice.LowPart); - slice.QuadPart /= CH_FREQUENCY; - QueryPerformanceCounter(&nextcnt); - nextcnt.QuadPart += slice.QuadPart; - - sdInit(); - - fflush(stdout); -} - -/* - * Interrupt simulation. - */ -void ChkIntSources(void) { - LARGE_INTEGER n; - bool_t rflag = FALSE; - - if (sd_lld_interrupt_pending()) { - if (chSchIsRescRequiredExI()) - rflag = TRUE; - } - - // Interrupt Timer simulation (10ms interval). - QueryPerformanceCounter(&n); - if (n.QuadPart > nextcnt.QuadPart) { - nextcnt.QuadPart += slice.QuadPart; - chSysTimerHandlerI(); - if (chSchIsRescRequiredExI()) - rflag = TRUE; - } - - if (rflag) - chSchDoRescheduleI(); -} - -/** - * Performs a context switch between two threads. - * @param otp the thread to be switched out - * @param ntp the thread to be switched in - */ -__attribute__((used)) -static void __dummy(Thread *otp, Thread *ntp) { - (void)otp; (void)ntp; - asm volatile (".globl @port_switch@8 \n\t" \ - "@port_switch@8: \n\t" \ - "push %ebp \n\t" \ - "push %esi \n\t" \ - "push %edi \n\t" \ - "push %ebx \n\t" \ - "movl %esp, 16(%ecx) \n\t" \ - "movl 16(%edx), %esp \n\t" \ - "pop %ebx \n\t" \ - "pop %edi \n\t" \ - "pop %esi \n\t" \ - "pop %ebp \n\t" \ - "ret"); -} - -/** - * Halts the system. In this implementation it just exits the simulation. - */ -__attribute__((fastcall)) -void port_halt(void) { - - fprintf(stderr, "\nHalted\n"); - fflush(stderr); - exit(2); -} - -/** - * Threads return point, it just invokes @p chThdExit(). - */ -void threadexit(void) { - - asm volatile ("push %eax \n\t" \ - "call _chThdExit"); -} - -/** @} */ diff --git a/test/coverage/chcore.h b/test/coverage/chcore.h deleted file mode 100644 index 9347a7d5e..000000000 --- a/test/coverage/chcore.h +++ /dev/null @@ -1,211 +0,0 @@ -/* - ChibiOS/RT - Copyright (C) 2006-2007 Giovanni Di Sirio. - - This file is part of ChibiOS/RT. - - ChibiOS/RT is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 3 of the License, or - (at your option) any later version. - - ChibiOS/RT is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program. If not, see . -*/ - -/** - * @addtogroup WIN32SIM_CORE - * @{ - */ - -#ifndef _CHCORE_H_ -#define _CHCORE_H_ - -/** - * Macro defining the a simulated architecture into Win32. - */ -#define CH_ARCHITECTURE_WIN32SIM - -/** - * Name of the implemented architecture. - */ -#define CH_ARCHITECTURE_NAME "WIN32 Simulator" - -/** - * 32 bit stack alignment. - */ -typedef uint32_t stkalign_t; - -/** - * Generic x86 register. - */ -typedef void *regx86; - -/** - * Interrupt saved context. - * This structure represents the stack frame saved during a preemption-capable - * interrupt handler. - */ -struct extctx { -}; - -/** - * System saved context. - * @note In this demo the floating point registers are not saved. - */ -struct intctx { - regx86 ebx; - regx86 edi; - regx86 esi; - regx86 ebp; - regx86 eip; -}; - -/** - * Platform dependent part of the @p Thread structure. - * This structure usually contains just the saved stack pointer defined as a - * pointer to a @p intctx structure. - */ -struct context { - struct intctx volatile *esp; -}; - -#define APUSH(p, a) (p) -= sizeof(void *), *(void **)(p) = (void*)(a) - -/** - * Platform dependent part of the @p chThdInit() API. - * This code usually setup the context switching frame represented by a - * @p intctx structure. - */ -#define SETUP_CONTEXT(workspace, wsize, pf, arg) { \ - uint8_t *esp = (uint8_t *)workspace + wsize; \ - APUSH(esp, arg); \ - APUSH(esp, threadexit); \ - esp -= sizeof(struct intctx); \ - ((struct intctx *)esp)->eip = pf; \ - ((struct intctx *)esp)->ebx = 0; \ - ((struct intctx *)esp)->edi = 0; \ - ((struct intctx *)esp)->esi = 0; \ - ((struct intctx *)esp)->ebp = 0; \ - tp->p_ctx.esp = (struct intctx *)esp; \ -} - -/** - * Stack size for the system idle thread. - */ -#ifndef IDLE_THREAD_STACK_SIZE -#define IDLE_THREAD_STACK_SIZE 256 -#endif - -/** - * Per-thread stack overhead for interrupts servicing, it is used in the - * calculation of the correct working area size. - * It requires stack space because the simulated "interrupt handlers" invoke - * Win32 APIs inside so it better have a lot of space. - */ -#ifndef INT_REQUIRED_STACK -#define INT_REQUIRED_STACK 16384 -#endif - -/** - * Enforces a correct alignment for a stack area size value. - */ -#define STACK_ALIGN(n) ((((n) - 1) | (sizeof(stkalign_t) - 1)) + 1) - - /** - * Computes the thread working area global size. - */ -#define THD_WA_SIZE(n) STACK_ALIGN(sizeof(Thread) + \ - sizeof(void *) * 2 + \ - sizeof(struct intctx) + \ - sizeof(struct extctx) + \ - (n) + (INT_REQUIRED_STACK)) - -/** - * Macro used to allocate a thread working area aligned as both position and - * size. - */ -#define WORKING_AREA(s, n) stkalign_t s[THD_WA_SIZE(n) / sizeof(stkalign_t)]; - -/** - * IRQ prologue code, inserted at the start of all IRQ handlers enabled to - * invoke system APIs. - */ -#define PORT_IRQ_PROLOGUE() asm volatile ("nop") - -/** - * IRQ epilogue code, inserted at the end of all IRQ handlers enabled to - * invoke system APIs. - */ -#define PORT_IRQ_EPILOGUE() asm volatile ("nop") - -/** - * IRQ handler function declaration. - */ -#define PORT_IRQ_HANDLER(id) void id(void) - -/** - * Simulator initialization. - */ -#define port_init() InitCore() - -/** - * Does nothing in this simulator. - */ -#define port_lock() asm volatile ("nop") - -/** - * Does nothing in this simulator. - */ -#define port_unlock() asm volatile ("nop") - -/** - * Does nothing in this simulator. - */ -#define port_lock_from_isr() asm volatile ("nop") - -/** - * Does nothing in this simulator. - */ -#define port_unlock_from_isr() asm volatile ("nop") - -/** - * Does nothing in this simulator. - */ -#define port_disable() asm volatile ("nop") - -/** - * Does nothing in this simulator. - */ -#define port_suspend() asm volatile ("nop") - -/** - * Does nothing in this simulator. - */ -#define port_enable() asm volatile ("nop") - -/** - * In the simulator this does a polling pass on the simulated interrupt - * sources. - */ -#define port_wait_for_interrupt() ChkIntSources() - -#ifdef __cplusplus -extern "C" { -#endif - __attribute__((fastcall)) void port_switch(Thread *otp, Thread *ntp); - __attribute__((fastcall)) void port_halt(void); - void InitCore(void); - void ChkIntSources(void); - void threadexit(void); -#ifdef __cplusplus -} -#endif - -#endif /* _CHCORE_H_ */ - -/** @} */ diff --git a/test/coverage/chtypes.h b/test/coverage/chtypes.h deleted file mode 100644 index 354da269e..000000000 --- a/test/coverage/chtypes.h +++ /dev/null @@ -1,47 +0,0 @@ -/* - ChibiOS/RT - Copyright (C) 2006-2007 Giovanni Di Sirio. - - This file is part of ChibiOS/RT. - - ChibiOS/RT is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 3 of the License, or - (at your option) any later version. - - ChibiOS/RT is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program. If not, see . -*/ - -#ifndef _CHTYPES_H_ -#define _CHTYPES_H_ - -#define __need_NULL -#define __need_size_t -#define __need_ptrdiff_t -#include - -#if !defined(_STDINT_H) && !defined(__STDINT_H_) -#include -#endif - -typedef int8_t bool_t; -typedef uint8_t tmode_t; -typedef uint8_t tstate_t; -typedef uint32_t tprio_t; -typedef int32_t msg_t; -typedef int32_t eventid_t; -typedef uint32_t eventmask_t; -typedef uint32_t systime_t; -typedef int32_t cnt_t; - -#define INLINE inline -#define PACK_STRUCT_STRUCT __attribute__((packed)) -#define PACK_STRUCT_BEGIN -#define PACK_STRUCT_END - -#endif /* _CHTYPES_H_ */ diff --git a/test/coverage/console.c b/test/coverage/console.c new file mode 100644 index 000000000..d35bc3850 --- /dev/null +++ b/test/coverage/console.c @@ -0,0 +1,77 @@ +/* + ChibiOS/RT - Copyright (C) 2006-2007 Giovanni Di Sirio. + + This file is part of ChibiOS/RT. + + ChibiOS/RT is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 3 of the License, or + (at your option) any later version. + + ChibiOS/RT is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see . +*/ + +/** + * @file console.c + * @brief Simulator console driver code. + * @{ + */ + +#include + +#include "ch.h" +#include "console.h" + +/** + * @brief Console driver 1. + */ +BaseChannel CD1; + +/* + * Interface implementation, the following functions just invoke the equivalent + * queue-level function or macro. + */ +static bool_t putwouldblock(void *ip) { + + (void)ip; + return FALSE; +} + +static bool_t getwouldblock(void *ip) { + + (void)ip; + return FALSE; /******************************/ +} + +static msg_t put(void *ip, uint8_t b, systime_t timeout) { + + (void)ip; + (void)timeout; + fputc(b, stdout); + fflush(stdout); + return RDY_OK; +} + +static msg_t get(void *ip, systime_t timeout) { + + (void)ip; + (void)timeout; + return 0; +} + +static const struct BaseChannelVMT vmt = { + {putwouldblock, getwouldblock, put, get} +}; + +void conInit(void) { + + CD1.vmt = &vmt; +} + +/** @} */ diff --git a/test/coverage/console.h b/test/coverage/console.h new file mode 100644 index 000000000..e8079a042 --- /dev/null +++ b/test/coverage/console.h @@ -0,0 +1,41 @@ +/* + ChibiOS/RT - Copyright (C) 2006-2007 Giovanni Di Sirio. + + This file is part of ChibiOS/RT. + + ChibiOS/RT is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 3 of the License, or + (at your option) any later version. + + ChibiOS/RT is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see . +*/ + +/** + * @file console.h + * @brief Simulator console driver header. + * @{ + */ + +#ifndef _CONSOLE_H_ +#define _CONSOLE_H_ + +extern BaseChannel CD1; + +#ifdef __cplusplus +extern "C" { +#endif + void conInit(void); +#ifdef __cplusplus +} +#endif + +#endif /* _CONSOLE_H_ */ + +/** @} */ diff --git a/test/coverage/halconf.h b/test/coverage/halconf.h new file mode 100644 index 000000000..51a169a37 --- /dev/null +++ b/test/coverage/halconf.h @@ -0,0 +1,96 @@ +/* + ChibiOS/RT - Copyright (C) 2006-2007 Giovanni Di Sirio. + + This file is part of ChibiOS/RT. + + ChibiOS/RT is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 3 of the License, or + (at your option) any later version. + + ChibiOS/RT is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see . +*/ + +/** + * @file templates/halconf.h + * @brief HAL configuration header. + * @addtogroup HAL_CONF + * @{ + */ + +/* + * HAL configuration file, this file allows to enable or disable the various + * device drivers from your application. You may also use this file in order + * to change the device drivers settings found in the low level drivers + * headers, just define here the new settings and those will override the + * defaults defined in the LLD headers. + */ + +#ifndef _HALCONF_H_ +#define _HALCONF_H_ + +/** + * @brief Enables the PAL subsystem. + */ +#if !defined(CH_HAL_USE_PAL) || defined(__DOXYGEN__) +#define CH_HAL_USE_PAL FALSE +#endif + +/** + * @brief Enables the ADC subsystem. + */ +#if !defined(CH_HAL_USE_ADC) || defined(__DOXYGEN__) +#define CH_HAL_USE_ADC FALSE +#endif + +/** + * @brief Enables the CAN subsystem. + */ +#if !defined(CH_HAL_USE_CAN) || defined(__DOXYGEN__) +#define CH_HAL_USE_CAN FALSE +#endif + +/** + * @brief Enables the MAC subsystem. + */ +#if !defined(CH_HAL_USE_MAC) || defined(__DOXYGEN__) +#define CH_HAL_USE_MAC FALSE +#endif + +/** + * @brief Enables the PWM subsystem. + */ +#if !defined(CH_HAL_USE_PWM) || defined(__DOXYGEN__) +#define CH_HAL_USE_PWM FALSE +#endif + +/** + * @brief Enables the SERIAL subsystem. + */ +#if !defined(CH_HAL_USE_SERIAL) || defined(__DOXYGEN__) +#define CH_HAL_USE_SERIAL FALSE +#endif + +/** + * @brief Enables the SPI subsystem. + */ +#if !defined(CH_HAL_USE_SPI) || defined(__DOXYGEN__) +#define CH_HAL_USE_SPI FALSE +#endif + +/** + * @brief Enables the MMC_SPI subsystem. + */ +#if !defined(CH_HAL_USE_MMC_SPI) || defined(__DOXYGEN__) +#define CH_HAL_USE_MMC_SPI FALSE +#endif + +#endif /* _HALCONF_H_ */ + +/** @} */ diff --git a/test/coverage/main.c b/test/coverage/main.c index 929ed622e..80390360d 100644 --- a/test/coverage/main.c +++ b/test/coverage/main.c @@ -23,6 +23,7 @@ #include "ch.h" #include "hal.h" #include "test.h" +#include "console.h" /* * Simulator main. @@ -33,12 +34,11 @@ int main(int argc, char *argv[]) { (void)argc; (void)argv; + halInit(); + conInit(); chSysInit(); - sdStart(&SD1, NULL); - result = TestThread(&SD1); - chThdSleepMilliseconds(1); /* Gives time to flush SD1 output queue */ - fflush(stdout); + result = TestThread(&CD1); if (result) exit(1); else diff --git a/test/coverage/serial_lld.c b/test/coverage/serial_lld.c deleted file mode 100644 index 512a6ebc1..000000000 --- a/test/coverage/serial_lld.c +++ /dev/null @@ -1,118 +0,0 @@ -/* - ChibiOS/RT - Copyright (C) 2006-2007 Giovanni Di Sirio. - - This file is part of ChibiOS/RT. - - ChibiOS/RT is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 3 of the License, or - (at your option) any later version. - - ChibiOS/RT is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program. If not, see . -*/ - -/** - * @file Win32/serial_lld.c - * @brief Win32 low level simulated serial driver code - * @addtogroup WIN32_SERIAL - * @{ - */ - -#include -#include - -#include "ch.h" -#include "hal.h" - -/** @brief Test serial driver identifier.*/ -SerialDriver SD1; - -/** @brief Driver default configuration.*/ -static const SerialDriverConfig default_config = { -}; - -/*===========================================================================*/ -/* Low Level Driver local functions. */ -/*===========================================================================*/ - -static bool_t sd1_conn_chkint(void) { - - return FALSE; -} - -static bool_t sd1_in_chkint(void) { - - return FALSE; -} - -static bool_t sd1_out_chkint(void) { - msg_t n; - bool_t rflag = FALSE; - - while (TRUE) { - n = sdRequestDataI(&SD1); - if (n < 0) { - fflush(stdout); - return rflag; - } - fputc(n, stdout); - rflag = TRUE; - } -} - -/*===========================================================================*/ -/* Low Level Driver interrupt handlers. */ -/*===========================================================================*/ - -/*===========================================================================*/ -/* Low Level Driver exported functions. */ -/*===========================================================================*/ - -/** - * Low level serial driver initialization. - */ -void sd_lld_init(void) { - - sdObjectInit(&SD1, NULL, NULL); -} - -/** - * @brief Low level serial driver configuration and (re)start. - * - * @param[in] sdp pointer to a @p SerialDriver object - * @param[in] config the architecture-dependent serial driver configuration. - * If this parameter is set to @p NULL then a default - * configuration is used. - */ -void sd_lld_start(SerialDriver *sdp, const SerialDriverConfig *config) { - - (void)sdp; - if (config == NULL) - config = &default_config; - -} - -/** - * @brief Low level serial driver stop. - * @details De-initializes the USART, stops the associated clock, resets the - * interrupt vector. - * - * @param[in] sdp pointer to a @p SerialDriver object - */ -void sd_lld_stop(SerialDriver *sdp) { - - (void)sdp; -} - -bool_t sd_lld_interrupt_pending(void) { - - return sd1_conn_chkint() || sd1_in_chkint() || sd1_out_chkint(); -} - -/** @} */ diff --git a/test/coverage/serial_lld.h b/test/coverage/serial_lld.h deleted file mode 100644 index ba3a27b87..000000000 --- a/test/coverage/serial_lld.h +++ /dev/null @@ -1,124 +0,0 @@ -/* - ChibiOS/RT - Copyright (C) 2006-2007 Giovanni Di Sirio. - - This file is part of ChibiOS/RT. - - ChibiOS/RT is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 3 of the License, or - (at your option) any later version. - - ChibiOS/RT is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program. If not, see . -*/ - -/** - * @file Win32/serial_lld.h - * @brief Win32 low level simulated serial driver header - * @addtogroup WIN32_SERIAL - * @{ - */ - -#ifndef _SERIAL_LLD_H_ -#define _SERIAL_LLD_H_ - -#include - -/*===========================================================================*/ -/* Driver pre-compile time settings. */ -/*===========================================================================*/ - -/** - * @brief Serial buffers size. - * @details Configuration parameter, you can change the depth of the queue - * buffers depending on the requirements of your application. - */ -#if !defined(SERIAL_BUFFERS_SIZE) || defined(__DOXYGEN__) -#define SERIAL_BUFFERS_SIZE 1024 -#endif - -/*===========================================================================*/ -/* Unsupported event flags and custom events. */ -/*===========================================================================*/ - -/*===========================================================================*/ -/* Driver data structures and types. */ -/*===========================================================================*/ - -/** - * Serial Driver condition flags type. - */ -typedef uint32_t sdflags_t; - -/** - * @brief @p SerialDriver specific data. - */ -struct _serial_driver_data { - /** - * Input queue, incoming data can be read from this input queue by - * using the queues APIs. - */ - InputQueue iqueue; - /** - * Output queue, outgoing data can be written to this output queue by - * using the queues APIs. - */ - OutputQueue oqueue; - /** - * Status Change @p EventSource. This event is generated when one or more - * condition flags change. - */ - EventSource sevent; - /** - * I/O driver status flags. - */ - sdflags_t flags; - /** - * Input circular buffer. - */ - uint8_t ib[SERIAL_BUFFERS_SIZE]; - /** - * Output circular buffer. - */ - uint8_t ob[SERIAL_BUFFERS_SIZE]; -}; - -/** - * @brief Generic Serial Driver configuration structure. - * @details An instance of this structure must be passed to @p sdStart() - * in order to configure and start a serial driver operations. - * - * @note This structure content is architecture dependent, each driver - * implementation defines its own version and the custom static - * initializers. - */ -typedef struct { -} SerialDriverConfig; - -/*===========================================================================*/ -/* External declarations. */ -/*===========================================================================*/ - -/** @cond never*/ -extern SerialDriver SD1; - -#ifdef __cplusplus -extern "C" { -#endif - void sd_lld_init(void); - void sd_lld_start(SerialDriver *sdp, const SerialDriverConfig *config); - void sd_lld_stop(SerialDriver *sdp); - bool_t sd_lld_interrupt_pending(void); -#ifdef __cplusplus -} -#endif -/** @endcond*/ - -#endif /* _SERIAL_LLD_H_ */ - -/** @} */ -- cgit v1.2.3 From ae568007d949c5ac8e40bbac2b167529fa226fb6 Mon Sep 17 00:00:00 2001 From: gdisirio Date: Wed, 9 Dec 2009 20:29:28 +0000 Subject: git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@1406 35acf78f-673a-0410-8e92-d51de3d6d3f4 --- test/coverage/console.c | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) (limited to 'test') diff --git a/test/coverage/console.c b/test/coverage/console.c index d35bc3850..e6e9a1be8 100644 --- a/test/coverage/console.c +++ b/test/coverage/console.c @@ -33,10 +33,6 @@ */ BaseChannel CD1; -/* - * Interface implementation, the following functions just invoke the equivalent - * queue-level function or macro. - */ static bool_t putwouldblock(void *ip) { (void)ip; @@ -46,7 +42,7 @@ static bool_t putwouldblock(void *ip) { static bool_t getwouldblock(void *ip) { (void)ip; - return FALSE; /******************************/ + return TRUE; } static msg_t put(void *ip, uint8_t b, systime_t timeout) { @@ -62,7 +58,7 @@ static msg_t get(void *ip, systime_t timeout) { (void)ip; (void)timeout; - return 0; + return fgetc(stdin); } static const struct BaseChannelVMT vmt = { -- cgit v1.2.3 From 97b35245d19b59ff87d69fa9f7df701eea8f18c9 Mon Sep 17 00:00:00 2001 From: gdisirio Date: Wed, 9 Dec 2009 21:34:22 +0000 Subject: git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@1410 35acf78f-673a-0410-8e92-d51de3d6d3f4 --- test/coverage/chconf.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'test') diff --git a/test/coverage/chconf.h b/test/coverage/chconf.h index 50aa1a98b..8f172f453 100644 --- a/test/coverage/chconf.h +++ b/test/coverage/chconf.h @@ -277,7 +277,7 @@ * * @note The default is @p TRUE. */ -#if !defined(CH_USE_HEAP) || defined(__DOXYGEN__) +#if !defined(CH_USE_MEMCORE) || defined(__DOXYGEN__) #define CH_USE_MEMCORE TRUE #endif -- cgit v1.2.3 From f64a7dc6bb2ed71e294dc608ce2130891e0aa07b Mon Sep 17 00:00:00 2001 From: gdisirio Date: Fri, 11 Dec 2009 17:00:52 +0000 Subject: git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@1418 35acf78f-673a-0410-8e92-d51de3d6d3f4 --- test/coverage/Makefile | 3 +- test/coverage/console.c | 73 ------------------------------------------------- test/coverage/console.h | 41 --------------------------- 3 files changed, 2 insertions(+), 115 deletions(-) delete mode 100644 test/coverage/console.c delete mode 100644 test/coverage/console.h (limited to 'test') diff --git a/test/coverage/Makefile b/test/coverage/Makefile index 37d0de1ef..788a7bc99 100644 --- a/test/coverage/Makefile +++ b/test/coverage/Makefile @@ -70,7 +70,8 @@ SRC = ${PORTSRC} \ ${TESTSRC} \ ${HALSRC} \ ${PLATFORMSRC} \ - console.c main.c + ${CHIBIOS}/os/hal/platforms/Win32/console.c \ + main.c # List ASM source files here ASRC = diff --git a/test/coverage/console.c b/test/coverage/console.c deleted file mode 100644 index e6e9a1be8..000000000 --- a/test/coverage/console.c +++ /dev/null @@ -1,73 +0,0 @@ -/* - ChibiOS/RT - Copyright (C) 2006-2007 Giovanni Di Sirio. - - This file is part of ChibiOS/RT. - - ChibiOS/RT is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 3 of the License, or - (at your option) any later version. - - ChibiOS/RT is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program. If not, see . -*/ - -/** - * @file console.c - * @brief Simulator console driver code. - * @{ - */ - -#include - -#include "ch.h" -#include "console.h" - -/** - * @brief Console driver 1. - */ -BaseChannel CD1; - -static bool_t putwouldblock(void *ip) { - - (void)ip; - return FALSE; -} - -static bool_t getwouldblock(void *ip) { - - (void)ip; - return TRUE; -} - -static msg_t put(void *ip, uint8_t b, systime_t timeout) { - - (void)ip; - (void)timeout; - fputc(b, stdout); - fflush(stdout); - return RDY_OK; -} - -static msg_t get(void *ip, systime_t timeout) { - - (void)ip; - (void)timeout; - return fgetc(stdin); -} - -static const struct BaseChannelVMT vmt = { - {putwouldblock, getwouldblock, put, get} -}; - -void conInit(void) { - - CD1.vmt = &vmt; -} - -/** @} */ diff --git a/test/coverage/console.h b/test/coverage/console.h deleted file mode 100644 index e8079a042..000000000 --- a/test/coverage/console.h +++ /dev/null @@ -1,41 +0,0 @@ -/* - ChibiOS/RT - Copyright (C) 2006-2007 Giovanni Di Sirio. - - This file is part of ChibiOS/RT. - - ChibiOS/RT is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 3 of the License, or - (at your option) any later version. - - ChibiOS/RT is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program. If not, see . -*/ - -/** - * @file console.h - * @brief Simulator console driver header. - * @{ - */ - -#ifndef _CONSOLE_H_ -#define _CONSOLE_H_ - -extern BaseChannel CD1; - -#ifdef __cplusplus -extern "C" { -#endif - void conInit(void); -#ifdef __cplusplus -} -#endif - -#endif /* _CONSOLE_H_ */ - -/** @} */ -- cgit v1.2.3 From 0873332c30f78769147f0cb16d71f38ed846a814 Mon Sep 17 00:00:00 2001 From: gdisirio Date: Thu, 24 Dec 2009 09:38:50 +0000 Subject: git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@1463 35acf78f-673a-0410-8e92-d51de3d6d3f4 --- test/test.c | 2 +- test/testbmk.c | 20 ++++++++++---------- 2 files changed, 11 insertions(+), 11 deletions(-) (limited to 'test') diff --git a/test/test.c b/test/test.c index f4272ca14..623545318 100644 --- a/test/test.c +++ b/test/test.c @@ -189,7 +189,7 @@ void test_cpu_pulse(unsigned duration) { end = start + MS2ST(duration); do { now = chThdSelf()->p_time; -#if defined(WIN32) +#if defined(SIMULATOR) ChkIntSources(); #endif } diff --git a/test/testbmk.c b/test/testbmk.c index 35a193221..89a50cd9d 100644 --- a/test/testbmk.c +++ b/test/testbmk.c @@ -81,7 +81,7 @@ static unsigned int msg_loop_test(Thread *tp) { do { (void)chMsgSend(tp, 1); n++; -#if defined(WIN32) +#if defined(SIMULATOR) ChkIntSources(); #endif } while (!test_timer_done); @@ -248,7 +248,7 @@ static void bmk4_execute(void) { chSchWakeupS(tp, RDY_OK); chSysUnlock(); n += 4; -#if defined(WIN32) +#if defined(SIMULATOR) ChkIntSources(); #endif } while (!test_timer_done); @@ -295,7 +295,7 @@ static void bmk5_execute(void) { do { chThdWait(chThdCreateStatic(wap, WA_SIZE, prio, thread2, NULL)); n++; -#if defined(WIN32) +#if defined(SIMULATOR) ChkIntSources(); #endif } while (!test_timer_done); @@ -339,7 +339,7 @@ static void bmk6_execute(void) { do { chThdCreateStatic(wap, WA_SIZE, prio, thread2, NULL); n++; -#if defined(WIN32) +#if defined(SIMULATOR) ChkIntSources(); #endif } while (!test_timer_done); @@ -399,7 +399,7 @@ static void bmk7_execute(void) { do { chSemReset(&sem1, 0); n++; -#if defined(WIN32) +#if defined(SIMULATOR) ChkIntSources(); #endif } while (!test_timer_done); @@ -439,7 +439,7 @@ static msg_t thread8(void *p) { chThdYield(); chThdYield(); (*(uint32_t *)p) += 4; -#if defined(WIN32) +#if defined(SIMULATOR) ChkIntSources(); #endif } while(!chThdShouldTerminate()); @@ -514,7 +514,7 @@ static void bmk9_execute(void) { (void)chIQGet(&iq); (void)chIQGet(&iq); n++; -#if defined(WIN32) +#if defined(SIMULATOR) ChkIntSources(); #endif } while (!test_timer_done); @@ -560,7 +560,7 @@ static void bmk10_execute(void) { chVTResetI(&vt2); chSysUnlock(); n++; -#if defined(WIN32) +#if defined(SIMULATOR) ChkIntSources(); #endif } while (!test_timer_done); @@ -611,7 +611,7 @@ static void bmk11_execute(void) { chSemWait(&sem1); chSemSignal(&sem1); n++; -#if defined(WIN32) +#if defined(SIMULATOR) ChkIntSources(); #endif } while (!test_timer_done); @@ -663,7 +663,7 @@ static void bmk12_execute(void) { chMtxLock(&mtx1); chMtxUnlock(); n++; -#if defined(WIN32) +#if defined(SIMULATOR) ChkIntSources(); #endif } while (!test_timer_done); -- cgit v1.2.3 From 0e87fac778e89fb8ecd2b33df4472cd635438dde Mon Sep 17 00:00:00 2001 From: gdisirio Date: Fri, 25 Dec 2009 16:15:08 +0000 Subject: Fixed bug 2921120. git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@1471 35acf78f-673a-0410-8e92-d51de3d6d3f4 --- test/coverage/Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'test') diff --git a/test/coverage/Makefile b/test/coverage/Makefile index 788a7bc99..91ceacc01 100644 --- a/test/coverage/Makefile +++ b/test/coverage/Makefile @@ -22,7 +22,7 @@ AS = $(TRGT)gcc -x assembler-with-cpp COV = gcov # List all default C defines here, like -D_DEBUG=1 -DDEFS = +DDEFS = -DSIMULATOR # List all default ASM defines here, like -D_DEBUG=1 DADEFS = -- cgit v1.2.3 From da565f622c53f2fb23c1d66332ee764e44361ea3 Mon Sep 17 00:00:00 2001 From: gdisirio Date: Tue, 29 Dec 2009 16:22:45 +0000 Subject: New HAL configuration file ported to all demos. git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@1482 35acf78f-673a-0410-8e92-d51de3d6d3f4 --- test/coverage/halconf.h | 56 ++++++++++++++++++++++++++++++++++++++++++++++--- 1 file changed, 53 insertions(+), 3 deletions(-) (limited to 'test') diff --git a/test/coverage/halconf.h b/test/coverage/halconf.h index 51a169a37..75534adfc 100644 --- a/test/coverage/halconf.h +++ b/test/coverage/halconf.h @@ -27,14 +27,23 @@ /* * HAL configuration file, this file allows to enable or disable the various * device drivers from your application. You may also use this file in order - * to change the device drivers settings found in the low level drivers - * headers, just define here the new settings and those will override the - * defaults defined in the LLD headers. + * to override the device drivers default settings. */ #ifndef _HALCONF_H_ #define _HALCONF_H_ +/* + * Uncomment the following line in order to include a mcu-related + * settings file. This file can be used to include platform specific + * header files or to override the low level drivers settings. + */ +/*#include "mcuconf.h"*/ + +/*===========================================================================*/ +/* PAL driver related settings. */ +/*===========================================================================*/ + /** * @brief Enables the PAL subsystem. */ @@ -42,6 +51,10 @@ #define CH_HAL_USE_PAL FALSE #endif +/*===========================================================================*/ +/* ADC driver related settings. */ +/*===========================================================================*/ + /** * @brief Enables the ADC subsystem. */ @@ -49,6 +62,10 @@ #define CH_HAL_USE_ADC FALSE #endif +/*===========================================================================*/ +/* CAN driver related settings. */ +/*===========================================================================*/ + /** * @brief Enables the CAN subsystem. */ @@ -56,6 +73,10 @@ #define CH_HAL_USE_CAN FALSE #endif +/*===========================================================================*/ +/* MAC driver related settings. */ +/*===========================================================================*/ + /** * @brief Enables the MAC subsystem. */ @@ -63,6 +84,10 @@ #define CH_HAL_USE_MAC FALSE #endif +/*===========================================================================*/ +/* PWM driver related settings. */ +/*===========================================================================*/ + /** * @brief Enables the PWM subsystem. */ @@ -70,6 +95,10 @@ #define CH_HAL_USE_PWM FALSE #endif +/*===========================================================================*/ +/* SERIAL driver related settings. */ +/*===========================================================================*/ + /** * @brief Enables the SERIAL subsystem. */ @@ -77,6 +106,10 @@ #define CH_HAL_USE_SERIAL FALSE #endif +/*===========================================================================*/ +/* SPI driver related settings. */ +/*===========================================================================*/ + /** * @brief Enables the SPI subsystem. */ @@ -84,6 +117,15 @@ #define CH_HAL_USE_SPI FALSE #endif +/* + * Default SPI settings overrides (uncomment to override). + */ +/*#define SPI_USE_MUTUAL_EXCLUSION TRUE*/ + +/*===========================================================================*/ +/* MMC_SPI driver related settings. */ +/*===========================================================================*/ + /** * @brief Enables the MMC_SPI subsystem. */ @@ -91,6 +133,14 @@ #define CH_HAL_USE_MMC_SPI FALSE #endif +/* + * Default MMC_SPI settings overrides (uncomment to override). + */ +/*#define MMC_SECTOR_SIZE 512*/ +/*#define MMC_NICE_WAITING TRUE*/ +/*#define MMC_POLLING_INTERVAL 10*/ +/*#define MMC_POLLING_DELAY 10*/ + #endif /* _HALCONF_H_ */ /** @} */ -- cgit v1.2.3 From bedb87c1e7cc9741c57c299d81d6e24c5e9c59c5 Mon Sep 17 00:00:00 2001 From: gdisirio Date: Sat, 2 Jan 2010 13:35:55 +0000 Subject: git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@1495 35acf78f-673a-0410-8e92-d51de3d6d3f4 --- test/coverage/halconf.h | 32 +++++++++++++++++++------------- 1 file changed, 19 insertions(+), 13 deletions(-) (limited to 'test') diff --git a/test/coverage/halconf.h b/test/coverage/halconf.h index 75534adfc..190e3e753 100644 --- a/test/coverage/halconf.h +++ b/test/coverage/halconf.h @@ -48,7 +48,7 @@ * @brief Enables the PAL subsystem. */ #if !defined(CH_HAL_USE_PAL) || defined(__DOXYGEN__) -#define CH_HAL_USE_PAL FALSE +#define CH_HAL_USE_PAL FALSE #endif /*===========================================================================*/ @@ -59,7 +59,7 @@ * @brief Enables the ADC subsystem. */ #if !defined(CH_HAL_USE_ADC) || defined(__DOXYGEN__) -#define CH_HAL_USE_ADC FALSE +#define CH_HAL_USE_ADC FALSE #endif /*===========================================================================*/ @@ -70,7 +70,7 @@ * @brief Enables the CAN subsystem. */ #if !defined(CH_HAL_USE_CAN) || defined(__DOXYGEN__) -#define CH_HAL_USE_CAN FALSE +#define CH_HAL_USE_CAN FALSE #endif /*===========================================================================*/ @@ -81,7 +81,7 @@ * @brief Enables the MAC subsystem. */ #if !defined(CH_HAL_USE_MAC) || defined(__DOXYGEN__) -#define CH_HAL_USE_MAC FALSE +#define CH_HAL_USE_MAC FALSE #endif /*===========================================================================*/ @@ -92,7 +92,7 @@ * @brief Enables the PWM subsystem. */ #if !defined(CH_HAL_USE_PWM) || defined(__DOXYGEN__) -#define CH_HAL_USE_PWM FALSE +#define CH_HAL_USE_PWM FALSE #endif /*===========================================================================*/ @@ -103,9 +103,15 @@ * @brief Enables the SERIAL subsystem. */ #if !defined(CH_HAL_USE_SERIAL) || defined(__DOXYGEN__) -#define CH_HAL_USE_SERIAL FALSE +#define CH_HAL_USE_SERIAL FALSE #endif +/* + * Default SERIAL settings overrides (uncomment to override). + */ +/*#define SERIAL_DEFAULT_BITRATE 38400*/ +/*#define SERIAL_BUFFERS_SIZE 64*/ + /*===========================================================================*/ /* SPI driver related settings. */ /*===========================================================================*/ @@ -114,13 +120,13 @@ * @brief Enables the SPI subsystem. */ #if !defined(CH_HAL_USE_SPI) || defined(__DOXYGEN__) -#define CH_HAL_USE_SPI FALSE +#define CH_HAL_USE_SPI FALSE #endif /* * Default SPI settings overrides (uncomment to override). */ -/*#define SPI_USE_MUTUAL_EXCLUSION TRUE*/ +/*#define SPI_USE_MUTUAL_EXCLUSION TRUE*/ /*===========================================================================*/ /* MMC_SPI driver related settings. */ @@ -130,16 +136,16 @@ * @brief Enables the MMC_SPI subsystem. */ #if !defined(CH_HAL_USE_MMC_SPI) || defined(__DOXYGEN__) -#define CH_HAL_USE_MMC_SPI FALSE +#define CH_HAL_USE_MMC_SPI FALSE #endif /* * Default MMC_SPI settings overrides (uncomment to override). */ -/*#define MMC_SECTOR_SIZE 512*/ -/*#define MMC_NICE_WAITING TRUE*/ -/*#define MMC_POLLING_INTERVAL 10*/ -/*#define MMC_POLLING_DELAY 10*/ +/*#define MMC_SECTOR_SIZE 512*/ +/*#define MMC_NICE_WAITING TRUE*/ +/*#define MMC_POLLING_INTERVAL 10*/ +/*#define MMC_POLLING_DELAY 10*/ #endif /* _HALCONF_H_ */ -- cgit v1.2.3 From 1a9cc2599eef7cddca853fc02997dc7543f1bb80 Mon Sep 17 00:00:00 2001 From: gdisirio Date: Sun, 3 Jan 2010 08:16:18 +0000 Subject: git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@1498 35acf78f-673a-0410-8e92-d51de3d6d3f4 --- test/test.c | 6 +++--- test/test.h | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) (limited to 'test') diff --git a/test/test.c b/test/test.c index 623545318..774ab774d 100644 --- a/test/test.c +++ b/test/test.c @@ -277,9 +277,6 @@ msg_t TestThread(void *p) { while (patterns[i]) { j = 0; while (patterns[i][j]) { -#if DELAY_BETWEEN_TESTS > 0 - chThdSleepMilliseconds(DELAY_BETWEEN_TESTS); -#endif print_line(); test_print("--- Test Case "); test_printn(i + 1); @@ -288,6 +285,9 @@ msg_t TestThread(void *p) { test_print(" ("); test_print(patterns[i][j]->gettest()); test_println(")"); +#if DELAY_BETWEEN_TESTS > 0 + chThdSleepMilliseconds(DELAY_BETWEEN_TESTS); +#endif execute_test(patterns[i][j]); if (local_fail) { test_print("--- Result: FAILURE (#"); diff --git a/test/test.h b/test/test.h index c31caf633..500ffa6bd 100644 --- a/test/test.h +++ b/test/test.h @@ -33,7 +33,7 @@ #if defined(CH_ARCHITECTURE_AVR) || defined(CH_ARCHITECTURE_MSP430) #define THREADS_STACK_SIZE 48 -#elif defined(CH_ARCHITECTURE_WIN32SIM) +#elif defined(CH_ARCHITECTURE_SIMIA32) #define THREADS_STACK_SIZE 512 #else #define THREADS_STACK_SIZE 128 -- cgit v1.2.3 From 855fe2391d07c5dab27129ad626541482fe8d782 Mon Sep 17 00:00:00 2001 From: gdisirio Date: Tue, 5 Jan 2010 17:14:09 +0000 Subject: git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@1501 35acf78f-673a-0410-8e92-d51de3d6d3f4 --- test/test.dox | 44 ++++++++++++++++++++++++++++++++++++++------ test/testqueues.c | 12 ++++++------ 2 files changed, 44 insertions(+), 12 deletions(-) (limited to 'test') diff --git a/test/test.dox b/test/test.dox index ad3c03927..75a46366e 100644 --- a/test/test.dox +++ b/test/test.dox @@ -18,20 +18,52 @@ */ /** - * @page testsuite Test Suite + * @page testsuite Testing Strategy *

Description

* Most of the ChibiOS/RT demos link a set of software modules (test suite) in * order to verify the proper working of the kernel, the port and the demo - * itself.
- * Each Test Module performs a series of tests on a specified subsystem or + * itself. + * + *

Strategy by Components

+ * The OS components are tested in various modes depending on their importance: + * - Kernel. The kernel code is subject to rigorous testing. The test + * suite aims to test all the kernel code and reach a code coverage + * as close to 100% as possible. In addition to the code coverage, the kernel + * code is tested for functionality and benchmarked for speed + * and size before each stable release. In addition to the code + * coverage and functional testing a batch compilation test is + * performed before each release, the kernel is compiled by alternatively + * enabling and disabling all the various configuration options, the + * kernel code is expected to compile without errors nor warnings and + * execute the test suite without failures (a specific simulator is used + * for this execution test, it is done automatically by a script because + * the entire sequence can require hours).
+ * All the tests results are included as reports in the OS distribution + * under @p ./docs/reports. + * - Ports. The port code is tested by executing the kernel test + * suite on the target hardware. A port is validated only if it passes all + * the tests. Speed and size benchmarks for all the supported architectures + * are performed, both size and speed regressions are monitored. + * - HAL. The HAL high level code and device drivers implementations + * are tested by use in the various demos and/or by users. + * - Various. The miscellaneous code is tested by use in the various + * demos and/or by users. + * - External Code. Not tested, external libraries or components are + * used as-is or with minor patching where required, problems are usually + * reported upstream. + * . + *

Kernel Test Suite

+ * The kernel test suite is divided in modules or test sequences. Each Test + * Module performs a series of tests on a specified kernel subsystem or * subsystems and can report a failure/success status and/or a performance * index as the test suite output.
* The test suite is usually activated in the demo applications by pressing a * button on the target board, see the readme into the various demos - * directories. The test suite output is usually sent through a serial port and - * can be examined by using a terminal emulator program. + * directories. The test suite output is usually sent through a serial port + * and can be examined by using a terminal emulator program. + * + *

Kernel Test Modules

* - *

Test Modules

* - @subpage test_threads * - @subpage test_dynamic * - @subpage test_msg diff --git a/test/testqueues.c b/test/testqueues.c index 6989442c4..c07e8aee3 100644 --- a/test/testqueues.c +++ b/test/testqueues.c @@ -86,6 +86,7 @@ static void queues1_setup(void) { static void queues1_execute(void) { unsigned i; + size_t n; /* Initial empty state */ test_assert(1, chIQIsEmpty(&iq), "not empty"); @@ -107,9 +108,8 @@ static void queues1_execute(void) { chIQPutI(&iq, 'A' + i); /* Reading the whole thing */ - test_assert(6, - chIQRead(&iq, wa[1], TEST_QUEUES_SIZE * 2) == TEST_QUEUES_SIZE, - "wrong returned size"); + n = chIQReadTimeout(&iq, wa[1], TEST_QUEUES_SIZE * 2, TIME_IMMEDIATE); + test_assert(6, n == TEST_QUEUES_SIZE, "wrong returned size"); test_assert(7, chIQIsEmpty(&iq), "still full"); /* Testing reset */ @@ -148,6 +148,7 @@ static void queues2_setup(void) { static void queues2_execute(void) { unsigned i; + size_t n; /* Initial empty state */ test_assert(1, chOQIsEmpty(&oq), "not empty"); @@ -165,9 +166,8 @@ static void queues2_execute(void) { test_assert(5, chOQGetI(&oq) == Q_EMPTY, "failed to report Q_EMPTY"); /* Writing the whole thing */ - test_assert(6, - chOQWrite(&oq, wa[1], TEST_QUEUES_SIZE * 2) == TEST_QUEUES_SIZE, - "wrong returned size"); + n = chOQWriteTimeout(&oq, wa[1], TEST_QUEUES_SIZE * 2, TIME_IMMEDIATE); + test_assert(6, n == TEST_QUEUES_SIZE,"wrong returned size"); test_assert(7, chOQIsFull(&oq), "not full"); /* Testing reset */ -- cgit v1.2.3 From bc489e39a8036bd8cc70569ac8e31ec257d68747 Mon Sep 17 00:00:00 2001 From: gdisirio Date: Wed, 6 Jan 2010 10:30:01 +0000 Subject: Coverage 100% for modified queues. git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@1505 35acf78f-673a-0410-8e92-d51de3d6d3f4 --- test/testqueues.c | 29 ++++++++++++++++++++++------- 1 file changed, 22 insertions(+), 7 deletions(-) (limited to 'test') diff --git a/test/testqueues.c b/test/testqueues.c index c07e8aee3..6c16cce63 100644 --- a/test/testqueues.c +++ b/test/testqueues.c @@ -112,13 +112,24 @@ static void queues1_execute(void) { test_assert(6, n == TEST_QUEUES_SIZE, "wrong returned size"); test_assert(7, chIQIsEmpty(&iq), "still full"); + /* Queue filling again */ + for (i = 0; i < TEST_QUEUES_SIZE; i++) + chIQPutI(&iq, 'A' + i); + + /* Partial reads */ + n = chIQReadTimeout(&iq, wa[1], TEST_QUEUES_SIZE / 2, TIME_IMMEDIATE); + test_assert(8, n == TEST_QUEUES_SIZE / 2, "wrong returned size"); + n = chIQReadTimeout(&iq, wa[1], TEST_QUEUES_SIZE / 2, TIME_IMMEDIATE); + test_assert(9, n == TEST_QUEUES_SIZE / 2, "wrong returned size"); + test_assert(10, chIQIsEmpty(&iq), "still full"); + /* Testing reset */ chIQPutI(&iq, 0); chIQResetI(&iq); - test_assert(8, chIQIsEmpty(&iq), "still full"); + test_assert(11, chIQIsEmpty(&iq), "still full"); /* Timeout */ - test_assert(9, chIQGetTimeout(&iq, 10) == Q_TIMEOUT, "wrong timeout return"); + test_assert(12, chIQGetTimeout(&iq, 10) == Q_TIMEOUT, "wrong timeout return"); } const struct testcase testqueues1 = { @@ -167,18 +178,22 @@ static void queues2_execute(void) { /* Writing the whole thing */ n = chOQWriteTimeout(&oq, wa[1], TEST_QUEUES_SIZE * 2, TIME_IMMEDIATE); - test_assert(6, n == TEST_QUEUES_SIZE,"wrong returned size"); + test_assert(6, n == TEST_QUEUES_SIZE, "wrong returned size"); test_assert(7, chOQIsFull(&oq), "not full"); /* Testing reset */ chOQResetI(&oq); test_assert(8, chOQIsEmpty(&oq), "still full"); + /* Partial writes */ + n = chOQWriteTimeout(&oq, wa[1], TEST_QUEUES_SIZE / 2, TIME_IMMEDIATE); + test_assert(9, n == TEST_QUEUES_SIZE / 2, "wrong returned size"); + n = chOQWriteTimeout(&oq, wa[1], TEST_QUEUES_SIZE / 2, TIME_IMMEDIATE); + test_assert(10, n == TEST_QUEUES_SIZE / 2, "wrong returned size"); + test_assert(11, chOQIsFull(&oq), "not full"); + /* Timeout */ - for (i = 0; i < TEST_QUEUES_SIZE; i++) - chOQPut(&oq, 'A' + i); - test_assert(9, chOQIsFull(&oq), "still has space"); - test_assert(10, chOQPutTimeout(&oq, 0, 10) == Q_TIMEOUT, "wrong timeout return"); + test_assert(12, chOQPutTimeout(&oq, 0, 10) == Q_TIMEOUT, "wrong timeout return"); } const struct testcase testqueues2 = { -- cgit v1.2.3 From 1eebe078ffbb85c3fb8a14db4d241502b27145bf Mon Sep 17 00:00:00 2001 From: gdisirio Date: Thu, 7 Jan 2010 15:23:38 +0000 Subject: git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@1509 35acf78f-673a-0410-8e92-d51de3d6d3f4 --- test/test.dox | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'test') diff --git a/test/test.dox b/test/test.dox index 75a46366e..9e83c095d 100644 --- a/test/test.dox +++ b/test/test.dox @@ -24,7 +24,7 @@ * order to verify the proper working of the kernel, the port and the demo * itself. * - *

Strategy by Components

+ *

Strategy by Component

* The OS components are tested in various modes depending on their importance: * - Kernel. The kernel code is subject to rigorous testing. The test * suite aims to test all the kernel code and reach a code coverage -- cgit v1.2.3 From 7bd8164f8ff6ffd0a9458d44e18097582adae201 Mon Sep 17 00:00:00 2001 From: gdisirio Date: Wed, 20 Jan 2010 14:39:34 +0000 Subject: git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@1532 35acf78f-673a-0410-8e92-d51de3d6d3f4 --- test/testbmk.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'test') diff --git a/test/testbmk.c b/test/testbmk.c index 89a50cd9d..4d76c36bb 100644 --- a/test/testbmk.c +++ b/test/testbmk.c @@ -226,8 +226,8 @@ msg_t thread4(void *p) { (void)p; chSysLock(); do { - chSchGoSleepS(PRSUSPENDED); - msg = self->p_rdymsg; + chSchGoSleepS(THD_STATE_SUSPENDED); + msg = self->p_u.rdymsg; } while (msg == RDY_OK); chSysUnlock(); return 0; -- cgit v1.2.3 From e32275f84af6e07cbe737262ce90c75f69b9a1c1 Mon Sep 17 00:00:00 2001 From: gdisirio Date: Wed, 3 Feb 2010 09:37:33 +0000 Subject: git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@1563 35acf78f-673a-0410-8e92-d51de3d6d3f4 --- test/coverage/chconf.h | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'test') diff --git a/test/coverage/chconf.h b/test/coverage/chconf.h index 8f172f453..d7b4c7e40 100644 --- a/test/coverage/chconf.h +++ b/test/coverage/chconf.h @@ -123,6 +123,16 @@ /* Subsystem options. */ /*===========================================================================*/ +/** + * @brief Threads registry APIs. + * @details If enabled then the registry APIs are included in the kernel. + * + * @note The default is @p TRUE. + */ +#if !defined(CH_USE_REGISTRY) || defined(__DOXYGEN__) +#define CH_USE_REGISTRY TRUE +#endif + /** * @brief Threads synchronization APIs. * @details If enabled then the @p chThdWait() function is included in -- cgit v1.2.3 From 0fc33d47532b1b7727d576b3814498c8907b3c31 Mon Sep 17 00:00:00 2001 From: gdisirio Date: Sat, 20 Feb 2010 11:39:33 +0000 Subject: git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@1644 35acf78f-673a-0410-8e92-d51de3d6d3f4 --- test/test.c | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) (limited to 'test') diff --git a/test/test.c b/test/test.c index 774ab774d..33a971e08 100644 --- a/test/test.c +++ b/test/test.c @@ -18,6 +18,7 @@ */ #include "ch.h" +#include "hal.h" #include "test.h" #include "testthd.h" @@ -264,11 +265,23 @@ msg_t TestThread(void *p) { test_println("***"); test_print("*** Kernel: "); test_println(CH_KERNEL_VERSION); - test_print("*** Architecture: "); - test_println(CH_ARCHITECTURE_NAME); #ifdef __GNUC__ test_print("*** GCC Version: "); test_println(__VERSION__); +#endif + test_print("*** Architecture: "); + test_println(CH_ARCHITECTURE_NAME); +#ifdef CH_CORE_VARIANT_NAME + test_print("*** Core Variant: "); + test_println(CH_CORE_VARIANT_NAME); +#endif +#ifdef PLATFORM_NAME + test_print("*** Platform: "); + test_println(PLATFORM_NAME); +#endif +#ifdef BOARD_NAME + test_print("*** Test Board: "); + test_println(BOARD_NAME); #endif test_println(""); -- cgit v1.2.3 From 157b6f9695e7f72f2d54b231c19cb4045710ed01 Mon Sep 17 00:00:00 2001 From: gdisirio Date: Sun, 21 Feb 2010 07:24:53 +0000 Subject: Updated license dates. git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@1646 35acf78f-673a-0410-8e92-d51de3d6d3f4 --- test/coverage/board.h | 2 +- test/coverage/chconf.h | 4 ++-- test/coverage/halconf.h | 10 +++++----- test/coverage/main.c | 2 +- test/test.c | 8 ++++---- test/test.dox | 2 +- test/test.h | 2 +- test/testbmk.c | 2 +- test/testbmk.h | 2 +- test/testdyn.c | 2 +- test/testdyn.h | 2 +- test/testevt.c | 2 +- test/testevt.h | 2 +- test/testheap.c | 4 ++-- test/testheap.h | 2 +- test/testmbox.c | 2 +- test/testmbox.h | 2 +- test/testmsg.c | 2 +- test/testmsg.h | 2 +- test/testmtx.c | 2 +- test/testmtx.h | 2 +- test/testpools.c | 2 +- test/testpools.h | 2 +- test/testqueues.c | 2 +- test/testqueues.h | 2 +- test/testsem.c | 4 ++-- test/testsem.h | 2 +- test/testthd.c | 2 +- test/testthd.h | 2 +- 29 files changed, 39 insertions(+), 39 deletions(-) (limited to 'test') diff --git a/test/coverage/board.h b/test/coverage/board.h index a6e056d58..7b89d92d0 100644 --- a/test/coverage/board.h +++ b/test/coverage/board.h @@ -1,5 +1,5 @@ /* - ChibiOS/RT - Copyright (C) 2006-2007 Giovanni Di Sirio. + ChibiOS/RT - Copyright (C) 2006,2007,2008,2009,2010 Giovanni Di Sirio. This file is part of ChibiOS/RT. diff --git a/test/coverage/chconf.h b/test/coverage/chconf.h index d7b4c7e40..988a6fd64 100644 --- a/test/coverage/chconf.h +++ b/test/coverage/chconf.h @@ -1,5 +1,5 @@ /* - ChibiOS/RT - Copyright (C) 2006-2007 Giovanni Di Sirio. + ChibiOS/RT - Copyright (C) 2006,2007,2008,2009,2010 Giovanni Di Sirio. This file is part of ChibiOS/RT. @@ -396,7 +396,7 @@ * @brief Debug option, stacks initialization. * @details If enabled then the threads working area is filled with a byte * value when a thread is created. This can be useful for the - * runtime measurement of the used stack. + * runtime measurement of the used stack. * * @note The default is @p FALSE. */ diff --git a/test/coverage/halconf.h b/test/coverage/halconf.h index 190e3e753..bf7084dc6 100644 --- a/test/coverage/halconf.h +++ b/test/coverage/halconf.h @@ -1,5 +1,5 @@ /* - ChibiOS/RT - Copyright (C) 2006-2007 Giovanni Di Sirio. + ChibiOS/RT - Copyright (C) 2006,2007,2008,2009,2010 Giovanni Di Sirio. This file is part of ChibiOS/RT. @@ -27,7 +27,7 @@ /* * HAL configuration file, this file allows to enable or disable the various * device drivers from your application. You may also use this file in order - * to override the device drivers default settings. + * to override the device drivers default settings. */ #ifndef _HALCONF_H_ @@ -36,7 +36,7 @@ /* * Uncomment the following line in order to include a mcu-related * settings file. This file can be used to include platform specific - * header files or to override the low level drivers settings. + * header files or to override the low level drivers settings. */ /*#include "mcuconf.h"*/ @@ -45,7 +45,7 @@ /*===========================================================================*/ /** - * @brief Enables the PAL subsystem. + * @brief Enables the PAL subsystem. */ #if !defined(CH_HAL_USE_PAL) || defined(__DOXYGEN__) #define CH_HAL_USE_PAL FALSE @@ -124,7 +124,7 @@ #endif /* - * Default SPI settings overrides (uncomment to override). + * Default SPI settings overrides (uncomment to override). */ /*#define SPI_USE_MUTUAL_EXCLUSION TRUE*/ diff --git a/test/coverage/main.c b/test/coverage/main.c index 80390360d..2f7613a22 100644 --- a/test/coverage/main.c +++ b/test/coverage/main.c @@ -1,5 +1,5 @@ /* - ChibiOS/RT - Copyright (C) 2006-2007 Giovanni Di Sirio. + ChibiOS/RT - Copyright (C) 2006,2007,2008,2009,2010 Giovanni Di Sirio. This file is part of ChibiOS/RT. diff --git a/test/test.c b/test/test.c index 33a971e08..cb23de241 100644 --- a/test/test.c +++ b/test/test.c @@ -1,5 +1,5 @@ /* - ChibiOS/RT - Copyright (C) 2006-2007 Giovanni Di Sirio. + ChibiOS/RT - Copyright (C) 2006,2007,2008,2009,2010 Giovanni Di Sirio. This file is part of ChibiOS/RT. @@ -58,17 +58,17 @@ static char *tokp; /* * Static working areas, the following areas can be used for threads or - * used as temporary buffers. + * used as temporary buffers. */ union test_buffers test; /* - * Pointers to the spawned threads. + * Pointers to the spawned threads. */ Thread *threads[MAX_THREADS]; /* - * Pointers to the working areas. + * Pointers to the working areas. */ void * const wa[5] = {test.waT0, test.waT1, test.waT2, test.waT3, test.waT4}; diff --git a/test/test.dox b/test/test.dox index 9e83c095d..02f0aaae8 100644 --- a/test/test.dox +++ b/test/test.dox @@ -1,5 +1,5 @@ /* - ChibiOS/RT - Copyright (C) 2006-2007 Giovanni Di Sirio. + ChibiOS/RT - Copyright (C) 2006,2007,2008,2009,2010 Giovanni Di Sirio. This file is part of ChibiOS/RT. diff --git a/test/test.h b/test/test.h index 500ffa6bd..a2da7edcb 100644 --- a/test/test.h +++ b/test/test.h @@ -1,5 +1,5 @@ /* - ChibiOS/RT - Copyright (C) 2006-2007 Giovanni Di Sirio. + ChibiOS/RT - Copyright (C) 2006,2007,2008,2009,2010 Giovanni Di Sirio. This file is part of ChibiOS/RT. diff --git a/test/testbmk.c b/test/testbmk.c index 4d76c36bb..9f5f873bf 100644 --- a/test/testbmk.c +++ b/test/testbmk.c @@ -1,5 +1,5 @@ /* - ChibiOS/RT - Copyright (C) 2006-2007 Giovanni Di Sirio. + ChibiOS/RT - Copyright (C) 2006,2007,2008,2009,2010 Giovanni Di Sirio. This file is part of ChibiOS/RT. diff --git a/test/testbmk.h b/test/testbmk.h index f5e269f31..775ea4501 100644 --- a/test/testbmk.h +++ b/test/testbmk.h @@ -1,5 +1,5 @@ /* - ChibiOS/RT - Copyright (C) 2006-2007 Giovanni Di Sirio. + ChibiOS/RT - Copyright (C) 2006,2007,2008,2009,2010 Giovanni Di Sirio. This file is part of ChibiOS/RT. diff --git a/test/testdyn.c b/test/testdyn.c index 943662e0d..cb6b40908 100644 --- a/test/testdyn.c +++ b/test/testdyn.c @@ -1,5 +1,5 @@ /* - ChibiOS/RT - Copyright (C) 2006-2007 Giovanni Di Sirio. + ChibiOS/RT - Copyright (C) 2006,2007,2008,2009,2010 Giovanni Di Sirio. This file is part of ChibiOS/RT. diff --git a/test/testdyn.h b/test/testdyn.h index d209c9f71..676f0863c 100644 --- a/test/testdyn.h +++ b/test/testdyn.h @@ -1,5 +1,5 @@ /* - ChibiOS/RT - Copyright (C) 2006-2007 Giovanni Di Sirio. + ChibiOS/RT - Copyright (C) 2006,2007,2008,2009,2010 Giovanni Di Sirio. This file is part of ChibiOS/RT. diff --git a/test/testevt.c b/test/testevt.c index 2bd704696..f8844d3a4 100644 --- a/test/testevt.c +++ b/test/testevt.c @@ -1,5 +1,5 @@ /* - ChibiOS/RT - Copyright (C) 2006-2007 Giovanni Di Sirio. + ChibiOS/RT - Copyright (C) 2006,2007,2008,2009,2010 Giovanni Di Sirio. This file is part of ChibiOS/RT. diff --git a/test/testevt.h b/test/testevt.h index 477b7083e..9fb501265 100644 --- a/test/testevt.h +++ b/test/testevt.h @@ -1,5 +1,5 @@ /* - ChibiOS/RT - Copyright (C) 2006-2007 Giovanni Di Sirio. + ChibiOS/RT - Copyright (C) 2006,2007,2008,2009,2010 Giovanni Di Sirio. This file is part of ChibiOS/RT. diff --git a/test/testheap.c b/test/testheap.c index e157d1c54..7d5c25610 100644 --- a/test/testheap.c +++ b/test/testheap.c @@ -1,5 +1,5 @@ /* - ChibiOS/RT - Copyright (C) 2006-2007 Giovanni Di Sirio. + ChibiOS/RT - Copyright (C) 2006,2007,2008,2009,2010 Giovanni Di Sirio. This file is part of ChibiOS/RT. @@ -78,7 +78,7 @@ static void heap1_execute(void) { /* * Test on the default heap in order to cover the core allocator at - * least one time. + * least one time. */ (void)chHeapStatus(NULL, &sz); p1 = chHeapAlloc(NULL, SIZE); diff --git a/test/testheap.h b/test/testheap.h index a310dc40c..c847036bf 100644 --- a/test/testheap.h +++ b/test/testheap.h @@ -1,5 +1,5 @@ /* - ChibiOS/RT - Copyright (C) 2006-2007 Giovanni Di Sirio. + ChibiOS/RT - Copyright (C) 2006,2007,2008,2009,2010 Giovanni Di Sirio. This file is part of ChibiOS/RT. diff --git a/test/testmbox.c b/test/testmbox.c index a8947e4ce..c6eb1e37c 100644 --- a/test/testmbox.c +++ b/test/testmbox.c @@ -1,5 +1,5 @@ /* - ChibiOS/RT - Copyright (C) 2006-2007 Giovanni Di Sirio. + ChibiOS/RT - Copyright (C) 2006,2007,2008,2009,2010 Giovanni Di Sirio. This file is part of ChibiOS/RT. diff --git a/test/testmbox.h b/test/testmbox.h index 52cb7ee18..5cd4ea8c7 100644 --- a/test/testmbox.h +++ b/test/testmbox.h @@ -1,5 +1,5 @@ /* - ChibiOS/RT - Copyright (C) 2006-2007 Giovanni Di Sirio. + ChibiOS/RT - Copyright (C) 2006,2007,2008,2009,2010 Giovanni Di Sirio. This file is part of ChibiOS/RT. diff --git a/test/testmsg.c b/test/testmsg.c index 0c920670a..5669f733e 100644 --- a/test/testmsg.c +++ b/test/testmsg.c @@ -1,5 +1,5 @@ /* - ChibiOS/RT - Copyright (C) 2006-2007 Giovanni Di Sirio. + ChibiOS/RT - Copyright (C) 2006,2007,2008,2009,2010 Giovanni Di Sirio. This file is part of ChibiOS/RT. diff --git a/test/testmsg.h b/test/testmsg.h index c3cadcafa..0b96557e0 100644 --- a/test/testmsg.h +++ b/test/testmsg.h @@ -1,5 +1,5 @@ /* - ChibiOS/RT - Copyright (C) 2006-2007 Giovanni Di Sirio. + ChibiOS/RT - Copyright (C) 2006,2007,2008,2009,2010 Giovanni Di Sirio. This file is part of ChibiOS/RT. diff --git a/test/testmtx.c b/test/testmtx.c index 755545593..7a31ac5f1 100644 --- a/test/testmtx.c +++ b/test/testmtx.c @@ -1,5 +1,5 @@ /* - ChibiOS/RT - Copyright (C) 2006-2007 Giovanni Di Sirio. + ChibiOS/RT - Copyright (C) 2006,2007,2008,2009,2010 Giovanni Di Sirio. This file is part of ChibiOS/RT. diff --git a/test/testmtx.h b/test/testmtx.h index 59c49605b..b28837775 100644 --- a/test/testmtx.h +++ b/test/testmtx.h @@ -1,5 +1,5 @@ /* - ChibiOS/RT - Copyright (C) 2006-2007 Giovanni Di Sirio. + ChibiOS/RT - Copyright (C) 2006,2007,2008,2009,2010 Giovanni Di Sirio. This file is part of ChibiOS/RT. diff --git a/test/testpools.c b/test/testpools.c index 71b1dd230..bed35c8f8 100644 --- a/test/testpools.c +++ b/test/testpools.c @@ -1,5 +1,5 @@ /* - ChibiOS/RT - Copyright (C) 2006-2007 Giovanni Di Sirio. + ChibiOS/RT - Copyright (C) 2006,2007,2008,2009,2010 Giovanni Di Sirio. This file is part of ChibiOS/RT. diff --git a/test/testpools.h b/test/testpools.h index 920e64da2..1d9d3e0d9 100644 --- a/test/testpools.h +++ b/test/testpools.h @@ -1,5 +1,5 @@ /* - ChibiOS/RT - Copyright (C) 2006-2007 Giovanni Di Sirio. + ChibiOS/RT - Copyright (C) 2006,2007,2008,2009,2010 Giovanni Di Sirio. This file is part of ChibiOS/RT. diff --git a/test/testqueues.c b/test/testqueues.c index 6c16cce63..42bcb9972 100644 --- a/test/testqueues.c +++ b/test/testqueues.c @@ -1,5 +1,5 @@ /* - ChibiOS/RT - Copyright (C) 2006-2007 Giovanni Di Sirio. + ChibiOS/RT - Copyright (C) 2006,2007,2008,2009,2010 Giovanni Di Sirio. This file is part of ChibiOS/RT. diff --git a/test/testqueues.h b/test/testqueues.h index 69b96dfb0..c05d62641 100644 --- a/test/testqueues.h +++ b/test/testqueues.h @@ -1,5 +1,5 @@ /* - ChibiOS/RT - Copyright (C) 2006-2007 Giovanni Di Sirio. + ChibiOS/RT - Copyright (C) 2006,2007,2008,2009,2010 Giovanni Di Sirio. This file is part of ChibiOS/RT. diff --git a/test/testsem.c b/test/testsem.c index 79c42c52f..bc7162de5 100644 --- a/test/testsem.c +++ b/test/testsem.c @@ -1,5 +1,5 @@ /* - ChibiOS/RT - Copyright (C) 2006-2007 Giovanni Di Sirio. + ChibiOS/RT - Copyright (C) 2006,2007,2008,2009,2010 Giovanni Di Sirio. This file is part of ChibiOS/RT. @@ -54,7 +54,7 @@ /* * Note, the static initializers are not really required because the * variables are explicitly initialized in each test case. It is done in order - * to test the macros. + * to test the macros. */ static SEMAPHORE_DECL(sem1, 0); diff --git a/test/testsem.h b/test/testsem.h index 3bb19d0d9..74a6f89bd 100644 --- a/test/testsem.h +++ b/test/testsem.h @@ -1,5 +1,5 @@ /* - ChibiOS/RT - Copyright (C) 2006-2007 Giovanni Di Sirio. + ChibiOS/RT - Copyright (C) 2006,2007,2008,2009,2010 Giovanni Di Sirio. This file is part of ChibiOS/RT. diff --git a/test/testthd.c b/test/testthd.c index 76110f444..08b792ce4 100644 --- a/test/testthd.c +++ b/test/testthd.c @@ -1,5 +1,5 @@ /* - ChibiOS/RT - Copyright (C) 2006-2007 Giovanni Di Sirio. + ChibiOS/RT - Copyright (C) 2006,2007,2008,2009,2010 Giovanni Di Sirio. This file is part of ChibiOS/RT. diff --git a/test/testthd.h b/test/testthd.h index 936795e56..5b71c98fb 100644 --- a/test/testthd.h +++ b/test/testthd.h @@ -1,5 +1,5 @@ /* - ChibiOS/RT - Copyright (C) 2006-2007 Giovanni Di Sirio. + ChibiOS/RT - Copyright (C) 2006,2007,2008,2009,2010 Giovanni Di Sirio. This file is part of ChibiOS/RT. -- cgit v1.2.3 From 7d197456418a1cfef07417a827489a4d45d27594 Mon Sep 17 00:00:00 2001 From: gdisirio Date: Mon, 22 Feb 2010 10:39:00 +0000 Subject: git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@1659 35acf78f-673a-0410-8e92-d51de3d6d3f4 --- test/testheap.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'test') diff --git a/test/testheap.c b/test/testheap.c index 7d5c25610..84936babc 100644 --- a/test/testheap.c +++ b/test/testheap.c @@ -114,7 +114,10 @@ static void heap1_execute(void) { chHeapFree(p1); test_assert(5, chHeapStatus(&test_heap, &n) == 2, "invalid state"); p1 = chHeapAlloc(&test_heap, SIZE); - test_assert(6, chHeapStatus(&test_heap, &n) == 1, "heap fragmented"); + /* 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"); chHeapFree(p2); chHeapFree(p1); test_assert(7, chHeapStatus(&test_heap, &n) == 1, "heap fragmented"); -- cgit v1.2.3 From 4d916c9d6c0d4048ec22094f251959177e2e4ba1 Mon Sep 17 00:00:00 2001 From: gdisirio Date: Wed, 24 Feb 2010 09:41:05 +0000 Subject: git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@1672 35acf78f-673a-0410-8e92-d51de3d6d3f4 --- test/test.c | 3 ++- test/test.h | 16 +++++++++------- test/testmbox.c | 4 ++-- test/testqueues.c | 4 ++-- 4 files changed, 15 insertions(+), 12 deletions(-) (limited to 'test') diff --git a/test/test.c b/test/test.c index cb23de241..013a0b21f 100644 --- a/test/test.c +++ b/test/test.c @@ -70,7 +70,8 @@ Thread *threads[MAX_THREADS]; /* * Pointers to the working areas. */ -void * const wa[5] = {test.waT0, test.waT1, test.waT2, test.waT3, test.waT4}; +void * const wa[5] = {test.wa.T0, test.wa.T1, test.wa.T2, + test.wa.T3, test.wa.T4}; /* * Console output. diff --git a/test/test.h b/test/test.h index a2da7edcb..983a7b093 100644 --- a/test/test.h +++ b/test/test.h @@ -31,7 +31,9 @@ #define MAX_THREADS 5 #define MAX_TOKENS 16 -#if defined(CH_ARCHITECTURE_AVR) || defined(CH_ARCHITECTURE_MSP430) +#if defined(CH_ARCHITECTURE_AVR) || \ + defined(CH_ARCHITECTURE_MSP430) || \ + defined(CH_ARCHITECTURE_STM8) #define THREADS_STACK_SIZE 48 #elif defined(CH_ARCHITECTURE_SIMIA32) #define THREADS_STACK_SIZE 512 @@ -50,12 +52,12 @@ struct testcase { #ifndef __DOXYGEN__ union test_buffers { struct { - WORKING_AREA(waT0, THREADS_STACK_SIZE); - WORKING_AREA(waT1, THREADS_STACK_SIZE); - WORKING_AREA(waT2, THREADS_STACK_SIZE); - WORKING_AREA(waT3, THREADS_STACK_SIZE); - WORKING_AREA(waT4, THREADS_STACK_SIZE); - }; + WORKING_AREA(T0, THREADS_STACK_SIZE); + WORKING_AREA(T1, THREADS_STACK_SIZE); + WORKING_AREA(T2, THREADS_STACK_SIZE); + WORKING_AREA(T3, THREADS_STACK_SIZE); + WORKING_AREA(T4, THREADS_STACK_SIZE); + } wa; uint8_t buffer[WA_SIZE * 5]; }; #endif diff --git a/test/testmbox.c b/test/testmbox.c index c6eb1e37c..707b112ef 100644 --- a/test/testmbox.c +++ b/test/testmbox.c @@ -58,7 +58,7 @@ * variables are explicitly initialized in each test case. It is done in order * to test the macros. */ -static MAILBOX_DECL(mb1, test.waT0, MB_SIZE); +static MAILBOX_DECL(mb1, test.wa.T0, MB_SIZE); /** * @page test_mbox_001 Queuing and timeouts @@ -76,7 +76,7 @@ static char *mbox1_gettest(void) { static void mbox1_setup(void) { - chMBInit(&mb1, (msg_t *)test.waT0, MB_SIZE); + chMBInit(&mb1, (msg_t *)test.wa.T0, MB_SIZE); } static void mbox1_execute(void) { diff --git a/test/testqueues.c b/test/testqueues.c index 42bcb9972..0f2ae7a81 100644 --- a/test/testqueues.c +++ b/test/testqueues.c @@ -62,8 +62,8 @@ static void notify(void) {} * variables are explicitly initialized in each test case. It is done in order * to test the macros. */ -static INPUTQUEUE_DECL(iq, test.waT0, TEST_QUEUES_SIZE, notify); -static OUTPUTQUEUE_DECL(oq, test.waT1, TEST_QUEUES_SIZE, notify); +static INPUTQUEUE_DECL(iq, test.wa.T0, TEST_QUEUES_SIZE, notify); +static OUTPUTQUEUE_DECL(oq, test.wa.T1, TEST_QUEUES_SIZE, notify); /** * @page test_queues_001 Input Queues functionality and APIs -- cgit v1.2.3 From 549fe1b7d3a791c2aa112a53bb2c49c2f48fa24e Mon Sep 17 00:00:00 2001 From: gdisirio Date: Fri, 5 Mar 2010 18:55:46 +0000 Subject: Fixed bug 2964418. git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@1712 35acf78f-673a-0410-8e92-d51de3d6d3f4 --- test/testbmk.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'test') diff --git a/test/testbmk.c b/test/testbmk.c index 9f5f873bf..d25d51d8b 100644 --- a/test/testbmk.c +++ b/test/testbmk.c @@ -72,7 +72,9 @@ static msg_t thread1(void *p) { return 0; } +#ifdef __GNUC__ __attribute__((noinline)) +#endif static unsigned int msg_loop_test(Thread *tp) { uint32_t n = 0; @@ -235,9 +237,10 @@ msg_t thread4(void *p) { static void bmk4_execute(void) { Thread *tp; + uint32_t n; tp = threads[0] = chThdCreateStatic(wa[0], WA_SIZE, chThdGetPriority()+1, thread4, NULL); - uint32_t n = 0; + n = 0; test_wait_tick(); test_start_timer(1000); do { @@ -497,11 +500,12 @@ static char *bmk9_gettest(void) { } static void bmk9_execute(void) { + uint32_t n; static uint8_t ib[16]; static InputQueue iq; chIQInit(&iq, ib, sizeof(ib), NULL); - uint32_t n = 0; + n = 0; test_wait_tick(); test_start_timer(1000); do { -- cgit v1.2.3 From b69948bc4883423fde36e63e2ef5d2d16f7ec71c Mon Sep 17 00:00:00 2001 From: gdisirio Date: Fri, 5 Mar 2010 19:01:12 +0000 Subject: git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@1713 35acf78f-673a-0410-8e92-d51de3d6d3f4 --- test/testbmk.c | 3 --- 1 file changed, 3 deletions(-) (limited to 'test') diff --git a/test/testbmk.c b/test/testbmk.c index d25d51d8b..e07b7018b 100644 --- a/test/testbmk.c +++ b/test/testbmk.c @@ -110,7 +110,6 @@ static void bmk1_execute(void) { threads[0] = chThdCreateStatic(wa[0], WA_SIZE, chThdGetPriority()-1, thread1, NULL); n = msg_loop_test(threads[0]); - chThdTerminate(threads[0]); test_wait_threads(); test_print("--- Score : "); test_printn(n); @@ -145,7 +144,6 @@ static void bmk2_execute(void) { threads[0] = chThdCreateStatic(wa[0], WA_SIZE, chThdGetPriority()+1, thread1, NULL); n = msg_loop_test(threads[0]); - chThdTerminate(threads[0]); test_wait_threads(); test_print("--- Score : "); test_printn(n); @@ -190,7 +188,6 @@ static void bmk3_execute(void) { threads[3] = chThdCreateStatic(wa[3], WA_SIZE, chThdGetPriority()-4, thread2, NULL); threads[4] = chThdCreateStatic(wa[4], WA_SIZE, chThdGetPriority()-5, thread2, NULL); n = msg_loop_test(threads[0]); - chThdTerminate(threads[0]); test_wait_threads(); test_print("--- Score : "); test_printn(n); -- cgit v1.2.3 From 8f15a800ee63f1f2d44f3ca24d2415b410919a05 Mon Sep 17 00:00:00 2001 From: gdisirio Date: Fri, 5 Mar 2010 20:19:20 +0000 Subject: git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@1715 35acf78f-673a-0410-8e92-d51de3d6d3f4 --- test/testmtx.c | 2 ++ 1 file changed, 2 insertions(+) (limited to 'test') diff --git a/test/testmtx.c b/test/testmtx.c index 7a31ac5f1..2ac3059b3 100644 --- a/test/testmtx.c +++ b/test/testmtx.c @@ -68,7 +68,9 @@ */ static MUTEX_DECL(m1); static MUTEX_DECL(m2); +#if CH_USE_CONDVARS static CONDVAR_DECL(c1); +#endif /** * @page test_mtx_001 Priority enqueuing test -- cgit v1.2.3 From cf1b70f486a2696d523d585e91d0e4e5c7b8021c Mon Sep 17 00:00:00 2001 From: gdisirio Date: Thu, 18 Mar 2010 16:01:11 +0000 Subject: git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@1749 35acf78f-673a-0410-8e92-d51de3d6d3f4 --- test/testbmk.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'test') diff --git a/test/testbmk.c b/test/testbmk.c index e07b7018b..46c30081e 100644 --- a/test/testbmk.c +++ b/test/testbmk.c @@ -356,7 +356,7 @@ const struct testcase testbmk6 = { }; /** - * @page test_benchmarks_007 Mass reschedulation performance + * @page test_benchmarks_007 Mass reschedule performance * *

Description

* Five threads are created and atomically reschedulated by resetting the @@ -376,7 +376,7 @@ static msg_t thread3(void *p) { static char *bmk7_gettest(void) { - return "Benchmark, mass reschedulation, 5 threads"; + return "Benchmark, mass reschedule, 5 threads"; } static void bmk7_setup(void) { @@ -409,7 +409,7 @@ static void bmk7_execute(void) { test_print("--- Score : "); test_printn(n); - test_print(" reschedulations/S, "); + test_print(" reschedules/S, "); test_printn(n * 6); test_println(" ctxswc/S"); } @@ -422,7 +422,7 @@ const struct testcase testbmk7 = { }; /** - * @page test_benchmarks_008 I/O Round-Robin voluntary reschedulation. + * @page test_benchmarks_008 I/O Round-Robin voluntary reschedule. * *

Description

* Five threads are created at equal priority, each thread just increases a @@ -469,7 +469,7 @@ static void bmk8_execute(void) { test_print("--- Score : "); test_printn(n); - test_print(" reschedulations/S, "); + test_print(" reschedules/S, "); test_printn(n); test_println(" ctxswc/S"); } -- cgit v1.2.3 From 0ebd06ee970fc9e0fa01cf5b1df87d313c3df04d Mon Sep 17 00:00:00 2001 From: gdisirio Date: Thu, 18 Mar 2010 21:00:25 +0000 Subject: git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@1752 35acf78f-673a-0410-8e92-d51de3d6d3f4 --- test/testbmk.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) (limited to 'test') diff --git a/test/testbmk.c b/test/testbmk.c index 46c30081e..565c0c066 100644 --- a/test/testbmk.c +++ b/test/testbmk.c @@ -359,7 +359,7 @@ const struct testcase testbmk6 = { * @page test_benchmarks_007 Mass reschedule performance * *

Description

- * Five threads are created and atomically reschedulated by resetting the + * Five threads are created and atomically rescheduled by resetting the * semaphore where they are waiting on. The operation is performed into a * continuous loop.
* The performance is calculated by measuring the number of iterations after @@ -469,8 +469,6 @@ static void bmk8_execute(void) { test_print("--- Score : "); test_printn(n); - test_print(" reschedules/S, "); - test_printn(n); test_println(" ctxswc/S"); } -- cgit v1.2.3 From 79075f9e81d9d56be5da3bf6cdae56f4ace950de Mon Sep 17 00:00:00 2001 From: gdisirio Date: Fri, 19 Mar 2010 12:48:54 +0000 Subject: git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@1755 35acf78f-673a-0410-8e92-d51de3d6d3f4 --- test/coverage/chconf.h | 215 ++++++++++++++++++++++++++----------------------- 1 file changed, 112 insertions(+), 103 deletions(-) (limited to 'test') diff --git a/test/coverage/chconf.h b/test/coverage/chconf.h index 988a6fd64..65ac31b4f 100644 --- a/test/coverage/chconf.h +++ b/test/coverage/chconf.h @@ -18,9 +18,13 @@ */ /** - * @file templates/chconf.h - * @brief Configuration file template. + * @file templates/chconf.h + * @brief Configuration file template. + * @details A copy of this file must be placed in each project directory, it + * contains the application specific kernel settings. + * * @addtogroup config + * @details Kernel related settings and hooks. * @{ */ @@ -32,7 +36,7 @@ /*===========================================================================*/ /** - * @brief System tick frequency. + * @brief System tick frequency. * @details Frequency of the system timer that drives the system ticks. This * setting also defines the system tick time unit. */ @@ -41,20 +45,22 @@ #endif /** - * @brief Round robin interval. + * @brief Round robin interval. * @details This constant is the number of system ticks allowed for the * threads before preemption occurs. Setting this value to zero - * disables the round robin mechanism. + * disables the preemption for threads with equal priority and the + * round robin becomes cooperative. Note that higher priority + * threads can still preempt, the kernel is always preemptive. * - * @note Disabling round robin makes the kernel more compact and generally - * faster but forbids multiple threads at the same priority level. + * @note Disabling the round robin preemption makes the kernel more compact + * and generally faster. */ #if !defined(CH_TIME_QUANTUM) || defined(__DOXYGEN__) #define CH_TIME_QUANTUM 20 #endif /** - * @brief Nested locks. + * @brief Nested locks. * @details If enabled then the use of nested @p chSysLock() / @p chSysUnlock() * operations is allowed.
* For performance and code size reasons the recommended setting @@ -62,22 +68,22 @@ * You may use this option if you need to merge ChibiOS/RT with * external libraries that require nested lock/unlock operations. * - * @note The default is @p FALSE. + * @note T he default is @p FALSE. */ #if !defined(CH_USE_NESTED_LOCKS) || defined(__DOXYGEN__) #define CH_USE_NESTED_LOCKS TRUE #endif /** - * @brief Managed RAM size. + * @brief Managed RAM size. * @details Size of the RAM area to be managed by the OS. If set to zero * then the whole available RAM is used. The core memory is made * available to the heap allocator and/or can be used directly through * the simplified core memory allocator. * - * @note In order to let the OS manage the whole RAM the linker script must - * provide the @p __heap_base__ and @p __heap_end__ symbols. - * @note Requires @p CH_USE_COREMEM. + * @note In order to let the OS manage the whole RAM the linker script must + * provide the @p __heap_base__ and @p __heap_end__ symbols. + * @note Requires @p CH_USE_COREMEM. */ #if !defined(CH_MEMCORE_SIZE) || defined(__DOXYGEN__) #define CH_MEMCORE_SIZE 0x20000 @@ -88,32 +94,32 @@ /*===========================================================================*/ /** - * @brief OS optimization. + * @brief OS optimization. * @details If enabled then time efficient rather than space efficient code * is used when two possible implementations exist. * - * @note This is not related to the compiler optimization options. - * @note The default is @p TRUE. + * @note This is not related to the compiler optimization options. + * @note The default is @p TRUE. */ #if !defined(CH_OPTIMIZE_SPEED) || defined(__DOXYGEN__) #define CH_OPTIMIZE_SPEED FALSE #endif /** - * @brief Exotic optimization. + * @brief Exotic optimization. * @details If defined then a CPU register is used as storage for the global * @p currp variable. Caching this variable in a register greatly * improves both space and time OS efficiency. A side effect is that * one less register has to be saved during the context switch * resulting in lower RAM usage and faster context switch. * - * @note This option is only usable with the GCC compiler and is only useful - * on processors with many registers like ARM cores. - * @note If this option is enabled then ALL the libraries linked to the - * ChibiOS/RT code must be recompiled with the GCC option @p - * -ffixed-@. - * @note This option must be enabled in the Makefile, it is listed here for - * documentation only. + * @note This option is only usable with the GCC compiler and is only useful + * on processors with many registers like ARM cores. + * @note If this option is enabled then ALL the libraries linked to the + * ChibiOS/RT code must be recompiled with the GCC option @p + * -ffixed-@. + * @note This option must be enabled in the Makefile, it is listed here for + * documentation only. */ #if defined(__DOXYGEN__) #define CH_CURRP_REGISTER_CACHE "reg" @@ -124,219 +130,220 @@ /*===========================================================================*/ /** - * @brief Threads registry APIs. + * @brief Threads registry APIs. * @details If enabled then the registry APIs are included in the kernel. * - * @note The default is @p TRUE. + * @note The default is @p TRUE. */ #if !defined(CH_USE_REGISTRY) || defined(__DOXYGEN__) #define CH_USE_REGISTRY TRUE #endif /** - * @brief Threads synchronization APIs. + * @brief Threads synchronization APIs. * @details If enabled then the @p chThdWait() function is included in * the kernel. * - * @note The default is @p TRUE. + * @note The default is @p TRUE. */ #if !defined(CH_USE_WAITEXIT) || defined(__DOXYGEN__) #define CH_USE_WAITEXIT TRUE #endif /** - * @brief Semaphores APIs. + * @brief Semaphores APIs. * @details If enabled then the Semaphores APIs are included in the kernel. * - * @note The default is @p TRUE. + * @note The default is @p TRUE. */ #if !defined(CH_USE_SEMAPHORES) || defined(__DOXYGEN__) #define CH_USE_SEMAPHORES TRUE #endif /** - * @brief Semaphores queuing mode. + * @brief Semaphores queuing mode. * @details If enabled then the threads are enqueued on semaphores by * priority rather than in FIFO order. * - * @note The default is @p FALSE. Enable this if you have special requirements. - * @note Requires @p CH_USE_SEMAPHORES. + * @note The default is @p FALSE. Enable this if you have special requirements. + * @note Requires @p CH_USE_SEMAPHORES. */ #if !defined(CH_USE_SEMAPHORES_PRIORITY) || defined(__DOXYGEN__) #define CH_USE_SEMAPHORES_PRIORITY FALSE #endif /** - * @brief Atomic semaphore API. - * @details If enabled then the semaphores the @p chSemWaitSignal() API + * @brief Atomic semaphore API. + * @details If enabled then the semaphores the @p chSemSignalWait() API * is included in the kernel. * - * @note The default is @p TRUE. - * @note Requires @p CH_USE_SEMAPHORES. + * @note The default is @p TRUE. + * @note Requires @p CH_USE_SEMAPHORES. */ #if !defined(CH_USE_SEMSW) || defined(__DOXYGEN__) #define CH_USE_SEMSW TRUE #endif /** - * @brief Mutexes APIs. + * @brief Mutexes APIs. * @details If enabled then the mutexes APIs are included in the kernel. * - * @note The default is @p TRUE. + * @note The default is @p TRUE. */ #if !defined(CH_USE_MUTEXES) || defined(__DOXYGEN__) #define CH_USE_MUTEXES TRUE #endif /** - * @brief Conditional Variables APIs. + * @brief Conditional Variables APIs. * @details If enabled then the conditional variables APIs are included * in the kernel. * - * @note The default is @p TRUE. - * @note Requires @p CH_USE_MUTEXES. + * @note The default is @p TRUE. + * @note Requires @p CH_USE_MUTEXES. */ #if !defined(CH_USE_CONDVARS) || defined(__DOXYGEN__) #define CH_USE_CONDVARS TRUE #endif /** - * @brief Conditional Variables APIs with timeout. + * @brief Conditional Variables APIs with timeout. * @details If enabled then the conditional variables APIs with timeout * specification are included in the kernel. * - * @note The default is @p TRUE. - * @note Requires @p CH_USE_CONDVARS. + * @note The default is @p TRUE. + * @note Requires @p CH_USE_CONDVARS. */ #if !defined(CH_USE_CONDVARS_TIMEOUT) || defined(__DOXYGEN__) #define CH_USE_CONDVARS_TIMEOUT TRUE #endif /** - * @brief Events Flags APIs. + * @brief Events Flags APIs. * @details If enabled then the event flags APIs are included in the kernel. * - * @note The default is @p TRUE. + * @note The default is @p TRUE. */ #if !defined(CH_USE_EVENTS) || defined(__DOXYGEN__) #define CH_USE_EVENTS TRUE #endif /** - * @brief Events Flags APIs with timeout. + * @brief Events Flags APIs with timeout. * @details If enabled then the events APIs with timeout specification * are included in the kernel. * - * @note The default is @p TRUE. - * @note Requires @p CH_USE_EVENTS. + * @note The default is @p TRUE. + * @note Requires @p CH_USE_EVENTS. */ #if !defined(CH_USE_EVENTS_TIMEOUT) || defined(__DOXYGEN__) #define CH_USE_EVENTS_TIMEOUT TRUE #endif /** - * @brief Synchronous Messages APIs. + * @brief Synchronous Messages APIs. * @details If enabled then the synchronous messages APIs are included * in the kernel. * - * @note The default is @p TRUE. + * @note The default is @p TRUE. */ #if !defined(CH_USE_MESSAGES) || defined(__DOXYGEN__) #define CH_USE_MESSAGES TRUE #endif /** - * @brief Synchronous Messages queuing mode. + * @brief Synchronous Messages queuing mode. * @details If enabled then messages are served by priority rather than in * FIFO order. * - * @note The default is @p FALSE. Enable this if you have special requirements. - * @note Requires @p CH_USE_MESSAGES. + * @note The default is @p FALSE. Enable this if you have special requirements. + * @note Requires @p CH_USE_MESSAGES. */ #if !defined(CH_USE_MESSAGES_PRIORITY) || defined(__DOXYGEN__) #define CH_USE_MESSAGES_PRIORITY FALSE #endif /** - * @brief Mailboxes APIs. + * @brief Mailboxes APIs. * @details If enabled then the asynchronous messages (mailboxes) APIs are * included in the kernel. * - * @note The default is @p TRUE. - * @note Requires @p CH_USE_SEMAPHORES. + * @note The default is @p TRUE. + * @note Requires @p CH_USE_SEMAPHORES. */ #if !defined(CH_USE_MAILBOXES) || defined(__DOXYGEN__) #define CH_USE_MAILBOXES TRUE #endif /** - * @brief I/O Queues APIs. + * @brief I/O Queues APIs. * @details If enabled then the I/O queues APIs are included in the kernel. * - * @note The default is @p TRUE. - * @note Requires @p CH_USE_SEMAPHORES. + * @note The default is @p TRUE. + * @note Requires @p CH_USE_SEMAPHORES. */ #if !defined(CH_USE_QUEUES) || defined(__DOXYGEN__) #define CH_USE_QUEUES TRUE #endif /** - * @brief Core Memory Manager APIs. + * @brief Core Memory Manager APIs. * @details If enabled then the core memory manager APIs are included * in the kernel. * - * @note The default is @p TRUE. + * @note The default is @p TRUE. */ #if !defined(CH_USE_MEMCORE) || defined(__DOXYGEN__) #define CH_USE_MEMCORE TRUE #endif /** - * @brief Heap Allocator APIs. + * @brief Heap Allocator APIs. * @details If enabled then the memory heap allocator APIs are included * in the kernel. * - * @note The default is @p TRUE. - * @note Requires @p CH_USE_COREMEM and either @p CH_USE_MUTEXES or - * @p CH_USE_SEMAPHORES. - * @note Mutexes are recommended. + * @note The default is @p TRUE. + * @note Requires @p CH_USE_COREMEM and either @p CH_USE_MUTEXES or + * @p CH_USE_SEMAPHORES. + * @note Mutexes are recommended. */ #if !defined(CH_USE_HEAP) || defined(__DOXYGEN__) #define CH_USE_HEAP TRUE #endif /** - * @brief C-runtime allocator. + * @brief C-runtime allocator. * @details If enabled the the heap allocator APIs just wrap the C-runtime * @p malloc() and @p free() functions. * - * @note The default is @p FALSE. - * @note Requires @p CH_USE_HEAP. - * @note The C-runtime may or may not require @p CH_USE_COREMEM, see the - * appropriate documentation. + * @note The default is @p FALSE. + * @note Requires @p CH_USE_HEAP. + * @note The C-runtime may or may not require @p CH_USE_COREMEM, see the + * appropriate documentation. */ #if !defined(CH_USE_MALLOC_HEAP) || defined(__DOXYGEN__) #define CH_USE_MALLOC_HEAP FALSE #endif /** - * @brief Memory Pools Allocator APIs. + * @brief Memory Pools Allocator APIs. * @details If enabled then the memory pools allocator APIs are included * in the kernel. * - * @note The default is @p TRUE. + * @note The default is @p TRUE. */ #if !defined(CH_USE_MEMPOOLS) || defined(__DOXYGEN__) #define CH_USE_MEMPOOLS TRUE #endif /** - * @brief Dynamic Threads APIs. + * @brief Dynamic Threads APIs. * @details If enabled then the dynamic threads creation APIs are included * in the kernel. * - * @note The default is @p TRUE. - * @note Requires @p CH_USE_WAITEXIT. + * @note The default is @p TRUE. + * @note Requires @p CH_USE_WAITEXIT. + * @note Requires @p CH_USE_HEAP and/or @p CH_USE_MEMPOOLS. */ #if !defined(CH_USE_DYNAMIC) || defined(__DOXYGEN__) #define CH_USE_DYNAMIC TRUE @@ -347,71 +354,73 @@ /*===========================================================================*/ /** - * @brief Debug option, parameters checks. + * @brief Debug option, parameters checks. * @details If enabled then the checks on the API functions input * parameters are activated. * - * @note The default is @p FALSE. + * @note The default is @p FALSE. */ #if !defined(CH_DBG_ENABLE_CHECKS) || defined(__DOXYGEN__) #define CH_DBG_ENABLE_CHECKS FALSE #endif /** - * @brief Debug option, consistency checks. + * @brief Debug option, consistency checks. * @details If enabled then all the assertions in the kernel code are * activated. This includes consistency checks inside the kernel, * runtime anomalies and port-defined checks. * - * @note The default is @p FALSE. + * @note The default is @p FALSE. */ #if !defined(CH_DBG_ENABLE_ASSERTS) || defined(__DOXYGEN__) #define CH_DBG_ENABLE_ASSERTS FALSE #endif /** - * @brief Debug option, trace buffer. + * @brief Debug option, trace buffer. * @details If enabled then the context switch circular trace buffer is * activated. * - * @note The default is @p FALSE. + * @note The default is @p FALSE. */ #if !defined(CH_DBG_ENABLE_TRACE) || defined(__DOXYGEN__) #define CH_DBG_ENABLE_TRACE TRUE #endif /** - * @brief Debug option, stack checks. + * @brief Debug option, stack checks. * @details If enabled then a runtime stack check is performed. * - * @note The default is @p FALSE. - * @note The stack check is performed in a architecture/port dependent way. It - * may not be implemented or some ports. + * @note The default is @p FALSE. + * @note The stack check is performed in a architecture/port dependent way. + * It may not be implemented or some ports. + * @note The default failure mode is to halt the system with the global + * @p panic_msg variable set to @p NULL. */ #if !defined(CH_DBG_ENABLE_STACK_CHECK) || defined(__DOXYGEN__) #define CH_DBG_ENABLE_STACK_CHECK TRUE #endif /** - * @brief Debug option, stacks initialization. + * @brief Debug option, stacks initialization. * @details If enabled then the threads working area is filled with a byte * value when a thread is created. This can be useful for the * runtime measurement of the used stack. * - * @note The default is @p FALSE. + * @note The default is @p FALSE. */ #if !defined(CH_DBG_FILL_THREADS) || defined(__DOXYGEN__) #define CH_DBG_FILL_THREADS TRUE #endif /** - * @brief Debug option, threads profiling. + * @brief Debug option, threads profiling. * @details If enabled then a field is added to the @p Thread structure that * counts the system ticks occurred while executing the thread. * - * @note The default is @p TRUE. - * @note This debug option is defaulted to TRUE because it is required by - * some test cases into the test suite. + * @note The default is @p TRUE. + * @note This debug option is defaulted to TRUE because it is required by + * some test cases into the test suite. */ #if !defined(CH_DBG_THREADS_PROFILING) || defined(__DOXYGEN__) #define CH_DBG_THREADS_PROFILING TRUE @@ -422,7 +431,7 @@ /*===========================================================================*/ /** - * @brief Threads descriptor structure hook. + * @brief Threads descriptor structure hook. * @details User fields added to the end of the @p Thread structure. */ #if !defined(THREAD_EXT_FIELDS) || defined(__DOXYGEN__) @@ -433,11 +442,11 @@ struct { \ #endif /** - * @brief Threads initialization hook. + * @brief Threads initialization hook. * @details User initialization code added to the @p chThdInit() API. * - * @note It is invoked from within @p chThdInit() and implicitily from all - * the threads creation APIs. + * @note It is invoked from within @p chThdInit() and implicitily from all + * the threads creation APIs. */ #if !defined(THREAD_EXT_INIT) || defined(__DOXYGEN__) #define THREAD_EXT_INIT(tp) { \ @@ -446,12 +455,12 @@ struct { \ #endif /** - * @brief Threads finalization hook. + * @brief Threads finalization hook. * @details User finalization code added to the @p chThdExit() API. * - * @note It is inserted into lock zone. - * @note It is also invoked when the threads simply return in order to - * terminate. + * @note It is inserted into lock zone. + * @note It is also invoked when the threads simply return in order to + * terminate. */ #if !defined(THREAD_EXT_EXIT) || defined(__DOXYGEN__) #define THREAD_EXT_EXIT(tp) { \ @@ -460,7 +469,7 @@ struct { \ #endif /** - * @brief Idle Loop hook. + * @brief Idle Loop hook. * @details This hook is continuously invoked by the idle thread loop. */ #if !defined(IDLE_LOOP_HOOK) || defined(__DOXYGEN__) -- cgit v1.2.3 From 09126fe34f64af501fd163d4d385a71479d71096 Mon Sep 17 00:00:00 2001 From: gdisirio Date: Sun, 18 Apr 2010 11:48:03 +0000 Subject: git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@1874 35acf78f-673a-0410-8e92-d51de3d6d3f4 --- test/test.dox | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'test') diff --git a/test/test.dox b/test/test.dox index 02f0aaae8..5678e9090 100644 --- a/test/test.dox +++ b/test/test.dox @@ -37,7 +37,7 @@ * kernel code is expected to compile without errors nor warnings and * execute the test suite without failures (a specific simulator is used * for this execution test, it is done automatically by a script because - * the entire sequence can require hours).
+ * the entire sequence can take hours).
* All the tests results are included as reports in the OS distribution * under @p ./docs/reports. * - Ports. The port code is tested by executing the kernel test -- cgit v1.2.3 From 0074052e3f64b2166258f2d117faf8acdf5d4566 Mon Sep 17 00:00:00 2001 From: gdisirio Date: Tue, 27 Apr 2010 11:53:03 +0000 Subject: Documented test runtime code. git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@1895 35acf78f-673a-0410-8e92-d51de3d6d3f4 --- test/test.c | 60 ++++++++++++++++++++++++++++++++++++++++- test/test.dox | 6 +++++ test/test.h | 80 ++++++++++++++++++++++++++++++++++++++++++------------- test/testbmk.c | 6 +++-- test/testdyn.c | 6 +++-- test/testevt.c | 6 +++-- test/testheap.c | 6 +++-- test/testmbox.c | 6 +++-- test/testmsg.c | 6 +++-- test/testmtx.c | 6 +++-- test/testpools.c | 4 ++- test/testqueues.c | 6 +++-- test/testsem.c | 6 +++-- test/testthd.c | 6 +++-- 14 files changed, 170 insertions(+), 40 deletions(-) (limited to 'test') diff --git a/test/test.c b/test/test.c index 013a0b21f..0d52d479b 100644 --- a/test/test.c +++ b/test/test.c @@ -17,6 +17,14 @@ along with this program. If not, see . */ +/** + * @file test.c + * @brief Tests support code. + * + * @addtogroup test + * @{ + */ + #include "ch.h" #include "hal.h" @@ -78,6 +86,11 @@ void * const wa[5] = {test.wa.T0, test.wa.T1, test.wa.T2, */ static BaseChannel *chp; +/** + * @brief Prints a decimal unsigned number. + * + * @param[in] n the number to be printed + */ void test_printn(uint32_t n) { char buf[16], *p; @@ -92,12 +105,22 @@ void test_printn(uint32_t n) { } } +/** + * @brief Prints a line without final end-of-line. + * + * @param[in] msgp the message + */ void test_print(char *msgp) { while (*msgp) chIOPut(chp, *msgp++); } +/** + * @brief Prints a line. + * + * @param[in] msgp the message + */ void test_println(char *msgp) { test_print(msgp); @@ -120,6 +143,11 @@ static void print_tokens(void) { chIOPut(chp, *cp++); } +/** + * @brief Emits a token into the tokens buffer. + * + * @param[in] token the token as a char + */ void test_emit_token(char token) { chSysLock(); @@ -165,6 +193,10 @@ bool_t _test_assert_time_window(unsigned point, systime_t start, systime_t end) /* * Threads utils. */ + +/** + * @brief Pends a termination request in all the test-spawned threads. + */ void test_terminate_threads(void) { int i; @@ -173,6 +205,9 @@ void test_terminate_threads(void) { chThdTerminate(threads[i]); } +/** + * @brief Waits for the completion of all the test-spawned threads. + */ void test_wait_threads(void) { int i; @@ -184,6 +219,12 @@ void test_wait_threads(void) { } #if CH_DBG_THREADS_PROFILING +/** + * @brief CPU pulse. + * @note The current implementation is not totally reliable. + * + * @param[in] duration CPU pulse duration in milliseconds + */ void test_cpu_pulse(unsigned duration) { systime_t start, end, now; @@ -200,6 +241,9 @@ void test_cpu_pulse(unsigned duration) { } #endif +/** + * @brief Delays execution until next system time tick. + */ systime_t test_wait_tick(void) { chThdSleep(1); @@ -209,15 +253,22 @@ systime_t test_wait_tick(void) { /* * Timer utils. */ -static VirtualTimer vt; + +/** @brief Set to @p TRUE when the test timer reaches its deadline.*/ bool_t test_timer_done; +static VirtualTimer vt; static void tmr(void *p) { (void)p; test_timer_done = TRUE; } +/** + * @brief Starts the test timer. + * + * @param[in] ms time in milliseconds + */ void test_start_timer(unsigned ms) { systime_t duration = MS2ST(ms); @@ -257,6 +308,11 @@ static void print_line(void) { chIOPut(chp, '\n'); } +/** + * @brief Test execution thread function. + * + * @param[in] p pointer to a @p BaseChannel object for test output + */ msg_t TestThread(void *p) { int i, j; @@ -326,3 +382,5 @@ msg_t TestThread(void *p) { return (msg_t)global_fail; } + +/** @} */ diff --git a/test/test.dox b/test/test.dox index 5678e9090..beda6d0ea 100644 --- a/test/test.dox +++ b/test/test.dox @@ -17,6 +17,12 @@ along with this program. If not, see . */ +/** + * @defgroup test Test Runtime + * @details Runtime code for the test suite execution, this code is not part + * of the OS and should not be included in user applications. + */ + /** * @page testsuite Testing Strategy *

Description

diff --git a/test/test.h b/test/test.h index 983a7b093..bcdc2e3a0 100644 --- a/test/test.h +++ b/test/test.h @@ -17,14 +17,28 @@ along with this program. If not, see . */ +/** + * @file test.h + * @brief Tests support header. + * + * @addtogroup test + * @{ + */ + #ifndef _TEST_H_ #define _TEST_H_ -#ifndef DELAY_BETWEEN_TESTS +/** + * @brief Delay inserted between test cases. + */ +#if !defined(DELAY_BETWEEN_TESTS) || defined(__DOXYGEN__) #define DELAY_BETWEEN_TESTS 200 #endif -#ifndef TEST_NO_BENCHMARKS +/** + * @brief If @p TRUE then benchmarks are not included. + */ +#if !defined(TEST_NO_BENCHMARKS) || defined(__DOXYGEN__) #define TEST_NO_BENCHMARKS FALSE #endif @@ -42,11 +56,14 @@ #endif #define WA_SIZE THD_WA_SIZE(THREADS_STACK_SIZE) +/** + * @brief Structure representing a test case. + */ struct testcase { - char *(*gettest)(void); - void (*setup)(void); - void (*teardown)(void); - void (*execute)(void); + char *(*gettest)(void); /**< @brief Test case name get function. */ + void (*setup)(void); /**< @brief Test case preparation function. */ + void (*teardown)(void); /**< @brief Test case clean up function. */ + void (*execute)(void); /**< @brief Test case execution function. */ }; #ifndef __DOXYGEN__ @@ -88,29 +105,56 @@ extern "C" { } #endif -#define test_fail(point) { \ - _test_fail(point); \ - return; \ +/** + * @brief Test failure enforcement. + */ +#define test_fail(point) { \ + _test_fail(point); \ + return; \ } -#define test_assert(point, condition, msg) { \ - if (_test_assert(point, condition)) \ - return; \ +/** + * @brief Test assertion. + * + * @param[in] point numeric assertion identifier + * @param[in] condition a boolean expression that must be verified to be true + * @param[in] msg failure message + */ +#define test_assert(point, condition, msg) { \ + if (_test_assert(point, condition)) \ + return; \ } -#define test_assert_sequence(point, expected) { \ - if (_test_assert_sequence(point, expected)) \ - return; \ +/** + * @brief Test sequence assertion. + * + * @param[in] point numeric assertion identifier + * @param[in] expected string to be matched with the tokens buffer + */ +#define test_assert_sequence(point, expected) { \ + if (_test_assert_sequence(point, expected)) \ + return; \ } -#define test_assert_time_window(point, start, end) { \ - if (_test_assert_time_window(point, start, end)) \ - return; \ +/** + * @brief Test time window assertion. + * + * @param[in] point numeric assertion identifier + * @param[in] start initial time in the window (included) + * @param[in] end final time in the window (not included) + */ +#define test_assert_time_window(point, start, end) { \ + if (_test_assert_time_window(point, start, end)) \ + return; \ } +#if !defined(__DOXYGEN__) extern Thread *threads[MAX_THREADS]; extern union test_buffers test; extern void * const wa[]; extern bool_t test_timer_done; +#endif #endif /* _TEST_H_ */ + +/** @} */ diff --git a/test/testbmk.c b/test/testbmk.c index 565c0c066..9e0d687e2 100644 --- a/test/testbmk.c +++ b/test/testbmk.c @@ -23,6 +23,8 @@ /** * @page test_benchmarks Kernel Benchmarks * + * File: @ref testbmk.c + * *

Description

* This module implements a series of system benchmarks. The benchmarks are * useful as a stress test and as a reference when comparing ChibiOS/RT @@ -744,8 +746,8 @@ const struct testcase testbmk13 = { bmk13_execute }; -/* - * Test sequence for benchmarks pattern. +/** + * @brief Test sequence for benchmarks. */ const struct testcase * const patternbmk[] = { #if !TEST_NO_BENCHMARKS diff --git a/test/testdyn.c b/test/testdyn.c index cb6b40908..2d05f346b 100644 --- a/test/testdyn.c +++ b/test/testdyn.c @@ -23,6 +23,8 @@ /** * @page test_dynamic Dynamic APIs test * + * File: @ref testdyn.c + * *

Description

* This module implements the test sequence for the dynamic thread creation * APIs. @@ -189,8 +191,8 @@ const struct testcase testdyn2 = { #endif /* CH_USE_DYNAMIC */ -/* - * Test sequence for dynamic APIs pattern. +/** + * @brief Test sequence for dynamic APIs. */ const struct testcase * const patterndyn[] = { #if CH_USE_DYNAMIC diff --git a/test/testevt.c b/test/testevt.c index f8844d3a4..52ffc5ccd 100644 --- a/test/testevt.c +++ b/test/testevt.c @@ -23,6 +23,8 @@ /** * @page test_events Events test * + * File: @ref testevt.c + * *

Description

* This module implements the test sequence for the @ref events subsystem. * @@ -293,8 +295,8 @@ const struct testcase testevt3 = { }; #endif /* CH_USE_EVENTS_TIMEOUT */ -/* - * Test sequence for events pattern. +/** + * @brief Test sequence for events. */ const struct testcase * const patternevt[] = { #if CH_USE_EVENTS diff --git a/test/testheap.c b/test/testheap.c index 84936babc..2f4998be6 100644 --- a/test/testheap.c +++ b/test/testheap.c @@ -23,6 +23,8 @@ /** * @page test_heap Memory Heap test * + * File: @ref testheap.c + * *

Description

* This module implements the test sequence for the @ref heaps subsystem. * @@ -151,8 +153,8 @@ const struct testcase testheap1 = { #endif /* CH_USE_HEAP.*/ -/* - * Test sequence for heap pattern. +/** + * @brief Test sequence for heap. */ const struct testcase * const patternheap[] = { #if CH_USE_HEAP diff --git a/test/testmbox.c b/test/testmbox.c index 707b112ef..b3fa57470 100644 --- a/test/testmbox.c +++ b/test/testmbox.c @@ -23,6 +23,8 @@ /** * @page test_mbox Mailboxes test * + * File: @ref testmbox.c + * *

Description

* This module implements the test sequence for the @ref mailboxes subsystem. * @@ -167,8 +169,8 @@ const struct testcase testmbox1 = { #endif /* CH_USE_MAILBOXES */ -/* - * Test sequence for mailboxes pattern. +/** + * @brief Test sequence for mailboxes. */ const struct testcase * const patternmbox[] = { #if CH_USE_MAILBOXES diff --git a/test/testmsg.c b/test/testmsg.c index 5669f733e..3757f1de9 100644 --- a/test/testmsg.c +++ b/test/testmsg.c @@ -23,6 +23,8 @@ /** * @page test_msg Messages test * + * File: @ref testmsg.c + * *

Description

* This module implements the test sequence for the @ref messages subsystem. * @@ -113,8 +115,8 @@ const struct testcase testmsg1 = { #endif /* CH_USE_MESSAGES */ -/* - * Test sequence for messages pattern. +/** + * @brief Test sequence for messages. */ const struct testcase * const patternmsg[] = { #if CH_USE_MESSAGES diff --git a/test/testmtx.c b/test/testmtx.c index 2ac3059b3..f1d7b6d2a 100644 --- a/test/testmtx.c +++ b/test/testmtx.c @@ -23,6 +23,8 @@ /** * @page test_mtx Mutexes test * + * File: @ref testmtx.c + * *

Description

* This module implements the test sequence for the @ref mutexes and * @ref condvars subsystems.
@@ -643,8 +645,8 @@ const struct testcase testmtx8 = { #endif /* CH_USE_CONDVARS */ #endif /* CH_USE_MUTEXES */ -/* - * Test sequence for mutexes pattern. +/** + * @brief Test sequence for mutexes. */ const struct testcase * const patternmtx[] = { #if CH_USE_MUTEXES diff --git a/test/testpools.c b/test/testpools.c index bed35c8f8..75b26d50f 100644 --- a/test/testpools.c +++ b/test/testpools.c @@ -23,6 +23,8 @@ /** * @page test_pools Memory Pools test * + * File: @ref testpools.c + * *

Description

* This module implements the test sequence for the @ref pools subsystem. * @@ -93,7 +95,7 @@ const struct testcase testpools1 = { #endif /* CH_USE_MEMPOOLS */ /* - * Test sequence for pools pattern. + * @brief Test sequence for pools. */ const struct testcase * const patternpools[] = { #if CH_USE_MEMPOOLS diff --git a/test/testqueues.c b/test/testqueues.c index 0f2ae7a81..8247cbd07 100644 --- a/test/testqueues.c +++ b/test/testqueues.c @@ -23,6 +23,8 @@ /** * @page test_queues I/O Queues test * + * File: @ref testqueues.c + * *

Description

* This module implements the test sequence for the @ref io_queues subsystem. * The tests are performed by inserting and removing data from queues and by @@ -204,8 +206,8 @@ const struct testcase testqueues2 = { }; #endif /* CH_USE_QUEUES */ -/* - * Test sequence for queues pattern. +/** + * @brief Test sequence for queues. */ const struct testcase * const patternqueues[] = { #if CH_USE_QUEUES diff --git a/test/testsem.c b/test/testsem.c index bc7162de5..dd9db66cd 100644 --- a/test/testsem.c +++ b/test/testsem.c @@ -23,6 +23,8 @@ /** * @page test_sem Semaphores test * + * File: @ref testsem.c + * *

Description

* This module implements the test sequence for the @ref semaphores subsystem. * @@ -242,8 +244,8 @@ const struct testcase testsem3 = { #endif /* CH_USE_SEMSW */ #endif /* CH_USE_SEMAPHORES */ -/* - * Test sequence for semaphores pattern. +/** + * @brief Test sequence for semaphores. */ const struct testcase * const patternsem[] = { #if CH_USE_SEMAPHORES diff --git a/test/testthd.c b/test/testthd.c index 08b792ce4..c2150a9c1 100644 --- a/test/testthd.c +++ b/test/testthd.c @@ -23,6 +23,8 @@ /** * @page test_threads Threads and Scheduler test * + * File: @ref testthd.c + * *

Description

* This module implements the test sequence for the @ref scheduler, * @ref threads and @ref time subsystems.
@@ -236,8 +238,8 @@ const struct testcase testthd4 = { thd4_execute }; -/* - * Test sequence for threads patterns. +/** + * @brief Test sequence for threads. */ const struct testcase * const patternthd[] = { &testthd1, -- cgit v1.2.3 From bc9d319ddb279f973404c2b1abf15ec1091bd891 Mon Sep 17 00:00:00 2001 From: gdisirio Date: Tue, 4 May 2010 12:31:05 +0000 Subject: Improved code coverage. git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@1902 35acf78f-673a-0410-8e92-d51de3d6d3f4 --- test/testdyn.c | 75 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++ test/testheap.c | 3 +++ test/testpools.c | 9 +++++++ 3 files changed, 87 insertions(+) (limited to 'test') diff --git a/test/testdyn.c b/test/testdyn.c index 2d05f346b..dcd2d951e 100644 --- a/test/testdyn.c +++ b/test/testdyn.c @@ -44,6 +44,7 @@ *

Test Cases

* - @subpage test_dynamic_001 * - @subpage test_dynamic_002 + * - @subpage test_dynamic_003 * . * @file testdyn.c * @brief Dynamic thread APIs test source file @@ -189,6 +190,77 @@ const struct testcase testdyn2 = { }; #endif /* CH_USE_MEMPOOLS */ +#if CH_USE_HEAP +/** + * @page test_dynamic_003 Registry and References test + * + *

Description

+ * Registry and Thread References APIs are tested for functionality and + * coverage. + */ + +static unsigned regscan(void) { + Thread *tp; + unsigned i = 0; + + tp = chRegFirstThread(); + do { + i++; + tp = chRegNextThread(tp); + } while (tp != NULL); + return i; +} + +static char *dyn3_gettest(void) { + + return "Dynamic APIs, registry and references"; +} + +static void dyn3_setup(void) { + + chHeapInit(&heap1, test.buffer, sizeof(union test_buffers)); +} + +static void dyn3_execute(void) { + unsigned n1, n2, n3; + tprio_t prio = chThdGetPriority(); + + /* Current number of threads in the system, two times just in case some + external detached thread terminated.*/ + (void)regscan(); + n1 = regscan(); + + /* Testing references increase/decrease and final detach.*/ + threads[0] = chThdCreateFromHeap(&heap1, THD_WA_SIZE(THREADS_STACK_SIZE), + prio-1, thread, "A"); + test_assert(1, threads[0]->p_refs == 1, "wrong initial reference counter"); + chThdAddRef(threads[0]); + test_assert(2, threads[0]->p_refs == 2, "references increase failure"); + chThdRelease(threads[0]); + test_assert(3, threads[0]->p_refs == 1, "references decrease failure"); + + /* Verify the new threads count.*/ + n2 = regscan(); + test_assert(4, n1 == n2 - 1, "unexpected threads count"); + + /* Detach and let the thread execute and terminate.*/ + chThdRelease(threads[0]); + test_assert(5, threads[0]->p_refs == 0, "detach failure"); + chThdSleepMilliseconds(50); /* The thread just terminates. */ + test_assert(6, threads[0]->p_state == THD_STATE_FINAL, "invalid state"); + + /* Clearing the zombie by scanning the registry.*/ + n3 = regscan(); + test_assert(7, n1 == n3, "unexpected threads count"); +} + +const struct testcase testdyn3 = { + dyn3_gettest, + dyn3_setup, + NULL, + dyn3_execute +}; +#endif /* CH_USE_HEAP */ #endif /* CH_USE_DYNAMIC */ /** @@ -202,6 +274,9 @@ const struct testcase * const patterndyn[] = { #if CH_USE_MEMPOOLS &testdyn2, #endif +#if CH_USE_HEAP + &testdyn3, +#endif #endif NULL }; diff --git a/test/testheap.c b/test/testheap.c index 2f4998be6..eb81f77ed 100644 --- a/test/testheap.c +++ b/test/testheap.c @@ -78,6 +78,9 @@ static void heap1_execute(void) { void *p1, *p2, *p3; size_t n, sz; + /* Unrelated, for coverage only.*/ + (void)chCoreStatus(); + /* * Test on the default heap in order to cover the core allocator at * least one time. diff --git a/test/testpools.c b/test/testpools.c index 75b26d50f..af4999547 100644 --- a/test/testpools.c +++ b/test/testpools.c @@ -60,6 +60,11 @@ static MEMORYPOOL_DECL(mp1, THD_WA_SIZE(THREADS_STACK_SIZE), NULL); * operation. */ +static void *null_provider(size_t size) { + + return NULL; +} + static char *pools1_gettest(void) { return "Memory Pools, queue/dequeue"; @@ -83,6 +88,10 @@ static void pools1_execute(void) { /* Now must be empty. */ test_assert(2, chPoolAlloc(&mp1) == NULL, "list not empty"); + + /* Covering the case where a provider is unable to return more memory.*/ + chPoolInit(&mp1, 16, null_provider); + test_assert(3, chPoolAlloc(&mp1) == NULL, "provider returned memory"); } const struct testcase testpools1 = { -- cgit v1.2.3 From 9d256a8b42e827204c80205cc47a982d5c5c7b52 Mon Sep 17 00:00:00 2001 From: gdisirio Date: Tue, 4 May 2010 19:55:26 +0000 Subject: git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@1903 35acf78f-673a-0410-8e92-d51de3d6d3f4 --- test/testpools.c | 1 + 1 file changed, 1 insertion(+) (limited to 'test') diff --git a/test/testpools.c b/test/testpools.c index af4999547..fdd637768 100644 --- a/test/testpools.c +++ b/test/testpools.c @@ -62,6 +62,7 @@ static MEMORYPOOL_DECL(mp1, THD_WA_SIZE(THREADS_STACK_SIZE), NULL); static void *null_provider(size_t size) { + (void)size; return NULL; } -- cgit v1.2.3 From 691538eb399e9a0ca1e8ed86699c58e3022d6fd5 Mon Sep 17 00:00:00 2001 From: gdisirio Date: Sat, 8 May 2010 10:30:38 +0000 Subject: git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@1909 35acf78f-673a-0410-8e92-d51de3d6d3f4 --- test/testdyn.c | 37 +++++++++++++++++++------------------ 1 file changed, 19 insertions(+), 18 deletions(-) (limited to 'test') diff --git a/test/testdyn.c b/test/testdyn.c index dcd2d951e..345076828 100644 --- a/test/testdyn.c +++ b/test/testdyn.c @@ -53,6 +53,12 @@ */ #if CH_USE_DYNAMIC +#if CH_USE_HEAP +static MemoryHeap heap1; +#endif +#if CH_USE_MEMPOOLS +static MemoryPool mp1; +#endif /** * @page test_dynamic_001 Threads creation from Memory Heap @@ -72,9 +78,6 @@ static msg_t thread(void *p) { } #if CH_USE_HEAP - -static MemoryHeap heap1; - static char *dyn1_gettest(void) { return "Dynamic APIs, threads creation from heap"; @@ -138,8 +141,6 @@ const struct testcase testdyn1 = { * one to fail. */ -static MemoryPool mp1; - static char *dyn2_gettest(void) { return "Dynamic APIs, threads creation from memory pool"; @@ -190,7 +191,7 @@ const struct testcase testdyn2 = { }; #endif /* CH_USE_MEMPOOLS */ -#if CH_USE_HEAP +#if CH_USE_HEAP && CH_USE_REGISTRY /** * @page test_dynamic_003 Registry and References test * @@ -223,6 +224,7 @@ static void dyn3_setup(void) { static void dyn3_execute(void) { unsigned n1, n2, n3; + Thread *tp; tprio_t prio = chThdGetPriority(); /* Current number of threads in the system, two times just in case some @@ -231,23 +233,22 @@ static void dyn3_execute(void) { n1 = regscan(); /* Testing references increase/decrease and final detach.*/ - threads[0] = chThdCreateFromHeap(&heap1, THD_WA_SIZE(THREADS_STACK_SIZE), - prio-1, thread, "A"); - test_assert(1, threads[0]->p_refs == 1, "wrong initial reference counter"); - chThdAddRef(threads[0]); - test_assert(2, threads[0]->p_refs == 2, "references increase failure"); - chThdRelease(threads[0]); - test_assert(3, threads[0]->p_refs == 1, "references decrease failure"); + tp = chThdCreateFromHeap(&heap1, WA_SIZE, prio-1, thread, "A"); + test_assert(1, tp->p_refs == 1, "wrong initial reference counter"); + chThdAddRef(tp); + test_assert(2, tp->p_refs == 2, "references increase failure"); + chThdRelease(tp); + test_assert(3, tp->p_refs == 1, "references decrease failure"); /* Verify the new threads count.*/ n2 = regscan(); test_assert(4, n1 == n2 - 1, "unexpected threads count"); /* Detach and let the thread execute and terminate.*/ - chThdRelease(threads[0]); - test_assert(5, threads[0]->p_refs == 0, "detach failure"); + chThdRelease(tp); + test_assert(5, tp->p_refs == 0, "detach failure"); chThdSleepMilliseconds(50); /* The thread just terminates. */ - test_assert(6, threads[0]->p_state == THD_STATE_FINAL, "invalid state"); + test_assert(6, tp->p_state == THD_STATE_FINAL, "invalid state"); /* Clearing the zombie by scanning the registry.*/ n3 = regscan(); @@ -260,7 +261,7 @@ const struct testcase testdyn3 = { NULL, dyn3_execute }; -#endif /* CH_USE_HEAP */ +#endif /* CH_USE_HEAP && CH_USE_REGISTRY */ #endif /* CH_USE_DYNAMIC */ /** @@ -274,7 +275,7 @@ const struct testcase * const patterndyn[] = { #if CH_USE_MEMPOOLS &testdyn2, #endif -#if CH_USE_HEAP +#if CH_USE_HEAP && CH_USE_REGISTRY &testdyn3, #endif #endif -- cgit v1.2.3 From fd41cf487a4e4e6d949efecdedc16b3e67d5d0b4 Mon Sep 17 00:00:00 2001 From: gdisirio Date: Fri, 4 Jun 2010 12:33:23 +0000 Subject: git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@1997 35acf78f-673a-0410-8e92-d51de3d6d3f4 --- test/coverage/chconf.h | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'test') diff --git a/test/coverage/chconf.h b/test/coverage/chconf.h index 65ac31b4f..9458d0257 100644 --- a/test/coverage/chconf.h +++ b/test/coverage/chconf.h @@ -478,6 +478,10 @@ struct { \ } #endif +/*===========================================================================*/ +/* Port-specific settings (override port settings defaulted in chcore.h). */ +/*===========================================================================*/ + #endif /* _CHCONF_H_ */ /** @} */ -- cgit v1.2.3 From a544f87a38e6f0b4b60113dbec8352d5f6c04104 Mon Sep 17 00:00:00 2001 From: gdisirio Date: Tue, 15 Jun 2010 11:34:16 +0000 Subject: git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@2020 35acf78f-673a-0410-8e92-d51de3d6d3f4 --- test/test.c | 6 ++-- test/test.h | 6 ++-- test/testbmk.c | 91 ++++++++----------------------------------------------- test/testdyn.c | 21 ++----------- test/testevt.c | 21 ++----------- test/testheap.c | 7 +---- test/testmbox.c | 7 +---- test/testmsg.c | 7 +---- test/testmtx.c | 49 +++++------------------------- test/testpools.c | 7 +---- test/testqueues.c | 13 ++------ test/testsem.c | 31 ++++++------------- test/testthd.c | 28 +++-------------- 13 files changed, 52 insertions(+), 242 deletions(-) (limited to 'test') diff --git a/test/test.c b/test/test.c index 0d52d479b..3a5c93edc 100644 --- a/test/test.c +++ b/test/test.c @@ -110,7 +110,7 @@ void test_printn(uint32_t n) { * * @param[in] msgp the message */ -void test_print(char *msgp) { +void test_print(const char *msgp) { while (*msgp) chIOPut(chp, *msgp++); @@ -121,7 +121,7 @@ void test_print(char *msgp) { * * @param[in] msgp the message */ -void test_println(char *msgp) { +void test_println(const char *msgp) { test_print(msgp); chIOPut(chp, '\r'); @@ -353,7 +353,7 @@ msg_t TestThread(void *p) { test_print("."); test_printn(j + 1); test_print(" ("); - test_print(patterns[i][j]->gettest()); + test_print(patterns[i][j]->name); test_println(")"); #if DELAY_BETWEEN_TESTS > 0 chThdSleepMilliseconds(DELAY_BETWEEN_TESTS); diff --git a/test/test.h b/test/test.h index bcdc2e3a0..2ab27847e 100644 --- a/test/test.h +++ b/test/test.h @@ -60,7 +60,7 @@ * @brief Structure representing a test case. */ struct testcase { - char *(*gettest)(void); /**< @brief Test case name get function. */ + const char *name; /**< @brief Test case name. */ void (*setup)(void); /**< @brief Test case preparation function. */ void (*teardown)(void); /**< @brief Test case clean up function. */ void (*execute)(void); /**< @brief Test case execution function. */ @@ -84,8 +84,8 @@ extern "C" { #endif msg_t TestThread(void *p); void test_printn(uint32_t n); - void test_print(char *msgp); - void test_println(char *msgp); + void test_print(const char *msgp); + void test_println(const char *msgp); void test_emit_token(char token); bool_t _test_fail(unsigned point); bool_t _test_assert(unsigned point, bool_t condition); diff --git a/test/testbmk.c b/test/testbmk.c index 9e0d687e2..a67c09af1 100644 --- a/test/testbmk.c +++ b/test/testbmk.c @@ -102,11 +102,6 @@ static unsigned int msg_loop_test(Thread *tp) { * printed in the output log. */ -static char *bmk1_gettest(void) { - - return "Benchmark, messages #1"; -} - static void bmk1_execute(void) { uint32_t n; @@ -121,7 +116,7 @@ static void bmk1_execute(void) { } const struct testcase testbmk1 = { - bmk1_gettest, + "Benchmark, messages #1", NULL, NULL, bmk1_execute @@ -136,11 +131,6 @@ const struct testcase testbmk1 = { * printed in the output log. */ -static char *bmk2_gettest(void) { - - return "Benchmark, messages #2"; -} - static void bmk2_execute(void) { uint32_t n; @@ -155,7 +145,7 @@ static void bmk2_execute(void) { } const struct testcase testbmk2 = { - bmk2_gettest, + "Benchmark, messages #2", NULL, NULL, bmk2_execute @@ -176,11 +166,6 @@ static msg_t thread2(void *p) { * printed in the output log. */ -static char *bmk3_gettest(void) { - - return "Benchmark, messages #3"; -} - static void bmk3_execute(void) { uint32_t n; @@ -199,7 +184,7 @@ static void bmk3_execute(void) { } const struct testcase testbmk3 = { - bmk3_gettest, + "Benchmark, messages #3", NULL, NULL, bmk3_execute @@ -215,11 +200,6 @@ const struct testcase testbmk3 = { * iterations after a second of continuous operations. */ -static char *bmk4_gettest(void) { - - return "Benchmark, context switch"; -} - msg_t thread4(void *p) { msg_t msg; Thread *self = chThdSelf(); @@ -265,7 +245,7 @@ static void bmk4_execute(void) { } const struct testcase testbmk4 = { - bmk4_gettest, + "Benchmark, context switch", NULL, NULL, bmk4_execute @@ -282,11 +262,6 @@ const struct testcase testbmk4 = { * a second of continuous operations. */ -static char *bmk5_gettest(void) { - - return "Benchmark, threads, full cycle"; -} - static void bmk5_execute(void) { uint32_t n = 0; @@ -307,7 +282,7 @@ static void bmk5_execute(void) { } const struct testcase testbmk5 = { - bmk5_gettest, + "Benchmark, threads, full cycle", NULL, NULL, bmk5_execute @@ -326,11 +301,6 @@ const struct testcase testbmk5 = { * a second of continuous operations. */ -static char *bmk6_gettest(void) { - - return "Benchmark, threads, create only"; -} - static void bmk6_execute(void) { uint32_t n = 0; @@ -351,7 +321,7 @@ static void bmk6_execute(void) { } const struct testcase testbmk6 = { - bmk6_gettest, + "Benchmark, threads, create only", NULL, NULL, bmk6_execute @@ -376,11 +346,6 @@ static msg_t thread3(void *p) { return 0; } -static char *bmk7_gettest(void) { - - return "Benchmark, mass reschedule, 5 threads"; -} - static void bmk7_setup(void) { chSemInit(&sem1, 0); @@ -417,7 +382,7 @@ static void bmk7_execute(void) { } const struct testcase testbmk7 = { - bmk7_gettest, + "Benchmark, mass reschedule, 5 threads", bmk7_setup, NULL, bmk7_execute @@ -448,11 +413,6 @@ static msg_t thread8(void *p) { return 0; } -static char *bmk8_gettest(void) { - - return "Benchmark, round robin context switching"; -} - static void bmk8_execute(void) { uint32_t n; @@ -475,7 +435,7 @@ static void bmk8_execute(void) { } const struct testcase testbmk8 = { - bmk8_gettest, + "Benchmark, round robin context switching", NULL, NULL, bmk8_execute @@ -491,11 +451,6 @@ const struct testcase testbmk8 = { * a second of continuous operations. */ -static char *bmk9_gettest(void) { - - return "Benchmark, I/O Queues throughput"; -} - static void bmk9_execute(void) { uint32_t n; static uint8_t ib[16]; @@ -525,7 +480,7 @@ static void bmk9_execute(void) { } const struct testcase testbmk9 = { - bmk9_gettest, + "Benchmark, I/O Queues throughput", NULL, NULL, bmk9_execute @@ -540,11 +495,6 @@ const struct testcase testbmk9 = { * a second of continuous operations. */ -static char *bmk10_gettest(void) { - - return "Benchmark, virtual timers set/reset"; -} - static void tmo(void *param) {(void)param;} static void bmk10_execute(void) { @@ -571,7 +521,7 @@ static void bmk10_execute(void) { } const struct testcase testbmk10 = { - bmk10_gettest, + "Benchmark, virtual timers set/reset", NULL, NULL, bmk10_execute @@ -587,11 +537,6 @@ const struct testcase testbmk10 = { * a second of continuous operations. */ -static char *bmk11_gettest(void) { - - return "Benchmark, semaphores wait/signal"; -} - static void bmk11_setup(void) { chSemInit(&sem1, 1); @@ -622,7 +567,7 @@ static void bmk11_execute(void) { } const struct testcase testbmk11 = { - bmk11_gettest, + "Benchmark, semaphores wait/signal", bmk11_setup, NULL, bmk11_execute @@ -639,11 +584,6 @@ const struct testcase testbmk11 = { * a second of continuous operations. */ -static char *bmk12_gettest(void) { - - return "Benchmark, mutexes lock/unlock"; -} - static void bmk12_setup(void) { chMtxInit(&mtx1); @@ -674,7 +614,7 @@ static void bmk12_execute(void) { } const struct testcase testbmk12 = { - bmk12_gettest, + "Benchmark, mutexes lock/unlock", bmk12_setup, NULL, bmk12_execute @@ -688,11 +628,6 @@ const struct testcase testbmk12 = { * The memory size of the various kernel objects is printed. */ -static char *bmk13_gettest(void) { - - return "Benchmark, RAM footprint"; -} - static void bmk13_execute(void) { test_print("--- System: "); @@ -740,7 +675,7 @@ static void bmk13_execute(void) { } const struct testcase testbmk13 = { - bmk13_gettest, + "Benchmark, RAM footprint", NULL, NULL, bmk13_execute diff --git a/test/testdyn.c b/test/testdyn.c index 345076828..4bd4ed06c 100644 --- a/test/testdyn.c +++ b/test/testdyn.c @@ -78,11 +78,6 @@ static msg_t thread(void *p) { } #if CH_USE_HEAP -static char *dyn1_gettest(void) { - - return "Dynamic APIs, threads creation from heap"; -} - static void dyn1_setup(void) { chHeapInit(&heap1, test.buffer, sizeof(union test_buffers)); @@ -123,7 +118,7 @@ static void dyn1_execute(void) { } const struct testcase testdyn1 = { - dyn1_gettest, + "Dynamic APIs, threads creation from heap", dyn1_setup, NULL, dyn1_execute @@ -141,11 +136,6 @@ const struct testcase testdyn1 = { * one to fail. */ -static char *dyn2_gettest(void) { - - return "Dynamic APIs, threads creation from memory pool"; -} - static void dyn2_setup(void) { chPoolInit(&mp1, THD_WA_SIZE(THREADS_STACK_SIZE), NULL); @@ -184,7 +174,7 @@ static void dyn2_execute(void) { } const struct testcase testdyn2 = { - dyn2_gettest, + "Dynamic APIs, threads creation from memory pool", dyn2_setup, NULL, dyn2_execute @@ -212,11 +202,6 @@ static unsigned regscan(void) { return i; } -static char *dyn3_gettest(void) { - - return "Dynamic APIs, registry and references"; -} - static void dyn3_setup(void) { chHeapInit(&heap1, test.buffer, sizeof(union test_buffers)); @@ -256,7 +241,7 @@ static void dyn3_execute(void) { } const struct testcase testdyn3 = { - dyn3_gettest, + "Dynamic APIs, registry and references", dyn3_setup, NULL, dyn3_execute diff --git a/test/testevt.c b/test/testevt.c index 52ffc5ccd..7e3f4a405 100644 --- a/test/testevt.c +++ b/test/testevt.c @@ -75,11 +75,6 @@ static EVENTSOURCE_DECL(es2); * the associated event handlers are invoked in LSb-first order. */ -static char *evt1_gettest(void) { - - return "Events, registration and dispatch"; -} - static void evt1_setup(void) { chEvtClear(ALL_EVENTS); @@ -113,7 +108,7 @@ static void evt1_execute(void) { } const struct testcase testevt1 = { - evt1_gettest, + "Events, registration and dispatch", evt1_setup, NULL, evt1_execute @@ -133,11 +128,6 @@ const struct testcase testevt1 = { * the expected time and that there are no stuck event flags. */ -static char *evt2_gettest(void) { - - return "Events, wait and broadcast"; -} - static void evt2_setup(void) { chEvtClear(ALL_EVENTS); @@ -235,7 +225,7 @@ static void evt2_execute(void) { } const struct testcase testevt2 = { - evt2_gettest, + "Events, wait and broadcast", evt2_setup, NULL, evt2_execute @@ -257,11 +247,6 @@ const struct testcase testevt2 = { * After each test phase the test verifies that there are no stuck event flags. */ -static char *evt3_gettest(void) { - - return "Events, timeouts"; -} - static void evt3_setup(void) { chEvtClear(ALL_EVENTS); @@ -288,7 +273,7 @@ static void evt3_execute(void) { } const struct testcase testevt3 = { - evt3_gettest, + "Events, timeouts", evt3_setup, NULL, evt3_execute diff --git a/test/testheap.c b/test/testheap.c index eb81f77ed..698a01861 100644 --- a/test/testheap.c +++ b/test/testheap.c @@ -64,11 +64,6 @@ static MemoryHeap test_heap; * sequence. */ -static char *heap1_gettest(void) { - - return "Heap, allocation and fragmentation test"; -} - static void heap1_setup(void) { chHeapInit(&test_heap, test.buffer, sizeof(union test_buffers)); @@ -148,7 +143,7 @@ static void heap1_execute(void) { } const struct testcase testheap1 = { - heap1_gettest, + "Heap, allocation and fragmentation test", heap1_setup, NULL, heap1_execute diff --git a/test/testmbox.c b/test/testmbox.c index b3fa57470..7926f3d06 100644 --- a/test/testmbox.c +++ b/test/testmbox.c @@ -71,11 +71,6 @@ static MAILBOX_DECL(mb1, test.wa.T0, MB_SIZE); * The test expects to find a consistent mailbox status after each operation. */ -static char *mbox1_gettest(void) { - - return "Mailboxes, queuing and timeouts"; -} - static void mbox1_setup(void) { chMBInit(&mb1, (msg_t *)test.wa.T0, MB_SIZE); @@ -161,7 +156,7 @@ static void mbox1_execute(void) { } const struct testcase testmbox1 = { - mbox1_gettest, + "Mailboxes, queuing and timeouts", mbox1_setup, NULL, mbox1_execute diff --git a/test/testmsg.c b/test/testmsg.c index 3757f1de9..5db9614bb 100644 --- a/test/testmsg.c +++ b/test/testmsg.c @@ -59,11 +59,6 @@ * not find a fifth message waiting. */ -static char *msg1_gettest(void) { - - return "Messages, loop"; -} - static msg_t thread(void *p) { chMsgSend(p, 'A'); @@ -107,7 +102,7 @@ static void msg1_execute(void) { } const struct testcase testmsg1 = { - msg1_gettest, + "Messages, loop", NULL, NULL, msg1_execute diff --git a/test/testmtx.c b/test/testmtx.c index f1d7b6d2a..7337b1f14 100644 --- a/test/testmtx.c +++ b/test/testmtx.c @@ -83,10 +83,6 @@ static CONDVAR_DECL(c1); * The test expects the threads to perform their operations in increasing * priority order regardless of the initial order. */ -static char *mtx1_gettest(void) { - - return "Mutexes, priority enqueuing test"; -} static void mtx1_setup(void) { @@ -117,7 +113,7 @@ static void mtx1_execute(void) { } const struct testcase testmtx1 = { - mtx1_gettest, + "Mutexes, priority enqueuing test", mtx1_setup, NULL, mtx1_execute @@ -155,11 +151,6 @@ const struct testcase testmtx1 = { * @endcode */ -static char *mtx2_gettest(void) { - - return "Mutexes, priority inheritance, simple case"; -} - static void mtx2_setup(void) { chMtxInit(&m1); @@ -213,7 +204,7 @@ static void mtx2_execute(void) { } const struct testcase testmtx2 = { - mtx2_gettest, + "Mutexes, priority inheritance, simple case", mtx2_setup, NULL, mtx2_execute @@ -249,10 +240,6 @@ const struct testcase testmtx2 = { * ^ - Priority transition (boost or return). * @endcode */ -static char *mtx3_gettest(void) { - - return "Mutexes, priority inheritance, complex case"; -} static void mtx3_setup(void) { @@ -337,7 +324,7 @@ static void mtx3_execute(void) { } const struct testcase testmtx3 = { - mtx3_gettest, + "Mutexes, priority inheritance, complex case", mtx3_setup, NULL, mtx3_execute @@ -353,10 +340,6 @@ const struct testcase testmtx3 = { * The test expects that the priority changes caused by the priority * inheritance algorithm happen at the right moment and with the right values. */ -static char *mtx4_gettest(void) { - - return "Mutexes, priority return"; -} static void mtx4_setup(void) { @@ -429,7 +412,7 @@ static void mtx4_execute(void) { } const struct testcase testmtx4 = { - mtx4_gettest, + "Mutexes, priority return", mtx4_setup, NULL, mtx4_execute @@ -444,10 +427,6 @@ const struct testcase testmtx4 = { * The test expects that the internal mutex status is consistent after each * operation. */ -static char *mtx5_gettest(void) { - - return "Mutexes, status"; -} static void mtx5_setup(void) { @@ -476,7 +455,7 @@ static void mtx5_execute(void) { } const struct testcase testmtx5 = { - mtx5_gettest, + "Mutexes, status", mtx5_setup, NULL, mtx5_execute @@ -493,10 +472,6 @@ const struct testcase testmtx5 = { * The test expects the threads to reach their goal in increasing priority * order regardless of the initial order. */ -static char *mtx6_gettest(void) { - - return "CondVar, signal test"; -} static void mtx6_setup(void) { @@ -534,7 +509,7 @@ static void mtx6_execute(void) { } const struct testcase testmtx6 = { - mtx6_gettest, + "CondVar, signal test", mtx6_setup, NULL, mtx6_execute @@ -549,10 +524,6 @@ const struct testcase testmtx6 = { * The test expects the threads to reach their goal in increasing priority * order regardless of the initial order. */ -static char *mtx7_gettest(void) { - - return "CondVar, broadcast test"; -} static void mtx7_setup(void) { @@ -575,7 +546,7 @@ static void mtx7_execute(void) { } const struct testcase testmtx7 = { - mtx7_gettest, + "CondVar, broadcast test", mtx7_setup, NULL, mtx7_execute @@ -589,10 +560,6 @@ const struct testcase testmtx7 = { * conditional variable queue. It tests this very specific situation in order * to complete the code coverage. */ -static char *mtx8_gettest(void) { - - return "CondVar, boost test"; -} static void mtx8_setup(void) { @@ -637,7 +604,7 @@ static void mtx8_execute(void) { } const struct testcase testmtx8 = { - mtx8_gettest, + "CondVar, boost test", mtx8_setup, NULL, mtx8_execute diff --git a/test/testpools.c b/test/testpools.c index fdd637768..2ed0e6b35 100644 --- a/test/testpools.c +++ b/test/testpools.c @@ -66,11 +66,6 @@ static void *null_provider(size_t size) { return NULL; } -static char *pools1_gettest(void) { - - return "Memory Pools, queue/dequeue"; -} - static void pools1_setup(void) { chPoolInit(&mp1, THD_WA_SIZE(THREADS_STACK_SIZE), NULL); @@ -96,7 +91,7 @@ static void pools1_execute(void) { } const struct testcase testpools1 = { - pools1_gettest, + "Memory Pools, queue/dequeue", pools1_setup, NULL, pools1_execute diff --git a/test/testqueues.c b/test/testqueues.c index 8247cbd07..149c2a3c3 100644 --- a/test/testqueues.c +++ b/test/testqueues.c @@ -76,11 +76,6 @@ static OUTPUTQUEUE_DECL(oq, test.wa.T1, TEST_QUEUES_SIZE, notify); * consistent through the whole test. */ -static char *queues1_gettest(void) { - - return "Queues, input queues"; -} - static void queues1_setup(void) { chIQInit(&iq, wa[0], TEST_QUEUES_SIZE, notify); @@ -135,7 +130,7 @@ static void queues1_execute(void) { } const struct testcase testqueues1 = { - queues1_gettest, + "Queues, input queues", queues1_setup, NULL, queues1_execute @@ -149,10 +144,6 @@ const struct testcase testqueues1 = { * @p OutputQueue object including timeouts. The queue state must remain * consistent through the whole test. */ -static char *queues2_gettest(void) { - - return "Queues, output queues"; -} static void queues2_setup(void) { @@ -199,7 +190,7 @@ static void queues2_execute(void) { } const struct testcase testqueues2 = { - queues2_gettest, + "Queues, output queues", queues2_setup, NULL, queues2_execute diff --git a/test/testsem.c b/test/testsem.c index dd9db66cd..58d4e5e35 100644 --- a/test/testsem.c +++ b/test/testsem.c @@ -70,10 +70,6 @@ static SEMAPHORE_DECL(sem1, 0); * priority order depending on the CH_USE_SEMAPHORES_PRIORITY configuration * setting. */ -static char *sem1_gettest(void) { - - return "Semaphores, enqueuing"; -} static void sem1_setup(void) { @@ -107,6 +103,13 @@ static void sem1_execute(void) { #endif } +const struct testcase testsem1 = { + "Semaphores, enqueuing", + sem1_setup, + NULL, + sem1_execute +}; + /** * @page test_sem_002 Timeout test * @@ -117,17 +120,6 @@ static void sem1_execute(void) { * in each of the above scenario and that the semaphore structure status is * correct after each operation. */ -const struct testcase testsem1 = { - sem1_gettest, - sem1_setup, - NULL, - sem1_execute -}; - -static char *sem2_gettest(void) { - - return "Semaphores, timeout"; -} static void sem2_setup(void) { @@ -186,7 +178,7 @@ static void sem2_execute(void) { } const struct testcase testsem2 = { - sem2_gettest, + "Semaphores, timeout", sem2_setup, NULL, sem2_execute @@ -205,11 +197,6 @@ const struct testcase testsem2 = { * correct after each operation. */ -static char *sem3_gettest(void) { - - return "Semaphores, atomic signal-wait"; -} - static void sem3_setup(void) { chSemInit(&sem1, 0); @@ -236,7 +223,7 @@ static void sem3_execute(void) { } const struct testcase testsem3 = { - sem3_gettest, + "Semaphores, atomic signal-wait", sem3_setup, NULL, sem3_execute diff --git a/test/testthd.c b/test/testthd.c index c2150a9c1..232ea7008 100644 --- a/test/testthd.c +++ b/test/testthd.c @@ -66,11 +66,6 @@ static msg_t thread(void *p) { return 0; } -static char *thd1_gettest(void) { - - return "Threads, enqueuing test #1"; -} - static void thd1_execute(void) { threads[0] = chThdCreateStatic(wa[0], WA_SIZE, chThdGetPriority()-5, thread, "E"); @@ -83,7 +78,7 @@ static void thd1_execute(void) { } const struct testcase testthd1 = { - thd1_gettest, + "Threads, enqueuing test #1", NULL, NULL, thd1_execute @@ -99,11 +94,6 @@ const struct testcase testthd1 = { * priority order regardless of the initial order. */ -static char *thd2_gettest(void) { - - return "Threads, enqueuing test #2"; -} - static void thd2_execute(void) { threads[1] = chThdCreateStatic(wa[1], WA_SIZE, chThdGetPriority()-4, thread, "D"); @@ -116,7 +106,7 @@ static void thd2_execute(void) { } const struct testcase testthd2 = { - thd2_gettest, + "Threads, enqueuing test #2", NULL, NULL, thd2_execute @@ -132,11 +122,6 @@ const struct testcase testthd2 = { * also tested under priority inheritance boosted priority state. */ -static char *thd3_gettest(void) { - - return "Threads, priority change"; -} - static void thd3_execute(void) { tprio_t prio, p1; @@ -186,7 +171,7 @@ static void thd3_execute(void) { } const struct testcase testthd3 = { - thd3_gettest, + "Threads, priority change", NULL, NULL, thd3_execute @@ -200,11 +185,6 @@ const struct testcase testthd3 = { * to wake up at the exact expected time. */ -static char *thd4_gettest(void) { - - return "Threads, delays"; -} - static void thd4_execute(void) { systime_t time; @@ -232,7 +212,7 @@ static void thd4_execute(void) { } const struct testcase testthd4 = { - thd4_gettest, + "Threads, delays", NULL, NULL, thd4_execute -- cgit v1.2.3 From 88bea4b8c200fad936c063718289250ce49cda61 Mon Sep 17 00:00:00 2001 From: gdisirio Date: Fri, 25 Jun 2010 08:55:40 +0000 Subject: git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@2038 35acf78f-673a-0410-8e92-d51de3d6d3f4 --- test/test.c | 6 +++--- test/test.h | 12 ++++++------ test/testbmk.c | 28 ++++++++++++++-------------- test/testbmk.h | 2 +- test/testdyn.c | 8 ++++---- test/testdyn.h | 2 +- test/testevt.c | 10 +++++----- test/testevt.h | 2 +- test/testheap.c | 4 ++-- test/testheap.h | 2 +- test/testmbox.c | 4 ++-- test/testmbox.h | 2 +- test/testmsg.c | 4 ++-- test/testmsg.h | 2 +- test/testmtx.c | 18 +++++++++--------- test/testmtx.h | 2 +- test/testpools.c | 4 ++-- test/testpools.h | 2 +- test/testqueues.c | 6 +++--- test/testqueues.h | 2 +- test/testsem.c | 8 ++++---- test/testsem.h | 2 +- test/testthd.c | 10 +++++----- test/testthd.h | 2 +- 24 files changed, 72 insertions(+), 72 deletions(-) (limited to 'test') diff --git a/test/test.c b/test/test.c index 3a5c93edc..5f876e6b8 100644 --- a/test/test.c +++ b/test/test.c @@ -44,7 +44,7 @@ /* * Array of all the test patterns. */ -static const struct testcase **patterns[] = { +static ROMCONST struct testcase **patterns[] = { patternthd, patternsem, patternmtx, @@ -78,8 +78,8 @@ Thread *threads[MAX_THREADS]; /* * Pointers to the working areas. */ -void * const wa[5] = {test.wa.T0, test.wa.T1, test.wa.T2, - test.wa.T3, test.wa.T4}; +void * ROMCONST wa[5] = {test.wa.T0, test.wa.T1, test.wa.T2, + test.wa.T3, test.wa.T4}; /* * Console output. diff --git a/test/test.h b/test/test.h index 2ab27847e..0815cfcfa 100644 --- a/test/test.h +++ b/test/test.h @@ -45,10 +45,10 @@ #define MAX_THREADS 5 #define MAX_TOKENS 16 -#if defined(CH_ARCHITECTURE_AVR) || \ - defined(CH_ARCHITECTURE_MSP430) || \ - defined(CH_ARCHITECTURE_STM8) +#if defined(CH_ARCHITECTURE_AVR) || defined(CH_ARCHITECTURE_MSP430) #define THREADS_STACK_SIZE 48 +#elif defined(CH_ARCHITECTURE_STM8) +#define THREADS_STACK_SIZE 64 #elif defined(CH_ARCHITECTURE_SIMIA32) #define THREADS_STACK_SIZE 512 #else @@ -84,8 +84,8 @@ extern "C" { #endif msg_t TestThread(void *p); void test_printn(uint32_t n); - void test_print(const char *msgp); - void test_println(const char *msgp); + void test_print(char *msgp); + void test_println(char *msgp); void test_emit_token(char token); bool_t _test_fail(unsigned point); bool_t _test_assert(unsigned point, bool_t condition); @@ -151,7 +151,7 @@ extern "C" { #if !defined(__DOXYGEN__) extern Thread *threads[MAX_THREADS]; extern union test_buffers test; -extern void * const wa[]; +extern void * ROMCONST wa[]; extern bool_t test_timer_done; #endif diff --git a/test/testbmk.c b/test/testbmk.c index a67c09af1..0f38eb78b 100644 --- a/test/testbmk.c +++ b/test/testbmk.c @@ -115,7 +115,7 @@ static void bmk1_execute(void) { test_println(" ctxswc/S"); } -const struct testcase testbmk1 = { +ROMCONST struct testcase testbmk1 = { "Benchmark, messages #1", NULL, NULL, @@ -144,7 +144,7 @@ static void bmk2_execute(void) { test_println(" ctxswc/S"); } -const struct testcase testbmk2 = { +ROMCONST struct testcase testbmk2 = { "Benchmark, messages #2", NULL, NULL, @@ -183,7 +183,7 @@ static void bmk3_execute(void) { test_println(" ctxswc/S"); } -const struct testcase testbmk3 = { +ROMCONST struct testcase testbmk3 = { "Benchmark, messages #3", NULL, NULL, @@ -244,7 +244,7 @@ static void bmk4_execute(void) { test_println(" ctxswc/S"); } -const struct testcase testbmk4 = { +ROMCONST struct testcase testbmk4 = { "Benchmark, context switch", NULL, NULL, @@ -281,7 +281,7 @@ static void bmk5_execute(void) { test_println(" threads/S"); } -const struct testcase testbmk5 = { +ROMCONST struct testcase testbmk5 = { "Benchmark, threads, full cycle", NULL, NULL, @@ -320,7 +320,7 @@ static void bmk6_execute(void) { test_println(" threads/S"); } -const struct testcase testbmk6 = { +ROMCONST struct testcase testbmk6 = { "Benchmark, threads, create only", NULL, NULL, @@ -381,7 +381,7 @@ static void bmk7_execute(void) { test_println(" ctxswc/S"); } -const struct testcase testbmk7 = { +ROMCONST struct testcase testbmk7 = { "Benchmark, mass reschedule, 5 threads", bmk7_setup, NULL, @@ -434,7 +434,7 @@ static void bmk8_execute(void) { test_println(" ctxswc/S"); } -const struct testcase testbmk8 = { +ROMCONST struct testcase testbmk8 = { "Benchmark, round robin context switching", NULL, NULL, @@ -479,7 +479,7 @@ static void bmk9_execute(void) { test_println(" bytes/S"); } -const struct testcase testbmk9 = { +ROMCONST struct testcase testbmk9 = { "Benchmark, I/O Queues throughput", NULL, NULL, @@ -520,7 +520,7 @@ static void bmk10_execute(void) { test_println(" timers/S"); } -const struct testcase testbmk10 = { +ROMCONST struct testcase testbmk10 = { "Benchmark, virtual timers set/reset", NULL, NULL, @@ -566,7 +566,7 @@ static void bmk11_execute(void) { test_println(" wait+signal/S"); } -const struct testcase testbmk11 = { +ROMCONST struct testcase testbmk11 = { "Benchmark, semaphores wait/signal", bmk11_setup, NULL, @@ -613,7 +613,7 @@ static void bmk12_execute(void) { test_println(" lock+unlock/S"); } -const struct testcase testbmk12 = { +ROMCONST struct testcase testbmk12 = { "Benchmark, mutexes lock/unlock", bmk12_setup, NULL, @@ -674,7 +674,7 @@ static void bmk13_execute(void) { #endif } -const struct testcase testbmk13 = { +ROMCONST struct testcase testbmk13 = { "Benchmark, RAM footprint", NULL, NULL, @@ -684,7 +684,7 @@ const struct testcase testbmk13 = { /** * @brief Test sequence for benchmarks. */ -const struct testcase * const patternbmk[] = { +ROMCONST struct testcase * ROMCONST patternbmk[] = { #if !TEST_NO_BENCHMARKS &testbmk1, &testbmk2, diff --git a/test/testbmk.h b/test/testbmk.h index 775ea4501..5dde9a60c 100644 --- a/test/testbmk.h +++ b/test/testbmk.h @@ -20,6 +20,6 @@ #ifndef _TESTBMK_H_ #define _TESTBMK_H_ -extern const struct testcase *patternbmk[]; +extern ROMCONST struct testcase * ROMCONST patternbmk[]; #endif /* _TESTBMK_H_ */ diff --git a/test/testdyn.c b/test/testdyn.c index 4bd4ed06c..69a1c3312 100644 --- a/test/testdyn.c +++ b/test/testdyn.c @@ -117,7 +117,7 @@ static void dyn1_execute(void) { test_assert(4, n == sz, "heap size changed"); } -const struct testcase testdyn1 = { +ROMCONST struct testcase testdyn1 = { "Dynamic APIs, threads creation from heap", dyn1_setup, NULL, @@ -173,7 +173,7 @@ static void dyn2_execute(void) { test_assert(4, chPoolAlloc(&mp1) == NULL, "pool list not empty"); } -const struct testcase testdyn2 = { +ROMCONST struct testcase testdyn2 = { "Dynamic APIs, threads creation from memory pool", dyn2_setup, NULL, @@ -240,7 +240,7 @@ static void dyn3_execute(void) { test_assert(7, n1 == n3, "unexpected threads count"); } -const struct testcase testdyn3 = { +ROMCONST struct testcase testdyn3 = { "Dynamic APIs, registry and references", dyn3_setup, NULL, @@ -252,7 +252,7 @@ const struct testcase testdyn3 = { /** * @brief Test sequence for dynamic APIs. */ -const struct testcase * const patterndyn[] = { +ROMCONST struct testcase * ROMCONST patterndyn[] = { #if CH_USE_DYNAMIC #if CH_USE_HEAP &testdyn1, diff --git a/test/testdyn.h b/test/testdyn.h index 676f0863c..efcd4dc1e 100644 --- a/test/testdyn.h +++ b/test/testdyn.h @@ -20,6 +20,6 @@ #ifndef _TESTDYN_H_ #define _TESTDYN_H_ -extern const struct testcase *patterndyn[]; +extern ROMCONST struct testcase * ROMCONST patterndyn[]; #endif /* _TESTDYN_H_ */ diff --git a/test/testevt.c b/test/testevt.c index 7e3f4a405..677e06d44 100644 --- a/test/testevt.c +++ b/test/testevt.c @@ -83,7 +83,7 @@ static void evt1_setup(void) { static void h1(eventid_t id) {(void)id;test_emit_token('A');} static void h2(eventid_t id) {(void)id;test_emit_token('B');} static void h3(eventid_t id) {(void)id;test_emit_token('C');} -static const evhandler_t evhndl[] = {h1, h2, h3}; +static ROMCONST evhandler_t evhndl[] = {h1, h2, h3}; static void evt1_execute(void) { EventListener el1, el2; @@ -107,7 +107,7 @@ static void evt1_execute(void) { test_assert_sequence(4, "ABC"); } -const struct testcase testevt1 = { +ROMCONST struct testcase testevt1 = { "Events, registration and dispatch", evt1_setup, NULL, @@ -224,7 +224,7 @@ static void evt2_execute(void) { test_assert(15, !chEvtIsListening(&es2), "stuck listener"); } -const struct testcase testevt2 = { +ROMCONST struct testcase testevt2 = { "Events, wait and broadcast", evt2_setup, NULL, @@ -272,7 +272,7 @@ static void evt3_execute(void) { test_assert(6, m == 0, "spurious event"); } -const struct testcase testevt3 = { +ROMCONST struct testcase testevt3 = { "Events, timeouts", evt3_setup, NULL, @@ -283,7 +283,7 @@ const struct testcase testevt3 = { /** * @brief Test sequence for events. */ -const struct testcase * const patternevt[] = { +ROMCONST struct testcase * ROMCONST patternevt[] = { #if CH_USE_EVENTS &testevt1, &testevt2, diff --git a/test/testevt.h b/test/testevt.h index 9fb501265..687b16912 100644 --- a/test/testevt.h +++ b/test/testevt.h @@ -20,6 +20,6 @@ #ifndef _TESTEVT_H_ #define _TESTEVT_H_ -extern const struct testcase *patternevt[]; +extern ROMCONST struct testcase * ROMCONST patternevt[]; #endif /* _TESTEVT_H_ */ diff --git a/test/testheap.c b/test/testheap.c index 698a01861..94fb87bb9 100644 --- a/test/testheap.c +++ b/test/testheap.c @@ -142,7 +142,7 @@ static void heap1_execute(void) { test_assert(12, n == sz, "size changed"); } -const struct testcase testheap1 = { +ROMCONST struct testcase testheap1 = { "Heap, allocation and fragmentation test", heap1_setup, NULL, @@ -154,7 +154,7 @@ const struct testcase testheap1 = { /** * @brief Test sequence for heap. */ -const struct testcase * const patternheap[] = { +ROMCONST struct testcase * ROMCONST patternheap[] = { #if CH_USE_HEAP &testheap1, #endif diff --git a/test/testheap.h b/test/testheap.h index c847036bf..d5ce66ce3 100644 --- a/test/testheap.h +++ b/test/testheap.h @@ -20,6 +20,6 @@ #ifndef _TESTHEAP_H_ #define _TESTHEAP_H_ -extern const struct testcase *patternheap[]; +extern ROMCONST struct testcase * ROMCONST patternheap[]; #endif /* _TESTHEAP_H_ */ diff --git a/test/testmbox.c b/test/testmbox.c index 7926f3d06..33706b5f5 100644 --- a/test/testmbox.c +++ b/test/testmbox.c @@ -155,7 +155,7 @@ static void mbox1_execute(void) { test_assert(21, mb1.mb_buffer == mb1.mb_rdptr, "read pointer not aligned to base"); } -const struct testcase testmbox1 = { +ROMCONST struct testcase testmbox1 = { "Mailboxes, queuing and timeouts", mbox1_setup, NULL, @@ -167,7 +167,7 @@ const struct testcase testmbox1 = { /** * @brief Test sequence for mailboxes. */ -const struct testcase * const patternmbox[] = { +ROMCONST struct testcase * ROMCONST patternmbox[] = { #if CH_USE_MAILBOXES &testmbox1, #endif diff --git a/test/testmbox.h b/test/testmbox.h index 5cd4ea8c7..fc75552a3 100644 --- a/test/testmbox.h +++ b/test/testmbox.h @@ -20,6 +20,6 @@ #ifndef _TESTMBOX_H_ #define _TESTMBOX_H_ -extern const struct testcase *patternmbox[]; +extern ROMCONST struct testcase * ROMCONST patternmbox[]; #endif /* _TESTMBOX_H_ */ diff --git a/test/testmsg.c b/test/testmsg.c index 5db9614bb..881db167f 100644 --- a/test/testmsg.c +++ b/test/testmsg.c @@ -101,7 +101,7 @@ static void msg1_execute(void) { test_assert(3, msg == 0, "unknown message"); } -const struct testcase testmsg1 = { +ROMCONST struct testcase testmsg1 = { "Messages, loop", NULL, NULL, @@ -113,7 +113,7 @@ const struct testcase testmsg1 = { /** * @brief Test sequence for messages. */ -const struct testcase * const patternmsg[] = { +ROMCONST struct testcase * ROMCONST patternmsg[] = { #if CH_USE_MESSAGES &testmsg1, #endif diff --git a/test/testmsg.h b/test/testmsg.h index 0b96557e0..d7817d427 100644 --- a/test/testmsg.h +++ b/test/testmsg.h @@ -20,6 +20,6 @@ #ifndef _TESTMSG_H_ #define _TESTMSG_H_ -extern const struct testcase *patternmsg[]; +extern ROMCONST struct testcase * ROMCONST patternmsg[]; #endif /* _TESTMSG_H_ */ diff --git a/test/testmtx.c b/test/testmtx.c index 7337b1f14..339403127 100644 --- a/test/testmtx.c +++ b/test/testmtx.c @@ -112,7 +112,7 @@ static void mtx1_execute(void) { test_assert_sequence(2, "ABCDE"); } -const struct testcase testmtx1 = { +ROMCONST struct testcase testmtx1 = { "Mutexes, priority enqueuing test", mtx1_setup, NULL, @@ -203,7 +203,7 @@ static void mtx2_execute(void) { test_assert_time_window(2, time + MS2ST(100), time + MS2ST(100) + ALLOWED_DELAY); } -const struct testcase testmtx2 = { +ROMCONST struct testcase testmtx2 = { "Mutexes, priority inheritance, simple case", mtx2_setup, NULL, @@ -323,7 +323,7 @@ static void mtx3_execute(void) { test_assert_time_window(2, time + MS2ST(110), time + MS2ST(110) + ALLOWED_DELAY); } -const struct testcase testmtx3 = { +ROMCONST struct testcase testmtx3 = { "Mutexes, priority inheritance, complex case", mtx3_setup, NULL, @@ -411,7 +411,7 @@ static void mtx4_execute(void) { test_wait_threads(); } -const struct testcase testmtx4 = { +ROMCONST struct testcase testmtx4 = { "Mutexes, priority return", mtx4_setup, NULL, @@ -454,7 +454,7 @@ static void mtx5_execute(void) { test_assert(5, chThdGetPriority() == prio, "wrong priority level"); } -const struct testcase testmtx5 = { +ROMCONST struct testcase testmtx5 = { "Mutexes, status", mtx5_setup, NULL, @@ -508,7 +508,7 @@ static void mtx6_execute(void) { test_assert_sequence(1, "ABCDE"); } -const struct testcase testmtx6 = { +ROMCONST struct testcase testmtx6 = { "CondVar, signal test", mtx6_setup, NULL, @@ -545,7 +545,7 @@ static void mtx7_execute(void) { test_assert_sequence(1, "ABCDE"); } -const struct testcase testmtx7 = { +ROMCONST struct testcase testmtx7 = { "CondVar, broadcast test", mtx7_setup, NULL, @@ -603,7 +603,7 @@ static void mtx8_execute(void) { test_assert_sequence(1, "ABC"); } -const struct testcase testmtx8 = { +ROMCONST struct testcase testmtx8 = { "CondVar, boost test", mtx8_setup, NULL, @@ -615,7 +615,7 @@ const struct testcase testmtx8 = { /** * @brief Test sequence for mutexes. */ -const struct testcase * const patternmtx[] = { +ROMCONST struct testcase * ROMCONST patternmtx[] = { #if CH_USE_MUTEXES &testmtx1, #if CH_DBG_THREADS_PROFILING diff --git a/test/testmtx.h b/test/testmtx.h index b28837775..cd7ddf497 100644 --- a/test/testmtx.h +++ b/test/testmtx.h @@ -20,6 +20,6 @@ #ifndef _TESTMTX_H_ #define _TESTMTX_H_ -extern const struct testcase *patternmtx[]; +extern ROMCONST struct testcase * ROMCONST patternmtx[]; #endif /* _TESTMTX_H_ */ diff --git a/test/testpools.c b/test/testpools.c index 2ed0e6b35..c503ecbda 100644 --- a/test/testpools.c +++ b/test/testpools.c @@ -90,7 +90,7 @@ static void pools1_execute(void) { test_assert(3, chPoolAlloc(&mp1) == NULL, "provider returned memory"); } -const struct testcase testpools1 = { +ROMCONST struct testcase testpools1 = { "Memory Pools, queue/dequeue", pools1_setup, NULL, @@ -102,7 +102,7 @@ const struct testcase testpools1 = { /* * @brief Test sequence for pools. */ -const struct testcase * const patternpools[] = { +ROMCONST struct testcase * ROMCONST patternpools[] = { #if CH_USE_MEMPOOLS &testpools1, #endif diff --git a/test/testpools.h b/test/testpools.h index 1d9d3e0d9..5f526f1d6 100644 --- a/test/testpools.h +++ b/test/testpools.h @@ -20,6 +20,6 @@ #ifndef _TESTPOOLS_H_ #define _TESTPOOLS_H_ -extern const struct testcase *patternpools[]; +extern ROMCONST struct testcase * ROMCONST patternpools[]; #endif /* _TESTPOOLS_H_ */ diff --git a/test/testqueues.c b/test/testqueues.c index 149c2a3c3..a9895a29a 100644 --- a/test/testqueues.c +++ b/test/testqueues.c @@ -129,7 +129,7 @@ static void queues1_execute(void) { test_assert(12, chIQGetTimeout(&iq, 10) == Q_TIMEOUT, "wrong timeout return"); } -const struct testcase testqueues1 = { +ROMCONST struct testcase testqueues1 = { "Queues, input queues", queues1_setup, NULL, @@ -189,7 +189,7 @@ static void queues2_execute(void) { test_assert(12, chOQPutTimeout(&oq, 0, 10) == Q_TIMEOUT, "wrong timeout return"); } -const struct testcase testqueues2 = { +ROMCONST struct testcase testqueues2 = { "Queues, output queues", queues2_setup, NULL, @@ -200,7 +200,7 @@ const struct testcase testqueues2 = { /** * @brief Test sequence for queues. */ -const struct testcase * const patternqueues[] = { +ROMCONST struct testcase * ROMCONST patternqueues[] = { #if CH_USE_QUEUES &testqueues1, &testqueues2, diff --git a/test/testqueues.h b/test/testqueues.h index c05d62641..1f86fc763 100644 --- a/test/testqueues.h +++ b/test/testqueues.h @@ -20,6 +20,6 @@ #ifndef _TESTQUEUES_H_ #define _TESTQUEUES_H_ -extern const struct testcase *patternqueues[]; +extern ROMCONST struct testcase * ROMCONST patternqueues[]; #endif /* _TESTQUEUES_H_ */ diff --git a/test/testsem.c b/test/testsem.c index 58d4e5e35..798e3a65d 100644 --- a/test/testsem.c +++ b/test/testsem.c @@ -103,7 +103,7 @@ static void sem1_execute(void) { #endif } -const struct testcase testsem1 = { +ROMCONST struct testcase testsem1 = { "Semaphores, enqueuing", sem1_setup, NULL, @@ -177,7 +177,7 @@ static void sem2_execute(void) { test_assert_time_window(11, target_time, target_time + ALLOWED_DELAY); } -const struct testcase testsem2 = { +ROMCONST struct testcase testsem2 = { "Semaphores, timeout", sem2_setup, NULL, @@ -222,7 +222,7 @@ static void sem3_execute(void) { test_assert(4, sem1.s_cnt == 0, "counter not zero"); } -const struct testcase testsem3 = { +ROMCONST struct testcase testsem3 = { "Semaphores, atomic signal-wait", sem3_setup, NULL, @@ -234,7 +234,7 @@ const struct testcase testsem3 = { /** * @brief Test sequence for semaphores. */ -const struct testcase * const patternsem[] = { +ROMCONST struct testcase * ROMCONST patternsem[] = { #if CH_USE_SEMAPHORES &testsem1, &testsem2, diff --git a/test/testsem.h b/test/testsem.h index 74a6f89bd..cfa3b6330 100644 --- a/test/testsem.h +++ b/test/testsem.h @@ -20,6 +20,6 @@ #ifndef _TESTSEM_H_ #define _TESTSEM_H_ -extern const struct testcase *patternsem[]; +extern ROMCONST struct testcase * ROMCONST patternsem[]; #endif /* _TESTSEM_H_ */ diff --git a/test/testthd.c b/test/testthd.c index 232ea7008..b12378320 100644 --- a/test/testthd.c +++ b/test/testthd.c @@ -77,7 +77,7 @@ static void thd1_execute(void) { test_assert_sequence(1, "ABCDE"); } -const struct testcase testthd1 = { +ROMCONST struct testcase testthd1 = { "Threads, enqueuing test #1", NULL, NULL, @@ -105,7 +105,7 @@ static void thd2_execute(void) { test_assert_sequence(1, "ABCDE"); } -const struct testcase testthd2 = { +ROMCONST struct testcase testthd2 = { "Threads, enqueuing test #2", NULL, NULL, @@ -170,7 +170,7 @@ static void thd3_execute(void) { #endif } -const struct testcase testthd3 = { +ROMCONST struct testcase testthd3 = { "Threads, priority change", NULL, NULL, @@ -211,7 +211,7 @@ static void thd4_execute(void) { test_assert_time_window(4, time, time + 1); } -const struct testcase testthd4 = { +ROMCONST struct testcase testthd4 = { "Threads, delays", NULL, NULL, @@ -221,7 +221,7 @@ const struct testcase testthd4 = { /** * @brief Test sequence for threads. */ -const struct testcase * const patternthd[] = { +ROMCONST struct testcase * ROMCONST patternthd[] = { &testthd1, &testthd2, &testthd3, diff --git a/test/testthd.h b/test/testthd.h index 5b71c98fb..e355f63fb 100644 --- a/test/testthd.h +++ b/test/testthd.h @@ -20,6 +20,6 @@ #ifndef _TESTRDY_H_ #define _TESTRDY_H_ -extern const struct testcase *patternthd[]; +extern ROMCONST struct testcase * ROMCONST patternthd[]; #endif /* _TESTRDY_H_ */ -- cgit v1.2.3 From 71767ea71ed7cf537cdfd2900b035d98a71eed4d Mon Sep 17 00:00:00 2001 From: gdisirio Date: Sat, 26 Jun 2010 09:53:51 +0000 Subject: missing const qualifier git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@2041 35acf78f-673a-0410-8e92-d51de3d6d3f4 --- test/test.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'test') diff --git a/test/test.h b/test/test.h index 0815cfcfa..987e361bf 100644 --- a/test/test.h +++ b/test/test.h @@ -84,8 +84,8 @@ extern "C" { #endif msg_t TestThread(void *p); void test_printn(uint32_t n); - void test_print(char *msgp); - void test_println(char *msgp); + void test_print(const char *msgp); + void test_println(const char *msgp); void test_emit_token(char token); bool_t _test_fail(unsigned point); bool_t _test_assert(unsigned point, bool_t condition); -- cgit v1.2.3 From 2e7bca6cc8e2d7f5e8675895ddcf3e4f89d8e28d Mon Sep 17 00:00:00 2001 From: gdisirio Date: Sat, 3 Jul 2010 07:02:34 +0000 Subject: git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@2047 35acf78f-673a-0410-8e92-d51de3d6d3f4 --- test/test.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'test') diff --git a/test/test.c b/test/test.c index 5f876e6b8..42e8708ec 100644 --- a/test/test.c +++ b/test/test.c @@ -44,7 +44,7 @@ /* * Array of all the test patterns. */ -static ROMCONST struct testcase **patterns[] = { +static ROMCONST struct testcase * ROMCONST *patterns[] = { patternthd, patternsem, patternmtx, -- cgit v1.2.3 From 131b177925913634bd96e02e7a9f7d529a122df0 Mon Sep 17 00:00:00 2001 From: gdisirio Date: Sat, 24 Jul 2010 09:10:47 +0000 Subject: Updated all the halconf.h files in the tree. git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@2088 35acf78f-673a-0410-8e92-d51de3d6d3f4 --- test/coverage/halconf.h | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'test') diff --git a/test/coverage/halconf.h b/test/coverage/halconf.h index bf7084dc6..c93f68779 100644 --- a/test/coverage/halconf.h +++ b/test/coverage/halconf.h @@ -147,6 +147,17 @@ /*#define MMC_POLLING_INTERVAL 10*/ /*#define MMC_POLLING_DELAY 10*/ +/*===========================================================================*/ +/* UART driver related settings. */ +/*===========================================================================*/ + +/** + * @brief Enables the UART subsystem. + */ +#if !defined(CH_HAL_USE_UART) || defined(__DOXYGEN__) +#define CH_HAL_USE_UART FALSE +#endif + #endif /* _HALCONF_H_ */ /** @} */ -- cgit v1.2.3 From 138c0f900d823b2c953038048bc40b14610f958a Mon Sep 17 00:00:00 2001 From: gdisirio Date: Sat, 21 Aug 2010 08:38:14 +0000 Subject: Added new kernel hooks (on halt and on systick). git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@2136 35acf78f-673a-0410-8e92-d51de3d6d3f4 --- test/coverage/chconf.h | 46 +++++++++++++++++++++++++++++++++------------- 1 file changed, 33 insertions(+), 13 deletions(-) (limited to 'test') diff --git a/test/coverage/chconf.h b/test/coverage/chconf.h index 9458d0257..aa6f1e66a 100644 --- a/test/coverage/chconf.h +++ b/test/coverage/chconf.h @@ -434,11 +434,9 @@ * @brief Threads descriptor structure hook. * @details User fields added to the end of the @p Thread structure. */ -#if !defined(THREAD_EXT_FIELDS) || defined(__DOXYGEN__) -#define THREAD_EXT_FIELDS \ -struct { \ - /* Add threads custom fields here.*/ \ -}; +#if !defined(THREAD_EXT_FIELDS_HOOK) || defined(__DOXYGEN__) +#define THREAD_EXT_FIELDS_HOOK \ + /* Add threads custom fields here.*/ #endif /** @@ -448,9 +446,9 @@ struct { \ * @note It is invoked from within @p chThdInit() and implicitily from all * the threads creation APIs. */ -#if !defined(THREAD_EXT_INIT) || defined(__DOXYGEN__) -#define THREAD_EXT_INIT(tp) { \ - /* Add threads initialization code here.*/ \ +#if !defined(THREAD_EXT_INIT_HOOK) || defined(__DOXYGEN__) +#define THREAD_EXT_INIT_HOOK(tp) { \ + /* Add threads initialization code here.*/ \ } #endif @@ -462,9 +460,9 @@ struct { \ * @note It is also invoked when the threads simply return in order to * terminate. */ -#if !defined(THREAD_EXT_EXIT) || defined(__DOXYGEN__) -#define THREAD_EXT_EXIT(tp) { \ - /* Add threads finalization code here.*/ \ +#if !defined(THREAD_EXT_EXIT_HOOK) || defined(__DOXYGEN__) +#define THREAD_EXT_EXIT_HOOK(tp) { \ + /* Add threads finalization code here.*/ \ } #endif @@ -473,8 +471,30 @@ struct { \ * @details This hook is continuously invoked by the idle thread loop. */ #if !defined(IDLE_LOOP_HOOK) || defined(__DOXYGEN__) -#define IDLE_LOOP_HOOK() { \ - /* Idle loop code here.*/ \ +#define IDLE_LOOP_HOOK() { \ + /* Idle loop code here.*/ \ +} +#endif + +/** + * @brief System tick event hook. + * @details This hook is invoked in the system tick handler immediately + * after processing the virtual timers queue. + */ +#if !defined(SYSTEM_TICK_EVENT_HOOK) || defined(__DOXYGEN__) +#define SYSTEM_TICK_EVENT_HOOK() { \ + /* System tick event code here.*/ \ +} +#endif + +/** + * @brief System halt hook. + * @details This hook is invoked in case to a system halting error before + * the system is halted. + */ +#if !defined(SYSTEM_HALT_HOOK) || defined(__DOXYGEN__) +#define SYSTEM_HALT_HOOK() { \ + /* System halt code here.*/ \ } #endif -- cgit v1.2.3 From 781b0b129cccbecba160effce8c4ddd68295b8b9 Mon Sep 17 00:00:00 2001 From: gdisirio Date: Sat, 11 Sep 2010 10:57:11 +0000 Subject: Fixed bug 3064204. git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@2175 35acf78f-673a-0410-8e92-d51de3d6d3f4 --- test/coverage/halconf.h | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'test') diff --git a/test/coverage/halconf.h b/test/coverage/halconf.h index c93f68779..3e4b15d2d 100644 --- a/test/coverage/halconf.h +++ b/test/coverage/halconf.h @@ -62,6 +62,11 @@ #define CH_HAL_USE_ADC FALSE #endif +/* + * Default ADC settings overrides (uncomment to override). + */ +/*#define ADC_USE_WAIT TRUE*/ + /*===========================================================================*/ /* CAN driver related settings. */ /*===========================================================================*/ @@ -73,6 +78,11 @@ #define CH_HAL_USE_CAN FALSE #endif +/* + * Default CAN settings overrides (uncomment to override). + */ +/*#define CAN_USE_SLEEP_MODE TRUE*/ + /*===========================================================================*/ /* MAC driver related settings. */ /*===========================================================================*/ -- cgit v1.2.3 From 9ffea7e261ec4016d788abbbf7c4a6d3a78e0a04 Mon Sep 17 00:00:00 2001 From: gdisirio Date: Sat, 18 Sep 2010 06:48:56 +0000 Subject: Documentation improvements, renamed some event APIs. git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@2179 35acf78f-673a-0410-8e92-d51de3d6d3f4 --- test/testevt.c | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) (limited to 'test') diff --git a/test/testevt.c b/test/testevt.c index 677e06d44..079257ac5 100644 --- a/test/testevt.c +++ b/test/testevt.c @@ -77,7 +77,7 @@ static EVENTSOURCE_DECL(es2); static void evt1_setup(void) { - chEvtClear(ALL_EVENTS); + chEvtClearFlags(ALL_EVENTS); } static void h1(eventid_t id) {(void)id;test_emit_token('A');} @@ -130,7 +130,7 @@ ROMCONST struct testcase testevt1 = { static void evt2_setup(void) { - chEvtClear(ALL_EVENTS); + chEvtClearFlags(ALL_EVENTS); } static msg_t thread1(void *p) { @@ -157,12 +157,12 @@ static void evt2_execute(void) { /* * Test on chEvtWaitOne() without wait. */ - chEvtPend(5); + chEvtAddFlags(5); m = chEvtWaitOne(ALL_EVENTS); test_assert(1, m == 1, "single event error"); m = chEvtWaitOne(ALL_EVENTS); test_assert(2, m == 4, "single event error"); - m = chEvtClear(ALL_EVENTS); + m = chEvtClearFlags(ALL_EVENTS); test_assert(3, m == 0, "stuck event"); /* @@ -175,17 +175,17 @@ static void evt2_execute(void) { m = chEvtWaitOne(ALL_EVENTS); test_assert_time_window(4, target_time, target_time + ALLOWED_DELAY); test_assert(5, m == 1, "single event error"); - m = chEvtClear(ALL_EVENTS); + m = chEvtClearFlags(ALL_EVENTS); test_assert(6, m == 0, "stuck event"); test_wait_threads(); /* * Test on chEvtWaitAny() without wait. */ - chEvtPend(5); + chEvtAddFlags(5); m = chEvtWaitAny(ALL_EVENTS); test_assert(7, m == 5, "unexpected pending bit"); - m = chEvtClear(ALL_EVENTS); + m = chEvtClearFlags(ALL_EVENTS); test_assert(8, m == 0, "stuck event"); /* @@ -198,7 +198,7 @@ static void evt2_execute(void) { m = chEvtWaitAny(ALL_EVENTS); test_assert_time_window(9, target_time, target_time + ALLOWED_DELAY); test_assert(10, m == 1, "single event error"); - m = chEvtClear(ALL_EVENTS); + m = chEvtClearFlags(ALL_EVENTS); test_assert(11, m == 0, "stuck event"); test_wait_threads(); @@ -215,7 +215,7 @@ static void evt2_execute(void) { thread2, "A"); m = chEvtWaitAll(5); test_assert_time_window(12, target_time, target_time + ALLOWED_DELAY); - m = chEvtClear(ALL_EVENTS); + m = chEvtClearFlags(ALL_EVENTS); test_assert(13, m == 0, "stuck event"); test_wait_threads(); chEvtUnregister(&es1, &el1); @@ -249,7 +249,7 @@ ROMCONST struct testcase testevt2 = { static void evt3_setup(void) { - chEvtClear(ALL_EVENTS); + chEvtClearFlags(ALL_EVENTS); } static void evt3_execute(void) { -- cgit v1.2.3 From 07351222e6d0b6b3dcd4f50ecb18bc09e7402d1c Mon Sep 17 00:00:00 2001 From: gdisirio Date: Tue, 21 Sep 2010 10:22:06 +0000 Subject: git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@2184 35acf78f-673a-0410-8e92-d51de3d6d3f4 --- test/testevt.c | 10 +++++----- test/testmbox.c | 14 +++++++------- test/testqueues.c | 24 ++++++++++++------------ 3 files changed, 24 insertions(+), 24 deletions(-) (limited to 'test') diff --git a/test/testevt.c b/test/testevt.c index 079257ac5..656a8430d 100644 --- a/test/testevt.c +++ b/test/testevt.c @@ -94,11 +94,11 @@ static void evt1_execute(void) { chEvtInit(&es1); chEvtRegisterMask(&es1, &el1, 1); chEvtRegisterMask(&es1, &el2, 2); - test_assert(1, chEvtIsListening(&es1), "no listener"); + test_assert(1, chEvtIsListeningI(&es1), "no listener"); chEvtUnregister(&es1, &el1); - test_assert(2, chEvtIsListening(&es1), "no listener"); + test_assert(2, chEvtIsListeningI(&es1), "no listener"); chEvtUnregister(&es1, &el2); - test_assert(3, !chEvtIsListening(&es1), "stuck listener"); + test_assert(3, !chEvtIsListeningI(&es1), "stuck listener"); /* * Testing chEvtDispatch(). @@ -220,8 +220,8 @@ static void evt2_execute(void) { test_wait_threads(); chEvtUnregister(&es1, &el1); chEvtUnregister(&es2, &el2); - test_assert(14, !chEvtIsListening(&es1), "stuck listener"); - test_assert(15, !chEvtIsListening(&es2), "stuck listener"); + test_assert(14, !chEvtIsListeningI(&es1), "stuck listener"); + test_assert(15, !chEvtIsListeningI(&es2), "stuck listener"); } ROMCONST struct testcase testevt2 = { diff --git a/test/testmbox.c b/test/testmbox.c index 33706b5f5..60fa5cb44 100644 --- a/test/testmbox.c +++ b/test/testmbox.c @@ -83,7 +83,7 @@ static void mbox1_execute(void) { /* * Testing initial space. */ - test_assert(1, chMBGetEmpty(&mb1) == MB_SIZE, "wrong size"); + test_assert(1, chMBGetEmptyI(&mb1) == MB_SIZE, "wrong size"); /* * Testing enqueuing and backward circularity. @@ -104,8 +104,8 @@ static void mbox1_execute(void) { /* * Testing final conditions. */ - test_assert(5, chMBGetEmpty(&mb1) == 0, "still empty"); - test_assert(6, chMBGetFull(&mb1) == MB_SIZE, "not full"); + test_assert(5, chMBGetEmptyI(&mb1) == 0, "still empty"); + test_assert(6, chMBGetFullI(&mb1) == MB_SIZE, "not full"); test_assert(7, mb1.mb_rdptr == mb1.mb_wrptr, "pointers not aligned"); /* @@ -137,8 +137,8 @@ static void mbox1_execute(void) { /* * Testing final conditions. */ - test_assert(15, chMBGetEmpty(&mb1) == MB_SIZE, "not empty"); - test_assert(16, chMBGetFull(&mb1) == 0, "still full"); + test_assert(15, chMBGetEmptyI(&mb1) == MB_SIZE, "not empty"); + test_assert(16, chMBGetFullI(&mb1) == 0, "still full"); test_assert(17, mb1.mb_rdptr == mb1.mb_wrptr, "pointers not aligned"); /* @@ -149,8 +149,8 @@ static void mbox1_execute(void) { /* * Re-testing final conditions. */ - test_assert(18, chMBGetEmpty(&mb1) == MB_SIZE, "not empty"); - test_assert(19, chMBGetFull(&mb1) == 0, "still full"); + test_assert(18, chMBGetEmptyI(&mb1) == MB_SIZE, "not empty"); + test_assert(19, chMBGetFullI(&mb1) == 0, "still full"); test_assert(20, mb1.mb_buffer == mb1.mb_wrptr, "write pointer not aligned to base"); test_assert(21, mb1.mb_buffer == mb1.mb_rdptr, "read pointer not aligned to base"); } diff --git a/test/testqueues.c b/test/testqueues.c index a9895a29a..27f533142 100644 --- a/test/testqueues.c +++ b/test/testqueues.c @@ -86,18 +86,18 @@ static void queues1_execute(void) { size_t n; /* Initial empty state */ - test_assert(1, chIQIsEmpty(&iq), "not empty"); + test_assert(1, chIQIsEmptyI(&iq), "not empty"); /* Queue filling */ for (i = 0; i < TEST_QUEUES_SIZE; i++) chIQPutI(&iq, 'A' + i); - test_assert(2, chIQIsFull(&iq), "still has space"); + test_assert(2, chIQIsFullI(&iq), "still has space"); test_assert(3, chIQPutI(&iq, 0) == Q_FULL, "failed to report Q_FULL"); /* Queue emptying */ for (i = 0; i < TEST_QUEUES_SIZE; i++) test_emit_token(chIQGet(&iq)); - test_assert(4, chIQIsEmpty(&iq), "still full"); + test_assert(4, chIQIsEmptyI(&iq), "still full"); test_assert_sequence(5, "ABCD"); /* Queue filling again */ @@ -107,7 +107,7 @@ static void queues1_execute(void) { /* Reading the whole thing */ n = chIQReadTimeout(&iq, wa[1], TEST_QUEUES_SIZE * 2, TIME_IMMEDIATE); test_assert(6, n == TEST_QUEUES_SIZE, "wrong returned size"); - test_assert(7, chIQIsEmpty(&iq), "still full"); + test_assert(7, chIQIsEmptyI(&iq), "still full"); /* Queue filling again */ for (i = 0; i < TEST_QUEUES_SIZE; i++) @@ -118,12 +118,12 @@ static void queues1_execute(void) { test_assert(8, n == TEST_QUEUES_SIZE / 2, "wrong returned size"); n = chIQReadTimeout(&iq, wa[1], TEST_QUEUES_SIZE / 2, TIME_IMMEDIATE); test_assert(9, n == TEST_QUEUES_SIZE / 2, "wrong returned size"); - test_assert(10, chIQIsEmpty(&iq), "still full"); + test_assert(10, chIQIsEmptyI(&iq), "still full"); /* Testing reset */ chIQPutI(&iq, 0); chIQResetI(&iq); - test_assert(11, chIQIsEmpty(&iq), "still full"); + test_assert(11, chIQIsEmptyI(&iq), "still full"); /* Timeout */ test_assert(12, chIQGetTimeout(&iq, 10) == Q_TIMEOUT, "wrong timeout return"); @@ -155,35 +155,35 @@ static void queues2_execute(void) { size_t n; /* Initial empty state */ - test_assert(1, chOQIsEmpty(&oq), "not empty"); + test_assert(1, chOQIsEmptyI(&oq), "not empty"); /* Queue filling */ for (i = 0; i < TEST_QUEUES_SIZE; i++) chOQPut(&oq, 'A' + i); - test_assert(2, chOQIsFull(&oq), "still has space"); + test_assert(2, chOQIsFullI(&oq), "still has space"); /* Queue emptying */ for (i = 0; i < TEST_QUEUES_SIZE; i++) test_emit_token(chOQGetI(&oq)); - test_assert(3, chOQIsEmpty(&oq), "still full"); + test_assert(3, chOQIsEmptyI(&oq), "still full"); test_assert_sequence(4, "ABCD"); test_assert(5, chOQGetI(&oq) == Q_EMPTY, "failed to report Q_EMPTY"); /* Writing the whole thing */ n = chOQWriteTimeout(&oq, wa[1], TEST_QUEUES_SIZE * 2, TIME_IMMEDIATE); test_assert(6, n == TEST_QUEUES_SIZE, "wrong returned size"); - test_assert(7, chOQIsFull(&oq), "not full"); + test_assert(7, chOQIsFullI(&oq), "not full"); /* Testing reset */ chOQResetI(&oq); - test_assert(8, chOQIsEmpty(&oq), "still full"); + test_assert(8, chOQIsEmptyI(&oq), "still full"); /* Partial writes */ n = chOQWriteTimeout(&oq, wa[1], TEST_QUEUES_SIZE / 2, TIME_IMMEDIATE); test_assert(9, n == TEST_QUEUES_SIZE / 2, "wrong returned size"); n = chOQWriteTimeout(&oq, wa[1], TEST_QUEUES_SIZE / 2, TIME_IMMEDIATE); test_assert(10, n == TEST_QUEUES_SIZE / 2, "wrong returned size"); - test_assert(11, chOQIsFull(&oq), "not full"); + test_assert(11, chOQIsFullI(&oq), "not full"); /* Timeout */ test_assert(12, chOQPutTimeout(&oq, 0, 10) == Q_TIMEOUT, "wrong timeout return"); -- cgit v1.2.3 From efdf9a658b9bffb0a42dc792f2852f88873f4240 Mon Sep 17 00:00:00 2001 From: gdisirio Date: Mon, 27 Sep 2010 18:43:55 +0000 Subject: Reverted name change for macro THREAD_EXT_FIELDS. git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@2210 35acf78f-673a-0410-8e92-d51de3d6d3f4 --- test/coverage/chconf.h | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'test') diff --git a/test/coverage/chconf.h b/test/coverage/chconf.h index aa6f1e66a..14f85af56 100644 --- a/test/coverage/chconf.h +++ b/test/coverage/chconf.h @@ -431,11 +431,11 @@ /*===========================================================================*/ /** - * @brief Threads descriptor structure hook. + * @brief Threads descriptor structure extension. * @details User fields added to the end of the @p Thread structure. */ -#if !defined(THREAD_EXT_FIELDS_HOOK) || defined(__DOXYGEN__) -#define THREAD_EXT_FIELDS_HOOK \ +#if !defined(THREAD_EXT_FIELDS) || defined(__DOXYGEN__) +#define THREAD_EXT_FIELDS \ /* Add threads custom fields here.*/ #endif -- cgit v1.2.3 From d5853de4bd4603ba507999d45075031779b13912 Mon Sep 17 00:00:00 2001 From: gdisirio Date: Tue, 5 Oct 2010 14:05:25 +0000 Subject: git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@2235 35acf78f-673a-0410-8e92-d51de3d6d3f4 --- test/testmtx.c | 5 +++++ test/testsem.c | 54 +++++++++++++++++++++++++++++++++++++++++++++++++++++- test/testthd.c | 6 +++++- 3 files changed, 63 insertions(+), 2 deletions(-) (limited to 'test') diff --git a/test/testmtx.c b/test/testmtx.c index 339403127..9ca9edc85 100644 --- a/test/testmtx.c +++ b/test/testmtx.c @@ -452,6 +452,11 @@ static void mtx5_execute(void) { test_assert(3, isempty(&m1.m_queue), "queue not empty"); test_assert(4, m1.m_owner == NULL, "still owned"); test_assert(5, chThdGetPriority() == prio, "wrong priority level"); + + chMtxLock(&m1); + chMtxUnlockAll(); + test_assert(6, isempty(&m1.m_queue), "queue not empty"); + test_assert(7, m1.m_owner == NULL, "still owned"); } ROMCONST struct testcase testmtx5 = { diff --git a/test/testsem.c b/test/testsem.c index 798e3a65d..85535ed0a 100644 --- a/test/testsem.c +++ b/test/testsem.c @@ -189,7 +189,7 @@ ROMCONST struct testcase testsem2 = { * @page test_sem_003 Atomic signal-wait test * *

Description

- * This test case explicitly address the @p chSemWaitSignal() function. A + * This test case explicitly addresses the @p chSemWaitSignal() function. A * thread is created that performs a wait and a signal operations. * The tester thread is awakened from an atomic wait/signal operation.
* The test expects that the semaphore wait function returns the correct value @@ -229,6 +229,57 @@ ROMCONST struct testcase testsem3 = { sem3_execute }; #endif /* CH_USE_SEMSW */ + +/** + * @page test_sem_004 Binary Wait and Signal + * + *

Description

+ * This test case tests the binary semaphores functionality. The test both + * checks the binary semaphore status and the expected status of the underlying + * counting semaphore. + */ +static msg_t thread4(void *p) { + + chBSemSignal((BinarySemaphore *)p); + return 0; +} + +static void sem4_execute(void) { + BinarySemaphore bsem; + + /* Creates a taken binary semaphore.*/ + chBSemInit(&bsem, TRUE); + chBSemReset(&bsem, TRUE); + test_assert(1, chBSemGetStateI(&bsem) == TRUE, "not taken"); + + /* Starts a signaler thread at a lower priority.*/ + threads[0] = chThdCreateStatic(wa[0], WA_SIZE, + chThdGetPriority()-1, thread4, &bsem); + + /* Waits to be signaled.*/ + chBSemWait(&bsem); + + /* The binary semaphore is expected to be taken.*/ + test_assert(2, chBSemGetStateI(&bsem) == TRUE, "not taken"); + + /* Releasing it, check both the binary semaphore state and the underlying + counter semaphore state..*/ + chBSemSignal(&bsem); + test_assert(3, chBSemGetStateI(&bsem) == FALSE, "still taken"); + test_assert(4, chSemGetCounterI(&bsem.bs_sem) == 1, "unexpected counter"); + + /* Checking signaling overflow, the counter must not go beyond 1.*/ + chBSemSignal(&bsem); + test_assert(3, chBSemGetStateI(&bsem) == FALSE, "taken"); + test_assert(5, chSemGetCounterI(&bsem.bs_sem) == 1, "unexpected counter"); +} + +ROMCONST struct testcase testsem4 = { + "Binary Semaphores, functionality", + NULL, + NULL, + sem4_execute +}; #endif /* CH_USE_SEMAPHORES */ /** @@ -241,6 +292,7 @@ ROMCONST struct testcase * ROMCONST patternsem[] = { #if CH_USE_SEMSW &testsem3, #endif + &testsem4, #endif NULL }; diff --git a/test/testthd.c b/test/testthd.c index b12378320..8b0440248 100644 --- a/test/testthd.c +++ b/test/testthd.c @@ -100,7 +100,11 @@ static void thd2_execute(void) { threads[0] = chThdCreateStatic(wa[0], WA_SIZE, chThdGetPriority()-5, thread, "E"); threads[4] = chThdCreateStatic(wa[4], WA_SIZE, chThdGetPriority()-1, thread, "A"); threads[3] = chThdCreateStatic(wa[3], WA_SIZE, chThdGetPriority()-2, thread, "B"); - threads[2] = chThdCreateStatic(wa[2], WA_SIZE, chThdGetPriority()-3, thread, "C"); + /* Done this way for coverage of chThdCreateI() and chThdResume().*/ + chSysLock(); + threads[2] = chThdCreateI(wa[2], WA_SIZE, chThdGetPriority()-3, thread, "C"); + chSysUnlock(); + chThdResume(threads[2]); test_wait_threads(); test_assert_sequence(1, "ABCDE"); } -- cgit v1.2.3 From c2efc1ebe91a1496b3046d44898b3384df24fc60 Mon Sep 17 00:00:00 2001 From: gdisirio Date: Tue, 5 Oct 2010 17:19:23 +0000 Subject: git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@2236 35acf78f-673a-0410-8e92-d51de3d6d3f4 --- test/testsem.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'test') diff --git a/test/testsem.c b/test/testsem.c index 85535ed0a..f87187ac8 100644 --- a/test/testsem.c +++ b/test/testsem.c @@ -42,6 +42,7 @@ * - @subpage test_sem_001 * - @subpage test_sem_002 * - @subpage test_sem_003 + * - @subpage test_sem_004 * . * @file testsem.c * @brief Semaphores test source file @@ -231,7 +232,7 @@ ROMCONST struct testcase testsem3 = { #endif /* CH_USE_SEMSW */ /** - * @page test_sem_004 Binary Wait and Signal + * @page test_sem_004 Binary wait and signal * *

Description

* This test case tests the binary semaphores functionality. The test both -- cgit v1.2.3 From 38cc48d575a6232cfd440d97711f89f5f531422d Mon Sep 17 00:00:00 2001 From: gdisirio Date: Thu, 7 Oct 2010 13:32:58 +0000 Subject: git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@2237 35acf78f-673a-0410-8e92-d51de3d6d3f4 --- test/testmbox.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) (limited to 'test') diff --git a/test/testmbox.c b/test/testmbox.c index 60fa5cb44..b72fef2c1 100644 --- a/test/testmbox.c +++ b/test/testmbox.c @@ -83,7 +83,7 @@ static void mbox1_execute(void) { /* * Testing initial space. */ - test_assert(1, chMBGetEmptyI(&mb1) == MB_SIZE, "wrong size"); + test_assert(1, chMBGetFreeCountI(&mb1) == MB_SIZE, "wrong size"); /* * Testing enqueuing and backward circularity. @@ -104,8 +104,8 @@ static void mbox1_execute(void) { /* * Testing final conditions. */ - test_assert(5, chMBGetEmptyI(&mb1) == 0, "still empty"); - test_assert(6, chMBGetFullI(&mb1) == MB_SIZE, "not full"); + test_assert(5, chMBGetFreeCountI(&mb1) == 0, "still empty"); + test_assert(6, chMBGetFullCountI(&mb1) == MB_SIZE, "not full"); test_assert(7, mb1.mb_rdptr == mb1.mb_wrptr, "pointers not aligned"); /* @@ -137,8 +137,8 @@ static void mbox1_execute(void) { /* * Testing final conditions. */ - test_assert(15, chMBGetEmptyI(&mb1) == MB_SIZE, "not empty"); - test_assert(16, chMBGetFullI(&mb1) == 0, "still full"); + test_assert(15, chMBGetFreeCountI(&mb1) == MB_SIZE, "not empty"); + test_assert(16, chMBGetFullCountI(&mb1) == 0, "still full"); test_assert(17, mb1.mb_rdptr == mb1.mb_wrptr, "pointers not aligned"); /* @@ -149,8 +149,8 @@ static void mbox1_execute(void) { /* * Re-testing final conditions. */ - test_assert(18, chMBGetEmptyI(&mb1) == MB_SIZE, "not empty"); - test_assert(19, chMBGetFullI(&mb1) == 0, "still full"); + test_assert(18, chMBGetFreeCountI(&mb1) == MB_SIZE, "not empty"); + test_assert(19, chMBGetFullCountI(&mb1) == 0, "still full"); test_assert(20, mb1.mb_buffer == mb1.mb_wrptr, "write pointer not aligned to base"); test_assert(21, mb1.mb_buffer == mb1.mb_rdptr, "read pointer not aligned to base"); } -- cgit v1.2.3 From f407e4a84fcf2cf3bb003ed36f80ec136f8683c2 Mon Sep 17 00:00:00 2001 From: gdisirio Date: Fri, 8 Oct 2010 18:16:38 +0000 Subject: HAL improvements, mailboxes macro name changed. git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@2238 35acf78f-673a-0410-8e92-d51de3d6d3f4 --- test/testmbox.c | 6 +++--- test/testsem.c | 3 +-- 2 files changed, 4 insertions(+), 5 deletions(-) (limited to 'test') diff --git a/test/testmbox.c b/test/testmbox.c index b72fef2c1..b3ac17e01 100644 --- a/test/testmbox.c +++ b/test/testmbox.c @@ -105,7 +105,7 @@ static void mbox1_execute(void) { * Testing final conditions. */ test_assert(5, chMBGetFreeCountI(&mb1) == 0, "still empty"); - test_assert(6, chMBGetFullCountI(&mb1) == MB_SIZE, "not full"); + test_assert(6, chMBGetUsedCountI(&mb1) == MB_SIZE, "not full"); test_assert(7, mb1.mb_rdptr == mb1.mb_wrptr, "pointers not aligned"); /* @@ -138,7 +138,7 @@ static void mbox1_execute(void) { * Testing final conditions. */ test_assert(15, chMBGetFreeCountI(&mb1) == MB_SIZE, "not empty"); - test_assert(16, chMBGetFullCountI(&mb1) == 0, "still full"); + test_assert(16, chMBGetUsedCountI(&mb1) == 0, "still full"); test_assert(17, mb1.mb_rdptr == mb1.mb_wrptr, "pointers not aligned"); /* @@ -150,7 +150,7 @@ static void mbox1_execute(void) { * Re-testing final conditions. */ test_assert(18, chMBGetFreeCountI(&mb1) == MB_SIZE, "not empty"); - test_assert(19, chMBGetFullCountI(&mb1) == 0, "still full"); + test_assert(19, chMBGetUsedCountI(&mb1) == 0, "still full"); test_assert(20, mb1.mb_buffer == mb1.mb_wrptr, "write pointer not aligned to base"); test_assert(21, mb1.mb_buffer == mb1.mb_rdptr, "read pointer not aligned to base"); } diff --git a/test/testsem.c b/test/testsem.c index f87187ac8..85535ed0a 100644 --- a/test/testsem.c +++ b/test/testsem.c @@ -42,7 +42,6 @@ * - @subpage test_sem_001 * - @subpage test_sem_002 * - @subpage test_sem_003 - * - @subpage test_sem_004 * . * @file testsem.c * @brief Semaphores test source file @@ -232,7 +231,7 @@ ROMCONST struct testcase testsem3 = { #endif /* CH_USE_SEMSW */ /** - * @page test_sem_004 Binary wait and signal + * @page test_sem_004 Binary Wait and Signal * *

Description

* This test case tests the binary semaphores functionality. The test both -- cgit v1.2.3 From 19ee10d24417ce8db6d28cf2e57755450bdf42d8 Mon Sep 17 00:00:00 2001 From: gdisirio Date: Sat, 9 Oct 2010 07:58:41 +0000 Subject: Defaulted serial buffer sizes to 16 bytes. Improvements to the documentation. git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@2239 35acf78f-673a-0410-8e92-d51de3d6d3f4 --- test/testsem.c | 1 + 1 file changed, 1 insertion(+) (limited to 'test') diff --git a/test/testsem.c b/test/testsem.c index 85535ed0a..46caad56a 100644 --- a/test/testsem.c +++ b/test/testsem.c @@ -42,6 +42,7 @@ * - @subpage test_sem_001 * - @subpage test_sem_002 * - @subpage test_sem_003 + * - @subpage test_sem_004 * . * @file testsem.c * @brief Semaphores test source file -- cgit v1.2.3 From 80cf0731d8321843868b38074e19569d3ca31d99 Mon Sep 17 00:00:00 2001 From: gdisirio Date: Sat, 9 Oct 2010 10:17:11 +0000 Subject: Documentation improvements. git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@2240 35acf78f-673a-0410-8e92-d51de3d6d3f4 --- test/test.c | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) (limited to 'test') diff --git a/test/test.c b/test/test.c index 42e8708ec..00b5858bc 100644 --- a/test/test.c +++ b/test/test.c @@ -195,7 +195,7 @@ bool_t _test_assert_time_window(unsigned point, systime_t start, systime_t end) */ /** - * @brief Pends a termination request in all the test-spawned threads. + * @brief Sets a termination request in all the test-spawned threads. */ void test_terminate_threads(void) { int i; @@ -242,7 +242,9 @@ void test_cpu_pulse(unsigned duration) { #endif /** - * @brief Delays execution until next system time tick. + * @brief Delays execution until next system time tick. + * + * @return The system time. */ systime_t test_wait_tick(void) { @@ -254,7 +256,9 @@ systime_t test_wait_tick(void) { * Timer utils. */ -/** @brief Set to @p TRUE when the test timer reaches its deadline.*/ +/** + * @brief Set to @p TRUE when the test timer reaches its deadline. + */ bool_t test_timer_done; static VirtualTimer vt; @@ -312,6 +316,7 @@ static void print_line(void) { * @brief Test execution thread function. * * @param[in] p pointer to a @p BaseChannel object for test output + * @return A failure boolean value. */ msg_t TestThread(void *p) { int i, j; -- cgit v1.2.3 From d8be44136c1e6d02ee105ac0791f9e6732551fec Mon Sep 17 00:00:00 2001 From: gdisirio Date: Mon, 1 Nov 2010 17:29:56 +0000 Subject: Fixed bug 3100946, renamed HAL switches removing the CH_ part. git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@2326 35acf78f-673a-0410-8e92-d51de3d6d3f4 --- test/coverage/halconf.h | 232 +++++++++++++++++++++++++++++++++--------------- 1 file changed, 161 insertions(+), 71 deletions(-) (limited to 'test') diff --git a/test/coverage/halconf.h b/test/coverage/halconf.h index 3e4b15d2d..437b67a6c 100644 --- a/test/coverage/halconf.h +++ b/test/coverage/halconf.h @@ -18,156 +18,246 @@ */ /** - * @file templates/halconf.h - * @brief HAL configuration header. + * @file templates/halconf.h + * @brief HAL configuration header. + * @details HAL configuration file, this file allows to enable or disable the + * various device drivers from your application. You may also use + * this file in order to override the device drivers default settings. + * * @addtogroup HAL_CONF * @{ */ /* - * HAL configuration file, this file allows to enable or disable the various - * device drivers from your application. You may also use this file in order - * to override the device drivers default settings. + * */ #ifndef _HALCONF_H_ #define _HALCONF_H_ -/* - * Uncomment the following line in order to include a mcu-related - * settings file. This file can be used to include platform specific - * header files or to override the low level drivers settings. - */ /*#include "mcuconf.h"*/ -/*===========================================================================*/ -/* PAL driver related settings. */ -/*===========================================================================*/ +/** + * @brief Enables the PAL subsystem. + */ +#if !defined(HAL_USE_PAL) || defined(__DOXYGEN__) +#define HAL_USE_PAL FALSE +#endif /** - * @brief Enables the PAL subsystem. + * @brief Enables the ADC subsystem. */ -#if !defined(CH_HAL_USE_PAL) || defined(__DOXYGEN__) -#define CH_HAL_USE_PAL FALSE +#if !defined(HAL_USE_ADC) || defined(__DOXYGEN__) +#define HAL_USE_ADC FALSE #endif -/*===========================================================================*/ -/* ADC driver related settings. */ -/*===========================================================================*/ +/** + * @brief Enables the CAN subsystem. + */ +#if !defined(HAL_USE_CAN) || defined(__DOXYGEN__) +#define HAL_USE_CAN FALSE +#endif /** - * @brief Enables the ADC subsystem. + * @brief Enables the I2C subsystem. */ -#if !defined(CH_HAL_USE_ADC) || defined(__DOXYGEN__) -#define CH_HAL_USE_ADC FALSE +#if !defined(HAL_USE_I2C) || defined(__DOXYGEN__) +#define HAL_USE_I2C FALSE #endif -/* - * Default ADC settings overrides (uncomment to override). +/** + * @brief Enables the MAC subsystem. + */ +#if !defined(HAL_USE_MAC) || defined(__DOXYGEN__) +#define HAL_USE_MAC FALSE +#endif + +/** + * @brief Enables the MMC_SPI subsystem. + */ +#if !defined(HAL_USE_MMC_SPI) || defined(__DOXYGEN__) +#define HAL_USE_MMC_SPI FALSE +#endif + +/** + * @brief Enables the PWM subsystem. + */ +#if !defined(HAL_USE_PWM) || defined(__DOXYGEN__) +#define HAL_USE_PWM FALSE +#endif + +/** + * @brief Enables the SERIAL subsystem. + */ +#if !defined(HAL_USE_SERIAL) || defined(__DOXYGEN__) +#define HAL_USE_SERIAL FALSE +#endif + +/** + * @brief Enables the SPI subsystem. + */ +#if !defined(HAL_USE_SPI) || defined(__DOXYGEN__) +#define HAL_USE_SPI FALSE +#endif + +/** + * @brief Enables the UART subsystem. */ -/*#define ADC_USE_WAIT TRUE*/ +#if !defined(HAL_USE_UART) || defined(__DOXYGEN__) +#define HAL_USE_UART FALSE +#endif /*===========================================================================*/ -/* CAN driver related settings. */ +/* ADC driver related settings. */ /*===========================================================================*/ /** - * @brief Enables the CAN subsystem. + * @brief Enables synchronous APIs. + * @note Disabling this option saves both code and data space. */ -#if !defined(CH_HAL_USE_CAN) || defined(__DOXYGEN__) -#define CH_HAL_USE_CAN FALSE +#if !defined(ADC_USE_WAIT) || defined(__DOXYGEN__) +#define ADC_USE_WAIT TRUE #endif -/* - * Default CAN settings overrides (uncomment to override). +/** + * @brief Enables the @p adcAcquireBus() and @p adcReleaseBus() APIs. + * @note Disabling this option saves both code and data space. */ -/*#define CAN_USE_SLEEP_MODE TRUE*/ +#if !defined(ADC_USE_MUTUAL_EXCLUSION) || defined(__DOXYGEN__) +#define ADC_USE_MUTUAL_EXCLUSION TRUE +#endif /*===========================================================================*/ -/* MAC driver related settings. */ +/* CAN driver related settings. */ /*===========================================================================*/ /** - * @brief Enables the MAC subsystem. + * @brief Sleep mode related APIs inclusion switch. */ -#if !defined(CH_HAL_USE_MAC) || defined(__DOXYGEN__) -#define CH_HAL_USE_MAC FALSE +#if !defined(CAN_USE_SLEEP_MODE) || defined(__DOXYGEN__) +#define CAN_USE_SLEEP_MODE TRUE #endif /*===========================================================================*/ -/* PWM driver related settings. */ +/* I2C driver related settings. */ /*===========================================================================*/ /** - * @brief Enables the PWM subsystem. + * @brief Enables the mutual exclusion APIs on the I2C bus. */ -#if !defined(CH_HAL_USE_PWM) || defined(__DOXYGEN__) -#define CH_HAL_USE_PWM FALSE +#if !defined(I2C_USE_MUTUAL_EXCLUSION) || defined(__DOXYGEN__) +#define I2C_USE_MUTUAL_EXCLUSION TRUE #endif /*===========================================================================*/ -/* SERIAL driver related settings. */ +/* MAC driver related settings. */ +/*===========================================================================*/ + +/*===========================================================================*/ +/* MMC_SPI driver related settings. */ /*===========================================================================*/ /** - * @brief Enables the SERIAL subsystem. + * @brief Block size for MMC transfers. */ -#if !defined(CH_HAL_USE_SERIAL) || defined(__DOXYGEN__) -#define CH_HAL_USE_SERIAL FALSE +#if !defined(MMC_SECTOR_SIZE) || defined(__DOXYGEN__) +#define MMC_SECTOR_SIZE 512 #endif -/* - * Default SERIAL settings overrides (uncomment to override). +/** + * @brief Delays insertions. + * @details If enabled this options inserts delays into the MMC waiting + * routines releasing some extra CPU time for the threads with + * lower priority, this may slow down the driver a bit however. + * This option is recommended also if the SPI driver does not + * use a DMA channel and heavily loads the CPU. */ -/*#define SERIAL_DEFAULT_BITRATE 38400*/ -/*#define SERIAL_BUFFERS_SIZE 64*/ +#if !defined(MMC_NICE_WAITING) || defined(__DOXYGEN__) +#define MMC_NICE_WAITING TRUE +#endif -/*===========================================================================*/ -/* SPI driver related settings. */ -/*===========================================================================*/ +/** + * @brief Number of positive insertion queries before generating the + * insertion event. + */ +#if !defined(MMC_POLLING_INTERVAL) || defined(__DOXYGEN__) +#define MMC_POLLING_INTERVAL 10 +#endif /** - * @brief Enables the SPI subsystem. + * @brief Interval, in milliseconds, between insertion queries. */ -#if !defined(CH_HAL_USE_SPI) || defined(__DOXYGEN__) -#define CH_HAL_USE_SPI FALSE +#if !defined(MMC_POLLING_DELAY) || defined(__DOXYGEN__) +#define MMC_POLLING_DELAY 10 #endif -/* - * Default SPI settings overrides (uncomment to override). +/** + * @brief Uses the SPI polled API for small data transfers. + * @details Polled transfers usually improve performance because it + * saves two context switches and interrupt servicing. Note + * that this option has no effect on large transfers which + * are always performed using DMAs/IRQs. */ -/*#define SPI_USE_MUTUAL_EXCLUSION TRUE*/ +#if !defined(MMC_USE_SPI_POLLING) || defined(__DOXYGEN__) +#define MMC_USE_SPI_POLLING TRUE +#endif /*===========================================================================*/ -/* MMC_SPI driver related settings. */ +/* PAL driver related settings. */ +/*===========================================================================*/ + +/*===========================================================================*/ +/* PWM driver related settings. */ +/*===========================================================================*/ + +/*===========================================================================*/ +/* SERIAL driver related settings. */ /*===========================================================================*/ /** - * @brief Enables the MMC_SPI subsystem. + * @brief Default bit rate. + * @details Configuration parameter, this is the baud rate selected for the + * default configuration. */ -#if !defined(CH_HAL_USE_MMC_SPI) || defined(__DOXYGEN__) -#define CH_HAL_USE_MMC_SPI FALSE +#if !defined(SERIAL_DEFAULT_BITRATE) || defined(__DOXYGEN__) +#define SERIAL_DEFAULT_BITRATE 38400 #endif -/* - * Default MMC_SPI settings overrides (uncomment to override). +/** + * @brief Serial buffers size. + * @details Configuration parameter, you can change the depth of the queue + * buffers depending on the requirements of your application. + * @note The default is 64 bytes for both the transmission and receive + * buffers. */ -/*#define MMC_SECTOR_SIZE 512*/ -/*#define MMC_NICE_WAITING TRUE*/ -/*#define MMC_POLLING_INTERVAL 10*/ -/*#define MMC_POLLING_DELAY 10*/ +#if !defined(SERIAL_BUFFERS_SIZE) || defined(__DOXYGEN__) +#define SERIAL_BUFFERS_SIZE 16 +#endif /*===========================================================================*/ -/* UART driver related settings. */ +/* SPI driver related settings. */ /*===========================================================================*/ /** - * @brief Enables the UART subsystem. + * @brief Enables synchronous APIs. + * @note Disabling this option saves both code and data space. */ -#if !defined(CH_HAL_USE_UART) || defined(__DOXYGEN__) -#define CH_HAL_USE_UART FALSE +#if !defined(SPI_USE_WAIT) || defined(__DOXYGEN__) +#define SPI_USE_WAIT TRUE #endif +/** + * @brief Enables the @p spiAcquireBus() and @p spiReleaseBus() APIs. + * @note Disabling this option saves both code and data space. + */ +#if !defined(SPI_USE_MUTUAL_EXCLUSION) || defined(__DOXYGEN__) +#define SPI_USE_MUTUAL_EXCLUSION TRUE +#endif + +/*===========================================================================*/ +/* UART driver related settings. */ +/*===========================================================================*/ + #endif /* _HALCONF_H_ */ /** @} */ -- cgit v1.2.3 From ef765be75f392d516bf77b307df5e2192458b3cc Mon Sep 17 00:00:00 2001 From: gdisirio Date: Sat, 20 Nov 2010 11:13:15 +0000 Subject: Fixed a misplaced comment in all the halconf.h files. git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@2394 35acf78f-673a-0410-8e92-d51de3d6d3f4 --- test/coverage/halconf.h | 4 ---- 1 file changed, 4 deletions(-) (limited to 'test') diff --git a/test/coverage/halconf.h b/test/coverage/halconf.h index 437b67a6c..f9ce1975c 100644 --- a/test/coverage/halconf.h +++ b/test/coverage/halconf.h @@ -28,10 +28,6 @@ * @{ */ -/* - * - */ - #ifndef _HALCONF_H_ #define _HALCONF_H_ -- cgit v1.2.3 From d973c3f25a6ab56e12b9f858b0692ec4297d84c9 Mon Sep 17 00:00:00 2001 From: gdisirio Date: Tue, 23 Nov 2010 20:26:17 +0000 Subject: Fixed bug 3116888. git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@2425 35acf78f-673a-0410-8e92-d51de3d6d3f4 --- test/testdyn.c | 37 +++++++++++++++++-------------------- 1 file changed, 17 insertions(+), 20 deletions(-) (limited to 'test') diff --git a/test/testdyn.c b/test/testdyn.c index 69a1c3312..2035224a1 100644 --- a/test/testdyn.c +++ b/test/testdyn.c @@ -190,16 +190,16 @@ ROMCONST struct testcase testdyn2 = { * coverage. */ -static unsigned regscan(void) { - Thread *tp; - unsigned i = 0; +static bool_t regfind(Thread *tp) { + Thread *ftp; + bool_t found = FALSE; - tp = chRegFirstThread(); + ftp = chRegFirstThread(); do { - i++; - tp = chRegNextThread(tp); - } while (tp != NULL); - return i; + found |= ftp == tp; + ftp = chRegNextThread(ftp); + } while (ftp != NULL); + return found; } static void dyn3_setup(void) { @@ -208,15 +208,9 @@ static void dyn3_setup(void) { } static void dyn3_execute(void) { - unsigned n1, n2, n3; Thread *tp; tprio_t prio = chThdGetPriority(); - /* Current number of threads in the system, two times just in case some - external detached thread terminated.*/ - (void)regscan(); - n1 = regscan(); - /* 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"); @@ -226,18 +220,21 @@ static void dyn3_execute(void) { test_assert(3, tp->p_refs == 1, "references decrease failure"); /* Verify the new threads count.*/ - n2 = regscan(); - test_assert(4, n1 == n2 - 1, "unexpected threads count"); + test_assert(4, regfind(tp), "thread missing from registry"); + test_assert(5, regfind(tp), "thread disappeared"); /* Detach and let the thread execute and terminate.*/ chThdRelease(tp); - test_assert(5, tp->p_refs == 0, "detach failure"); + test_assert(6, tp->p_refs == 0, "detach failure"); + test_assert(7, tp->p_state == THD_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(6, tp->p_state == THD_STATE_FINAL, "invalid state"); + test_assert(10, tp->p_state == THD_STATE_FINAL, "invalid state"); /* Clearing the zombie by scanning the registry.*/ - n3 = regscan(); - test_assert(7, n1 == n3, "unexpected threads count"); + test_assert(11, regfind(tp), "thread disappeared"); + test_assert(12, !regfind(tp), "thread still in registry"); } ROMCONST struct testcase testdyn3 = { -- cgit v1.2.3 From 68b05c757a60ba3bddbfb76d02b992f96d1e63f9 Mon Sep 17 00:00:00 2001 From: gdisirio Date: Thu, 2 Dec 2010 17:40:37 +0000 Subject: Fixed typo in configuration files. git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@2453 35acf78f-673a-0410-8e92-d51de3d6d3f4 --- test/coverage/chconf.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'test') diff --git a/test/coverage/chconf.h b/test/coverage/chconf.h index 14f85af56..617528316 100644 --- a/test/coverage/chconf.h +++ b/test/coverage/chconf.h @@ -68,7 +68,7 @@ * You may use this option if you need to merge ChibiOS/RT with * external libraries that require nested lock/unlock operations. * - * @note T he default is @p FALSE. + * @note The default is @p FALSE. */ #if !defined(CH_USE_NESTED_LOCKS) || defined(__DOXYGEN__) #define CH_USE_NESTED_LOCKS TRUE -- cgit v1.2.3 From 4ede72e0aa52fc11f06ef945a96f9843a5a790e4 Mon Sep 17 00:00:00 2001 From: gdisirio Date: Sun, 19 Dec 2010 11:28:21 +0000 Subject: Coverage tool updated. git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@2506 35acf78f-673a-0410-8e92-d51de3d6d3f4 --- test/coverage/Makefile | 7 +++++-- test/coverage/board.h | 23 ----------------------- test/coverage/main.c | 7 +++++++ 3 files changed, 12 insertions(+), 25 deletions(-) delete mode 100644 test/coverage/board.h (limited to 'test') diff --git a/test/coverage/Makefile b/test/coverage/Makefile index 91ceacc01..df99c931c 100644 --- a/test/coverage/Makefile +++ b/test/coverage/Makefile @@ -58,6 +58,7 @@ UADEFS = # Imported source files CHIBIOS = ../.. +include $(CHIBIOS)/boards/simulator/board.mk include ${CHIBIOS}/os/hal/hal.mk include ${CHIBIOS}/os/hal/platforms/Win32/platform.mk include ${CHIBIOS}/os/ports/GCC/SIMIA32/port.mk @@ -70,6 +71,7 @@ SRC = ${PORTSRC} \ ${TESTSRC} \ ${HALSRC} \ ${PLATFORMSRC} \ + $(BOARDSRC) \ ${CHIBIOS}/os/hal/platforms/Win32/console.c \ main.c @@ -77,8 +79,9 @@ SRC = ${PORTSRC} \ ASRC = # List all user directories here -UINCDIR = $(PORTINC) $(KERNINC) $(TESTINC) $(HALINC) $(PLATFORMINC) \ - ${CHIBIOS}/os/various +UINCDIR = $(PORTINC) $(KERNINC) $(TESTINC) \ + $(HALINC) $(PLATFORMINC) $(BOARDINC) \ + $(CHIBIOS)/os/various # List the user directory to look for the libraries here ULIBDIR = diff --git a/test/coverage/board.h b/test/coverage/board.h deleted file mode 100644 index 7b89d92d0..000000000 --- a/test/coverage/board.h +++ /dev/null @@ -1,23 +0,0 @@ -/* - ChibiOS/RT - Copyright (C) 2006,2007,2008,2009,2010 Giovanni Di Sirio. - - This file is part of ChibiOS/RT. - - ChibiOS/RT is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 3 of the License, or - (at your option) any later version. - - ChibiOS/RT is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program. If not, see . -*/ - -#ifndef _BOARD_H_ -#define _BOARD_H_ - -#endif /* _BOARD_H_ */ diff --git a/test/coverage/main.c b/test/coverage/main.c index 2f7613a22..b6f1ee696 100644 --- a/test/coverage/main.c +++ b/test/coverage/main.c @@ -34,6 +34,13 @@ int main(int argc, char *argv[]) { (void)argc; (void)argv; + /* + * System initializations. + * - HAL initialization, this also initializes the configured device drivers + * and performs the board-specific initializations. + * - Kernel initialization, the main() function becomes a thread and the + * RTOS is active. + */ halInit(); conInit(); chSysInit(); -- cgit v1.2.3 From c574cd3f8b97c0800b20ea7af9d6a6a4be9378fd Mon Sep 17 00:00:00 2001 From: gdisirio Date: Sun, 19 Dec 2010 11:32:40 +0000 Subject: git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@2507 35acf78f-673a-0410-8e92-d51de3d6d3f4 --- test/coverage/Makefile | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'test') diff --git a/test/coverage/Makefile b/test/coverage/Makefile index df99c931c..82dda4737 100644 --- a/test/coverage/Makefile +++ b/test/coverage/Makefile @@ -80,8 +80,8 @@ ASRC = # List all user directories here UINCDIR = $(PORTINC) $(KERNINC) $(TESTINC) \ - $(HALINC) $(PLATFORMINC) $(BOARDINC) \ - $(CHIBIOS)/os/various + $(HALINC) $(PLATFORMINC) $(BOARDINC) \ + $(CHIBIOS)/os/various # List the user directory to look for the libraries here ULIBDIR = -- cgit v1.2.3 From a1534ccb61d616ad15a69a668fe26466a87d76a9 Mon Sep 17 00:00:00 2001 From: gdisirio Date: Sun, 2 Jan 2011 14:01:18 +0000 Subject: New queues APIs. git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@2571 35acf78f-673a-0410-8e92-d51de3d6d3f4 --- test/testqueues.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'test') diff --git a/test/testqueues.c b/test/testqueues.c index 27f533142..8cd89fd0d 100644 --- a/test/testqueues.c +++ b/test/testqueues.c @@ -57,7 +57,7 @@ #define TEST_QUEUES_SIZE 4 -static void notify(void) {} +static void notify(GenericQueue *qp) {} /* * Note, the static initializers are not really required because the -- cgit v1.2.3 From 7799821b6e4f7c499eac4abc5e50028716da21f1 Mon Sep 17 00:00:00 2001 From: gdisirio Date: Thu, 6 Jan 2011 10:33:57 +0000 Subject: git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@2594 35acf78f-673a-0410-8e92-d51de3d6d3f4 --- test/testqueues.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'test') diff --git a/test/testqueues.c b/test/testqueues.c index 8cd89fd0d..9d76d7ac7 100644 --- a/test/testqueues.c +++ b/test/testqueues.c @@ -57,7 +57,9 @@ #define TEST_QUEUES_SIZE 4 -static void notify(GenericQueue *qp) {} +static void notify(GenericQueue *qp) { + (void)qp; +} /* * Note, the static initializers are not really required because the -- cgit v1.2.3 From 52d0114fdb2ea80c153988e3b7c36ddcfae80c14 Mon Sep 17 00:00:00 2001 From: gdisirio Date: Sat, 22 Jan 2011 16:10:42 +0000 Subject: Coverage improvements. git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@2676 35acf78f-673a-0410-8e92-d51de3d6d3f4 --- test/testqueues.c | 34 +++++++++++++++++++++++++++------- test/testsem.c | 4 ++++ 2 files changed, 31 insertions(+), 7 deletions(-) (limited to 'test') diff --git a/test/testqueues.c b/test/testqueues.c index 9d76d7ac7..dd4d00fba 100644 --- a/test/testqueues.c +++ b/test/testqueues.c @@ -83,6 +83,13 @@ static void queues1_setup(void) { chIQInit(&iq, wa[0], TEST_QUEUES_SIZE, notify); } +static msg_t thread1(void *p) { + + (void)p; + chIQGetTimeout(&iq, MS2ST(200)); + return 0; +} + static void queues1_execute(void) { unsigned i; size_t n; @@ -125,10 +132,13 @@ static void queues1_execute(void) { /* Testing reset */ chIQPutI(&iq, 0); chIQResetI(&iq); - test_assert(11, chIQIsEmptyI(&iq), "still full"); + test_assert(11, chIQGetFullI(&iq) == 0, "still full"); + threads[0] = chThdCreateStatic(wa[0], WA_SIZE, chThdGetPriority()+1, thread1, NULL); + test_assert(12, chIQGetFullI(&iq) == 0, "not empty"); + test_wait_threads(); /* Timeout */ - test_assert(12, chIQGetTimeout(&iq, 10) == Q_TIMEOUT, "wrong timeout return"); + test_assert(13, chIQGetTimeout(&iq, 10) == Q_TIMEOUT, "wrong timeout return"); } ROMCONST struct testcase testqueues1 = { @@ -152,6 +162,13 @@ static void queues2_setup(void) { chOQInit(&oq, wa[0], TEST_QUEUES_SIZE, notify); } +static msg_t thread2(void *p) { + + (void)p; + chOQPutTimeout(&oq, 0, MS2ST(200)); + return 0; +} + static void queues2_execute(void) { unsigned i; size_t n; @@ -175,20 +192,23 @@ static void queues2_execute(void) { n = chOQWriteTimeout(&oq, wa[1], TEST_QUEUES_SIZE * 2, TIME_IMMEDIATE); test_assert(6, n == TEST_QUEUES_SIZE, "wrong returned size"); test_assert(7, chOQIsFullI(&oq), "not full"); + threads[0] = chThdCreateStatic(wa[0], WA_SIZE, chThdGetPriority()+1, thread2, NULL); + test_assert(8, chOQGetFullI(&oq) == TEST_QUEUES_SIZE, "not empty"); + test_wait_threads(); /* Testing reset */ chOQResetI(&oq); - test_assert(8, chOQIsEmptyI(&oq), "still full"); + test_assert(9, chOQGetFullI(&oq) == 0, "still full"); /* Partial writes */ n = chOQWriteTimeout(&oq, wa[1], TEST_QUEUES_SIZE / 2, TIME_IMMEDIATE); - test_assert(9, n == TEST_QUEUES_SIZE / 2, "wrong returned size"); - n = chOQWriteTimeout(&oq, wa[1], TEST_QUEUES_SIZE / 2, TIME_IMMEDIATE); test_assert(10, n == TEST_QUEUES_SIZE / 2, "wrong returned size"); - test_assert(11, chOQIsFullI(&oq), "not full"); + n = chOQWriteTimeout(&oq, wa[1], TEST_QUEUES_SIZE / 2, TIME_IMMEDIATE); + test_assert(11, n == TEST_QUEUES_SIZE / 2, "wrong returned size"); + test_assert(12, chOQIsFullI(&oq), "not full"); /* Timeout */ - test_assert(12, chOQPutTimeout(&oq, 0, 10) == Q_TIMEOUT, "wrong timeout return"); + test_assert(13, chOQPutTimeout(&oq, 0, 10) == Q_TIMEOUT, "wrong timeout return"); } ROMCONST struct testcase testqueues2 = { diff --git a/test/testsem.c b/test/testsem.c index 46caad56a..25d87f3f1 100644 --- a/test/testsem.c +++ b/test/testsem.c @@ -102,6 +102,10 @@ static void sem1_execute(void) { #else test_assert_sequence(1, "ABCDE"); #endif + threads[0] = chThdCreateStatic(wa[0], WA_SIZE, chThdGetPriority()+5, thread1, "A"); + chSemSetCounterI(&sem1, 2); + test_wait_threads(); + test_assert(2, chSemGetCounterI(&sem1) == 2, "invalid counter"); } ROMCONST struct testcase testsem1 = { -- cgit v1.2.3 From 25832577af3589073deb78c2850eac93df73df9d Mon Sep 17 00:00:00 2001 From: gdisirio Date: Sun, 20 Feb 2011 07:44:48 +0000 Subject: Fixed bug 3184139. git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@2746 35acf78f-673a-0410-8e92-d51de3d6d3f4 --- test/testsem.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'test') diff --git a/test/testsem.c b/test/testsem.c index 25d87f3f1..36dae4086 100644 --- a/test/testsem.c +++ b/test/testsem.c @@ -250,7 +250,7 @@ static msg_t thread4(void *p) { } static void sem4_execute(void) { - BinarySemaphore bsem; + BSEMAPHORE_DECL(bsem, TRUE); /* Creates a taken binary semaphore.*/ chBSemInit(&bsem, TRUE); -- cgit v1.2.3 From 26d4b6431607f1437a5c51dfee4b8c12d3fb1bc7 Mon Sep 17 00:00:00 2001 From: gdisirio Date: Sun, 20 Feb 2011 08:34:05 +0000 Subject: Reverted the change, it is not portable. git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@2749 35acf78f-673a-0410-8e92-d51de3d6d3f4 --- test/testsem.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'test') diff --git a/test/testsem.c b/test/testsem.c index 36dae4086..25d87f3f1 100644 --- a/test/testsem.c +++ b/test/testsem.c @@ -250,7 +250,7 @@ static msg_t thread4(void *p) { } static void sem4_execute(void) { - BSEMAPHORE_DECL(bsem, TRUE); + BinarySemaphore bsem; /* Creates a taken binary semaphore.*/ chBSemInit(&bsem, TRUE); -- cgit v1.2.3 From db7b60f402fda8ffb708e73feea7ed566eea0386 Mon Sep 17 00:00:00 2001 From: gdisirio Date: Sun, 20 Feb 2011 15:26:43 +0000 Subject: Modified all the halconf.h files to include the USB and Serial over USB drivers. git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@2753 35acf78f-673a-0410-8e92-d51de3d6d3f4 --- test/coverage/halconf.h | 14 ++++++++++++++ 1 file changed, 14 insertions(+) (limited to 'test') diff --git a/test/coverage/halconf.h b/test/coverage/halconf.h index f9ce1975c..ccfc29df3 100644 --- a/test/coverage/halconf.h +++ b/test/coverage/halconf.h @@ -89,6 +89,13 @@ #define HAL_USE_SERIAL FALSE #endif +/** + * @brief Enables the SERIAL over USB subsystem. + */ +#if !defined(HAL_USE_SERIAL_USB) || defined(__DOXYGEN__) +#define HAL_USE_SERIAL_USB FALSE +#endif + /** * @brief Enables the SPI subsystem. */ @@ -103,6 +110,13 @@ #define HAL_USE_UART FALSE #endif +/** + * @brief Enables the USB subsystem. + */ +#if !defined(HAL_USE_USB) || defined(__DOXYGEN__) +#define HAL_USE_USB FALSE +#endif + /*===========================================================================*/ /* ADC driver related settings. */ /*===========================================================================*/ -- cgit v1.2.3 From 17f0815d52977bd1e3e9e662d2ffdccbaf77a6bd Mon Sep 17 00:00:00 2001 From: gdisirio Date: Mon, 21 Feb 2011 18:00:06 +0000 Subject: git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@2756 35acf78f-673a-0410-8e92-d51de3d6d3f4 --- test/testevt.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'test') diff --git a/test/testevt.c b/test/testevt.c index 656a8430d..ccf0ed576 100644 --- a/test/testevt.c +++ b/test/testevt.c @@ -136,7 +136,7 @@ static void evt2_setup(void) { static msg_t thread1(void *p) { chThdSleepMilliseconds(50); - chEvtSignal((Thread *)p, 1); + chEvtSignalFlags((Thread *)p, 1); return 0; } -- cgit v1.2.3 From 6f6e1a6401eda000dce198150937c7919b4c9855 Mon Sep 17 00:00:00 2001 From: gdisirio Date: Wed, 23 Feb 2011 18:59:39 +0000 Subject: Improved messages subsystem. git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@2759 35acf78f-673a-0410-8e92-d51de3d6d3f4 --- test/testbmk.c | 5 ++++- test/testmsg.c | 30 ++++++++++-------------------- 2 files changed, 14 insertions(+), 21 deletions(-) (limited to 'test') diff --git a/test/testbmk.c b/test/testbmk.c index 0f38eb78b..7e7a714df 100644 --- a/test/testbmk.c +++ b/test/testbmk.c @@ -65,11 +65,14 @@ static Mutex mtx1; #endif static msg_t thread1(void *p) { + Thread *tp; msg_t msg; (void)p; do { - chMsgRelease(msg = chMsgWait()); + tp = chMsgWait(); + msg = chMsgGet(tp); + chMsgRelease(tp, msg); } while (msg); return 0; } diff --git a/test/testmsg.c b/test/testmsg.c index 881db167f..14b6d8186 100644 --- a/test/testmsg.c +++ b/test/testmsg.c @@ -64,11 +64,11 @@ static msg_t thread(void *p) { chMsgSend(p, 'A'); chMsgSend(p, 'B'); chMsgSend(p, 'C'); - chMsgSend(p, 'D'); return 0; } static void msg1_execute(void) { + Thread *tp; msg_t msg; /* @@ -76,29 +76,19 @@ static void msg1_execute(void) { */ threads[0] = chThdCreateStatic(wa[0], WA_SIZE, chThdGetPriority() + 1, thread, chThdSelf()); - chMsgRelease(msg = chMsgWait()); + tp = chMsgWait(); + msg = chMsgGet(tp); + chMsgRelease(tp, msg); test_emit_token(msg); - chMsgRelease(msg = chMsgWait()); + tp = chMsgWait(); + msg = chMsgGet(tp); + chMsgRelease(tp, msg); test_emit_token(msg); - chMsgRelease(msg = chMsgWait()); + tp = chMsgWait(); + msg = chMsgGet(tp); + chMsgRelease(tp, msg); test_emit_token(msg); test_assert_sequence(1, "ABC"); - - /* - * Testing message fetch using chMsgGet(). - * Note, the following is valid because the sender has higher priority than - * the receiver. - */ - msg = chMsgGet(); - test_assert(1, msg != 0, "no message"); - chMsgRelease(0); - test_assert(2, msg == 'D', "wrong message"); - - /* - * Must not have pending messages. - */ - msg = chMsgGet(); - test_assert(3, msg == 0, "unknown message"); } ROMCONST struct testcase testmsg1 = { -- cgit v1.2.3 From 381bddaf5af985848e36ed8abbd4321bbb442538 Mon Sep 17 00:00:00 2001 From: gdisirio Date: Sat, 26 Feb 2011 15:18:15 +0000 Subject: Improved mailboxes coverage. git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@2771 35acf78f-673a-0410-8e92-d51de3d6d3f4 --- test/testmbox.c | 85 +++++++++++++++++++++++++++++++++++++++++++++------------ 1 file changed, 67 insertions(+), 18 deletions(-) (limited to 'test') diff --git a/test/testmbox.c b/test/testmbox.c index b3ac17e01..eba54a0d0 100644 --- a/test/testmbox.c +++ b/test/testmbox.c @@ -100,46 +100,95 @@ static void mbox1_execute(void) { */ msg1 = chMBPost(&mb1, 'X', 1); test_assert(4, msg1 == RDY_TIMEOUT, "wrong wake-up message"); + msg1 = chMBPostI(&mb1, 'X'); + test_assert(5, msg1 == RDY_TIMEOUT, "wrong wake-up message"); + msg1 = chMBPostAhead(&mb1, 'X', 1); + test_assert(6, msg1 == RDY_TIMEOUT, "wrong wake-up message"); + msg1 = chMBPostAheadI(&mb1, 'X'); + test_assert(7, msg1 == RDY_TIMEOUT, "wrong wake-up message"); /* * Testing final conditions. */ - test_assert(5, chMBGetFreeCountI(&mb1) == 0, "still empty"); - test_assert(6, chMBGetUsedCountI(&mb1) == MB_SIZE, "not full"); - test_assert(7, mb1.mb_rdptr == mb1.mb_wrptr, "pointers not aligned"); + test_assert(8, chMBGetFreeCountI(&mb1) == 0, "still empty"); + test_assert(9, chMBGetUsedCountI(&mb1) == MB_SIZE, "not full"); + test_assert(10, mb1.mb_rdptr == mb1.mb_wrptr, "pointers not aligned"); /* * Testing dequeuing. */ for (i = 0; i < MB_SIZE; i++) { - msg1 = chMBFetch(&mb1, &msg2, TIME_INFINITE); - test_assert(8, msg1 == RDY_OK, "wrong wake-up message"); + msg1 = chMBFetch(&mb1, &msg2, TIME_INFINITE); + test_assert(11, msg1 == RDY_OK, "wrong wake-up message"); test_emit_token(msg2); } - test_assert_sequence(9, "ABCDE"); + test_assert_sequence(12, "ABCDE"); /* * Testing buffer circularity. */ msg1 = chMBPost(&mb1, 'B' + i, TIME_INFINITE); - test_assert(10, msg1 == RDY_OK, "wrong wake-up message"); + test_assert(13, msg1 == RDY_OK, "wrong wake-up message"); msg1 = chMBFetch(&mb1, &msg2, TIME_INFINITE); - test_assert(11, msg1 == RDY_OK, "wrong wake-up message"); - test_assert(12, mb1.mb_buffer == mb1.mb_wrptr, "write pointer not aligned to base"); - test_assert(13, mb1.mb_buffer == mb1.mb_rdptr, "read pointer not aligned to base"); + test_assert(14, msg1 == RDY_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"); /* * Testing fetch timeout. */ msg1 = chMBFetch(&mb1, &msg2, 1); - test_assert(14, msg1 == RDY_TIMEOUT, "wrong wake-up message"); + test_assert(17, msg1 == RDY_TIMEOUT, "wrong wake-up message"); + msg1 = chMBFetchI(&mb1, &msg2); + test_assert(18, msg1 == RDY_TIMEOUT, "wrong wake-up message"); /* * Testing final conditions. */ - test_assert(15, chMBGetFreeCountI(&mb1) == MB_SIZE, "not empty"); - test_assert(16, chMBGetUsedCountI(&mb1) == 0, "still full"); - test_assert(17, mb1.mb_rdptr == mb1.mb_wrptr, "pointers not aligned"); + test_assert(19, chMBGetFreeCountI(&mb1) == MB_SIZE, "not empty"); + test_assert(20, chMBGetUsedCountI(&mb1) == 0, "still full"); + test_assert(21, mb1.mb_rdptr == mb1.mb_wrptr, "pointers not aligned"); + + /* + * Testing I-Class. + */ + msg1 = chMBPostI(&mb1, 'A'); + test_assert(22, msg1 == RDY_OK, "wrong wake-up message"); + msg1 = chMBPostI(&mb1, 'B'); + test_assert(23, msg1 == RDY_OK, "wrong wake-up message"); + msg1 = chMBPostI(&mb1, 'C'); + test_assert(24, msg1 == RDY_OK, "wrong wake-up message"); + msg1 = chMBPostI(&mb1, 'D'); + test_assert(25, msg1 == RDY_OK, "wrong wake-up message"); + msg1 = chMBPostI(&mb1, 'E'); + test_assert(26, msg1 == RDY_OK, "wrong wake-up message"); + test_assert(27, mb1.mb_rdptr == mb1.mb_wrptr, "pointers not aligned"); + for (i = 0; i < MB_SIZE; i++) { + msg1 = chMBFetchI(&mb1, &msg2); + test_assert(28, msg1 == RDY_OK, "wrong wake-up message"); + test_emit_token(msg2); + } + test_assert_sequence(29, "ABCDE"); + test_assert(30, mb1.mb_rdptr == mb1.mb_wrptr, "pointers not aligned"); + + msg1 = chMBPostAheadI(&mb1, 'E'); + test_assert(31, msg1 == RDY_OK, "wrong wake-up message"); + msg1 = chMBPostAheadI(&mb1, 'D'); + test_assert(32, msg1 == RDY_OK, "wrong wake-up message"); + msg1 = chMBPostAheadI(&mb1, 'C'); + test_assert(33, msg1 == RDY_OK, "wrong wake-up message"); + msg1 = chMBPostAheadI(&mb1, 'B'); + test_assert(34, msg1 == RDY_OK, "wrong wake-up message"); + msg1 = chMBPostAheadI(&mb1, 'A'); + test_assert(35, msg1 == RDY_OK, "wrong wake-up message"); + test_assert(36, mb1.mb_rdptr == mb1.mb_wrptr, "pointers not aligned"); + for (i = 0; i < MB_SIZE; i++) { + msg1 = chMBFetchI(&mb1, &msg2); + test_assert(37, msg1 == RDY_OK, "wrong wake-up message"); + test_emit_token(msg2); + } + test_assert_sequence(38, "ABCDE"); + test_assert(39, mb1.mb_rdptr == mb1.mb_wrptr, "pointers not aligned"); /* * Testing reset. @@ -149,10 +198,10 @@ static void mbox1_execute(void) { /* * Re-testing final conditions. */ - test_assert(18, chMBGetFreeCountI(&mb1) == MB_SIZE, "not empty"); - test_assert(19, chMBGetUsedCountI(&mb1) == 0, "still full"); - test_assert(20, mb1.mb_buffer == mb1.mb_wrptr, "write pointer not aligned to base"); - test_assert(21, mb1.mb_buffer == mb1.mb_rdptr, "read pointer not aligned to base"); + test_assert(40, chMBGetFreeCountI(&mb1) == MB_SIZE, "not empty"); + test_assert(41, chMBGetUsedCountI(&mb1) == 0, "still full"); + test_assert(42, mb1.mb_buffer == mb1.mb_wrptr, "write pointer not aligned to base"); + test_assert(43, mb1.mb_buffer == mb1.mb_rdptr, "read pointer not aligned to base"); } ROMCONST struct testcase testmbox1 = { -- cgit v1.2.3 From 761f9f7287db259fe4a280d9ad13e2ed6eaf95a3 Mon Sep 17 00:00:00 2001 From: gdisirio Date: Mon, 28 Feb 2011 19:28:47 +0000 Subject: Updated the various halconf.h and mcuconf.h with the GPT settings. git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@2782 35acf78f-673a-0410-8e92-d51de3d6d3f4 --- test/coverage/halconf.h | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'test') diff --git a/test/coverage/halconf.h b/test/coverage/halconf.h index ccfc29df3..a1e2190e8 100644 --- a/test/coverage/halconf.h +++ b/test/coverage/halconf.h @@ -54,6 +54,13 @@ #define HAL_USE_CAN FALSE #endif +/** + * @brief Enables the GPT subsystem. + */ +#if !defined(HAL_USE_GPT) || defined(__DOXYGEN__) +#define HAL_USE_GPT FALSE +#endif + /** * @brief Enables the I2C subsystem. */ -- cgit v1.2.3 From e7e79a6ccb4f3e320b2b8b7bad1b14d65218641d Mon Sep 17 00:00:00 2001 From: gdisirio Date: Fri, 18 Mar 2011 18:38:08 +0000 Subject: License updated. git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@2827 35acf78f-673a-0410-8e92-d51de3d6d3f4 --- test/coverage/chconf.h | 3 ++- test/coverage/halconf.h | 3 ++- test/coverage/main.c | 3 ++- test/test.c | 3 ++- test/test.dox | 3 ++- test/test.h | 3 ++- test/testbmk.c | 3 ++- test/testbmk.h | 3 ++- test/testdyn.c | 3 ++- test/testdyn.h | 3 ++- test/testevt.c | 3 ++- test/testevt.h | 3 ++- test/testheap.c | 3 ++- test/testheap.h | 3 ++- test/testmbox.c | 3 ++- test/testmbox.h | 3 ++- test/testmsg.c | 3 ++- test/testmsg.h | 3 ++- test/testmtx.c | 3 ++- test/testmtx.h | 3 ++- test/testpools.c | 3 ++- test/testpools.h | 3 ++- test/testqueues.c | 3 ++- test/testqueues.h | 3 ++- test/testsem.c | 3 ++- test/testsem.h | 3 ++- test/testthd.c | 3 ++- test/testthd.h | 3 ++- 28 files changed, 56 insertions(+), 28 deletions(-) (limited to 'test') diff --git a/test/coverage/chconf.h b/test/coverage/chconf.h index 617528316..b16d5d0d3 100644 --- a/test/coverage/chconf.h +++ b/test/coverage/chconf.h @@ -1,5 +1,6 @@ /* - ChibiOS/RT - Copyright (C) 2006,2007,2008,2009,2010 Giovanni Di Sirio. + ChibiOS/RT - Copyright (C) 2006,2007,2008,2009,2010, + 2011 Giovanni Di Sirio. This file is part of ChibiOS/RT. diff --git a/test/coverage/halconf.h b/test/coverage/halconf.h index a1e2190e8..a06bfaa23 100644 --- a/test/coverage/halconf.h +++ b/test/coverage/halconf.h @@ -1,5 +1,6 @@ /* - ChibiOS/RT - Copyright (C) 2006,2007,2008,2009,2010 Giovanni Di Sirio. + ChibiOS/RT - Copyright (C) 2006,2007,2008,2009,2010, + 2011 Giovanni Di Sirio. This file is part of ChibiOS/RT. diff --git a/test/coverage/main.c b/test/coverage/main.c index b6f1ee696..a2df0a409 100644 --- a/test/coverage/main.c +++ b/test/coverage/main.c @@ -1,5 +1,6 @@ /* - ChibiOS/RT - Copyright (C) 2006,2007,2008,2009,2010 Giovanni Di Sirio. + ChibiOS/RT - Copyright (C) 2006,2007,2008,2009,2010, + 2011 Giovanni Di Sirio. This file is part of ChibiOS/RT. diff --git a/test/test.c b/test/test.c index 00b5858bc..f1df08390 100644 --- a/test/test.c +++ b/test/test.c @@ -1,5 +1,6 @@ /* - ChibiOS/RT - Copyright (C) 2006,2007,2008,2009,2010 Giovanni Di Sirio. + ChibiOS/RT - Copyright (C) 2006,2007,2008,2009,2010, + 2011 Giovanni Di Sirio. This file is part of ChibiOS/RT. diff --git a/test/test.dox b/test/test.dox index beda6d0ea..296e2145e 100644 --- a/test/test.dox +++ b/test/test.dox @@ -1,5 +1,6 @@ /* - ChibiOS/RT - Copyright (C) 2006,2007,2008,2009,2010 Giovanni Di Sirio. + ChibiOS/RT - Copyright (C) 2006,2007,2008,2009,2010, + 2011 Giovanni Di Sirio. This file is part of ChibiOS/RT. diff --git a/test/test.h b/test/test.h index 987e361bf..31806fddb 100644 --- a/test/test.h +++ b/test/test.h @@ -1,5 +1,6 @@ /* - ChibiOS/RT - Copyright (C) 2006,2007,2008,2009,2010 Giovanni Di Sirio. + ChibiOS/RT - Copyright (C) 2006,2007,2008,2009,2010, + 2011 Giovanni Di Sirio. This file is part of ChibiOS/RT. diff --git a/test/testbmk.c b/test/testbmk.c index 7e7a714df..9c820b58a 100644 --- a/test/testbmk.c +++ b/test/testbmk.c @@ -1,5 +1,6 @@ /* - ChibiOS/RT - Copyright (C) 2006,2007,2008,2009,2010 Giovanni Di Sirio. + ChibiOS/RT - Copyright (C) 2006,2007,2008,2009,2010, + 2011 Giovanni Di Sirio. This file is part of ChibiOS/RT. diff --git a/test/testbmk.h b/test/testbmk.h index 5dde9a60c..43d4f2a22 100644 --- a/test/testbmk.h +++ b/test/testbmk.h @@ -1,5 +1,6 @@ /* - ChibiOS/RT - Copyright (C) 2006,2007,2008,2009,2010 Giovanni Di Sirio. + ChibiOS/RT - Copyright (C) 2006,2007,2008,2009,2010, + 2011 Giovanni Di Sirio. This file is part of ChibiOS/RT. diff --git a/test/testdyn.c b/test/testdyn.c index 2035224a1..c5b523816 100644 --- a/test/testdyn.c +++ b/test/testdyn.c @@ -1,5 +1,6 @@ /* - ChibiOS/RT - Copyright (C) 2006,2007,2008,2009,2010 Giovanni Di Sirio. + ChibiOS/RT - Copyright (C) 2006,2007,2008,2009,2010, + 2011 Giovanni Di Sirio. This file is part of ChibiOS/RT. diff --git a/test/testdyn.h b/test/testdyn.h index efcd4dc1e..366202d62 100644 --- a/test/testdyn.h +++ b/test/testdyn.h @@ -1,5 +1,6 @@ /* - ChibiOS/RT - Copyright (C) 2006,2007,2008,2009,2010 Giovanni Di Sirio. + ChibiOS/RT - Copyright (C) 2006,2007,2008,2009,2010, + 2011 Giovanni Di Sirio. This file is part of ChibiOS/RT. diff --git a/test/testevt.c b/test/testevt.c index ccf0ed576..c0f5baa5a 100644 --- a/test/testevt.c +++ b/test/testevt.c @@ -1,5 +1,6 @@ /* - ChibiOS/RT - Copyright (C) 2006,2007,2008,2009,2010 Giovanni Di Sirio. + ChibiOS/RT - Copyright (C) 2006,2007,2008,2009,2010, + 2011 Giovanni Di Sirio. This file is part of ChibiOS/RT. diff --git a/test/testevt.h b/test/testevt.h index 687b16912..810257608 100644 --- a/test/testevt.h +++ b/test/testevt.h @@ -1,5 +1,6 @@ /* - ChibiOS/RT - Copyright (C) 2006,2007,2008,2009,2010 Giovanni Di Sirio. + ChibiOS/RT - Copyright (C) 2006,2007,2008,2009,2010, + 2011 Giovanni Di Sirio. This file is part of ChibiOS/RT. diff --git a/test/testheap.c b/test/testheap.c index 94fb87bb9..4b480a575 100644 --- a/test/testheap.c +++ b/test/testheap.c @@ -1,5 +1,6 @@ /* - ChibiOS/RT - Copyright (C) 2006,2007,2008,2009,2010 Giovanni Di Sirio. + ChibiOS/RT - Copyright (C) 2006,2007,2008,2009,2010, + 2011 Giovanni Di Sirio. This file is part of ChibiOS/RT. diff --git a/test/testheap.h b/test/testheap.h index d5ce66ce3..4515f8846 100644 --- a/test/testheap.h +++ b/test/testheap.h @@ -1,5 +1,6 @@ /* - ChibiOS/RT - Copyright (C) 2006,2007,2008,2009,2010 Giovanni Di Sirio. + ChibiOS/RT - Copyright (C) 2006,2007,2008,2009,2010, + 2011 Giovanni Di Sirio. This file is part of ChibiOS/RT. diff --git a/test/testmbox.c b/test/testmbox.c index eba54a0d0..90b081c3e 100644 --- a/test/testmbox.c +++ b/test/testmbox.c @@ -1,5 +1,6 @@ /* - ChibiOS/RT - Copyright (C) 2006,2007,2008,2009,2010 Giovanni Di Sirio. + ChibiOS/RT - Copyright (C) 2006,2007,2008,2009,2010, + 2011 Giovanni Di Sirio. This file is part of ChibiOS/RT. diff --git a/test/testmbox.h b/test/testmbox.h index fc75552a3..c57a52495 100644 --- a/test/testmbox.h +++ b/test/testmbox.h @@ -1,5 +1,6 @@ /* - ChibiOS/RT - Copyright (C) 2006,2007,2008,2009,2010 Giovanni Di Sirio. + ChibiOS/RT - Copyright (C) 2006,2007,2008,2009,2010, + 2011 Giovanni Di Sirio. This file is part of ChibiOS/RT. diff --git a/test/testmsg.c b/test/testmsg.c index 14b6d8186..0fadc8d98 100644 --- a/test/testmsg.c +++ b/test/testmsg.c @@ -1,5 +1,6 @@ /* - ChibiOS/RT - Copyright (C) 2006,2007,2008,2009,2010 Giovanni Di Sirio. + ChibiOS/RT - Copyright (C) 2006,2007,2008,2009,2010, + 2011 Giovanni Di Sirio. This file is part of ChibiOS/RT. diff --git a/test/testmsg.h b/test/testmsg.h index d7817d427..7193156bd 100644 --- a/test/testmsg.h +++ b/test/testmsg.h @@ -1,5 +1,6 @@ /* - ChibiOS/RT - Copyright (C) 2006,2007,2008,2009,2010 Giovanni Di Sirio. + ChibiOS/RT - Copyright (C) 2006,2007,2008,2009,2010, + 2011 Giovanni Di Sirio. This file is part of ChibiOS/RT. diff --git a/test/testmtx.c b/test/testmtx.c index 9ca9edc85..4112eb004 100644 --- a/test/testmtx.c +++ b/test/testmtx.c @@ -1,5 +1,6 @@ /* - ChibiOS/RT - Copyright (C) 2006,2007,2008,2009,2010 Giovanni Di Sirio. + ChibiOS/RT - Copyright (C) 2006,2007,2008,2009,2010, + 2011 Giovanni Di Sirio. This file is part of ChibiOS/RT. diff --git a/test/testmtx.h b/test/testmtx.h index cd7ddf497..3bfaba78f 100644 --- a/test/testmtx.h +++ b/test/testmtx.h @@ -1,5 +1,6 @@ /* - ChibiOS/RT - Copyright (C) 2006,2007,2008,2009,2010 Giovanni Di Sirio. + ChibiOS/RT - Copyright (C) 2006,2007,2008,2009,2010, + 2011 Giovanni Di Sirio. This file is part of ChibiOS/RT. diff --git a/test/testpools.c b/test/testpools.c index c503ecbda..6479f20ea 100644 --- a/test/testpools.c +++ b/test/testpools.c @@ -1,5 +1,6 @@ /* - ChibiOS/RT - Copyright (C) 2006,2007,2008,2009,2010 Giovanni Di Sirio. + ChibiOS/RT - Copyright (C) 2006,2007,2008,2009,2010, + 2011 Giovanni Di Sirio. This file is part of ChibiOS/RT. diff --git a/test/testpools.h b/test/testpools.h index 5f526f1d6..a11ef4de7 100644 --- a/test/testpools.h +++ b/test/testpools.h @@ -1,5 +1,6 @@ /* - ChibiOS/RT - Copyright (C) 2006,2007,2008,2009,2010 Giovanni Di Sirio. + ChibiOS/RT - Copyright (C) 2006,2007,2008,2009,2010, + 2011 Giovanni Di Sirio. This file is part of ChibiOS/RT. diff --git a/test/testqueues.c b/test/testqueues.c index dd4d00fba..e30e12dcb 100644 --- a/test/testqueues.c +++ b/test/testqueues.c @@ -1,5 +1,6 @@ /* - ChibiOS/RT - Copyright (C) 2006,2007,2008,2009,2010 Giovanni Di Sirio. + ChibiOS/RT - Copyright (C) 2006,2007,2008,2009,2010, + 2011 Giovanni Di Sirio. This file is part of ChibiOS/RT. diff --git a/test/testqueues.h b/test/testqueues.h index 1f86fc763..ff9b6a618 100644 --- a/test/testqueues.h +++ b/test/testqueues.h @@ -1,5 +1,6 @@ /* - ChibiOS/RT - Copyright (C) 2006,2007,2008,2009,2010 Giovanni Di Sirio. + ChibiOS/RT - Copyright (C) 2006,2007,2008,2009,2010, + 2011 Giovanni Di Sirio. This file is part of ChibiOS/RT. diff --git a/test/testsem.c b/test/testsem.c index 25d87f3f1..75f4f1fcb 100644 --- a/test/testsem.c +++ b/test/testsem.c @@ -1,5 +1,6 @@ /* - ChibiOS/RT - Copyright (C) 2006,2007,2008,2009,2010 Giovanni Di Sirio. + ChibiOS/RT - Copyright (C) 2006,2007,2008,2009,2010, + 2011 Giovanni Di Sirio. This file is part of ChibiOS/RT. diff --git a/test/testsem.h b/test/testsem.h index cfa3b6330..032c75436 100644 --- a/test/testsem.h +++ b/test/testsem.h @@ -1,5 +1,6 @@ /* - ChibiOS/RT - Copyright (C) 2006,2007,2008,2009,2010 Giovanni Di Sirio. + ChibiOS/RT - Copyright (C) 2006,2007,2008,2009,2010, + 2011 Giovanni Di Sirio. This file is part of ChibiOS/RT. diff --git a/test/testthd.c b/test/testthd.c index 8b0440248..83c2c4d4f 100644 --- a/test/testthd.c +++ b/test/testthd.c @@ -1,5 +1,6 @@ /* - ChibiOS/RT - Copyright (C) 2006,2007,2008,2009,2010 Giovanni Di Sirio. + ChibiOS/RT - Copyright (C) 2006,2007,2008,2009,2010, + 2011 Giovanni Di Sirio. This file is part of ChibiOS/RT. diff --git a/test/testthd.h b/test/testthd.h index e355f63fb..5435cc02d 100644 --- a/test/testthd.h +++ b/test/testthd.h @@ -1,5 +1,6 @@ /* - ChibiOS/RT - Copyright (C) 2006,2007,2008,2009,2010 Giovanni Di Sirio. + ChibiOS/RT - Copyright (C) 2006,2007,2008,2009,2010, + 2011 Giovanni Di Sirio. This file is part of ChibiOS/RT. -- cgit v1.2.3 From 506212845dd0644b2755191da1252380aababd24 Mon Sep 17 00:00:00 2001 From: gdisirio Date: Wed, 23 Mar 2011 13:12:41 +0000 Subject: git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@2839 35acf78f-673a-0410-8e92-d51de3d6d3f4 --- test/testbmk.c | 16 ++++++++-------- test/testdyn.c | 20 ++++++++++---------- test/testevt.c | 8 ++++---- test/testheap.c | 4 ++-- test/testmbox.c | 4 ++-- test/testmsg.c | 4 ++-- test/testmtx.c | 16 ++++++++-------- test/testpools.c | 4 ++-- test/testqueues.c | 4 ++-- test/testsem.c | 8 ++++---- test/testthd.c | 2 +- 11 files changed, 45 insertions(+), 45 deletions(-) (limited to 'test') diff --git a/test/testbmk.c b/test/testbmk.c index 9c820b58a..6c878f557 100644 --- a/test/testbmk.c +++ b/test/testbmk.c @@ -61,7 +61,7 @@ */ static Semaphore sem1; -#if CH_USE_MUTEXES +#if CH_USE_MUTEXES || defined(__DOXYGEN__) static Mutex mtx1; #endif @@ -577,7 +577,7 @@ ROMCONST struct testcase testbmk11 = { bmk11_execute }; -#if CH_USE_MUTEXES +#if CH_USE_MUTEXES || defined(__DOXYGEN__) /** * @page test_benchmarks_012 Mutexes lock/unlock performance * @@ -648,7 +648,7 @@ static void bmk13_execute(void) { test_print("--- Semaph: "); test_printn(sizeof(Semaphore)); test_println(" bytes"); -#if CH_USE_EVENTS +#if CH_USE_EVENTS || defined(__DOXYGEN__) test_print("--- EventS: "); test_printn(sizeof(EventSource)); test_println(" bytes"); @@ -656,22 +656,22 @@ static void bmk13_execute(void) { test_printn(sizeof(EventListener)); test_println(" bytes"); #endif -#if CH_USE_MUTEXES +#if CH_USE_MUTEXES || defined(__DOXYGEN__) test_print("--- Mutex : "); test_printn(sizeof(Mutex)); test_println(" bytes"); #endif -#if CH_USE_CONDVARS +#if CH_USE_CONDVARS || defined(__DOXYGEN__) test_print("--- CondV.: "); test_printn(sizeof(CondVar)); test_println(" bytes"); #endif -#if CH_USE_QUEUES +#if CH_USE_QUEUES || defined(__DOXYGEN__) test_print("--- Queue : "); test_printn(sizeof(GenericQueue)); test_println(" bytes"); #endif -#if CH_USE_MAILBOXES +#if CH_USE_MAILBOXES || defined(__DOXYGEN__) test_print("--- MailB.: "); test_printn(sizeof(Mailbox)); test_println(" bytes"); @@ -701,7 +701,7 @@ ROMCONST struct testcase * ROMCONST patternbmk[] = { &testbmk9, &testbmk10, &testbmk11, -#if CH_USE_MUTEXES +#if CH_USE_MUTEXES || defined(__DOXYGEN__) &testbmk12, #endif &testbmk13, diff --git a/test/testdyn.c b/test/testdyn.c index c5b523816..5657a8dc2 100644 --- a/test/testdyn.c +++ b/test/testdyn.c @@ -53,11 +53,11 @@ * @brief Dynamic thread APIs test header file */ -#if CH_USE_DYNAMIC -#if CH_USE_HEAP +#if CH_USE_DYNAMIC || defined(__DOXYGEN__) +#if CH_USE_HEAP || defined(__DOXYGEN__) static MemoryHeap heap1; #endif -#if CH_USE_MEMPOOLS +#if CH_USE_MEMPOOLS || defined(__DOXYGEN__) static MemoryPool mp1; #endif @@ -78,7 +78,7 @@ static msg_t thread(void *p) { return 0; } -#if CH_USE_HEAP +#if CH_USE_HEAP || defined(__DOXYGEN__) static void dyn1_setup(void) { chHeapInit(&heap1, test.buffer, sizeof(union test_buffers)); @@ -126,7 +126,7 @@ ROMCONST struct testcase testdyn1 = { }; #endif /* CH_USE_HEAP */ -#if CH_USE_MEMPOOLS +#if CH_USE_MEMPOOLS || defined(__DOXYGEN__) /** * @page test_dynamic_002 Threads creation from Memory Pool * @@ -182,7 +182,7 @@ ROMCONST struct testcase testdyn2 = { }; #endif /* CH_USE_MEMPOOLS */ -#if CH_USE_HEAP && CH_USE_REGISTRY +#if (CH_USE_HEAP && CH_USE_REGISTRY) || defined(__DOXYGEN__) /** * @page test_dynamic_003 Registry and References test * @@ -251,14 +251,14 @@ ROMCONST struct testcase testdyn3 = { * @brief Test sequence for dynamic APIs. */ ROMCONST struct testcase * ROMCONST patterndyn[] = { -#if CH_USE_DYNAMIC -#if CH_USE_HEAP +#if CH_USE_DYNAMIC || defined(__DOXYGEN__) +#if CH_USE_HEAP || defined(__DOXYGEN__) &testdyn1, #endif -#if CH_USE_MEMPOOLS +#if CH_USE_MEMPOOLS || defined(__DOXYGEN__) &testdyn2, #endif -#if CH_USE_HEAP && CH_USE_REGISTRY +#if (CH_USE_HEAP && CH_USE_REGISTRY) || defined(__DOXYGEN__) &testdyn3, #endif #endif diff --git a/test/testevt.c b/test/testevt.c index c0f5baa5a..4bdeb8fc9 100644 --- a/test/testevt.c +++ b/test/testevt.c @@ -51,7 +51,7 @@ * @brief Events test header file */ -#if CH_USE_EVENTS +#if CH_USE_EVENTS || defined(__DOXYGEN__) #define ALLOWED_DELAY MS2ST(5) @@ -232,7 +232,7 @@ ROMCONST struct testcase testevt2 = { evt2_execute }; -#if CH_USE_EVENTS_TIMEOUT +#if CH_USE_EVENTS_TIMEOUT || defined(__DOXYGEN__) /** * @page test_events_003 Events timeout * @@ -285,10 +285,10 @@ ROMCONST struct testcase testevt3 = { * @brief Test sequence for events. */ ROMCONST struct testcase * ROMCONST patternevt[] = { -#if CH_USE_EVENTS +#if CH_USE_EVENTS || defined(__DOXYGEN__) &testevt1, &testevt2, -#if CH_USE_EVENTS_TIMEOUT +#if CH_USE_EVENTS_TIMEOUT || defined(__DOXYGEN__) &testevt3, #endif #endif diff --git a/test/testheap.c b/test/testheap.c index 4b480a575..bfdcea1e6 100644 --- a/test/testheap.c +++ b/test/testheap.c @@ -48,7 +48,7 @@ * @brief Heap header file */ -#if CH_USE_HEAP +#if CH_USE_HEAP || defined(__DOXYGEN__) #define SIZE 16 @@ -156,7 +156,7 @@ ROMCONST struct testcase testheap1 = { * @brief Test sequence for heap. */ ROMCONST struct testcase * ROMCONST patternheap[] = { -#if CH_USE_HEAP +#if CH_USE_HEAP || defined(__DOXYGEN__) &testheap1, #endif NULL diff --git a/test/testmbox.c b/test/testmbox.c index 90b081c3e..8797536c6 100644 --- a/test/testmbox.c +++ b/test/testmbox.c @@ -51,7 +51,7 @@ * @brief Mailboxes header file */ -#if CH_USE_MAILBOXES +#if CH_USE_MAILBOXES || defined(__DOXYGEN__) #define ALLOWED_DELAY MS2ST(5) #define MB_SIZE 5 @@ -218,7 +218,7 @@ ROMCONST struct testcase testmbox1 = { * @brief Test sequence for mailboxes. */ ROMCONST struct testcase * ROMCONST patternmbox[] = { -#if CH_USE_MAILBOXES +#if CH_USE_MAILBOXES || defined(__DOXYGEN__) &testmbox1, #endif NULL diff --git a/test/testmsg.c b/test/testmsg.c index 0fadc8d98..54c049d44 100644 --- a/test/testmsg.c +++ b/test/testmsg.c @@ -49,7 +49,7 @@ * @brief Messages header file */ -#if CH_USE_MESSAGES +#if CH_USE_MESSAGES || defined(__DOXYGEN__) /** * @page test_msg_001 Messages Server loop @@ -105,7 +105,7 @@ ROMCONST struct testcase testmsg1 = { * @brief Test sequence for messages. */ ROMCONST struct testcase * ROMCONST patternmsg[] = { -#if CH_USE_MESSAGES +#if CH_USE_MESSAGES || defined(__DOXYGEN__) &testmsg1, #endif NULL diff --git a/test/testmtx.c b/test/testmtx.c index 4112eb004..08329a33b 100644 --- a/test/testmtx.c +++ b/test/testmtx.c @@ -60,7 +60,7 @@ * @brief Mutexes and CondVars test header file */ -#if CH_USE_MUTEXES +#if CH_USE_MUTEXES || defined(__DOXYGEN__) #define ALLOWED_DELAY 5 @@ -71,7 +71,7 @@ */ static MUTEX_DECL(m1); static MUTEX_DECL(m2); -#if CH_USE_CONDVARS +#if CH_USE_CONDVARS || defined(__DOXYGEN__) static CONDVAR_DECL(c1); #endif @@ -120,7 +120,7 @@ ROMCONST struct testcase testmtx1 = { mtx1_execute }; -#if CH_DBG_THREADS_PROFILING +#if CH_DBG_THREADS_PROFILING || defined(__DOXYGEN__) /** * @page test_mtx_002 Priority inheritance, simple case * @@ -467,7 +467,7 @@ ROMCONST struct testcase testmtx5 = { mtx5_execute }; -#if CH_USE_CONDVARS +#if CH_USE_CONDVARS || defined(__DOXYGEN__) /** * @page test_mtx_006 Condition Variable signal test * @@ -578,7 +578,7 @@ static msg_t thread11(void *p) { chMtxLock(&m2); chMtxLock(&m1); -#if CH_USE_CONDVARS_TIMEOUT +#if CH_USE_CONDVARS_TIMEOUT || defined(__DOXYGEN__) chCondWaitTimeout(&c1, TIME_INFINITE); #else chCondWait(&c1); @@ -622,15 +622,15 @@ ROMCONST struct testcase testmtx8 = { * @brief Test sequence for mutexes. */ ROMCONST struct testcase * ROMCONST patternmtx[] = { -#if CH_USE_MUTEXES +#if CH_USE_MUTEXES || defined(__DOXYGEN__) &testmtx1, -#if CH_DBG_THREADS_PROFILING +#if CH_DBG_THREADS_PROFILING || defined(__DOXYGEN__) &testmtx2, &testmtx3, #endif &testmtx4, &testmtx5, -#if CH_USE_CONDVARS +#if CH_USE_CONDVARS || defined(__DOXYGEN__) &testmtx6, &testmtx7, &testmtx8, diff --git a/test/testpools.c b/test/testpools.c index 6479f20ea..afdd37018 100644 --- a/test/testpools.c +++ b/test/testpools.c @@ -48,7 +48,7 @@ * @brief Memory Pools test header file */ -#if CH_USE_MEMPOOLS +#if CH_USE_MEMPOOLS || defined(__DOXYGEN__) static MEMORYPOOL_DECL(mp1, THD_WA_SIZE(THREADS_STACK_SIZE), NULL); @@ -104,7 +104,7 @@ ROMCONST struct testcase testpools1 = { * @brief Test sequence for pools. */ ROMCONST struct testcase * ROMCONST patternpools[] = { -#if CH_USE_MEMPOOLS +#if CH_USE_MEMPOOLS || defined(__DOXYGEN__) &testpools1, #endif NULL diff --git a/test/testqueues.c b/test/testqueues.c index e30e12dcb..55945761d 100644 --- a/test/testqueues.c +++ b/test/testqueues.c @@ -54,7 +54,7 @@ * @brief I/O Queues test header file */ -#if CH_USE_QUEUES +#if CH_USE_QUEUES || defined(__DOXYGEN__) #define TEST_QUEUES_SIZE 4 @@ -224,7 +224,7 @@ ROMCONST struct testcase testqueues2 = { * @brief Test sequence for queues. */ ROMCONST struct testcase * ROMCONST patternqueues[] = { -#if CH_USE_QUEUES +#if CH_USE_QUEUES || defined(__DOXYGEN__) &testqueues1, &testqueues2, #endif diff --git a/test/testsem.c b/test/testsem.c index 75f4f1fcb..009a5910f 100644 --- a/test/testsem.c +++ b/test/testsem.c @@ -51,7 +51,7 @@ * @brief Semaphores test header file */ -#if CH_USE_SEMAPHORES +#if CH_USE_SEMAPHORES || defined(__DOXYGEN__) #define ALLOWED_DELAY MS2ST(5) @@ -190,7 +190,7 @@ ROMCONST struct testcase testsem2 = { sem2_execute }; -#if CH_USE_SEMSW +#if CH_USE_SEMSW || defined(__DOXYGEN__) /** * @page test_sem_003 Atomic signal-wait test * @@ -292,10 +292,10 @@ ROMCONST struct testcase testsem4 = { * @brief Test sequence for semaphores. */ ROMCONST struct testcase * ROMCONST patternsem[] = { -#if CH_USE_SEMAPHORES +#if CH_USE_SEMAPHORES || defined(__DOXYGEN__) &testsem1, &testsem2, -#if CH_USE_SEMSW +#if CH_USE_SEMSW || defined(__DOXYGEN__) &testsem3, #endif &testsem4, diff --git a/test/testthd.c b/test/testthd.c index 83c2c4d4f..3433d2eb4 100644 --- a/test/testthd.c +++ b/test/testthd.c @@ -142,7 +142,7 @@ static void thd3_execute(void) { test_assert(4, chThdGetPriority() == prio, "unexpected priority level"); -#if CH_USE_MUTEXES +#if CH_USE_MUTEXES || defined(__DOXYGEN__) /* Simulates a priority boost situation (p_prio > p_realprio).*/ chSysLock(); chThdSelf()->p_prio += 2; -- cgit v1.2.3 From de877486efb49378065f769ff423eef19ceb12e6 Mon Sep 17 00:00:00 2001 From: gdisirio Date: Sat, 9 Apr 2011 15:10:15 +0000 Subject: Fixed bug 3276379. git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@2872 35acf78f-673a-0410-8e92-d51de3d6d3f4 --- test/testsem.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'test') diff --git a/test/testsem.c b/test/testsem.c index 009a5910f..6a6a622ef 100644 --- a/test/testsem.c +++ b/test/testsem.c @@ -104,9 +104,9 @@ static void sem1_execute(void) { test_assert_sequence(1, "ABCDE"); #endif threads[0] = chThdCreateStatic(wa[0], WA_SIZE, chThdGetPriority()+5, thread1, "A"); - chSemSetCounterI(&sem1, 2); + chSemAddCounterI(&sem1, 2); test_wait_threads(); - test_assert(2, chSemGetCounterI(&sem1) == 2, "invalid counter"); + test_assert(2, chSemGetCounterI(&sem1) == 1, "invalid counter"); } ROMCONST struct testcase testsem1 = { -- cgit v1.2.3 From dfc2c1e189dff36c57dfa521ac33289fe34972d2 Mon Sep 17 00:00:00 2001 From: gdisirio Date: Sat, 23 Apr 2011 17:37:09 +0000 Subject: Updated all the HAL configuration files. git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@2900 35acf78f-673a-0410-8e92-d51de3d6d3f4 --- test/coverage/halconf.h | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'test') diff --git a/test/coverage/halconf.h b/test/coverage/halconf.h index a06bfaa23..3f84017ff 100644 --- a/test/coverage/halconf.h +++ b/test/coverage/halconf.h @@ -69,6 +69,13 @@ #define HAL_USE_I2C FALSE #endif +/** + * @brief Enables the ICU subsystem. + */ +#if !defined(HAL_USE_ICU) || defined(__DOXYGEN__) +#define HAL_USE_ICU TRUE +#endif + /** * @brief Enables the MAC subsystem. */ -- cgit v1.2.3 From 82215e70199aa16ccad770a0e47ca5131a3f8b93 Mon Sep 17 00:00:00 2001 From: gdisirio Date: Sun, 8 May 2011 09:16:22 +0000 Subject: All halcof.h files updated for the SDC driver. git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@2932 35acf78f-673a-0410-8e92-d51de3d6d3f4 --- test/coverage/halconf.h | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'test') diff --git a/test/coverage/halconf.h b/test/coverage/halconf.h index 3f84017ff..215ec1099 100644 --- a/test/coverage/halconf.h +++ b/test/coverage/halconf.h @@ -97,6 +97,13 @@ #define HAL_USE_PWM FALSE #endif +/** + * @brief Enables the SDC subsystem. + */ +#if !defined(HAL_USE_SDC) || defined(__DOXYGEN__) +#define HAL_USE_SDC TRUE +#endif + /** * @brief Enables the SERIAL subsystem. */ -- cgit v1.2.3 From 85f17ebe017f0ef2a42d96eb3525346db5b9c65e Mon Sep 17 00:00:00 2001 From: gdisirio Date: Fri, 13 May 2011 17:20:39 +0000 Subject: Customer CR. git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@2951 35acf78f-673a-0410-8e92-d51de3d6d3f4 --- test/coverage/chconf.h | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) (limited to 'test') diff --git a/test/coverage/chconf.h b/test/coverage/chconf.h index b16d5d0d3..1810540d5 100644 --- a/test/coverage/chconf.h +++ b/test/coverage/chconf.h @@ -90,6 +90,23 @@ #define CH_MEMCORE_SIZE 0x20000 #endif +/** + * @brief Idle thread automatic spawn suppression. + * @details When this option is activated the function @p chSysInit() + * does not spawn the idle thread automatically. The application has + * then the responsibility to do one of the following: + * - Spawn a custom idle thread at priority @p IDLEPRIO. + * - Change the main() thread priority to @p IDLEPRIO then enter + * an endless loop. In this scenario the @p main() thread acts as + * the idle thread. + * . + * @note Unless an idle thread is spawned the @p main() thread must not + * enter a sleep state. + */ +#if !defined(CH_NO_IDLE_THREAD) || defined(__DOXYGEN__) +#define CH_NO_IDLE_THREAD FALSE +#endif + /*===========================================================================*/ /* Performance options. */ /*===========================================================================*/ -- cgit v1.2.3 From 8af2607871d3a2f5bc92ce9fb095a23d7adab27b Mon Sep 17 00:00:00 2001 From: gdisirio Date: Sat, 14 May 2011 05:24:10 +0000 Subject: Updated HAL configuration files with SDC driver settings. git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@2953 35acf78f-673a-0410-8e92-d51de3d6d3f4 --- test/coverage/halconf.h | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) (limited to 'test') diff --git a/test/coverage/halconf.h b/test/coverage/halconf.h index 215ec1099..58b3ec841 100644 --- a/test/coverage/halconf.h +++ b/test/coverage/halconf.h @@ -242,6 +242,36 @@ /* PWM driver related settings. */ /*===========================================================================*/ +/*===========================================================================*/ +/* SDC driver related settings. */ +/*===========================================================================*/ +/** + * @brief Number of initialization attempts before rejecting the card. + * @note Attempts are performed at 10mS intevals. + */ +#if !defined(SDC_INIT_RETRY) || defined(__DOXYGEN__) +#define SDC_INIT_RETRY 100 +#endif + +/** + * @brief Include support for MMC cards. + * @note MMC support is not yet implemented so this option must be kept + * at @p FALSE. + */ +#if !defined(SDC_MMC_SUPPORT) || defined(__DOXYGEN__) +#define SDC_MMC_SUPPORT FALSE +#endif + +/** + * @brief Delays insertions. + * @details If enabled this options inserts delays into the MMC waiting + * routines releasing some extra CPU time for the threads with + * lower priority, this may slow down the driver a bit however. + */ +#if !defined(SDC_NICE_WAITING) || defined(__DOXYGEN__) +#define SDC_NICE_WAITING TRUE +#endif + /*===========================================================================*/ /* SERIAL driver related settings. */ /*===========================================================================*/ -- cgit v1.2.3 From 67e6534f658113f8bdfccab5fb6373214501d32b Mon Sep 17 00:00:00 2001 From: gdisirio Date: Sat, 14 May 2011 07:05:46 +0000 Subject: git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@2955 35acf78f-673a-0410-8e92-d51de3d6d3f4 --- test/coverage/halconf.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'test') diff --git a/test/coverage/halconf.h b/test/coverage/halconf.h index 58b3ec841..525e97ae8 100644 --- a/test/coverage/halconf.h +++ b/test/coverage/halconf.h @@ -101,7 +101,7 @@ * @brief Enables the SDC subsystem. */ #if !defined(HAL_USE_SDC) || defined(__DOXYGEN__) -#define HAL_USE_SDC TRUE +#define HAL_USE_SDC FALSE #endif /** -- cgit v1.2.3 From 391474c15f0695d4b1bbe1549fefc98ef3cf9e4d Mon Sep 17 00:00:00 2001 From: gdisirio Date: Sat, 14 May 2011 07:11:40 +0000 Subject: git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@2956 35acf78f-673a-0410-8e92-d51de3d6d3f4 --- test/coverage/halconf.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'test') diff --git a/test/coverage/halconf.h b/test/coverage/halconf.h index 525e97ae8..2829fb066 100644 --- a/test/coverage/halconf.h +++ b/test/coverage/halconf.h @@ -73,7 +73,7 @@ * @brief Enables the ICU subsystem. */ #if !defined(HAL_USE_ICU) || defined(__DOXYGEN__) -#define HAL_USE_ICU TRUE +#define HAL_USE_ICU FALSE #endif /** -- cgit v1.2.3 From e0b53350156cef01da9b83e46127f7322e967909 Mon Sep 17 00:00:00 2001 From: gdisirio Date: Tue, 17 May 2011 14:49:51 +0000 Subject: git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@2966 35acf78f-673a-0410-8e92-d51de3d6d3f4 --- test/test.c | 10 +++++++--- test/testbmk.c | 8 +++++--- 2 files changed, 12 insertions(+), 6 deletions(-) (limited to 'test') diff --git a/test/test.c b/test/test.c index f1df08390..41662308c 100644 --- a/test/test.c +++ b/test/test.c @@ -328,9 +328,9 @@ msg_t TestThread(void *p) { test_println("***"); test_print("*** Kernel: "); test_println(CH_KERNEL_VERSION); -#ifdef __GNUC__ - test_print("*** GCC Version: "); - test_println(__VERSION__); +#ifdef CH_COMPILER_NAME + test_print("*** Compiler: "); + test_println(CH_COMPILER_NAME); #endif test_print("*** Architecture: "); test_println(CH_ARCHITECTURE_NAME); @@ -338,6 +338,10 @@ msg_t TestThread(void *p) { test_print("*** Core Variant: "); test_println(CH_CORE_VARIANT_NAME); #endif +#ifdef CH_PORT_INFO + test_print("*** Port Info: "); + test_println(CH_PORT_INFO); +#endif #ifdef PLATFORM_NAME test_print("*** Platform: "); test_println(PLATFORM_NAME); diff --git a/test/testbmk.c b/test/testbmk.c index 6c878f557..54da81fd8 100644 --- a/test/testbmk.c +++ b/test/testbmk.c @@ -635,9 +635,11 @@ ROMCONST struct testcase testbmk12 = { static void bmk13_execute(void) { test_print("--- System: "); - test_printn(sizeof(ReadyList) + sizeof(VTList) + IDLE_THREAD_STACK_SIZE + - (sizeof(Thread) + sizeof(struct intctx) + sizeof(struct extctx) + - INT_REQUIRED_STACK) * 2); + test_printn(sizeof(ReadyList) + sizeof(VTList) + + PORT_IDLE_THREAD_STACK_SIZE + + (sizeof(Thread) + sizeof(struct intctx) + + sizeof(struct extctx) + + PORT_INT_REQUIRED_STACK) * 2); test_println(" bytes"); test_print("--- Thread: "); test_printn(sizeof(Thread)); -- cgit v1.2.3 From b4aa14e88c9e28a16a5f9c0c220fac6cc36750ad Mon Sep 17 00:00:00 2001 From: gdisirio Date: Wed, 18 May 2011 09:03:50 +0000 Subject: git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@2971 35acf78f-673a-0410-8e92-d51de3d6d3f4 --- test/coverage/chconf.h | 20 -------------------- 1 file changed, 20 deletions(-) (limited to 'test') diff --git a/test/coverage/chconf.h b/test/coverage/chconf.h index 1810540d5..f1cce630a 100644 --- a/test/coverage/chconf.h +++ b/test/coverage/chconf.h @@ -123,26 +123,6 @@ #define CH_OPTIMIZE_SPEED FALSE #endif -/** - * @brief Exotic optimization. - * @details If defined then a CPU register is used as storage for the global - * @p currp variable. Caching this variable in a register greatly - * improves both space and time OS efficiency. A side effect is that - * one less register has to be saved during the context switch - * resulting in lower RAM usage and faster context switch. - * - * @note This option is only usable with the GCC compiler and is only useful - * on processors with many registers like ARM cores. - * @note If this option is enabled then ALL the libraries linked to the - * ChibiOS/RT code must be recompiled with the GCC option @p - * -ffixed-@. - * @note This option must be enabled in the Makefile, it is listed here for - * documentation only. - */ -#if defined(__DOXYGEN__) -#define CH_CURRP_REGISTER_CACHE "reg" -#endif - /*===========================================================================*/ /* Subsystem options. */ /*===========================================================================*/ -- cgit v1.2.3 From 5e1249af266c9688ec575e5a2f14ecfe6084de49 Mon Sep 17 00:00:00 2001 From: gdisirio Date: Thu, 19 May 2011 09:13:24 +0000 Subject: Fixed bug 3303841. git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@2973 35acf78f-673a-0410-8e92-d51de3d6d3f4 --- test/testdyn.c | 14 ++++++++------ test/testheap.c | 4 ++-- 2 files changed, 10 insertions(+), 8 deletions(-) (limited to 'test') diff --git a/test/testdyn.c b/test/testdyn.c index 5657a8dc2..d015e2ac6 100644 --- a/test/testdyn.c +++ b/test/testdyn.c @@ -54,7 +54,7 @@ */ #if CH_USE_DYNAMIC || defined(__DOXYGEN__) -#if CH_USE_HEAP || defined(__DOXYGEN__) +#if (CH_USE_HEAP && !CH_USE_MALLOC_HEAP) || defined(__DOXYGEN__) static MemoryHeap heap1; #endif #if CH_USE_MEMPOOLS || defined(__DOXYGEN__) @@ -78,7 +78,7 @@ static msg_t thread(void *p) { return 0; } -#if CH_USE_HEAP || defined(__DOXYGEN__) +#if (CH_USE_HEAP && !CH_USE_MALLOC_HEAP) || defined(__DOXYGEN__) static void dyn1_setup(void) { chHeapInit(&heap1, test.buffer, sizeof(union test_buffers)); @@ -124,7 +124,7 @@ ROMCONST struct testcase testdyn1 = { NULL, dyn1_execute }; -#endif /* CH_USE_HEAP */ +#endif /* (CH_USE_HEAP && !CH_USE_MALLOC_HEAP) */ #if CH_USE_MEMPOOLS || defined(__DOXYGEN__) /** @@ -182,7 +182,8 @@ ROMCONST struct testcase testdyn2 = { }; #endif /* CH_USE_MEMPOOLS */ -#if (CH_USE_HEAP && CH_USE_REGISTRY) || defined(__DOXYGEN__) +#if (CH_USE_HEAP && !CH_USE_MALLOC_HEAP && CH_USE_REGISTRY) || \ + defined(__DOXYGEN__) /** * @page test_dynamic_003 Registry and References test * @@ -252,13 +253,14 @@ ROMCONST struct testcase testdyn3 = { */ ROMCONST struct testcase * ROMCONST patterndyn[] = { #if CH_USE_DYNAMIC || defined(__DOXYGEN__) -#if CH_USE_HEAP || defined(__DOXYGEN__) +#if (CH_USE_HEAP && !CH_USE_MALLOC_HEAP) || defined(__DOXYGEN__) &testdyn1, #endif #if CH_USE_MEMPOOLS || defined(__DOXYGEN__) &testdyn2, #endif -#if (CH_USE_HEAP && CH_USE_REGISTRY) || defined(__DOXYGEN__) +#if (CH_USE_HEAP && !CH_USE_MALLOC_HEAP && CH_USE_REGISTRY) || \ + defined(__DOXYGEN__) &testdyn3, #endif #endif diff --git a/test/testheap.c b/test/testheap.c index bfdcea1e6..6316b56c6 100644 --- a/test/testheap.c +++ b/test/testheap.c @@ -48,7 +48,7 @@ * @brief Heap header file */ -#if CH_USE_HEAP || defined(__DOXYGEN__) +#if (CH_USE_HEAP && !CH_USE_MALLOC_HEAP) || defined(__DOXYGEN__) #define SIZE 16 @@ -156,7 +156,7 @@ ROMCONST struct testcase testheap1 = { * @brief Test sequence for heap. */ ROMCONST struct testcase * ROMCONST patternheap[] = { -#if CH_USE_HEAP || defined(__DOXYGEN__) +#if (CH_USE_HEAP && !CH_USE_MALLOC_HEAP) || defined(__DOXYGEN__) &testheap1, #endif NULL -- cgit v1.2.3 From 3495905f51318549a2bd6764360a4812aac869fa Mon Sep 17 00:00:00 2001 From: gdisirio Date: Thu, 19 May 2011 17:46:52 +0000 Subject: git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@2974 35acf78f-673a-0410-8e92-d51de3d6d3f4 --- test/coverage/chconf.h | 1 - 1 file changed, 1 deletion(-) (limited to 'test') diff --git a/test/coverage/chconf.h b/test/coverage/chconf.h index f1cce630a..cf85ab513 100644 --- a/test/coverage/chconf.h +++ b/test/coverage/chconf.h @@ -278,7 +278,6 @@ * @details If enabled then the I/O queues APIs are included in the kernel. * * @note The default is @p TRUE. - * @note Requires @p CH_USE_SEMAPHORES. */ #if !defined(CH_USE_QUEUES) || defined(__DOXYGEN__) #define CH_USE_QUEUES TRUE -- cgit v1.2.3 From 6b6790350e7861f2a15b308d84bc052681d1d150 Mon Sep 17 00:00:00 2001 From: gdisirio Date: Thu, 19 May 2011 18:54:35 +0000 Subject: git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@2980 35acf78f-673a-0410-8e92-d51de3d6d3f4 --- test/coverage/chconf.h | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'test') diff --git a/test/coverage/chconf.h b/test/coverage/chconf.h index cf85ab513..d063fa93f 100644 --- a/test/coverage/chconf.h +++ b/test/coverage/chconf.h @@ -84,7 +84,7 @@ * * @note In order to let the OS manage the whole RAM the linker script must * provide the @p __heap_base__ and @p __heap_end__ symbols. - * @note Requires @p CH_USE_COREMEM. + * @note Requires @p CH_USE_MEMCORE. */ #if !defined(CH_MEMCORE_SIZE) || defined(__DOXYGEN__) #define CH_MEMCORE_SIZE 0x20000 @@ -300,7 +300,7 @@ * in the kernel. * * @note The default is @p TRUE. - * @note Requires @p CH_USE_COREMEM and either @p CH_USE_MUTEXES or + * @note Requires @p CH_USE_MEMCORE and either @p CH_USE_MUTEXES or * @p CH_USE_SEMAPHORES. * @note Mutexes are recommended. */ @@ -315,7 +315,7 @@ * * @note The default is @p FALSE. * @note Requires @p CH_USE_HEAP. - * @note The C-runtime may or may not require @p CH_USE_COREMEM, see the + * @note The C-runtime may or may not require @p CH_USE_MEMCORE, see the * appropriate documentation. */ #if !defined(CH_USE_MALLOC_HEAP) || defined(__DOXYGEN__) -- cgit v1.2.3 From b9933c2089f5f0cd93738ae9081c45fcf3df54b7 Mon Sep 17 00:00:00 2001 From: gdisirio Date: Thu, 11 Aug 2011 17:51:37 +0000 Subject: Implemented system state checker debug option, remove the option CH_USE_NESTED_LOCKS. Documentation improvements and fixes. git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@3221 35acf78f-673a-0410-8e92-d51de3d6d3f4 --- test/coverage/chconf.h | 61 +++++++++++++++++++++++++++++++++----------------- 1 file changed, 41 insertions(+), 20 deletions(-) (limited to 'test') diff --git a/test/coverage/chconf.h b/test/coverage/chconf.h index d063fa93f..d3bc3b430 100644 --- a/test/coverage/chconf.h +++ b/test/coverage/chconf.h @@ -33,7 +33,10 @@ #define _CHCONF_H_ /*===========================================================================*/ -/* Kernel parameters. */ +/** + * @name Kernel parameters and options + * @{ + */ /*===========================================================================*/ /** @@ -60,21 +63,6 @@ #define CH_TIME_QUANTUM 20 #endif -/** - * @brief Nested locks. - * @details If enabled then the use of nested @p chSysLock() / @p chSysUnlock() - * operations is allowed.
- * For performance and code size reasons the recommended setting - * is to leave this option disabled.
- * You may use this option if you need to merge ChibiOS/RT with - * external libraries that require nested lock/unlock operations. - * - * @note The default is @p FALSE. - */ -#if !defined(CH_USE_NESTED_LOCKS) || defined(__DOXYGEN__) -#define CH_USE_NESTED_LOCKS TRUE -#endif - /** * @brief Managed RAM size. * @details Size of the RAM area to be managed by the OS. If set to zero @@ -107,8 +95,13 @@ #define CH_NO_IDLE_THREAD FALSE #endif +/** @} */ + /*===========================================================================*/ -/* Performance options. */ +/** + * @name Performance options + * @{ + */ /*===========================================================================*/ /** @@ -123,8 +116,13 @@ #define CH_OPTIMIZE_SPEED FALSE #endif +/** @} */ + /*===========================================================================*/ -/* Subsystem options. */ +/** + * @name Subsystem options + * @{ + */ /*===========================================================================*/ /** @@ -346,10 +344,26 @@ #define CH_USE_DYNAMIC TRUE #endif +/** @} */ + /*===========================================================================*/ -/* Debug options. */ +/** + * @name Debug options + * @{ + */ /*===========================================================================*/ +/** + * @brief Debug option, system state check. + * @details If enabled the correct call protocol for system APIs is checked + * at runtime. + * + * @note The default is @p FALSE. + */ +#if !defined(CH_DBG_SYSTEM_STATE_CHECK) || defined(__DOXYGEN__) +#define CH_DBG_SYSTEM_STATE_CHECK FALSE +#endif + /** * @brief Debug option, parameters checks. * @details If enabled then the checks on the API functions input @@ -423,8 +437,13 @@ #define CH_DBG_THREADS_PROFILING TRUE #endif +/** @} */ + /*===========================================================================*/ -/* Kernel hooks. */ +/** + * @name Kernel hooks + * @{ + */ /*===========================================================================*/ /** @@ -495,6 +514,8 @@ } #endif +/** @} */ + /*===========================================================================*/ /* Port-specific settings (override port settings defaulted in chcore.h). */ /*===========================================================================*/ -- cgit v1.2.3 From 43752ee8d132fc57028a9ff15156c5bfcd81c013 Mon Sep 17 00:00:00 2001 From: gdisirio Date: Fri, 12 Aug 2011 11:10:19 +0000 Subject: Extended state check to all kernel I-class and s-class APIs, corrected some test cases where call protocol rules were not strictly observerd. No the whole test suite pass with the state checker enabled. git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@3223 35acf78f-673a-0410-8e92-d51de3d6d3f4 --- test/test.h | 16 ++++++++++++++++ test/testbmk.c | 2 ++ test/testmbox.c | 34 ++++++++++++++++++++++++---------- test/testqueues.c | 52 ++++++++++++++++++++++++++++++++++------------------ test/testsem.c | 2 ++ 5 files changed, 78 insertions(+), 28 deletions(-) (limited to 'test') diff --git a/test/test.h b/test/test.h index 31806fddb..b1fd311e6 100644 --- a/test/test.h +++ b/test/test.h @@ -126,6 +126,22 @@ extern "C" { return; \ } +/** + * @brief Test assertion with lock. + * + * @param[in] point numeric assertion identifier + * @param[in] condition a boolean expression that must be verified to be true + * @param[in] msg failure message + */ +#define test_assert_lock(point, condition, msg) { \ + chSysLock(); \ + if (_test_assert(point, condition)) { \ + chSysUnlock(); \ + return; \ + } \ + chSysUnlock(); \ +} + /** * @brief Test sequence assertion. * diff --git a/test/testbmk.c b/test/testbmk.c index 54da81fd8..4958ddf8b 100644 --- a/test/testbmk.c +++ b/test/testbmk.c @@ -465,10 +465,12 @@ static void bmk9_execute(void) { test_wait_tick(); test_start_timer(1000); do { + chSysLock(); chIQPutI(&iq, 0); chIQPutI(&iq, 1); chIQPutI(&iq, 2); chIQPutI(&iq, 3); + chSysUnlock(); (void)chIQGet(&iq); (void)chIQGet(&iq); (void)chIQGet(&iq); diff --git a/test/testmbox.c b/test/testmbox.c index 8797536c6..86b9febb4 100644 --- a/test/testmbox.c +++ b/test/testmbox.c @@ -101,19 +101,23 @@ static void mbox1_execute(void) { */ msg1 = chMBPost(&mb1, 'X', 1); test_assert(4, msg1 == RDY_TIMEOUT, "wrong wake-up message"); + chSysLock(); msg1 = chMBPostI(&mb1, 'X'); + chSysUnlock(); test_assert(5, msg1 == RDY_TIMEOUT, "wrong wake-up message"); msg1 = chMBPostAhead(&mb1, 'X', 1); test_assert(6, msg1 == RDY_TIMEOUT, "wrong wake-up message"); + chSysLock(); msg1 = chMBPostAheadI(&mb1, 'X'); + chSysUnlock(); test_assert(7, msg1 == RDY_TIMEOUT, "wrong wake-up message"); /* * Testing final conditions. */ - test_assert(8, chMBGetFreeCountI(&mb1) == 0, "still empty"); - test_assert(9, chMBGetUsedCountI(&mb1) == MB_SIZE, "not full"); - test_assert(10, mb1.mb_rdptr == mb1.mb_wrptr, "pointers not aligned"); + 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"); /* * Testing dequeuing. @@ -140,19 +144,22 @@ static void mbox1_execute(void) { */ msg1 = chMBFetch(&mb1, &msg2, 1); test_assert(17, msg1 == RDY_TIMEOUT, "wrong wake-up message"); + chSysLock(); msg1 = chMBFetchI(&mb1, &msg2); + chSysUnlock(); test_assert(18, msg1 == RDY_TIMEOUT, "wrong wake-up message"); /* * Testing final conditions. */ - test_assert(19, chMBGetFreeCountI(&mb1) == MB_SIZE, "not empty"); - test_assert(20, chMBGetUsedCountI(&mb1) == 0, "still full"); - test_assert(21, mb1.mb_rdptr == mb1.mb_wrptr, "pointers not aligned"); + 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"); /* * Testing I-Class. */ + chSysLock() msg1 = chMBPostI(&mb1, 'A'); test_assert(22, msg1 == RDY_OK, "wrong wake-up message"); msg1 = chMBPostI(&mb1, 'B'); @@ -162,16 +169,20 @@ static void mbox1_execute(void) { msg1 = chMBPostI(&mb1, 'D'); test_assert(25, msg1 == RDY_OK, "wrong wake-up message"); msg1 = chMBPostI(&mb1, 'E'); + chSysUnlock() test_assert(26, msg1 == RDY_OK, "wrong wake-up message"); test_assert(27, mb1.mb_rdptr == mb1.mb_wrptr, "pointers not aligned"); for (i = 0; i < MB_SIZE; i++) { + chSysLock(); msg1 = chMBFetchI(&mb1, &msg2); + chSysUnlock(); test_assert(28, msg1 == RDY_OK, "wrong wake-up message"); test_emit_token(msg2); } test_assert_sequence(29, "ABCDE"); test_assert(30, mb1.mb_rdptr == mb1.mb_wrptr, "pointers not aligned"); + chSysLock(); msg1 = chMBPostAheadI(&mb1, 'E'); test_assert(31, msg1 == RDY_OK, "wrong wake-up message"); msg1 = chMBPostAheadI(&mb1, 'D'); @@ -181,10 +192,13 @@ static void mbox1_execute(void) { msg1 = chMBPostAheadI(&mb1, 'B'); test_assert(34, msg1 == RDY_OK, "wrong wake-up message"); msg1 = chMBPostAheadI(&mb1, 'A'); + chSysUnlock(); test_assert(35, msg1 == RDY_OK, "wrong wake-up message"); test_assert(36, mb1.mb_rdptr == mb1.mb_wrptr, "pointers not aligned"); for (i = 0; i < MB_SIZE; i++) { + chSysLock(); msg1 = chMBFetchI(&mb1, &msg2); + chSysUnlock(); test_assert(37, msg1 == RDY_OK, "wrong wake-up message"); test_emit_token(msg2); } @@ -199,10 +213,10 @@ static void mbox1_execute(void) { /* * Re-testing final conditions. */ - test_assert(40, chMBGetFreeCountI(&mb1) == MB_SIZE, "not empty"); - test_assert(41, chMBGetUsedCountI(&mb1) == 0, "still full"); - test_assert(42, mb1.mb_buffer == mb1.mb_wrptr, "write pointer not aligned to base"); - test_assert(43, mb1.mb_buffer == mb1.mb_rdptr, "read pointer not aligned to base"); + test_assert_lock(40, chMBGetFreeCountI(&mb1) == MB_SIZE, "not empty"); + test_assert_lock(41, chMBGetUsedCountI(&mb1) == 0, "still full"); + test_assert_lock(42, mb1.mb_buffer == mb1.mb_wrptr, "write pointer not aligned to base"); + test_assert_lock(43, mb1.mb_buffer == mb1.mb_rdptr, "read pointer not aligned to base"); } ROMCONST struct testcase testmbox1 = { diff --git a/test/testqueues.c b/test/testqueues.c index 55945761d..456598fa4 100644 --- a/test/testqueues.c +++ b/test/testqueues.c @@ -96,46 +96,54 @@ static void queues1_execute(void) { size_t n; /* Initial empty state */ - test_assert(1, chIQIsEmptyI(&iq), "not empty"); + test_assert_lock(1, chIQIsEmptyI(&iq), "not empty"); /* Queue filling */ + chSysLock(); for (i = 0; i < TEST_QUEUES_SIZE; i++) chIQPutI(&iq, 'A' + i); - test_assert(2, chIQIsFullI(&iq), "still has space"); - test_assert(3, chIQPutI(&iq, 0) == Q_FULL, "failed to report Q_FULL"); + chSysUnlock(); + test_assert_lock(2, chIQIsFullI(&iq), "still has space"); + test_assert_lock(3, chIQPutI(&iq, 0) == Q_FULL, "failed to report Q_FULL"); /* Queue emptying */ for (i = 0; i < TEST_QUEUES_SIZE; i++) test_emit_token(chIQGet(&iq)); - test_assert(4, chIQIsEmptyI(&iq), "still full"); + test_assert_lock(4, chIQIsEmptyI(&iq), "still full"); test_assert_sequence(5, "ABCD"); /* Queue filling again */ + chSysLock(); for (i = 0; i < TEST_QUEUES_SIZE; i++) chIQPutI(&iq, 'A' + i); + chSysUnlock(); /* Reading the whole thing */ n = chIQReadTimeout(&iq, wa[1], TEST_QUEUES_SIZE * 2, TIME_IMMEDIATE); test_assert(6, n == TEST_QUEUES_SIZE, "wrong returned size"); - test_assert(7, chIQIsEmptyI(&iq), "still full"); + test_assert_lock(7, chIQIsEmptyI(&iq), "still full"); /* Queue filling again */ + chSysLock(); for (i = 0; i < TEST_QUEUES_SIZE; i++) chIQPutI(&iq, 'A' + i); + chSysUnlock(); /* Partial reads */ n = chIQReadTimeout(&iq, wa[1], TEST_QUEUES_SIZE / 2, TIME_IMMEDIATE); test_assert(8, n == TEST_QUEUES_SIZE / 2, "wrong returned size"); n = chIQReadTimeout(&iq, wa[1], TEST_QUEUES_SIZE / 2, TIME_IMMEDIATE); test_assert(9, n == TEST_QUEUES_SIZE / 2, "wrong returned size"); - test_assert(10, chIQIsEmptyI(&iq), "still full"); + test_assert_lock(10, chIQIsEmptyI(&iq), "still full"); /* Testing reset */ + chSysLock(); chIQPutI(&iq, 0); chIQResetI(&iq); - test_assert(11, chIQGetFullI(&iq) == 0, "still full"); + chSysUnlock(); + test_assert_lock(11, chIQGetFullI(&iq) == 0, "still full"); threads[0] = chThdCreateStatic(wa[0], WA_SIZE, chThdGetPriority()+1, thread1, NULL); - test_assert(12, chIQGetFullI(&iq) == 0, "not empty"); + test_assert_lock(12, chIQGetFullI(&iq) == 0, "not empty"); test_wait_threads(); /* Timeout */ @@ -175,38 +183,46 @@ static void queues2_execute(void) { size_t n; /* Initial empty state */ - test_assert(1, chOQIsEmptyI(&oq), "not empty"); + test_assert_lock(1, chOQIsEmptyI(&oq), "not empty"); /* Queue filling */ for (i = 0; i < TEST_QUEUES_SIZE; i++) chOQPut(&oq, 'A' + i); - test_assert(2, chOQIsFullI(&oq), "still has space"); + test_assert_lock(2, chOQIsFullI(&oq), "still has space"); /* Queue emptying */ - for (i = 0; i < TEST_QUEUES_SIZE; i++) - test_emit_token(chOQGetI(&oq)); - test_assert(3, chOQIsEmptyI(&oq), "still full"); + for (i = 0; i < TEST_QUEUES_SIZE; i++) { + char c; + + chSysLock(); + c = chOQGetI(&oq); + chSysUnlock(); + test_emit_token(c); + } + test_assert_lock(3, chOQIsEmptyI(&oq), "still full"); test_assert_sequence(4, "ABCD"); - test_assert(5, chOQGetI(&oq) == Q_EMPTY, "failed to report Q_EMPTY"); + test_assert_lock(5, chOQGetI(&oq) == Q_EMPTY, "failed to report Q_EMPTY"); /* Writing the whole thing */ n = chOQWriteTimeout(&oq, wa[1], TEST_QUEUES_SIZE * 2, TIME_IMMEDIATE); test_assert(6, n == TEST_QUEUES_SIZE, "wrong returned size"); - test_assert(7, chOQIsFullI(&oq), "not full"); + test_assert_lock(7, chOQIsFullI(&oq), "not full"); threads[0] = chThdCreateStatic(wa[0], WA_SIZE, chThdGetPriority()+1, thread2, NULL); - test_assert(8, chOQGetFullI(&oq) == TEST_QUEUES_SIZE, "not empty"); + test_assert_lock(8, chOQGetFullI(&oq) == TEST_QUEUES_SIZE, "not empty"); test_wait_threads(); /* Testing reset */ + chSysLock(); chOQResetI(&oq); - test_assert(9, chOQGetFullI(&oq) == 0, "still full"); + chSysUnlock(); + test_assert_lock(9, chOQGetFullI(&oq) == 0, "still full"); /* Partial writes */ n = chOQWriteTimeout(&oq, wa[1], TEST_QUEUES_SIZE / 2, TIME_IMMEDIATE); test_assert(10, n == TEST_QUEUES_SIZE / 2, "wrong returned size"); n = chOQWriteTimeout(&oq, wa[1], TEST_QUEUES_SIZE / 2, TIME_IMMEDIATE); test_assert(11, n == TEST_QUEUES_SIZE / 2, "wrong returned size"); - test_assert(12, chOQIsFullI(&oq), "not full"); + test_assert_lock(12, chOQIsFullI(&oq), "not full"); /* Timeout */ test_assert(13, chOQPutTimeout(&oq, 0, 10) == Q_TIMEOUT, "wrong timeout return"); diff --git a/test/testsem.c b/test/testsem.c index 6a6a622ef..d5c9072a7 100644 --- a/test/testsem.c +++ b/test/testsem.c @@ -104,7 +104,9 @@ static void sem1_execute(void) { test_assert_sequence(1, "ABCDE"); #endif threads[0] = chThdCreateStatic(wa[0], WA_SIZE, chThdGetPriority()+5, thread1, "A"); + chSysLock(); chSemAddCounterI(&sem1, 2); + chSysUnlock(); test_wait_threads(); test_assert(2, chSemGetCounterI(&sem1) == 1, "invalid counter"); } -- cgit v1.2.3 From 5cee2c08d787d1b14c62d5595b72644a773fe443 Mon Sep 17 00:00:00 2001 From: gdisirio Date: Sat, 13 Aug 2011 15:40:57 +0000 Subject: git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@3226 35acf78f-673a-0410-8e92-d51de3d6d3f4 --- test/coverage/chconf.h | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'test') diff --git a/test/coverage/chconf.h b/test/coverage/chconf.h index d3bc3b430..0859452de 100644 --- a/test/coverage/chconf.h +++ b/test/coverage/chconf.h @@ -482,6 +482,16 @@ } #endif +/** + * @brief Context switch hook. + * @details This hook is invoked just before switching between threads. + */ +#if !defined(THREAD_CONTEXT_SWITCH_HOOK) || defined(__DOXYGEN__) +#define THREAD_CONTEXT_SWITCH_HOOK(ntp, otp) { \ + /* System halt code here.*/ \ +} +#endif + /** * @brief Idle Loop hook. * @details This hook is continuously invoked by the idle thread loop. @@ -503,6 +513,7 @@ } #endif + /** * @brief System halt hook. * @details This hook is invoked in case to a system halting error before -- cgit v1.2.3 From bc571ccd326886a8cbbde85de66b6fab91336193 Mon Sep 17 00:00:00 2001 From: gdisirio Date: Mon, 12 Sep 2011 19:15:30 +0000 Subject: git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@3312 35acf78f-673a-0410-8e92-d51de3d6d3f4 --- test/coverage/halconf.h | 22 ++++++++++++++-------- 1 file changed, 14 insertions(+), 8 deletions(-) (limited to 'test') diff --git a/test/coverage/halconf.h b/test/coverage/halconf.h index 2829fb066..99f45746f 100644 --- a/test/coverage/halconf.h +++ b/test/coverage/halconf.h @@ -55,6 +55,13 @@ #define HAL_USE_CAN FALSE #endif +/** + * @brief Enables the EXT subsystem. + */ +#if !defined(HAL_USE_EXT) || defined(__DOXYGEN__) +#define HAL_USE_EXT FALSE +#endif + /** * @brief Enables the GPT subsystem. */ @@ -185,6 +192,13 @@ /* MAC driver related settings. */ /*===========================================================================*/ +/** + * @brief Enables an event sources for incoming packets. + */ +#if !defined(MAC_USE_EVENTS) || defined(__DOXYGEN__) +#define MAC_USE_EVENTS TRUE +#endif + /*===========================================================================*/ /* MMC_SPI driver related settings. */ /*===========================================================================*/ @@ -234,14 +248,6 @@ #define MMC_USE_SPI_POLLING TRUE #endif -/*===========================================================================*/ -/* PAL driver related settings. */ -/*===========================================================================*/ - -/*===========================================================================*/ -/* PWM driver related settings. */ -/*===========================================================================*/ - /*===========================================================================*/ /* SDC driver related settings. */ /*===========================================================================*/ -- cgit v1.2.3 From b86e5efeeb17af6937319d0fd874fc64b0c1ccb4 Mon Sep 17 00:00:00 2001 From: gdisirio Date: Mon, 12 Sep 2011 19:27:05 +0000 Subject: git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@3313 35acf78f-673a-0410-8e92-d51de3d6d3f4 --- test/coverage/halconf.h | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) (limited to 'test') diff --git a/test/coverage/halconf.h b/test/coverage/halconf.h index 99f45746f..95b25b63e 100644 --- a/test/coverage/halconf.h +++ b/test/coverage/halconf.h @@ -251,6 +251,7 @@ /*===========================================================================*/ /* SDC driver related settings. */ /*===========================================================================*/ + /** * @brief Number of initialization attempts before rejecting the card. * @note Attempts are performed at 10mS intevals. @@ -322,10 +323,6 @@ #define SPI_USE_MUTUAL_EXCLUSION TRUE #endif -/*===========================================================================*/ -/* UART driver related settings. */ -/*===========================================================================*/ - #endif /* _HALCONF_H_ */ /** @} */ -- cgit v1.2.3 From ae42ff1857ee56d67feca50d379c5f4b66d7fe69 Mon Sep 17 00:00:00 2001 From: gdisirio Date: Wed, 21 Sep 2011 17:10:15 +0000 Subject: git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@3377 35acf78f-673a-0410-8e92-d51de3d6d3f4 --- test/test.dox | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'test') diff --git a/test/test.dox b/test/test.dox index 296e2145e..ab937f9a2 100644 --- a/test/test.dox +++ b/test/test.dox @@ -52,9 +52,9 @@ * the tests. Speed and size benchmarks for all the supported architectures * are performed, both size and speed regressions are monitored. * - HAL. The HAL high level code and device drivers implementations - * are tested by use in the various demos and/or by users. + * are tested through specific test applications under ./testhal. * - Various. The miscellaneous code is tested by use in the various - * demos and/or by users. + * demos. * - External Code. Not tested, external libraries or components are * used as-is or with minor patching where required, problems are usually * reported upstream. @@ -65,7 +65,7 @@ * subsystems and can report a failure/success status and/or a performance * index as the test suite output.
* The test suite is usually activated in the demo applications by pressing a - * button on the target board, see the readme into the various demos + * button on the target board, see the readme file into the various demos * directories. The test suite output is usually sent through a serial port * and can be examined by using a terminal emulator program. * -- cgit v1.2.3 From c39d08fc2ae9c43f73114e24292520306bddde19 Mon Sep 17 00:00:00 2001 From: gdisirio Date: Fri, 23 Sep 2011 15:48:55 +0000 Subject: git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@3384 35acf78f-673a-0410-8e92-d51de3d6d3f4 --- test/test.c | 2 ++ test/test.dox | 4 ++-- 2 files changed, 4 insertions(+), 2 deletions(-) (limited to 'test') diff --git a/test/test.c b/test/test.c index 41662308c..74069415c 100644 --- a/test/test.c +++ b/test/test.c @@ -328,6 +328,8 @@ msg_t TestThread(void *p) { test_println("***"); test_print("*** Kernel: "); test_println(CH_KERNEL_VERSION); + test_print("*** Compiled: "); + test_println(__DATE__ " - " __TIME__); #ifdef CH_COMPILER_NAME test_print("*** Compiler: "); test_println(CH_COMPILER_NAME); diff --git a/test/test.dox b/test/test.dox index ab937f9a2..114b2af85 100644 --- a/test/test.dox +++ b/test/test.dox @@ -46,13 +46,13 @@ * for this execution test, it is done automatically by a script because * the entire sequence can take hours).
* All the tests results are included as reports in the OS distribution - * under @p ./docs/reports. + * under ./docs/reports. * - Ports. The port code is tested by executing the kernel test * suite on the target hardware. A port is validated only if it passes all * the tests. Speed and size benchmarks for all the supported architectures * are performed, both size and speed regressions are monitored. * - HAL. The HAL high level code and device drivers implementations - * are tested through specific test applications under ./testhal. + * are tested through specific test applications under ./testhal. * - Various. The miscellaneous code is tested by use in the various * demos. * - External Code. Not tested, external libraries or components are -- cgit v1.2.3 From eea23b22826e76dba443a12c651d5490a0314471 Mon Sep 17 00:00:00 2001 From: gdisirio Date: Sat, 8 Oct 2011 16:56:03 +0000 Subject: git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@3439 35acf78f-673a-0410-8e92-d51de3d6d3f4 --- test/coverage/halconf.h | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'test') diff --git a/test/coverage/halconf.h b/test/coverage/halconf.h index 95b25b63e..50f223ef8 100644 --- a/test/coverage/halconf.h +++ b/test/coverage/halconf.h @@ -104,6 +104,13 @@ #define HAL_USE_PWM FALSE #endif +/** + * @brief Enables the RTC subsystem. + */ +#if !defined(HAL_USE_RTC) || defined(__DOXYGEN__) +#define HAL_USE_RTC FALSE +#endif + /** * @brief Enables the SDC subsystem. */ -- cgit v1.2.3 From c56e9ea70a9a8e79f00fb70fb4278b9bd7bf3ae7 Mon Sep 17 00:00:00 2001 From: gdisirio Date: Fri, 6 Jan 2012 09:20:21 +0000 Subject: Removed instances of // git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@3746 35acf78f-673a-0410-8e92-d51de3d6d3f4 --- test/testmtx.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) (limited to 'test') diff --git a/test/testmtx.c b/test/testmtx.c index 08329a33b..599ed4539 100644 --- a/test/testmtx.c +++ b/test/testmtx.c @@ -100,7 +100,7 @@ static msg_t thread1(void *p) { static void mtx1_execute(void) { - tprio_t prio = chThdGetPriority(); // Because priority inheritance. + tprio_t prio = chThdGetPriority(); /* Because priority inheritance.*/ chMtxLock(&m1); threads[0] = chThdCreateStatic(wa[0], WA_SIZE, prio+1, thread1, "E"); threads[1] = chThdCreateStatic(wa[1], WA_SIZE, prio+2, thread1, "D"); @@ -244,8 +244,8 @@ ROMCONST struct testcase testmtx2 = { static void mtx3_setup(void) { - chMtxInit(&m1); // Mutex B - chMtxInit(&m2); // Mutex A + chMtxInit(&m1); /* Mutex B.*/ + chMtxInit(&m2); /* Mutex A.*/ } /* Lowest priority thread */ @@ -539,7 +539,6 @@ static void mtx7_setup(void) { static void mtx7_execute(void) { - // Bacause priority inheritance. tprio_t prio = chThdGetPriority(); threads[0] = chThdCreateStatic(wa[0], WA_SIZE, prio+1, thread10, "E"); threads[1] = chThdCreateStatic(wa[1], WA_SIZE, prio+2, thread10, "D"); -- cgit v1.2.3 From a2708c091beb3331967dff2af9a9232744427de4 Mon Sep 17 00:00:00 2001 From: gdisirio Date: Mon, 9 Jan 2012 19:37:58 +0000 Subject: Updated all halconf.h files. git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@3777 35acf78f-673a-0410-8e92-d51de3d6d3f4 --- test/coverage/halconf.h | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'test') diff --git a/test/coverage/halconf.h b/test/coverage/halconf.h index 50f223ef8..3e3e20244 100644 --- a/test/coverage/halconf.h +++ b/test/coverage/halconf.h @@ -34,6 +34,13 @@ /*#include "mcuconf.h"*/ +/** + * @brief Enables the TM subsystem. + */ +#if !defined(HAL_USE_TM) || defined(__DOXYGEN__) +#define HAL_USE_TM TRUE +#endif + /** * @brief Enables the PAL subsystem. */ -- cgit v1.2.3 From de5dcbba856524599a8f06d3a9bdbf1b01db44c2 Mon Sep 17 00:00:00 2001 From: gdisirio Date: Sat, 21 Jan 2012 14:29:42 +0000 Subject: License text updated with new year. git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@3846 35acf78f-673a-0410-8e92-d51de3d6d3f4 --- test/coverage/chconf.h | 2 +- test/coverage/halconf.h | 2 +- test/coverage/main.c | 2 +- test/test.c | 2 +- test/test.dox | 2 +- test/test.h | 2 +- test/testbmk.c | 2 +- test/testbmk.h | 2 +- test/testdyn.c | 2 +- test/testdyn.h | 2 +- test/testevt.c | 2 +- test/testevt.h | 2 +- test/testheap.c | 2 +- test/testheap.h | 2 +- test/testmbox.c | 2 +- test/testmbox.h | 2 +- test/testmsg.c | 2 +- test/testmsg.h | 2 +- test/testmtx.c | 2 +- test/testmtx.h | 2 +- test/testpools.c | 2 +- test/testpools.h | 2 +- test/testqueues.c | 2 +- test/testqueues.h | 2 +- test/testsem.c | 2 +- test/testsem.h | 2 +- test/testthd.c | 2 +- test/testthd.h | 2 +- 28 files changed, 28 insertions(+), 28 deletions(-) (limited to 'test') diff --git a/test/coverage/chconf.h b/test/coverage/chconf.h index 0859452de..5ed2886f1 100644 --- a/test/coverage/chconf.h +++ b/test/coverage/chconf.h @@ -1,6 +1,6 @@ /* ChibiOS/RT - Copyright (C) 2006,2007,2008,2009,2010, - 2011 Giovanni Di Sirio. + 2011,2012 Giovanni Di Sirio. This file is part of ChibiOS/RT. diff --git a/test/coverage/halconf.h b/test/coverage/halconf.h index 3e3e20244..def32cb3d 100644 --- a/test/coverage/halconf.h +++ b/test/coverage/halconf.h @@ -1,6 +1,6 @@ /* ChibiOS/RT - Copyright (C) 2006,2007,2008,2009,2010, - 2011 Giovanni Di Sirio. + 2011,2012 Giovanni Di Sirio. This file is part of ChibiOS/RT. diff --git a/test/coverage/main.c b/test/coverage/main.c index a2df0a409..4d8249483 100644 --- a/test/coverage/main.c +++ b/test/coverage/main.c @@ -1,6 +1,6 @@ /* ChibiOS/RT - Copyright (C) 2006,2007,2008,2009,2010, - 2011 Giovanni Di Sirio. + 2011,2012 Giovanni Di Sirio. This file is part of ChibiOS/RT. diff --git a/test/test.c b/test/test.c index 74069415c..bce0b5788 100644 --- a/test/test.c +++ b/test/test.c @@ -1,6 +1,6 @@ /* ChibiOS/RT - Copyright (C) 2006,2007,2008,2009,2010, - 2011 Giovanni Di Sirio. + 2011,2012 Giovanni Di Sirio. This file is part of ChibiOS/RT. diff --git a/test/test.dox b/test/test.dox index 114b2af85..9474d5386 100644 --- a/test/test.dox +++ b/test/test.dox @@ -1,6 +1,6 @@ /* ChibiOS/RT - Copyright (C) 2006,2007,2008,2009,2010, - 2011 Giovanni Di Sirio. + 2011,2012 Giovanni Di Sirio. This file is part of ChibiOS/RT. diff --git a/test/test.h b/test/test.h index b1fd311e6..f4d8e1086 100644 --- a/test/test.h +++ b/test/test.h @@ -1,6 +1,6 @@ /* ChibiOS/RT - Copyright (C) 2006,2007,2008,2009,2010, - 2011 Giovanni Di Sirio. + 2011,2012 Giovanni Di Sirio. This file is part of ChibiOS/RT. diff --git a/test/testbmk.c b/test/testbmk.c index 4958ddf8b..b8031f190 100644 --- a/test/testbmk.c +++ b/test/testbmk.c @@ -1,6 +1,6 @@ /* ChibiOS/RT - Copyright (C) 2006,2007,2008,2009,2010, - 2011 Giovanni Di Sirio. + 2011,2012 Giovanni Di Sirio. This file is part of ChibiOS/RT. diff --git a/test/testbmk.h b/test/testbmk.h index 43d4f2a22..6e8c4d1ba 100644 --- a/test/testbmk.h +++ b/test/testbmk.h @@ -1,6 +1,6 @@ /* ChibiOS/RT - Copyright (C) 2006,2007,2008,2009,2010, - 2011 Giovanni Di Sirio. + 2011,2012 Giovanni Di Sirio. This file is part of ChibiOS/RT. diff --git a/test/testdyn.c b/test/testdyn.c index d015e2ac6..5edbc0b63 100644 --- a/test/testdyn.c +++ b/test/testdyn.c @@ -1,6 +1,6 @@ /* ChibiOS/RT - Copyright (C) 2006,2007,2008,2009,2010, - 2011 Giovanni Di Sirio. + 2011,2012 Giovanni Di Sirio. This file is part of ChibiOS/RT. diff --git a/test/testdyn.h b/test/testdyn.h index 366202d62..e373df3ba 100644 --- a/test/testdyn.h +++ b/test/testdyn.h @@ -1,6 +1,6 @@ /* ChibiOS/RT - Copyright (C) 2006,2007,2008,2009,2010, - 2011 Giovanni Di Sirio. + 2011,2012 Giovanni Di Sirio. This file is part of ChibiOS/RT. diff --git a/test/testevt.c b/test/testevt.c index 4bdeb8fc9..00a1f3fed 100644 --- a/test/testevt.c +++ b/test/testevt.c @@ -1,6 +1,6 @@ /* ChibiOS/RT - Copyright (C) 2006,2007,2008,2009,2010, - 2011 Giovanni Di Sirio. + 2011,2012 Giovanni Di Sirio. This file is part of ChibiOS/RT. diff --git a/test/testevt.h b/test/testevt.h index 810257608..ca05c79c3 100644 --- a/test/testevt.h +++ b/test/testevt.h @@ -1,6 +1,6 @@ /* ChibiOS/RT - Copyright (C) 2006,2007,2008,2009,2010, - 2011 Giovanni Di Sirio. + 2011,2012 Giovanni Di Sirio. This file is part of ChibiOS/RT. diff --git a/test/testheap.c b/test/testheap.c index 6316b56c6..8d849257a 100644 --- a/test/testheap.c +++ b/test/testheap.c @@ -1,6 +1,6 @@ /* ChibiOS/RT - Copyright (C) 2006,2007,2008,2009,2010, - 2011 Giovanni Di Sirio. + 2011,2012 Giovanni Di Sirio. This file is part of ChibiOS/RT. diff --git a/test/testheap.h b/test/testheap.h index 4515f8846..4e027aeaa 100644 --- a/test/testheap.h +++ b/test/testheap.h @@ -1,6 +1,6 @@ /* ChibiOS/RT - Copyright (C) 2006,2007,2008,2009,2010, - 2011 Giovanni Di Sirio. + 2011,2012 Giovanni Di Sirio. This file is part of ChibiOS/RT. diff --git a/test/testmbox.c b/test/testmbox.c index 86b9febb4..5271752d2 100644 --- a/test/testmbox.c +++ b/test/testmbox.c @@ -1,6 +1,6 @@ /* ChibiOS/RT - Copyright (C) 2006,2007,2008,2009,2010, - 2011 Giovanni Di Sirio. + 2011,2012 Giovanni Di Sirio. This file is part of ChibiOS/RT. diff --git a/test/testmbox.h b/test/testmbox.h index c57a52495..e0693e8c6 100644 --- a/test/testmbox.h +++ b/test/testmbox.h @@ -1,6 +1,6 @@ /* ChibiOS/RT - Copyright (C) 2006,2007,2008,2009,2010, - 2011 Giovanni Di Sirio. + 2011,2012 Giovanni Di Sirio. This file is part of ChibiOS/RT. diff --git a/test/testmsg.c b/test/testmsg.c index 54c049d44..b04da4224 100644 --- a/test/testmsg.c +++ b/test/testmsg.c @@ -1,6 +1,6 @@ /* ChibiOS/RT - Copyright (C) 2006,2007,2008,2009,2010, - 2011 Giovanni Di Sirio. + 2011,2012 Giovanni Di Sirio. This file is part of ChibiOS/RT. diff --git a/test/testmsg.h b/test/testmsg.h index 7193156bd..b28b53354 100644 --- a/test/testmsg.h +++ b/test/testmsg.h @@ -1,6 +1,6 @@ /* ChibiOS/RT - Copyright (C) 2006,2007,2008,2009,2010, - 2011 Giovanni Di Sirio. + 2011,2012 Giovanni Di Sirio. This file is part of ChibiOS/RT. diff --git a/test/testmtx.c b/test/testmtx.c index 599ed4539..07605922c 100644 --- a/test/testmtx.c +++ b/test/testmtx.c @@ -1,6 +1,6 @@ /* ChibiOS/RT - Copyright (C) 2006,2007,2008,2009,2010, - 2011 Giovanni Di Sirio. + 2011,2012 Giovanni Di Sirio. This file is part of ChibiOS/RT. diff --git a/test/testmtx.h b/test/testmtx.h index 3bfaba78f..56e380a94 100644 --- a/test/testmtx.h +++ b/test/testmtx.h @@ -1,6 +1,6 @@ /* ChibiOS/RT - Copyright (C) 2006,2007,2008,2009,2010, - 2011 Giovanni Di Sirio. + 2011,2012 Giovanni Di Sirio. This file is part of ChibiOS/RT. diff --git a/test/testpools.c b/test/testpools.c index afdd37018..1c864d973 100644 --- a/test/testpools.c +++ b/test/testpools.c @@ -1,6 +1,6 @@ /* ChibiOS/RT - Copyright (C) 2006,2007,2008,2009,2010, - 2011 Giovanni Di Sirio. + 2011,2012 Giovanni Di Sirio. This file is part of ChibiOS/RT. diff --git a/test/testpools.h b/test/testpools.h index a11ef4de7..2cfa8e370 100644 --- a/test/testpools.h +++ b/test/testpools.h @@ -1,6 +1,6 @@ /* ChibiOS/RT - Copyright (C) 2006,2007,2008,2009,2010, - 2011 Giovanni Di Sirio. + 2011,2012 Giovanni Di Sirio. This file is part of ChibiOS/RT. diff --git a/test/testqueues.c b/test/testqueues.c index 456598fa4..86cb2e1e5 100644 --- a/test/testqueues.c +++ b/test/testqueues.c @@ -1,6 +1,6 @@ /* ChibiOS/RT - Copyright (C) 2006,2007,2008,2009,2010, - 2011 Giovanni Di Sirio. + 2011,2012 Giovanni Di Sirio. This file is part of ChibiOS/RT. diff --git a/test/testqueues.h b/test/testqueues.h index ff9b6a618..ae2a39b28 100644 --- a/test/testqueues.h +++ b/test/testqueues.h @@ -1,6 +1,6 @@ /* ChibiOS/RT - Copyright (C) 2006,2007,2008,2009,2010, - 2011 Giovanni Di Sirio. + 2011,2012 Giovanni Di Sirio. This file is part of ChibiOS/RT. diff --git a/test/testsem.c b/test/testsem.c index d5c9072a7..88f28791c 100644 --- a/test/testsem.c +++ b/test/testsem.c @@ -1,6 +1,6 @@ /* ChibiOS/RT - Copyright (C) 2006,2007,2008,2009,2010, - 2011 Giovanni Di Sirio. + 2011,2012 Giovanni Di Sirio. This file is part of ChibiOS/RT. diff --git a/test/testsem.h b/test/testsem.h index 032c75436..664e2ba77 100644 --- a/test/testsem.h +++ b/test/testsem.h @@ -1,6 +1,6 @@ /* ChibiOS/RT - Copyright (C) 2006,2007,2008,2009,2010, - 2011 Giovanni Di Sirio. + 2011,2012 Giovanni Di Sirio. This file is part of ChibiOS/RT. diff --git a/test/testthd.c b/test/testthd.c index 3433d2eb4..ac3fe5dd6 100644 --- a/test/testthd.c +++ b/test/testthd.c @@ -1,6 +1,6 @@ /* ChibiOS/RT - Copyright (C) 2006,2007,2008,2009,2010, - 2011 Giovanni Di Sirio. + 2011,2012 Giovanni Di Sirio. This file is part of ChibiOS/RT. diff --git a/test/testthd.h b/test/testthd.h index 5435cc02d..7ab6f4c72 100644 --- a/test/testthd.h +++ b/test/testthd.h @@ -1,6 +1,6 @@ /* ChibiOS/RT - Copyright (C) 2006,2007,2008,2009,2010, - 2011 Giovanni Di Sirio. + 2011,2012 Giovanni Di Sirio. This file is part of ChibiOS/RT. -- cgit v1.2.3 From aaa6634772fd7b39c87f32b9f4035372cbaf6952 Mon Sep 17 00:00:00 2001 From: gdisirio Date: Thu, 26 Jan 2012 09:17:52 +0000 Subject: git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@3879 35acf78f-673a-0410-8e92-d51de3d6d3f4 --- test/coverage/chconf.h | 2 +- test/coverage/halconf.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) (limited to 'test') diff --git a/test/coverage/chconf.h b/test/coverage/chconf.h index 5ed2886f1..d514e822d 100644 --- a/test/coverage/chconf.h +++ b/test/coverage/chconf.h @@ -409,7 +409,7 @@ * @p panic_msg variable set to @p NULL. */ #if !defined(CH_DBG_ENABLE_STACK_CHECK) || defined(__DOXYGEN__) -#define CH_DBG_ENABLE_STACK_CHECK TRUE +#define CH_DBG_ENABLE_STACK_CHECK FALSE #endif /** diff --git a/test/coverage/halconf.h b/test/coverage/halconf.h index def32cb3d..5b49950cd 100644 --- a/test/coverage/halconf.h +++ b/test/coverage/halconf.h @@ -38,7 +38,7 @@ * @brief Enables the TM subsystem. */ #if !defined(HAL_USE_TM) || defined(__DOXYGEN__) -#define HAL_USE_TM TRUE +#define HAL_USE_TM FALSE #endif /** -- cgit v1.2.3 From 18b8b495244411bb33254ea0d8b868259077be7d Mon Sep 17 00:00:00 2001 From: gdisirio Date: Wed, 8 Feb 2012 17:53:52 +0000 Subject: git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@3946 35acf78f-673a-0410-8e92-d51de3d6d3f4 --- test/test.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) (limited to 'test') diff --git a/test/test.c b/test/test.c index bce0b5788..55cfdf445 100644 --- a/test/test.c +++ b/test/test.c @@ -278,9 +278,7 @@ void test_start_timer(unsigned ms) { systime_t duration = MS2ST(ms); test_timer_done = FALSE; - chSysLock(); - chVTSetI(&vt, duration, tmr, NULL); - chSysUnlock(); + chVTSet(&vt, duration, tmr, NULL); } /* -- cgit v1.2.3 From 52e98077ee867e31189c43ad592cf97f386cac93 Mon Sep 17 00:00:00 2001 From: gdisirio Date: Thu, 15 Mar 2012 19:54:36 +0000 Subject: Fixed bug 3504450. git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@4039 35acf78f-673a-0410-8e92-d51de3d6d3f4 --- test/testmbox.c | 30 +++++++++++++++++------------- 1 file changed, 17 insertions(+), 13 deletions(-) (limited to 'test') diff --git a/test/testmbox.c b/test/testmbox.c index 5271752d2..544bc29ae 100644 --- a/test/testmbox.c +++ b/test/testmbox.c @@ -180,30 +180,34 @@ static void mbox1_execute(void) { test_emit_token(msg2); } test_assert_sequence(29, "ABCDE"); - test_assert(30, mb1.mb_rdptr == mb1.mb_wrptr, "pointers not aligned"); + 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"); chSysLock(); msg1 = chMBPostAheadI(&mb1, 'E'); - test_assert(31, msg1 == RDY_OK, "wrong wake-up message"); + test_assert(33, msg1 == RDY_OK, "wrong wake-up message"); msg1 = chMBPostAheadI(&mb1, 'D'); - test_assert(32, msg1 == RDY_OK, "wrong wake-up message"); + test_assert(34, msg1 == RDY_OK, "wrong wake-up message"); msg1 = chMBPostAheadI(&mb1, 'C'); - test_assert(33, msg1 == RDY_OK, "wrong wake-up message"); + test_assert(35, msg1 == RDY_OK, "wrong wake-up message"); msg1 = chMBPostAheadI(&mb1, 'B'); - test_assert(34, msg1 == RDY_OK, "wrong wake-up message"); + test_assert(36, msg1 == RDY_OK, "wrong wake-up message"); msg1 = chMBPostAheadI(&mb1, 'A'); chSysUnlock(); - test_assert(35, msg1 == RDY_OK, "wrong wake-up message"); - test_assert(36, mb1.mb_rdptr == mb1.mb_wrptr, "pointers not aligned"); + test_assert(37, msg1 == RDY_OK, "wrong wake-up message"); + test_assert(38, mb1.mb_rdptr == mb1.mb_wrptr, "pointers not aligned"); for (i = 0; i < MB_SIZE; i++) { chSysLock(); msg1 = chMBFetchI(&mb1, &msg2); chSysUnlock(); - test_assert(37, msg1 == RDY_OK, "wrong wake-up message"); + test_assert(39, msg1 == RDY_OK, "wrong wake-up message"); test_emit_token(msg2); } test_assert_sequence(38, "ABCDE"); - test_assert(39, mb1.mb_rdptr == mb1.mb_wrptr, "pointers not aligned"); + test_assert_lock(39, chMBGetFreeCountI(&mb1) == MB_SIZE, "not empty"); + test_assert_lock(40, chMBGetUsedCountI(&mb1) == 0, "still full"); + test_assert(41, mb1.mb_rdptr == mb1.mb_wrptr, "pointers not aligned"); /* * Testing reset. @@ -213,10 +217,10 @@ static void mbox1_execute(void) { /* * Re-testing final conditions. */ - test_assert_lock(40, chMBGetFreeCountI(&mb1) == MB_SIZE, "not empty"); - test_assert_lock(41, chMBGetUsedCountI(&mb1) == 0, "still full"); - test_assert_lock(42, mb1.mb_buffer == mb1.mb_wrptr, "write pointer not aligned to base"); - test_assert_lock(43, mb1.mb_buffer == mb1.mb_rdptr, "read pointer not aligned to base"); + test_assert_lock(42, chMBGetFreeCountI(&mb1) == MB_SIZE, "not empty"); + test_assert_lock(43, chMBGetUsedCountI(&mb1) == 0, "still full"); + test_assert_lock(44, mb1.mb_buffer == mb1.mb_wrptr, "write pointer not aligned to base"); + test_assert_lock(45, mb1.mb_buffer == mb1.mb_rdptr, "read pointer not aligned to base"); } ROMCONST struct testcase testmbox1 = { -- cgit v1.2.3 From 093b17ed718bef6d6c1b941218edd67327884c87 Mon Sep 17 00:00:00 2001 From: gdisirio Date: Thu, 15 Mar 2012 20:02:37 +0000 Subject: git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@4041 35acf78f-673a-0410-8e92-d51de3d6d3f4 --- test/testmbox.c | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) (limited to 'test') diff --git a/test/testmbox.c b/test/testmbox.c index 544bc29ae..9c0bc08fa 100644 --- a/test/testmbox.c +++ b/test/testmbox.c @@ -204,10 +204,10 @@ static void mbox1_execute(void) { test_assert(39, msg1 == RDY_OK, "wrong wake-up message"); test_emit_token(msg2); } - test_assert_sequence(38, "ABCDE"); - test_assert_lock(39, chMBGetFreeCountI(&mb1) == MB_SIZE, "not empty"); - test_assert_lock(40, chMBGetUsedCountI(&mb1) == 0, "still full"); - test_assert(41, mb1.mb_rdptr == mb1.mb_wrptr, "pointers not aligned"); + 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"); /* * Testing reset. @@ -217,10 +217,10 @@ static void mbox1_execute(void) { /* * Re-testing final conditions. */ - test_assert_lock(42, chMBGetFreeCountI(&mb1) == MB_SIZE, "not empty"); - test_assert_lock(43, chMBGetUsedCountI(&mb1) == 0, "still full"); - test_assert_lock(44, mb1.mb_buffer == mb1.mb_wrptr, "write pointer not aligned to base"); - test_assert_lock(45, mb1.mb_buffer == mb1.mb_rdptr, "read pointer not aligned to base"); + 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"); } ROMCONST struct testcase testmbox1 = { -- cgit v1.2.3 From f038bffdb512f67d4f90e8cba499713458eebd67 Mon Sep 17 00:00:00 2001 From: gdisirio Date: Sun, 1 Apr 2012 09:13:04 +0000 Subject: Fixed bug 3510812. git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@4066 35acf78f-673a-0410-8e92-d51de3d6d3f4 --- test/coverage/chconf.h | 2 +- test/coverage/halconf.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) (limited to 'test') diff --git a/test/coverage/chconf.h b/test/coverage/chconf.h index d514e822d..9db485f52 100644 --- a/test/coverage/chconf.h +++ b/test/coverage/chconf.h @@ -459,7 +459,7 @@ * @brief Threads initialization hook. * @details User initialization code added to the @p chThdInit() API. * - * @note It is invoked from within @p chThdInit() and implicitily from all + * @note It is invoked from within @p chThdInit() and implicitly from all * the threads creation APIs. */ #if !defined(THREAD_EXT_INIT_HOOK) || defined(__DOXYGEN__) diff --git a/test/coverage/halconf.h b/test/coverage/halconf.h index 5b49950cd..991f7cd1b 100644 --- a/test/coverage/halconf.h +++ b/test/coverage/halconf.h @@ -268,7 +268,7 @@ /** * @brief Number of initialization attempts before rejecting the card. - * @note Attempts are performed at 10mS intevals. + * @note Attempts are performed at 10mS intervals. */ #if !defined(SDC_INIT_RETRY) || defined(__DOXYGEN__) #define SDC_INIT_RETRY 100 -- cgit v1.2.3 From 7abee7168a90b07f3746779e338b4523d48724b0 Mon Sep 17 00:00:00 2001 From: gdisirio Date: Mon, 9 Apr 2012 13:13:25 +0000 Subject: Added new function chPoolLoadArray(). git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@4088 35acf78f-673a-0410-8e92-d51de3d6d3f4 --- test/testpools.c | 22 ++++++++++++++++------ 1 file changed, 16 insertions(+), 6 deletions(-) (limited to 'test') diff --git a/test/testpools.c b/test/testpools.c index 1c864d973..2583170fd 100644 --- a/test/testpools.c +++ b/test/testpools.c @@ -75,20 +75,30 @@ static void pools1_setup(void) { static void pools1_execute(void) { int i; - /* Adding the WAs to the pool. */ - for (i = 0; i < MAX_THREADS; i++) - chPoolFree(&mp1, wa[i]); + /* Adding the WAs to the pool.*/ + chPoolLoadArray(&mp1, wa[0], MAX_THREADS); - /* Empting the pool again. */ + /* Emptying the pool.*/ for (i = 0; i < MAX_THREADS; i++) test_assert(1, chPoolAlloc(&mp1) != NULL, "list empty"); - /* Now must be empty. */ + /* Now must be empty.*/ test_assert(2, chPoolAlloc(&mp1) == NULL, "list not empty"); + /* Adding the WAs to the pool, one by one this time.*/ + for (i = 0; i < MAX_THREADS; i++) + chPoolFree(&mp1, wa[i]); + + /* Emptying the pool again.*/ + for (i = 0; i < MAX_THREADS; i++) + test_assert(3, chPoolAlloc(&mp1) != NULL, "list empty"); + + /* Now must be empty again.*/ + test_assert(4, chPoolAlloc(&mp1) == NULL, "list not empty"); + /* Covering the case where a provider is unable to return more memory.*/ chPoolInit(&mp1, 16, null_provider); - test_assert(3, chPoolAlloc(&mp1) == NULL, "provider returned memory"); + test_assert(5, chPoolAlloc(&mp1) == NULL, "provider returned memory"); } ROMCONST struct testcase testpools1 = { -- cgit v1.2.3 From 5d374c633e69ae84bc8e02fc3bb3d0cbeded201e Mon Sep 17 00:00:00 2001 From: gdisirio Date: Mon, 30 Apr 2012 09:40:21 +0000 Subject: Fixed bug 3522301. git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@4151 35acf78f-673a-0410-8e92-d51de3d6d3f4 --- test/coverage/Makefile | 7 +++++-- test/coverage/main.c | 1 + 2 files changed, 6 insertions(+), 2 deletions(-) (limited to 'test') diff --git a/test/coverage/Makefile b/test/coverage/Makefile index 82dda4737..d19014202 100644 --- a/test/coverage/Makefile +++ b/test/coverage/Makefile @@ -35,6 +35,9 @@ DLIBDIR = # List all default libraries here DLIBS = -lws2_32 + +# Must be a directory in ${CHIBIOS}/os/hal/platforms +HOST_TYPE = Win32 # # End of default section @@ -60,7 +63,7 @@ UADEFS = CHIBIOS = ../.. include $(CHIBIOS)/boards/simulator/board.mk include ${CHIBIOS}/os/hal/hal.mk -include ${CHIBIOS}/os/hal/platforms/Win32/platform.mk +include ${CHIBIOS}/os/hal/platforms/$(HOST_TYPE)/platform.mk include ${CHIBIOS}/os/ports/GCC/SIMIA32/port.mk include ${CHIBIOS}/os/kernel/kernel.mk include ${CHIBIOS}/test/test.mk @@ -72,7 +75,7 @@ SRC = ${PORTSRC} \ ${HALSRC} \ ${PLATFORMSRC} \ $(BOARDSRC) \ - ${CHIBIOS}/os/hal/platforms/Win32/console.c \ + ${CHIBIOS}/os/hal/platforms/$(HOST_TYPE)/console.c \ main.c # List ASM source files here diff --git a/test/coverage/main.c b/test/coverage/main.c index 4d8249483..16c2702ec 100644 --- a/test/coverage/main.c +++ b/test/coverage/main.c @@ -20,6 +20,7 @@ #include #include +#include #include "ch.h" #include "hal.h" -- cgit v1.2.3 From d0a2e55ed0cf97be924ebbdae2497fd77bfac5b6 Mon Sep 17 00:00:00 2001 From: gdisirio Date: Tue, 8 May 2012 17:09:20 +0000 Subject: git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@4175 35acf78f-673a-0410-8e92-d51de3d6d3f4 --- test/test.c | 23 +++++++++++++---------- 1 file changed, 13 insertions(+), 10 deletions(-) (limited to 'test') diff --git a/test/test.c b/test/test.c index 55cfdf445..09596e592 100644 --- a/test/test.c +++ b/test/test.c @@ -85,7 +85,12 @@ void * ROMCONST wa[5] = {test.wa.T0, test.wa.T1, test.wa.T2, /* * Console output. */ -static BaseChannel *chp; +static BaseSequentialStream *chp; + +static void _putc(BaseSequentialStream *chp, char c) { + + chSequentialStreamWrite(chp, (const uint8_t *)&c, 1); +} /** * @brief Prints a decimal unsigned number. @@ -96,13 +101,13 @@ void test_printn(uint32_t n) { char buf[16], *p; if (!n) - chIOPut(chp, '0'); + _putc(chp, '0'); else { p = buf; while (n) *p++ = (n % 10) + '0', n /= 10; while (p > buf) - chIOPut(chp, *--p); + _putc(chp, *--p); } } @@ -114,7 +119,7 @@ void test_printn(uint32_t n) { void test_print(const char *msgp) { while (*msgp) - chIOPut(chp, *msgp++); + _putc(chp, *msgp++); } /** @@ -125,8 +130,7 @@ void test_print(const char *msgp) { void test_println(const char *msgp) { test_print(msgp); - chIOPut(chp, '\r'); - chIOPut(chp, '\n'); + chSequentialStreamWrite(chp, (const uint8_t *)"\r\n", 1); } /* @@ -141,7 +145,7 @@ static void print_tokens(void) { char *cp = tokens_buffer; while (cp < tokp) - chIOPut(chp, *cp++); + _putc(chp, *cp++); } /** @@ -306,9 +310,8 @@ static void print_line(void) { unsigned i; for (i = 0; i < 76; i++) - chIOPut(chp, '-'); - chIOPut(chp, '\r'); - chIOPut(chp, '\n'); + _putc(chp, '-'); + chSequentialStreamWrite(chp, (const uint8_t *)"\r\n", 1); } /** -- cgit v1.2.3 From 2a2b5fd348d9fcb9c1c996ea6e7ea7d362f0e9c4 Mon Sep 17 00:00:00 2001 From: gdisirio Date: Tue, 8 May 2012 17:28:23 +0000 Subject: git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@4176 35acf78f-673a-0410-8e92-d51de3d6d3f4 --- test/test.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'test') diff --git a/test/test.c b/test/test.c index 09596e592..beb0bfd3b 100644 --- a/test/test.c +++ b/test/test.c @@ -130,7 +130,7 @@ void test_print(const char *msgp) { void test_println(const char *msgp) { test_print(msgp); - chSequentialStreamWrite(chp, (const uint8_t *)"\r\n", 1); + chSequentialStreamWrite(chp, (const uint8_t *)"\r\n", 2); } /* @@ -311,7 +311,7 @@ static void print_line(void) { for (i = 0; i < 76; i++) _putc(chp, '-'); - chSequentialStreamWrite(chp, (const uint8_t *)"\r\n", 1); + chSequentialStreamWrite(chp, (const uint8_t *)"\r\n", 2); } /** -- cgit v1.2.3 From d094e348c5d1a3785289c69c5185bbaca1257de8 Mon Sep 17 00:00:00 2001 From: gdisirio Date: Mon, 11 Jun 2012 16:54:35 +0000 Subject: git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@4266 35acf78f-673a-0410-8e92-d51de3d6d3f4 --- test/testbmk.c | 2 +- test/testqueues.c | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) (limited to 'test') diff --git a/test/testbmk.c b/test/testbmk.c index b8031f190..5e5b11e7d 100644 --- a/test/testbmk.c +++ b/test/testbmk.c @@ -460,7 +460,7 @@ static void bmk9_execute(void) { static uint8_t ib[16]; static InputQueue iq; - chIQInit(&iq, ib, sizeof(ib), NULL); + chIQInit(&iq, ib, sizeof(ib), NULL, NULL); n = 0; test_wait_tick(); test_start_timer(1000); diff --git a/test/testqueues.c b/test/testqueues.c index 86cb2e1e5..1dc669af7 100644 --- a/test/testqueues.c +++ b/test/testqueues.c @@ -67,8 +67,8 @@ static void notify(GenericQueue *qp) { * variables are explicitly initialized in each test case. It is done in order * to test the macros. */ -static INPUTQUEUE_DECL(iq, test.wa.T0, TEST_QUEUES_SIZE, notify); -static OUTPUTQUEUE_DECL(oq, test.wa.T1, TEST_QUEUES_SIZE, notify); +static INPUTQUEUE_DECL(iq, test.wa.T0, TEST_QUEUES_SIZE, notify, NULL); +static OUTPUTQUEUE_DECL(oq, test.wa.T1, TEST_QUEUES_SIZE, notify, NULL); /** * @page test_queues_001 Input Queues functionality and APIs @@ -81,7 +81,7 @@ static OUTPUTQUEUE_DECL(oq, test.wa.T1, TEST_QUEUES_SIZE, notify); static void queues1_setup(void) { - chIQInit(&iq, wa[0], TEST_QUEUES_SIZE, notify); + chIQInit(&iq, wa[0], TEST_QUEUES_SIZE, notify, NULL); } static msg_t thread1(void *p) { @@ -168,7 +168,7 @@ ROMCONST struct testcase testqueues1 = { static void queues2_setup(void) { - chOQInit(&oq, wa[0], TEST_QUEUES_SIZE, notify); + chOQInit(&oq, wa[0], TEST_QUEUES_SIZE, notify, NULL); } static msg_t thread2(void *p) { -- cgit v1.2.3 From 9057c6c72be213bb7f07929e2ddd1ab1e942a1de Mon Sep 17 00:00:00 2001 From: gdisirio Date: Mon, 18 Jun 2012 16:22:34 +0000 Subject: git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@4294 35acf78f-673a-0410-8e92-d51de3d6d3f4 --- test/test.c | 15 +++++---------- 1 file changed, 5 insertions(+), 10 deletions(-) (limited to 'test') diff --git a/test/test.c b/test/test.c index beb0bfd3b..e6ee8e0ce 100644 --- a/test/test.c +++ b/test/test.c @@ -87,11 +87,6 @@ void * ROMCONST wa[5] = {test.wa.T0, test.wa.T1, test.wa.T2, */ static BaseSequentialStream *chp; -static void _putc(BaseSequentialStream *chp, char c) { - - chSequentialStreamWrite(chp, (const uint8_t *)&c, 1); -} - /** * @brief Prints a decimal unsigned number. * @@ -101,13 +96,13 @@ void test_printn(uint32_t n) { char buf[16], *p; if (!n) - _putc(chp, '0'); + chSequentialStreamPut(chp, '0'); else { p = buf; while (n) *p++ = (n % 10) + '0', n /= 10; while (p > buf) - _putc(chp, *--p); + chSequentialStreamPut(chp, *--p); } } @@ -119,7 +114,7 @@ void test_printn(uint32_t n) { void test_print(const char *msgp) { while (*msgp) - _putc(chp, *msgp++); + chSequentialStreamPut(chp, *msgp++); } /** @@ -145,7 +140,7 @@ static void print_tokens(void) { char *cp = tokens_buffer; while (cp < tokp) - _putc(chp, *cp++); + chSequentialStreamPut(chp, *cp++); } /** @@ -310,7 +305,7 @@ static void print_line(void) { unsigned i; for (i = 0; i < 76; i++) - _putc(chp, '-'); + chSequentialStreamPut(chp, '-'); chSequentialStreamWrite(chp, (const uint8_t *)"\r\n", 2); } -- cgit v1.2.3 From 5b39691e9eaa4f03b14794b824487f324aea7ca2 Mon Sep 17 00:00:00 2001 From: gdisirio Date: Sun, 16 Sep 2012 08:31:38 +0000 Subject: Kernel events improvements. git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@4667 35acf78f-673a-0410-8e92-d51de3d6d3f4 --- test/testevt.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'test') diff --git a/test/testevt.c b/test/testevt.c index 00a1f3fed..9ad9906d2 100644 --- a/test/testevt.c +++ b/test/testevt.c @@ -137,7 +137,7 @@ static void evt2_setup(void) { static msg_t thread1(void *p) { chThdSleepMilliseconds(50); - chEvtSignalFlags((Thread *)p, 1); + chEvtSignal((Thread *)p, 1); return 0; } -- cgit v1.2.3 From dfb876b3a1263c627465dfc6e3b76d5bab6c052e Mon Sep 17 00:00:00 2001 From: gdisirio Date: Sun, 16 Sep 2012 08:41:45 +0000 Subject: git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@4670 35acf78f-673a-0410-8e92-d51de3d6d3f4 --- test/testevt.c | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) (limited to 'test') diff --git a/test/testevt.c b/test/testevt.c index 9ad9906d2..cc42167a0 100644 --- a/test/testevt.c +++ b/test/testevt.c @@ -78,7 +78,7 @@ static EVENTSOURCE_DECL(es2); static void evt1_setup(void) { - chEvtClearFlags(ALL_EVENTS); + chEvtGetAndClearEvents(ALL_EVENTS); } static void h1(eventid_t id) {(void)id;test_emit_token('A');} @@ -131,7 +131,7 @@ ROMCONST struct testcase testevt1 = { static void evt2_setup(void) { - chEvtClearFlags(ALL_EVENTS); + chEvtGetAndClearEvents(ALL_EVENTS); } static msg_t thread1(void *p) { @@ -158,12 +158,12 @@ static void evt2_execute(void) { /* * Test on chEvtWaitOne() without wait. */ - chEvtAddFlags(5); + chEvtAddEvents(5); m = chEvtWaitOne(ALL_EVENTS); test_assert(1, m == 1, "single event error"); m = chEvtWaitOne(ALL_EVENTS); test_assert(2, m == 4, "single event error"); - m = chEvtClearFlags(ALL_EVENTS); + m = chEvtGetAndClearEvents(ALL_EVENTS); test_assert(3, m == 0, "stuck event"); /* @@ -176,17 +176,17 @@ static void evt2_execute(void) { m = chEvtWaitOne(ALL_EVENTS); test_assert_time_window(4, target_time, target_time + ALLOWED_DELAY); test_assert(5, m == 1, "single event error"); - m = chEvtClearFlags(ALL_EVENTS); + m = chEvtGetAndClearEvents(ALL_EVENTS); test_assert(6, m == 0, "stuck event"); test_wait_threads(); /* * Test on chEvtWaitAny() without wait. */ - chEvtAddFlags(5); + chEvtAddEvents(5); m = chEvtWaitAny(ALL_EVENTS); test_assert(7, m == 5, "unexpected pending bit"); - m = chEvtClearFlags(ALL_EVENTS); + m = chEvtGetAndClearEvents(ALL_EVENTS); test_assert(8, m == 0, "stuck event"); /* @@ -199,7 +199,7 @@ static void evt2_execute(void) { m = chEvtWaitAny(ALL_EVENTS); test_assert_time_window(9, target_time, target_time + ALLOWED_DELAY); test_assert(10, m == 1, "single event error"); - m = chEvtClearFlags(ALL_EVENTS); + m = chEvtGetAndClearEvents(ALL_EVENTS); test_assert(11, m == 0, "stuck event"); test_wait_threads(); @@ -216,7 +216,7 @@ static void evt2_execute(void) { thread2, "A"); m = chEvtWaitAll(5); test_assert_time_window(12, target_time, target_time + ALLOWED_DELAY); - m = chEvtClearFlags(ALL_EVENTS); + m = chEvtGetAndClearEvents(ALL_EVENTS); test_assert(13, m == 0, "stuck event"); test_wait_threads(); chEvtUnregister(&es1, &el1); @@ -250,7 +250,7 @@ ROMCONST struct testcase testevt2 = { static void evt3_setup(void) { - chEvtClearFlags(ALL_EVENTS); + chEvtGetAndClearEvents(ALL_EVENTS); } static void evt3_execute(void) { -- cgit v1.2.3 From c0664e0d08f342623207e4d22606bf2e5f9bd5d6 Mon Sep 17 00:00:00 2001 From: gdisirio Date: Sat, 10 Nov 2012 08:06:03 +0000 Subject: Fixed bug 3585979. git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@4804 35acf78f-673a-0410-8e92-d51de3d6d3f4 --- test/testmbox.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'test') diff --git a/test/testmbox.c b/test/testmbox.c index 9c0bc08fa..5d3b7f153 100644 --- a/test/testmbox.c +++ b/test/testmbox.c @@ -169,7 +169,7 @@ static void mbox1_execute(void) { msg1 = chMBPostI(&mb1, 'D'); test_assert(25, msg1 == RDY_OK, "wrong wake-up message"); msg1 = chMBPostI(&mb1, 'E'); - chSysUnlock() + chSysUnlock(); test_assert(26, msg1 == RDY_OK, "wrong wake-up message"); test_assert(27, mb1.mb_rdptr == mb1.mb_wrptr, "pointers not aligned"); for (i = 0; i < MB_SIZE; i++) { -- cgit v1.2.3 From 77d7a3741d05e24286f41d3bfdfdee78f4dbd8a6 Mon Sep 17 00:00:00 2001 From: gdisirio Date: Sun, 30 Dec 2012 09:43:16 +0000 Subject: git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@4995 35acf78f-673a-0410-8e92-d51de3d6d3f4 --- test/coverage/halconf.h | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'test') diff --git a/test/coverage/halconf.h b/test/coverage/halconf.h index 991f7cd1b..c151b9af0 100644 --- a/test/coverage/halconf.h +++ b/test/coverage/halconf.h @@ -206,6 +206,13 @@ /* MAC driver related settings. */ /*===========================================================================*/ +/** + * @brief Enables an event sources for incoming packets. + */ +#if !defined(MAC_USE_ZERO_COPY) || defined(__DOXYGEN__) +#define MAC_USE_ZERO_COPY FALSE +#endif + /** * @brief Enables an event sources for incoming packets. */ -- cgit v1.2.3 From 097062ca3be263bac3906c4b23d56ca765504ba8 Mon Sep 17 00:00:00 2001 From: gdisirio Date: Sat, 2 Feb 2013 10:35:45 +0000 Subject: Removed obsolete options from the haconf.h files. git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@5101 35acf78f-673a-0410-8e92-d51de3d6d3f4 --- test/coverage/halconf.h | 33 --------------------------------- 1 file changed, 33 deletions(-) (limited to 'test') diff --git a/test/coverage/halconf.h b/test/coverage/halconf.h index c151b9af0..76036000e 100644 --- a/test/coverage/halconf.h +++ b/test/coverage/halconf.h @@ -224,13 +224,6 @@ /* MMC_SPI driver related settings. */ /*===========================================================================*/ -/** - * @brief Block size for MMC transfers. - */ -#if !defined(MMC_SECTOR_SIZE) || defined(__DOXYGEN__) -#define MMC_SECTOR_SIZE 512 -#endif - /** * @brief Delays insertions. * @details If enabled this options inserts delays into the MMC waiting @@ -243,32 +236,6 @@ #define MMC_NICE_WAITING TRUE #endif -/** - * @brief Number of positive insertion queries before generating the - * insertion event. - */ -#if !defined(MMC_POLLING_INTERVAL) || defined(__DOXYGEN__) -#define MMC_POLLING_INTERVAL 10 -#endif - -/** - * @brief Interval, in milliseconds, between insertion queries. - */ -#if !defined(MMC_POLLING_DELAY) || defined(__DOXYGEN__) -#define MMC_POLLING_DELAY 10 -#endif - -/** - * @brief Uses the SPI polled API for small data transfers. - * @details Polled transfers usually improve performance because it - * saves two context switches and interrupt servicing. Note - * that this option has no effect on large transfers which - * are always performed using DMAs/IRQs. - */ -#if !defined(MMC_USE_SPI_POLLING) || defined(__DOXYGEN__) -#define MMC_USE_SPI_POLLING TRUE -#endif - /*===========================================================================*/ /* SDC driver related settings. */ /*===========================================================================*/ -- cgit v1.2.3 From 184a71345c6a36a9a8664eda8fbcc3ea728267a8 Mon Sep 17 00:00:00 2001 From: gdisirio Date: Sat, 2 Feb 2013 10:58:09 +0000 Subject: Updated license years. git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@5102 35acf78f-673a-0410-8e92-d51de3d6d3f4 --- test/coverage/chconf.h | 2 +- test/coverage/halconf.h | 2 +- test/coverage/main.c | 2 +- test/test.c | 2 +- test/test.dox | 2 +- test/test.h | 2 +- test/testbmk.c | 2 +- test/testbmk.h | 2 +- test/testdyn.c | 2 +- test/testdyn.h | 2 +- test/testevt.c | 2 +- test/testevt.h | 2 +- test/testheap.c | 2 +- test/testheap.h | 2 +- test/testmbox.c | 2 +- test/testmbox.h | 2 +- test/testmsg.c | 2 +- test/testmsg.h | 2 +- test/testmtx.c | 2 +- test/testmtx.h | 2 +- test/testpools.c | 2 +- test/testpools.h | 2 +- test/testqueues.c | 2 +- test/testqueues.h | 2 +- test/testsem.c | 2 +- test/testsem.h | 2 +- test/testthd.c | 2 +- test/testthd.h | 2 +- 28 files changed, 28 insertions(+), 28 deletions(-) (limited to 'test') diff --git a/test/coverage/chconf.h b/test/coverage/chconf.h index 9db485f52..78544024b 100644 --- a/test/coverage/chconf.h +++ b/test/coverage/chconf.h @@ -1,6 +1,6 @@ /* ChibiOS/RT - Copyright (C) 2006,2007,2008,2009,2010, - 2011,2012 Giovanni Di Sirio. + 2011,2012,2013 Giovanni Di Sirio. This file is part of ChibiOS/RT. diff --git a/test/coverage/halconf.h b/test/coverage/halconf.h index 76036000e..2203038e2 100644 --- a/test/coverage/halconf.h +++ b/test/coverage/halconf.h @@ -1,6 +1,6 @@ /* ChibiOS/RT - Copyright (C) 2006,2007,2008,2009,2010, - 2011,2012 Giovanni Di Sirio. + 2011,2012,2013 Giovanni Di Sirio. This file is part of ChibiOS/RT. diff --git a/test/coverage/main.c b/test/coverage/main.c index 16c2702ec..01d696aec 100644 --- a/test/coverage/main.c +++ b/test/coverage/main.c @@ -1,6 +1,6 @@ /* ChibiOS/RT - Copyright (C) 2006,2007,2008,2009,2010, - 2011,2012 Giovanni Di Sirio. + 2011,2012,2013 Giovanni Di Sirio. This file is part of ChibiOS/RT. diff --git a/test/test.c b/test/test.c index e6ee8e0ce..c319995be 100644 --- a/test/test.c +++ b/test/test.c @@ -1,6 +1,6 @@ /* ChibiOS/RT - Copyright (C) 2006,2007,2008,2009,2010, - 2011,2012 Giovanni Di Sirio. + 2011,2012,2013 Giovanni Di Sirio. This file is part of ChibiOS/RT. diff --git a/test/test.dox b/test/test.dox index 9474d5386..4ae32c562 100644 --- a/test/test.dox +++ b/test/test.dox @@ -1,6 +1,6 @@ /* ChibiOS/RT - Copyright (C) 2006,2007,2008,2009,2010, - 2011,2012 Giovanni Di Sirio. + 2011,2012,2013 Giovanni Di Sirio. This file is part of ChibiOS/RT. diff --git a/test/test.h b/test/test.h index f4d8e1086..7394d7511 100644 --- a/test/test.h +++ b/test/test.h @@ -1,6 +1,6 @@ /* ChibiOS/RT - Copyright (C) 2006,2007,2008,2009,2010, - 2011,2012 Giovanni Di Sirio. + 2011,2012,2013 Giovanni Di Sirio. This file is part of ChibiOS/RT. diff --git a/test/testbmk.c b/test/testbmk.c index 5e5b11e7d..04ca073ec 100644 --- a/test/testbmk.c +++ b/test/testbmk.c @@ -1,6 +1,6 @@ /* ChibiOS/RT - Copyright (C) 2006,2007,2008,2009,2010, - 2011,2012 Giovanni Di Sirio. + 2011,2012,2013 Giovanni Di Sirio. This file is part of ChibiOS/RT. diff --git a/test/testbmk.h b/test/testbmk.h index 6e8c4d1ba..5f9f52c79 100644 --- a/test/testbmk.h +++ b/test/testbmk.h @@ -1,6 +1,6 @@ /* ChibiOS/RT - Copyright (C) 2006,2007,2008,2009,2010, - 2011,2012 Giovanni Di Sirio. + 2011,2012,2013 Giovanni Di Sirio. This file is part of ChibiOS/RT. diff --git a/test/testdyn.c b/test/testdyn.c index 5edbc0b63..c8d75f84e 100644 --- a/test/testdyn.c +++ b/test/testdyn.c @@ -1,6 +1,6 @@ /* ChibiOS/RT - Copyright (C) 2006,2007,2008,2009,2010, - 2011,2012 Giovanni Di Sirio. + 2011,2012,2013 Giovanni Di Sirio. This file is part of ChibiOS/RT. diff --git a/test/testdyn.h b/test/testdyn.h index e373df3ba..28f5c9299 100644 --- a/test/testdyn.h +++ b/test/testdyn.h @@ -1,6 +1,6 @@ /* ChibiOS/RT - Copyright (C) 2006,2007,2008,2009,2010, - 2011,2012 Giovanni Di Sirio. + 2011,2012,2013 Giovanni Di Sirio. This file is part of ChibiOS/RT. diff --git a/test/testevt.c b/test/testevt.c index cc42167a0..8c86595f8 100644 --- a/test/testevt.c +++ b/test/testevt.c @@ -1,6 +1,6 @@ /* ChibiOS/RT - Copyright (C) 2006,2007,2008,2009,2010, - 2011,2012 Giovanni Di Sirio. + 2011,2012,2013 Giovanni Di Sirio. This file is part of ChibiOS/RT. diff --git a/test/testevt.h b/test/testevt.h index ca05c79c3..f06321196 100644 --- a/test/testevt.h +++ b/test/testevt.h @@ -1,6 +1,6 @@ /* ChibiOS/RT - Copyright (C) 2006,2007,2008,2009,2010, - 2011,2012 Giovanni Di Sirio. + 2011,2012,2013 Giovanni Di Sirio. This file is part of ChibiOS/RT. diff --git a/test/testheap.c b/test/testheap.c index 8d849257a..b21589f92 100644 --- a/test/testheap.c +++ b/test/testheap.c @@ -1,6 +1,6 @@ /* ChibiOS/RT - Copyright (C) 2006,2007,2008,2009,2010, - 2011,2012 Giovanni Di Sirio. + 2011,2012,2013 Giovanni Di Sirio. This file is part of ChibiOS/RT. diff --git a/test/testheap.h b/test/testheap.h index 4e027aeaa..afeac493e 100644 --- a/test/testheap.h +++ b/test/testheap.h @@ -1,6 +1,6 @@ /* ChibiOS/RT - Copyright (C) 2006,2007,2008,2009,2010, - 2011,2012 Giovanni Di Sirio. + 2011,2012,2013 Giovanni Di Sirio. This file is part of ChibiOS/RT. diff --git a/test/testmbox.c b/test/testmbox.c index 5d3b7f153..feda13356 100644 --- a/test/testmbox.c +++ b/test/testmbox.c @@ -1,6 +1,6 @@ /* ChibiOS/RT - Copyright (C) 2006,2007,2008,2009,2010, - 2011,2012 Giovanni Di Sirio. + 2011,2012,2013 Giovanni Di Sirio. This file is part of ChibiOS/RT. diff --git a/test/testmbox.h b/test/testmbox.h index e0693e8c6..42239ffd8 100644 --- a/test/testmbox.h +++ b/test/testmbox.h @@ -1,6 +1,6 @@ /* ChibiOS/RT - Copyright (C) 2006,2007,2008,2009,2010, - 2011,2012 Giovanni Di Sirio. + 2011,2012,2013 Giovanni Di Sirio. This file is part of ChibiOS/RT. diff --git a/test/testmsg.c b/test/testmsg.c index b04da4224..9f4fe8e67 100644 --- a/test/testmsg.c +++ b/test/testmsg.c @@ -1,6 +1,6 @@ /* ChibiOS/RT - Copyright (C) 2006,2007,2008,2009,2010, - 2011,2012 Giovanni Di Sirio. + 2011,2012,2013 Giovanni Di Sirio. This file is part of ChibiOS/RT. diff --git a/test/testmsg.h b/test/testmsg.h index b28b53354..98d8412b3 100644 --- a/test/testmsg.h +++ b/test/testmsg.h @@ -1,6 +1,6 @@ /* ChibiOS/RT - Copyright (C) 2006,2007,2008,2009,2010, - 2011,2012 Giovanni Di Sirio. + 2011,2012,2013 Giovanni Di Sirio. This file is part of ChibiOS/RT. diff --git a/test/testmtx.c b/test/testmtx.c index 07605922c..bbc6344ed 100644 --- a/test/testmtx.c +++ b/test/testmtx.c @@ -1,6 +1,6 @@ /* ChibiOS/RT - Copyright (C) 2006,2007,2008,2009,2010, - 2011,2012 Giovanni Di Sirio. + 2011,2012,2013 Giovanni Di Sirio. This file is part of ChibiOS/RT. diff --git a/test/testmtx.h b/test/testmtx.h index 56e380a94..2f9e3ecf8 100644 --- a/test/testmtx.h +++ b/test/testmtx.h @@ -1,6 +1,6 @@ /* ChibiOS/RT - Copyright (C) 2006,2007,2008,2009,2010, - 2011,2012 Giovanni Di Sirio. + 2011,2012,2013 Giovanni Di Sirio. This file is part of ChibiOS/RT. diff --git a/test/testpools.c b/test/testpools.c index 2583170fd..f0b196ab7 100644 --- a/test/testpools.c +++ b/test/testpools.c @@ -1,6 +1,6 @@ /* ChibiOS/RT - Copyright (C) 2006,2007,2008,2009,2010, - 2011,2012 Giovanni Di Sirio. + 2011,2012,2013 Giovanni Di Sirio. This file is part of ChibiOS/RT. diff --git a/test/testpools.h b/test/testpools.h index 2cfa8e370..da483d1dc 100644 --- a/test/testpools.h +++ b/test/testpools.h @@ -1,6 +1,6 @@ /* ChibiOS/RT - Copyright (C) 2006,2007,2008,2009,2010, - 2011,2012 Giovanni Di Sirio. + 2011,2012,2013 Giovanni Di Sirio. This file is part of ChibiOS/RT. diff --git a/test/testqueues.c b/test/testqueues.c index 1dc669af7..8ec668f8c 100644 --- a/test/testqueues.c +++ b/test/testqueues.c @@ -1,6 +1,6 @@ /* ChibiOS/RT - Copyright (C) 2006,2007,2008,2009,2010, - 2011,2012 Giovanni Di Sirio. + 2011,2012,2013 Giovanni Di Sirio. This file is part of ChibiOS/RT. diff --git a/test/testqueues.h b/test/testqueues.h index ae2a39b28..a61ce047a 100644 --- a/test/testqueues.h +++ b/test/testqueues.h @@ -1,6 +1,6 @@ /* ChibiOS/RT - Copyright (C) 2006,2007,2008,2009,2010, - 2011,2012 Giovanni Di Sirio. + 2011,2012,2013 Giovanni Di Sirio. This file is part of ChibiOS/RT. diff --git a/test/testsem.c b/test/testsem.c index 88f28791c..7e32e8c50 100644 --- a/test/testsem.c +++ b/test/testsem.c @@ -1,6 +1,6 @@ /* ChibiOS/RT - Copyright (C) 2006,2007,2008,2009,2010, - 2011,2012 Giovanni Di Sirio. + 2011,2012,2013 Giovanni Di Sirio. This file is part of ChibiOS/RT. diff --git a/test/testsem.h b/test/testsem.h index 664e2ba77..93dfcb772 100644 --- a/test/testsem.h +++ b/test/testsem.h @@ -1,6 +1,6 @@ /* ChibiOS/RT - Copyright (C) 2006,2007,2008,2009,2010, - 2011,2012 Giovanni Di Sirio. + 2011,2012,2013 Giovanni Di Sirio. This file is part of ChibiOS/RT. diff --git a/test/testthd.c b/test/testthd.c index ac3fe5dd6..a9ec41eaf 100644 --- a/test/testthd.c +++ b/test/testthd.c @@ -1,6 +1,6 @@ /* ChibiOS/RT - Copyright (C) 2006,2007,2008,2009,2010, - 2011,2012 Giovanni Di Sirio. + 2011,2012,2013 Giovanni Di Sirio. This file is part of ChibiOS/RT. diff --git a/test/testthd.h b/test/testthd.h index 7ab6f4c72..8bcf60712 100644 --- a/test/testthd.h +++ b/test/testthd.h @@ -1,6 +1,6 @@ /* ChibiOS/RT - Copyright (C) 2006,2007,2008,2009,2010, - 2011,2012 Giovanni Di Sirio. + 2011,2012,2013 Giovanni Di Sirio. This file is part of ChibiOS/RT. -- cgit v1.2.3 From 853216256ad4cdacf5f94edb7d6b738c6be165a1 Mon Sep 17 00:00:00 2001 From: gdisirio Date: Sat, 30 Mar 2013 10:32:37 +0000 Subject: Relicensing parts of the tree under the Apache 2.0 license. git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@5521 35acf78f-673a-0410-8e92-d51de3d6d3f4 --- test/coverage/chconf.h | 24 ++++++++++-------------- test/coverage/halconf.h | 24 ++++++++++-------------- test/coverage/main.c | 24 ++++++++++-------------- test/test.c | 24 ++++++++++-------------- test/test.dox | 24 ++++++++++-------------- test/test.h | 24 ++++++++++-------------- test/testbmk.c | 24 ++++++++++-------------- test/testbmk.h | 24 ++++++++++-------------- test/testdyn.c | 24 ++++++++++-------------- test/testdyn.h | 24 ++++++++++-------------- test/testevt.c | 24 ++++++++++-------------- test/testevt.h | 24 ++++++++++-------------- test/testheap.c | 24 ++++++++++-------------- test/testheap.h | 24 ++++++++++-------------- test/testmbox.c | 24 ++++++++++-------------- test/testmbox.h | 24 ++++++++++-------------- test/testmsg.c | 24 ++++++++++-------------- test/testmsg.h | 24 ++++++++++-------------- test/testmtx.c | 24 ++++++++++-------------- test/testmtx.h | 24 ++++++++++-------------- test/testpools.c | 24 ++++++++++-------------- test/testpools.h | 24 ++++++++++-------------- test/testqueues.c | 24 ++++++++++-------------- test/testqueues.h | 24 ++++++++++-------------- test/testsem.c | 24 ++++++++++-------------- test/testsem.h | 24 ++++++++++-------------- test/testthd.c | 24 ++++++++++-------------- test/testthd.h | 24 ++++++++++-------------- 28 files changed, 280 insertions(+), 392 deletions(-) (limited to 'test') diff --git a/test/coverage/chconf.h b/test/coverage/chconf.h index 78544024b..8b0f88662 100644 --- a/test/coverage/chconf.h +++ b/test/coverage/chconf.h @@ -1,21 +1,17 @@ /* - ChibiOS/RT - Copyright (C) 2006,2007,2008,2009,2010, - 2011,2012,2013 Giovanni Di Sirio. + ChibiOS/RT - Copyright (C) 2006-2013 Giovanni Di Sirio - This file is part of ChibiOS/RT. + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at - ChibiOS/RT is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 3 of the License, or - (at your option) any later version. + http://www.apache.org/licenses/LICENSE-2.0 - ChibiOS/RT is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program. If not, see . + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. */ /** diff --git a/test/coverage/halconf.h b/test/coverage/halconf.h index 2203038e2..516a705a2 100644 --- a/test/coverage/halconf.h +++ b/test/coverage/halconf.h @@ -1,21 +1,17 @@ /* - ChibiOS/RT - Copyright (C) 2006,2007,2008,2009,2010, - 2011,2012,2013 Giovanni Di Sirio. + ChibiOS/RT - Copyright (C) 2006-2013 Giovanni Di Sirio - This file is part of ChibiOS/RT. + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at - ChibiOS/RT is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 3 of the License, or - (at your option) any later version. + http://www.apache.org/licenses/LICENSE-2.0 - ChibiOS/RT is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program. If not, see . + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. */ /** diff --git a/test/coverage/main.c b/test/coverage/main.c index 01d696aec..c4f257f0d 100644 --- a/test/coverage/main.c +++ b/test/coverage/main.c @@ -1,21 +1,17 @@ /* - ChibiOS/RT - Copyright (C) 2006,2007,2008,2009,2010, - 2011,2012,2013 Giovanni Di Sirio. + ChibiOS/RT - Copyright (C) 2006-2013 Giovanni Di Sirio - This file is part of ChibiOS/RT. + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at - ChibiOS/RT is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 3 of the License, or - (at your option) any later version. + http://www.apache.org/licenses/LICENSE-2.0 - ChibiOS/RT is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program. If not, see . + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. */ #include diff --git a/test/test.c b/test/test.c index c319995be..1de688a28 100644 --- a/test/test.c +++ b/test/test.c @@ -1,21 +1,17 @@ /* - ChibiOS/RT - Copyright (C) 2006,2007,2008,2009,2010, - 2011,2012,2013 Giovanni Di Sirio. + ChibiOS/RT - Copyright (C) 2006-2013 Giovanni Di Sirio - This file is part of ChibiOS/RT. + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at - ChibiOS/RT is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 3 of the License, or - (at your option) any later version. + http://www.apache.org/licenses/LICENSE-2.0 - ChibiOS/RT is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program. If not, see . + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. */ /** diff --git a/test/test.dox b/test/test.dox index 4ae32c562..87c68320b 100644 --- a/test/test.dox +++ b/test/test.dox @@ -1,21 +1,17 @@ /* - ChibiOS/RT - Copyright (C) 2006,2007,2008,2009,2010, - 2011,2012,2013 Giovanni Di Sirio. + ChibiOS/RT - Copyright (C) 2006-2013 Giovanni Di Sirio - This file is part of ChibiOS/RT. + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at - ChibiOS/RT is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 3 of the License, or - (at your option) any later version. + http://www.apache.org/licenses/LICENSE-2.0 - ChibiOS/RT is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program. If not, see . + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. */ /** diff --git a/test/test.h b/test/test.h index 7394d7511..fbdfa27f0 100644 --- a/test/test.h +++ b/test/test.h @@ -1,21 +1,17 @@ /* - ChibiOS/RT - Copyright (C) 2006,2007,2008,2009,2010, - 2011,2012,2013 Giovanni Di Sirio. + ChibiOS/RT - Copyright (C) 2006-2013 Giovanni Di Sirio - This file is part of ChibiOS/RT. + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at - ChibiOS/RT is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 3 of the License, or - (at your option) any later version. + http://www.apache.org/licenses/LICENSE-2.0 - ChibiOS/RT is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program. If not, see . + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. */ /** diff --git a/test/testbmk.c b/test/testbmk.c index 04ca073ec..5b46023d8 100644 --- a/test/testbmk.c +++ b/test/testbmk.c @@ -1,21 +1,17 @@ /* - ChibiOS/RT - Copyright (C) 2006,2007,2008,2009,2010, - 2011,2012,2013 Giovanni Di Sirio. + ChibiOS/RT - Copyright (C) 2006-2013 Giovanni Di Sirio - This file is part of ChibiOS/RT. + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at - ChibiOS/RT is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 3 of the License, or - (at your option) any later version. + http://www.apache.org/licenses/LICENSE-2.0 - ChibiOS/RT is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program. If not, see . + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. */ #include "ch.h" diff --git a/test/testbmk.h b/test/testbmk.h index 5f9f52c79..8d7514f74 100644 --- a/test/testbmk.h +++ b/test/testbmk.h @@ -1,21 +1,17 @@ /* - ChibiOS/RT - Copyright (C) 2006,2007,2008,2009,2010, - 2011,2012,2013 Giovanni Di Sirio. + ChibiOS/RT - Copyright (C) 2006-2013 Giovanni Di Sirio - This file is part of ChibiOS/RT. + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at - ChibiOS/RT is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 3 of the License, or - (at your option) any later version. + http://www.apache.org/licenses/LICENSE-2.0 - ChibiOS/RT is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program. If not, see . + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. */ #ifndef _TESTBMK_H_ diff --git a/test/testdyn.c b/test/testdyn.c index c8d75f84e..8e54c81a1 100644 --- a/test/testdyn.c +++ b/test/testdyn.c @@ -1,21 +1,17 @@ /* - ChibiOS/RT - Copyright (C) 2006,2007,2008,2009,2010, - 2011,2012,2013 Giovanni Di Sirio. + ChibiOS/RT - Copyright (C) 2006-2013 Giovanni Di Sirio - This file is part of ChibiOS/RT. + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at - ChibiOS/RT is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 3 of the License, or - (at your option) any later version. + http://www.apache.org/licenses/LICENSE-2.0 - ChibiOS/RT is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program. If not, see . + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. */ #include "ch.h" diff --git a/test/testdyn.h b/test/testdyn.h index 28f5c9299..6b25dbb30 100644 --- a/test/testdyn.h +++ b/test/testdyn.h @@ -1,21 +1,17 @@ /* - ChibiOS/RT - Copyright (C) 2006,2007,2008,2009,2010, - 2011,2012,2013 Giovanni Di Sirio. + ChibiOS/RT - Copyright (C) 2006-2013 Giovanni Di Sirio - This file is part of ChibiOS/RT. + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at - ChibiOS/RT is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 3 of the License, or - (at your option) any later version. + http://www.apache.org/licenses/LICENSE-2.0 - ChibiOS/RT is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program. If not, see . + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. */ #ifndef _TESTDYN_H_ diff --git a/test/testevt.c b/test/testevt.c index 8c86595f8..0a014374e 100644 --- a/test/testevt.c +++ b/test/testevt.c @@ -1,21 +1,17 @@ /* - ChibiOS/RT - Copyright (C) 2006,2007,2008,2009,2010, - 2011,2012,2013 Giovanni Di Sirio. + ChibiOS/RT - Copyright (C) 2006-2013 Giovanni Di Sirio - This file is part of ChibiOS/RT. + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at - ChibiOS/RT is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 3 of the License, or - (at your option) any later version. + http://www.apache.org/licenses/LICENSE-2.0 - ChibiOS/RT is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program. If not, see . + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. */ #include "ch.h" diff --git a/test/testevt.h b/test/testevt.h index f06321196..7d189c17f 100644 --- a/test/testevt.h +++ b/test/testevt.h @@ -1,21 +1,17 @@ /* - ChibiOS/RT - Copyright (C) 2006,2007,2008,2009,2010, - 2011,2012,2013 Giovanni Di Sirio. + ChibiOS/RT - Copyright (C) 2006-2013 Giovanni Di Sirio - This file is part of ChibiOS/RT. + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at - ChibiOS/RT is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 3 of the License, or - (at your option) any later version. + http://www.apache.org/licenses/LICENSE-2.0 - ChibiOS/RT is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program. If not, see . + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. */ #ifndef _TESTEVT_H_ diff --git a/test/testheap.c b/test/testheap.c index b21589f92..9baa95d82 100644 --- a/test/testheap.c +++ b/test/testheap.c @@ -1,21 +1,17 @@ /* - ChibiOS/RT - Copyright (C) 2006,2007,2008,2009,2010, - 2011,2012,2013 Giovanni Di Sirio. + ChibiOS/RT - Copyright (C) 2006-2013 Giovanni Di Sirio - This file is part of ChibiOS/RT. + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at - ChibiOS/RT is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 3 of the License, or - (at your option) any later version. + http://www.apache.org/licenses/LICENSE-2.0 - ChibiOS/RT is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program. If not, see . + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. */ #include "ch.h" diff --git a/test/testheap.h b/test/testheap.h index afeac493e..24d577445 100644 --- a/test/testheap.h +++ b/test/testheap.h @@ -1,21 +1,17 @@ /* - ChibiOS/RT - Copyright (C) 2006,2007,2008,2009,2010, - 2011,2012,2013 Giovanni Di Sirio. + ChibiOS/RT - Copyright (C) 2006-2013 Giovanni Di Sirio - This file is part of ChibiOS/RT. + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at - ChibiOS/RT is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 3 of the License, or - (at your option) any later version. + http://www.apache.org/licenses/LICENSE-2.0 - ChibiOS/RT is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program. If not, see . + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. */ #ifndef _TESTHEAP_H_ diff --git a/test/testmbox.c b/test/testmbox.c index feda13356..b1fe675cc 100644 --- a/test/testmbox.c +++ b/test/testmbox.c @@ -1,21 +1,17 @@ /* - ChibiOS/RT - Copyright (C) 2006,2007,2008,2009,2010, - 2011,2012,2013 Giovanni Di Sirio. + ChibiOS/RT - Copyright (C) 2006-2013 Giovanni Di Sirio - This file is part of ChibiOS/RT. + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at - ChibiOS/RT is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 3 of the License, or - (at your option) any later version. + http://www.apache.org/licenses/LICENSE-2.0 - ChibiOS/RT is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program. If not, see . + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. */ #include "ch.h" diff --git a/test/testmbox.h b/test/testmbox.h index 42239ffd8..5b61ec888 100644 --- a/test/testmbox.h +++ b/test/testmbox.h @@ -1,21 +1,17 @@ /* - ChibiOS/RT - Copyright (C) 2006,2007,2008,2009,2010, - 2011,2012,2013 Giovanni Di Sirio. + ChibiOS/RT - Copyright (C) 2006-2013 Giovanni Di Sirio - This file is part of ChibiOS/RT. + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at - ChibiOS/RT is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 3 of the License, or - (at your option) any later version. + http://www.apache.org/licenses/LICENSE-2.0 - ChibiOS/RT is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program. If not, see . + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. */ #ifndef _TESTMBOX_H_ diff --git a/test/testmsg.c b/test/testmsg.c index 9f4fe8e67..3ffaa6bf7 100644 --- a/test/testmsg.c +++ b/test/testmsg.c @@ -1,21 +1,17 @@ /* - ChibiOS/RT - Copyright (C) 2006,2007,2008,2009,2010, - 2011,2012,2013 Giovanni Di Sirio. + ChibiOS/RT - Copyright (C) 2006-2013 Giovanni Di Sirio - This file is part of ChibiOS/RT. + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at - ChibiOS/RT is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 3 of the License, or - (at your option) any later version. + http://www.apache.org/licenses/LICENSE-2.0 - ChibiOS/RT is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program. If not, see . + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. */ #include "ch.h" diff --git a/test/testmsg.h b/test/testmsg.h index 98d8412b3..47f072d14 100644 --- a/test/testmsg.h +++ b/test/testmsg.h @@ -1,21 +1,17 @@ /* - ChibiOS/RT - Copyright (C) 2006,2007,2008,2009,2010, - 2011,2012,2013 Giovanni Di Sirio. + ChibiOS/RT - Copyright (C) 2006-2013 Giovanni Di Sirio - This file is part of ChibiOS/RT. + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at - ChibiOS/RT is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 3 of the License, or - (at your option) any later version. + http://www.apache.org/licenses/LICENSE-2.0 - ChibiOS/RT is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program. If not, see . + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. */ #ifndef _TESTMSG_H_ diff --git a/test/testmtx.c b/test/testmtx.c index bbc6344ed..149f47d11 100644 --- a/test/testmtx.c +++ b/test/testmtx.c @@ -1,21 +1,17 @@ /* - ChibiOS/RT - Copyright (C) 2006,2007,2008,2009,2010, - 2011,2012,2013 Giovanni Di Sirio. + ChibiOS/RT - Copyright (C) 2006-2013 Giovanni Di Sirio - This file is part of ChibiOS/RT. + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at - ChibiOS/RT is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 3 of the License, or - (at your option) any later version. + http://www.apache.org/licenses/LICENSE-2.0 - ChibiOS/RT is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program. If not, see . + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. */ #include "ch.h" diff --git a/test/testmtx.h b/test/testmtx.h index 2f9e3ecf8..653c4ad24 100644 --- a/test/testmtx.h +++ b/test/testmtx.h @@ -1,21 +1,17 @@ /* - ChibiOS/RT - Copyright (C) 2006,2007,2008,2009,2010, - 2011,2012,2013 Giovanni Di Sirio. + ChibiOS/RT - Copyright (C) 2006-2013 Giovanni Di Sirio - This file is part of ChibiOS/RT. + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at - ChibiOS/RT is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 3 of the License, or - (at your option) any later version. + http://www.apache.org/licenses/LICENSE-2.0 - ChibiOS/RT is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program. If not, see . + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. */ #ifndef _TESTMTX_H_ diff --git a/test/testpools.c b/test/testpools.c index f0b196ab7..6515b256f 100644 --- a/test/testpools.c +++ b/test/testpools.c @@ -1,21 +1,17 @@ /* - ChibiOS/RT - Copyright (C) 2006,2007,2008,2009,2010, - 2011,2012,2013 Giovanni Di Sirio. + ChibiOS/RT - Copyright (C) 2006-2013 Giovanni Di Sirio - This file is part of ChibiOS/RT. + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at - ChibiOS/RT is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 3 of the License, or - (at your option) any later version. + http://www.apache.org/licenses/LICENSE-2.0 - ChibiOS/RT is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program. If not, see . + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. */ #include "ch.h" diff --git a/test/testpools.h b/test/testpools.h index da483d1dc..3fe4ed0f6 100644 --- a/test/testpools.h +++ b/test/testpools.h @@ -1,21 +1,17 @@ /* - ChibiOS/RT - Copyright (C) 2006,2007,2008,2009,2010, - 2011,2012,2013 Giovanni Di Sirio. + ChibiOS/RT - Copyright (C) 2006-2013 Giovanni Di Sirio - This file is part of ChibiOS/RT. + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at - ChibiOS/RT is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 3 of the License, or - (at your option) any later version. + http://www.apache.org/licenses/LICENSE-2.0 - ChibiOS/RT is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program. If not, see . + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. */ #ifndef _TESTPOOLS_H_ diff --git a/test/testqueues.c b/test/testqueues.c index 8ec668f8c..7f682ef8e 100644 --- a/test/testqueues.c +++ b/test/testqueues.c @@ -1,21 +1,17 @@ /* - ChibiOS/RT - Copyright (C) 2006,2007,2008,2009,2010, - 2011,2012,2013 Giovanni Di Sirio. + ChibiOS/RT - Copyright (C) 2006-2013 Giovanni Di Sirio - This file is part of ChibiOS/RT. + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at - ChibiOS/RT is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 3 of the License, or - (at your option) any later version. + http://www.apache.org/licenses/LICENSE-2.0 - ChibiOS/RT is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program. If not, see . + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. */ #include "ch.h" diff --git a/test/testqueues.h b/test/testqueues.h index a61ce047a..fdfbc4359 100644 --- a/test/testqueues.h +++ b/test/testqueues.h @@ -1,21 +1,17 @@ /* - ChibiOS/RT - Copyright (C) 2006,2007,2008,2009,2010, - 2011,2012,2013 Giovanni Di Sirio. + ChibiOS/RT - Copyright (C) 2006-2013 Giovanni Di Sirio - This file is part of ChibiOS/RT. + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at - ChibiOS/RT is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 3 of the License, or - (at your option) any later version. + http://www.apache.org/licenses/LICENSE-2.0 - ChibiOS/RT is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program. If not, see . + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. */ #ifndef _TESTQUEUES_H_ diff --git a/test/testsem.c b/test/testsem.c index 7e32e8c50..d4b990797 100644 --- a/test/testsem.c +++ b/test/testsem.c @@ -1,21 +1,17 @@ /* - ChibiOS/RT - Copyright (C) 2006,2007,2008,2009,2010, - 2011,2012,2013 Giovanni Di Sirio. + ChibiOS/RT - Copyright (C) 2006-2013 Giovanni Di Sirio - This file is part of ChibiOS/RT. + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at - ChibiOS/RT is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 3 of the License, or - (at your option) any later version. + http://www.apache.org/licenses/LICENSE-2.0 - ChibiOS/RT is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program. If not, see . + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. */ #include "ch.h" diff --git a/test/testsem.h b/test/testsem.h index 93dfcb772..94a8bfca8 100644 --- a/test/testsem.h +++ b/test/testsem.h @@ -1,21 +1,17 @@ /* - ChibiOS/RT - Copyright (C) 2006,2007,2008,2009,2010, - 2011,2012,2013 Giovanni Di Sirio. + ChibiOS/RT - Copyright (C) 2006-2013 Giovanni Di Sirio - This file is part of ChibiOS/RT. + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at - ChibiOS/RT is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 3 of the License, or - (at your option) any later version. + http://www.apache.org/licenses/LICENSE-2.0 - ChibiOS/RT is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program. If not, see . + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. */ #ifndef _TESTSEM_H_ diff --git a/test/testthd.c b/test/testthd.c index a9ec41eaf..35b413acf 100644 --- a/test/testthd.c +++ b/test/testthd.c @@ -1,21 +1,17 @@ /* - ChibiOS/RT - Copyright (C) 2006,2007,2008,2009,2010, - 2011,2012,2013 Giovanni Di Sirio. + ChibiOS/RT - Copyright (C) 2006-2013 Giovanni Di Sirio - This file is part of ChibiOS/RT. + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at - ChibiOS/RT is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 3 of the License, or - (at your option) any later version. + http://www.apache.org/licenses/LICENSE-2.0 - ChibiOS/RT is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program. If not, see . + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. */ #include "ch.h" diff --git a/test/testthd.h b/test/testthd.h index 8bcf60712..f1e3a9475 100644 --- a/test/testthd.h +++ b/test/testthd.h @@ -1,21 +1,17 @@ /* - ChibiOS/RT - Copyright (C) 2006,2007,2008,2009,2010, - 2011,2012,2013 Giovanni Di Sirio. + ChibiOS/RT - Copyright (C) 2006-2013 Giovanni Di Sirio - This file is part of ChibiOS/RT. + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at - ChibiOS/RT is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 3 of the License, or - (at your option) any later version. + http://www.apache.org/licenses/LICENSE-2.0 - ChibiOS/RT is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program. If not, see . + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. */ #ifndef _TESTRDY_H_ -- cgit v1.2.3