aboutsummaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
authorGiovanni Di Sirio <gdisirio@gmail.com>2016-03-31 15:07:56 +0000
committerGiovanni Di Sirio <gdisirio@gmail.com>2016-03-31 15:07:56 +0000
commite47e9096bd7c396d1a3cef214fb2e3de5c43c64f (patch)
treeec48587da5b242bfbc9ec17567478c03132f66fb /test
parente783e741f5951c0907ce0debec86cd266899a185 (diff)
downloadChibiOS-e47e9096bd7c396d1a3cef214fb2e3de5c43c64f.tar.gz
ChibiOS-e47e9096bd7c396d1a3cef214fb2e3de5c43c64f.tar.bz2
ChibiOS-e47e9096bd7c396d1a3cef214fb2e3de5c43c64f.zip
git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@9191 35acf78f-673a-0410-8e92-d51de3d6d3f4
Diffstat (limited to 'test')
-rw-r--r--test/rt/configuration.xml56
-rw-r--r--test/rt/source/test/test_sequence_005.c22
2 files changed, 51 insertions, 27 deletions
diff --git a/test/rt/configuration.xml b/test/rt/configuration.xml
index a87534371..cfeff88f4 100644
--- a/test/rt/configuration.xml
+++ b/test/rt/configuration.xml
@@ -1341,6 +1341,7 @@ static THD_FUNCTION(thread1, p) {
chMtxUnlock(&m1);
}
+#if CH_DBG_THREADS_PROFILING || defined(__DOXYGEN__)
/* Low priority thread */
static THD_FUNCTION(thread2L, p) {
@@ -1427,6 +1428,7 @@ static THD_FUNCTION(thread3HH, p) {
chMtxUnlock(&m2);
test_emit_token('A');
}
+#endif /* CH_DBG_THREADS_PROFILING */
static THD_FUNCTION(thread4A, p) {
@@ -1562,7 +1564,7 @@ test_assert_sequence("ABCDE", "invalid sequence");]]></value>
<value>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 reach their goal in increasing priority order by rearranging their priorities in order to avoid the priority inversion trap.</value>
</description>
<condition>
- <value />
+ <value>CH_DBG_THREADS_PROFILING</value>
</condition>
<various_code>
<setup_code>
@@ -1624,7 +1626,7 @@ test_assert_sequence("ABC", "invalid sequence");]]></value>
<value>Five threads are involved in the complex priority inversion scenario, the priority inheritance algorithm is tested for depths greater than one. 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.</value>
</description>
<condition>
- <value />
+ <value>CH_DBG_THREADS_PROFILING</value>
</condition>
<various_code>
<setup_code>
@@ -2805,11 +2807,11 @@ test_wait_threads();]]></value>
<value />
</tags>
<code>
- <value><![CDATA[m = chEvtWaitOneTimeout(ALL_EVENTS, TIME_IMMEDIATE);
-test_assert(m == 0, "spurious event");
-m = chEvtWaitAnyTimeout(ALL_EVENTS, TIME_IMMEDIATE);
-test_assert(m == 0, "spurious event");
-m = chEvtWaitAllTimeout(ALL_EVENTS, TIME_IMMEDIATE);
+ <value><![CDATA[m = chEvtWaitOneTimeout(ALL_EVENTS, TIME_IMMEDIATE);
+test_assert(m == 0, "spurious event");
+m = chEvtWaitAnyTimeout(ALL_EVENTS, TIME_IMMEDIATE);
+test_assert(m == 0, "spurious event");
+m = chEvtWaitAllTimeout(ALL_EVENTS, TIME_IMMEDIATE);
test_assert(m == 0, "spurious event");]]></value>
</code>
</step>
@@ -2821,11 +2823,11 @@ test_assert(m == 0, "spurious event");]]></value>
<value />
</tags>
<code>
- <value><![CDATA[m = chEvtWaitOneTimeout(ALL_EVENTS, MS2ST(50));
-test_assert(m == 0, "spurious event");
-m = chEvtWaitAnyTimeout(ALL_EVENTS, MS2ST(50));
-test_assert(m == 0, "spurious event");
-m = chEvtWaitAllTimeout(ALL_EVENTS, MS2ST(50));
+ <value><![CDATA[m = chEvtWaitOneTimeout(ALL_EVENTS, MS2ST(50));
+test_assert(m == 0, "spurious event");
+m = chEvtWaitAnyTimeout(ALL_EVENTS, MS2ST(50));
+test_assert(m == 0, "spurious event");
+m = chEvtWaitAllTimeout(ALL_EVENTS, MS2ST(50));
test_assert(m == 0, "spurious event");]]></value>
</code>
</step>
@@ -2843,16 +2845,16 @@ test_assert(m == 0, "spurious event");]]></value>
</condition>
<various_code>
<setup_code>
- <value><![CDATA[chEvtGetAndClearEvents(ALL_EVENTS);
-chEvtObjectInit(&es1);
+ <value><![CDATA[chEvtGetAndClearEvents(ALL_EVENTS);
+chEvtObjectInit(&es1);
chEvtObjectInit(&es2);]]></value>
</setup_code>
<teardown_code>
<value />
</teardown_code>
<local_variables>
- <value><![CDATA[eventmask_t m;
-event_listener_t el1, el2;
+ <value><![CDATA[eventmask_t m;
+event_listener_t el1, el2;
systime_t target_time;]]></value>
</local_variables>
</various_code>
@@ -2865,7 +2867,7 @@ systime_t target_time;]]></value>
<value />
</tags>
<code>
- <value><![CDATA[chEvtRegisterMask(&es1, &el1, 1);
+ <value><![CDATA[chEvtRegisterMask(&es1, &el1, 1);
chEvtRegisterMask(&es2, &el2, 4);]]></value>
</code>
</step>
@@ -2877,8 +2879,8 @@ chEvtRegisterMask(&es2, &el2, 4);]]></value>
<value />
</tags>
<code>
- <value><![CDATA[target_time = test_wait_tick() + MS2ST(50);
-threads[0] = chThdCreateStatic(wa[0], WA_SIZE, chThdGetPriorityX() - 1,
+ <value><![CDATA[target_time = test_wait_tick() + MS2ST(50);
+threads[0] = chThdCreateStatic(wa[0], WA_SIZE, chThdGetPriorityX() - 1,
evt_thread7, "A");]]></value>
</code>
</step>
@@ -2890,11 +2892,11 @@ threads[0] = chThdCreateStatic(wa[0], WA_SIZE, chThdGetPriorityX() - 1,
<value />
</tags>
<code>
- <value><![CDATA[m = chEvtWaitAll(5);
-test_assert_time_window(target_time, target_time + ALLOWED_DELAY,
- "out of time window");
-m = chEvtGetAndClearEvents(ALL_EVENTS);
-test_assert(m == 0, "stuck event");
+ <value><![CDATA[m = chEvtWaitAll(5);
+test_assert_time_window(target_time, target_time + ALLOWED_DELAY,
+ "out of time window");
+m = chEvtGetAndClearEvents(ALL_EVENTS);
+test_assert(m == 0, "stuck event");
test_wait_threads();]]></value>
</code>
</step>
@@ -2906,9 +2908,9 @@ test_wait_threads();]]></value>
<value />
</tags>
<code>
- <value><![CDATA[chEvtUnregister(&es1, &el1);
-chEvtUnregister(&es2, &el2);
-test_assert(!chEvtIsListeningI(&es1), "stuck listener");
+ <value><![CDATA[chEvtUnregister(&es1, &el1);
+chEvtUnregister(&es2, &el2);
+test_assert(!chEvtIsListeningI(&es1), "stuck listener");
test_assert(!chEvtIsListeningI(&es2), "stuck listener");]]></value>
</code>
</step>
diff --git a/test/rt/source/test/test_sequence_005.c b/test/rt/source/test/test_sequence_005.c
index ebe7b79b3..7c09d3662 100644
--- a/test/rt/source/test/test_sequence_005.c
+++ b/test/rt/source/test/test_sequence_005.c
@@ -87,6 +87,7 @@ static THD_FUNCTION(thread1, p) {
chMtxUnlock(&m1);
}
+#if CH_DBG_THREADS_PROFILING || defined(__DOXYGEN__)
/* Low priority thread */
static THD_FUNCTION(thread2L, p) {
@@ -173,6 +174,7 @@ static THD_FUNCTION(thread3HH, p) {
chMtxUnlock(&m2);
test_emit_token('A');
}
+#endif /* CH_DBG_THREADS_PROFILING */
static THD_FUNCTION(thread4A, p) {
@@ -297,6 +299,7 @@ static const testcase_t test_005_001 = {
test_005_001_execute
};
+#if (CH_DBG_THREADS_PROFILING) || defined(__DOXYGEN__)
/**
* @page test_005_002 [5.2] Priority inheritance, simple case
*
@@ -308,6 +311,12 @@ static const testcase_t test_005_001 = {
* order by rearranging their priorities in order to avoid the priority
* inversion trap.
*
+ * <h2>Conditions</h2>
+ * This test is only executed if the following preprocessor condition
+ * evaluates to true:
+ * - CH_DBG_THREADS_PROFILING
+ * .
+ *
* <h2>Test Steps</h2>
* - [5.2.1] Getting the system time for test duration measurement.
* - [5.2.2] The three contenders threads are created and let run
@@ -358,7 +367,9 @@ static const testcase_t test_005_002 = {
NULL,
test_005_002_execute
};
+#endif /* CH_DBG_THREADS_PROFILING */
+#if (CH_DBG_THREADS_PROFILING) || defined(__DOXYGEN__)
/**
* @page test_005_003 [5.3] Priority inheritance, complex case
*
@@ -369,6 +380,12 @@ static const testcase_t test_005_002 = {
* operations in increasing priority order by rearranging their
* priorities in order to avoid the priority inversion trap.
*
+ * <h2>Conditions</h2>
+ * This test is only executed if the following preprocessor condition
+ * evaluates to true:
+ * - CH_DBG_THREADS_PROFILING
+ * .
+ *
* <h2>Test Steps</h2>
* - [5.3.1] Getting the system time for test duration measurement.
* - [5.3.2] The five contenders threads are created and let run
@@ -422,6 +439,7 @@ static const testcase_t test_005_003 = {
NULL,
test_005_003_execute
};
+#endif /* CH_DBG_THREADS_PROFILING */
/**
* @page test_005_004 [5.4] Priority return verification
@@ -1012,8 +1030,12 @@ static const testcase_t test_005_009 = {
*/
const testcase_t * const test_sequence_005[] = {
&test_005_001,
+#if (CH_DBG_THREADS_PROFILING) || defined(__DOXYGEN__)
&test_005_002,
+#endif
+#if (CH_DBG_THREADS_PROFILING) || defined(__DOXYGEN__)
&test_005_003,
+#endif
&test_005_004,
#if (!CH_CFG_USE_MUTEXES_RECURSIVE) || defined(__DOXYGEN__)
&test_005_005,