[rtems commit] smptests: Fix warnings
Sebastian Huber
sebh at rtems.org
Fri Feb 3 11:35:26 UTC 2017
Module: rtems
Branch: master
Commit: 239dd35fcea5c1572436820ec7f6956500110f0e
Changeset: http://git.rtems.org/rtems/commit/?id=239dd35fcea5c1572436820ec7f6956500110f0e
Author: Sebastian Huber <sebastian.huber at embedded-brains.de>
Date: Fri Feb 3 11:24:30 2017 +0100
smptests: Fix warnings
---
testsuites/smptests/smp03/tasks.c | 2 +-
testsuites/smptests/smp08/init.c | 4 +--
testsuites/smptests/smp08/tasks.c | 8 ++----
testsuites/smptests/smpschedaffinity05/init.c | 41 ++++++++++++++-------------
4 files changed, 27 insertions(+), 28 deletions(-)
diff --git a/testsuites/smptests/smp03/tasks.c b/testsuites/smptests/smp03/tasks.c
index 3d2afce..8d5ac4a 100644
--- a/testsuites/smptests/smp03/tasks.c
+++ b/testsuites/smptests/smp03/tasks.c
@@ -20,7 +20,7 @@ rtems_task Test_task(
char task_name[5];
/* Show that this task is running on cpu X */
- sprintf( task_name, "TA%" PRIu32, task_index );
+ sprintf( task_name, "TA%" PRIuPTR, task_index );
PrintTaskInfo( task_name );
TaskRan[task_index] = true;
diff --git a/testsuites/smptests/smp08/init.c b/testsuites/smptests/smp08/init.c
index d35f518..8500392 100644
--- a/testsuites/smptests/smp08/init.c
+++ b/testsuites/smptests/smp08/init.c
@@ -43,7 +43,7 @@ rtems_task Init(
{
rtems_status_code status;
rtems_time_of_day time;
- int i;
+ uint32_t i;
char ch[4];
rtems_id id;
@@ -78,7 +78,7 @@ rtems_task Init(
for ( i=1; i <= rtems_get_processor_count() *3; i++ ) {
- sprintf(ch, "%02" PRId32, i );
+ sprintf(ch, "%02" PRIu32, i );
status = rtems_task_create(
rtems_build_name( 'T', 'A', ch[0], ch[1] ),
2,
diff --git a/testsuites/smptests/smp08/tasks.c b/testsuites/smptests/smp08/tasks.c
index deda4bf..40a097d 100644
--- a/testsuites/smptests/smp08/tasks.c
+++ b/testsuites/smptests/smp08/tasks.c
@@ -21,7 +21,6 @@ rtems_task Test_task(
rtems_time_of_day time;
uint32_t task_index;
rtems_status_code status;
- uint32_t cpu_num;
char name[5];
char *p;
@@ -30,13 +29,11 @@ rtems_task Test_task(
rtems_test_assert( p != NULL );
status = rtems_task_ident( RTEMS_SELF, RTEMS_SEARCH_ALL_NODES, &tid );
+ rtems_test_assert( status == RTEMS_SUCCESSFUL );
task_index = task_number( tid );
for ( ; ; ) {
-
- /* Get the CPU Number */
- cpu_num = rtems_get_current_processor();
-
status = rtems_clock_get_tod( &time );
+ rtems_test_assert( status == RTEMS_SUCCESSFUL );
if ( time.second >= 35 ) {
TEST_END();
rtems_test_exit( 0 );
@@ -45,5 +42,6 @@ rtems_task Test_task(
PrintTaskInfo( p, &time );
status = rtems_task_wake_after(
task_index * 5 * rtems_clock_get_ticks_per_second() );
+ rtems_test_assert( status == RTEMS_SUCCESSFUL );
}
}
diff --git a/testsuites/smptests/smpschedaffinity05/init.c b/testsuites/smptests/smpschedaffinity05/init.c
index 2ab828c..be0aa31 100644
--- a/testsuites/smptests/smpschedaffinity05/init.c
+++ b/testsuites/smptests/smpschedaffinity05/init.c
@@ -16,7 +16,7 @@
* with affinity are at priority 4, so the affinity task
* on the core init is running on will preempt it.
*
- * Test tasks run and delete themselves.
+ * Test tasks run and delete themselves.
* Init task never blocks.
*/
@@ -25,6 +25,7 @@
#endif
#include <rtems.h>
+#include <inttypes.h>
#include "tmacros.h"
@@ -52,7 +53,7 @@ static struct task_data_t task_data[TASK_COUNT] = {
};
rtems_id task_sem;
-
+
static void verify_tasks(void);
/*
@@ -60,7 +61,7 @@ static void verify_tasks(void);
* processor.
*/
static void test_delay(int ticks)
-{
+{
rtems_interval start, stop;
start = rtems_clock_get_ticks_since_boot();
do {
@@ -86,9 +87,9 @@ static void verify_tasks(void)
int i;
printf("Verify Tasks Ran\n");
-
+
while( rtems_semaphore_obtain (task_sem, RTEMS_NO_WAIT, 0) != RTEMS_SUCCESSFUL );
-
+
/* Set Init task data */
task_data[0].ran = true;
task_data[0].actual_cpu = rtems_get_current_processor();
@@ -96,15 +97,15 @@ static void verify_tasks(void)
/* Verify all tasks */
for (i = 0; i < NUM_CPUS; i++) {
if (i==0)
- printf("Init(%d): ran=%d expected=%d actual=%d\n",
+ printf("Init(%" PRIu32 "): ran=%d expected=%d actual=%d\n",
task_data[i].priority,
task_data[i].ran,
task_data[i].expected_cpu,
task_data[i].actual_cpu
);
else
- printf( "TA0%d(%d): ran=%d expected=%d actual=%d\n",
- i,
+ printf( "TA0%d(%" PRIu32 "): ran=%d expected=%d actual=%d\n",
+ i,
task_data[i].priority,
task_data[i].ran,
task_data[i].expected_cpu,
@@ -142,11 +143,11 @@ static void test(void)
task_data[0].id = rtems_task_self();
printf("Create Semaphore\n");
- sc = rtems_semaphore_create(
+ sc = rtems_semaphore_create(
rtems_build_name('S', 'E', 'M', '0'),
1, /* initial count = 1 */
RTEMS_BINARY_SEMAPHORE |
- RTEMS_PRIORITY |
+ RTEMS_PRIORITY |
RTEMS_PRIORITY_CEILING,
0,
&task_sem
@@ -166,18 +167,18 @@ static void test(void)
&task_data[ i ].id
);
rtems_test_assert(sc == RTEMS_SUCCESSFUL);
-
- sc = rtems_task_set_affinity(
- task_data[ i ].id,
- size,
+
+ sc = rtems_task_set_affinity(
+ task_data[ i ].id,
+ size,
&task_data[i].cpuset
);
rtems_test_assert(sc == RTEMS_SUCCESSFUL);
-
+
printf(
- "Start TA%d at priority %d on cpu %d\n",
- i,
- task_data[i].priority,
+ "Start TA%d at priority %" PRIu32 " on cpu %d\n",
+ i,
+ task_data[i].priority,
task_data[i].expected_cpu
);
sc = rtems_task_start( task_data[ i ].id, task, i );
@@ -186,12 +187,12 @@ static void test(void)
/* spin for 100 ticks */
test_delay(100);
-
+
verify_tasks();
i = TASK_COUNT - 1;
task_data[ i ].priority = 4;
- printf("Set TA%d priority %d\n", i,task_data[i].priority );
+ printf("Set TA%d priority %" PRIu32 "\n", i,task_data[i].priority );
sc = rtems_task_set_priority(
task_data[ i ].id,
task_data[ i ].priority,
More information about the vc
mailing list