diff options
author | Giovanni Di Sirio <gdisirio@gmail.com> | 2016-01-16 11:31:20 +0000 |
---|---|---|
committer | Giovanni Di Sirio <gdisirio@gmail.com> | 2016-01-16 11:31:20 +0000 |
commit | c2ffa54ce115fa017ca086bd82245783d0619304 (patch) | |
tree | 9da179a8c50180095a03c9e667794f1fb150042f /test/nil | |
parent | b2b371f231bff1128480459ee47e8c491eff620b (diff) | |
download | ChibiOS-c2ffa54ce115fa017ca086bd82245783d0619304.tar.gz ChibiOS-c2ffa54ce115fa017ca086bd82245783d0619304.tar.bz2 ChibiOS-c2ffa54ce115fa017ca086bd82245783d0619304.zip |
Fixed bug #692.
git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@8763 35acf78f-673a-0410-8e92-d51de3d6d3f4
Diffstat (limited to 'test/nil')
-rw-r--r-- | test/nil/test_root.c | 6 | ||||
-rw-r--r-- | test/nil/test_sequence_002.c | 16 |
2 files changed, 15 insertions, 7 deletions
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
|