From c2ffa54ce115fa017ca086bd82245783d0619304 Mon Sep 17 00:00:00 2001 From: Giovanni Di Sirio Date: Sat, 16 Jan 2016 11:31:20 +0000 Subject: [PATCH] Fixed bug #692. git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@8763 35acf78f-673a-0410-8e92-d51de3d6d3f4 --- readme.txt | 2 ++ test/nil/test_root.c | 6 ++++++ test/nil/test_sequence_002.c | 16 +++++++++------- 3 files changed, 17 insertions(+), 7 deletions(-) diff --git a/readme.txt b/readme.txt index 69234d74d..7a4c9481d 100644 --- a/readme.txt +++ b/readme.txt @@ -76,6 +76,8 @@ - RT: Removed the p_msg field from the thread_t structure saving a msg_t-sized field from the structure. Messages now use a new field into the p_u union. Now synchronous messages are even faster. +- NIL: Fixed NIL test suite calls I and S functions outside critical zone + (bug #692)(backported to 3.0.5 and 16.1.1). - NIL: Fixed protocol violation in NIL OSAL (bug #691)(backported to 3.0.5 and 16.1.1). - HAL: Fixed error in HAL buffer queues (bug #689)(backported to 16.1.1). diff --git a/test/nil/test_root.c b/test/nil/test_root.c index 3c79f46c7..12ae7ef52 100644 --- a/test/nil/test_root.c +++ b/test/nil/test_root.c @@ -51,7 +51,11 @@ thread_reference_t gtr1; */ THD_WORKING_AREA(wa_test_support, 128); THD_FUNCTION(test_support, arg) { +#if NIL_CFG_USE_EVENTS == TRUE thread_t *tp = (thread_t *)arg; +#else + (void)arg; +#endif /* Initializing global resources.*/ chSemObjectInit(&gsem1, 0); @@ -64,7 +68,9 @@ THD_FUNCTION(test_support, arg) { chSemSignalI(&gsem1); chSemResetI(&gsem2, 0); chThdResumeI(>r1, MSG_OK); +#if NIL_CFG_USE_EVENTS == TRUE chEvtSignalI(tp, 0x55); +#endif chSchRescheduleS(); chSysUnlock(); diff --git a/test/nil/test_sequence_002.c b/test/nil/test_sequence_002.c index 0cf582fca..7b1d41d64 100644 --- a/test/nil/test_sequence_002.c +++ b/test/nil/test_sequence_002.c @@ -291,7 +291,9 @@ static void test_002_004_execute(void) { and the state of the reference are tested.*/ test_set_step(1); { + chSysLock(); msg = chThdSuspendTimeoutS(>r1, TIME_INFINITE); + chSysUnlock(); test_assert(NULL == gtr1, "not NULL"); test_assert(MSG_OK == msg, @@ -303,8 +305,10 @@ static void test_002_004_execute(void) { and the state of the reference are tested.*/ test_set_step(2); { + chSysLock(); time = chVTGetSystemTimeX(); msg = chThdSuspendTimeoutS(&tr1, MS2ST(1000)); + chSysUnlock(); test_assert_time_window(time + MS2ST(1000), time + MS2ST(1000) + 1, "out of time window"); @@ -323,7 +327,7 @@ static const testcase_t test_002_004 = { }; #endif /* TRUE */ -#if TRUE || defined(__DOXYGEN__) +#if (NIL_CFG_USE_EVENTS == TRUE) || defined(__DOXYGEN__) /** * @page test_002_005 Events functionality * @@ -362,7 +366,7 @@ static void test_002_005_execute(void) { test_set_step(1); { time = chVTGetSystemTimeX(); - chEvtSignalI(chThdGetSelfX(), 0x55); + chEvtSignal(chThdGetSelfX(), 0x55); events = chEvtWaitAnyTimeout(ALL_EVENTS, MS2ST(1000)); test_assert((eventmask_t)0 != events, "timed out"); @@ -388,10 +392,8 @@ static void test_002_005_execute(void) { wakeup the thread, the function must return because timeout.*/ test_set_step(3); { - chSysLock(); time = chVTGetSystemTimeX(); - events = chEvtWaitAnyTimeoutS(0, MS2ST(1000)); - chSysUnlock(); + events = chEvtWaitAnyTimeout(0, MS2ST(1000)); test_assert_time_window(time + MS2ST(1000), time + MS2ST(1000) + 1, "out of time window"); @@ -406,7 +408,7 @@ static const testcase_t test_002_005 = { NULL, test_002_005_execute }; -#endif /* TRUE */ +#endif /* NIL_CFG_USE_EVENTS == TRUE */ /**************************************************************************** * Exported data. @@ -428,7 +430,7 @@ const testcase_t * const test_sequence_002[] = { #if TRUE || defined(__DOXYGEN__) &test_002_004, #endif -#if TRUE || defined(__DOXYGEN__) +#if (NIL_CFG_USE_EVENTS == TRUE) || defined(__DOXYGEN__) &test_002_005, #endif NULL