testsuite: Use printk for all test output where possible.

- Remove the printf support leaving the direct printk support configured
  with TESTS_USE_PRINTK and all other output goes via a buffered vsniprintf
  call to printk.
- Control the test's single init for functions and global data with
  TEST_INIT and not CONFIGURE_INIT. They are now separate.

Updates #3170.
This commit is contained in:
Chris Johns
2017-10-23 16:25:45 +11:00
parent eeb8d8387f
commit 98c6d50145
555 changed files with 1349 additions and 342 deletions
+2
View File
@@ -16,6 +16,8 @@
#include "config.h"
#endif
#define TEST_INIT
#include "tmacros.h"
const char rtems_test_name[] = "DHRYSTONE";
+2
View File
@@ -16,6 +16,8 @@
#include "config.h"
#endif
#define TEST_INIT
#include "tmacros.h"
const char rtems_test_name[] = "LINPACK";
+2
View File
@@ -16,6 +16,8 @@
#include "config.h"
#endif
#define TEST_INIT
#include "tmacros.h"
const char rtems_test_name[] = "WHETSTONE";
+2
View File
@@ -16,6 +16,8 @@
#include "config.h"
#endif
#define TEST_INIT
#include "tmacros.h"
#include <sys/stat.h>
+2
View File
@@ -16,6 +16,8 @@
#include "config.h"
#endif
#define TEST_INIT
#include <sys/stat.h>
#include <sys/ioctl.h>
#include <sys/uio.h>
@@ -16,6 +16,8 @@
#include "config.h"
#endif
#define TEST_INIT
#include "tmacros.h"
#include <fcntl.h>
+2
View File
@@ -17,6 +17,8 @@
#endif
#define TEST_INIT
#include "tmacros.h"
#include <errno.h>
+2
View File
@@ -16,6 +16,8 @@
#include "config.h"
#endif
#define TEST_INIT
#include <sys/stat.h>
#include <fcntl.h>
#include <stdlib.h>
+2
View File
@@ -16,6 +16,8 @@
#include "config.h"
#endif
#define TEST_INIT
#include "tmacros.h"
#include <sys/stat.h>
+2
View File
@@ -16,6 +16,8 @@
#include "config.h"
#endif
#define TEST_INIT
#include "tmacros.h"
#include <fcntl.h>
#include <rtems/dosfs.h>
+2
View File
@@ -16,6 +16,8 @@
#include "config.h"
#endif
#define TEST_INIT
#include "tmacros.h"
#include <sys/types.h>
+2
View File
@@ -16,6 +16,8 @@
#include "config.h"
#endif
#define TEST_INIT
#define TESTS_USE_PRINTK
#include "tmacros.h"
+2
View File
@@ -16,6 +16,8 @@
#include "config.h"
#endif
#define TEST_INIT
#include "tmacros.h"
#include <sys/stat.h>
+2
View File
@@ -16,6 +16,8 @@
#include "config.h"
#endif
#define TEST_INIT
#define TESTS_USE_PRINTK
#include "tmacros.h"
@@ -16,6 +16,8 @@
#include "config.h"
#endif
#define TEST_INIT
#include "tmacros.h"
#include <sys/stat.h>
+2
View File
@@ -16,6 +16,8 @@
#include "config.h"
#endif
#define TEST_INIT
#define TESTS_USE_PRINTK
#include "tmacros.h"
+2
View File
@@ -16,6 +16,8 @@
#include "config.h"
#endif
#define TEST_INIT
#include "tmacros.h"
#include <sys/stat.h>
@@ -1,3 +1,5 @@
#define TEST_INIT
/*
* COPYRIGHT (c) 1989-2011.
* On-Line Applications Research Corporation (OAR).
@@ -12,6 +12,8 @@
* http://www.rtems.org/license/LICENSE.
*/
#define TEST_INIT
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
@@ -1,3 +1,5 @@
#define TEST_INIT
/*
* COPYRIGHT (c) 1989-2011.
* On-Line Applications Research Corporation (OAR).
@@ -7,6 +7,8 @@
* http://www.rtems.org/license/LICENSE.
*/
#define TEST_INIT
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
@@ -7,6 +7,8 @@
* http://www.rtems.org/license/LICENSE.
*/
#define TEST_INIT
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
+2
View File
@@ -24,6 +24,8 @@
#include "config.h"
#endif
#define TEST_INIT
#include <sys/stat.h>
#include <stdio.h>
#include <fcntl.h>
+2
View File
@@ -24,6 +24,8 @@
#include "config.h"
#endif
#define TEST_INIT
#define TESTS_USE_PRINTK
#include "tmacros.h"
+2
View File
@@ -24,6 +24,8 @@
#include "config.h"
#endif
#define TEST_INIT
#define TESTS_USE_PRINTK
#include "tmacros.h"
+2
View File
@@ -24,6 +24,8 @@
#include "config.h"
#endif
#define TEST_INIT
#define TESTS_USE_PRINTK
#include "tmacros.h"
+2
View File
@@ -24,6 +24,8 @@
#include "config.h"
#endif
#define TEST_INIT
#define TESTS_USE_PRINTK
#include "tmacros.h"
#include <stdarg.h>
File diff suppressed because it is too large Load Diff
+19 -17
View File
@@ -23,12 +23,14 @@
#include "config.h"
#endif
#define TEST_INIT
#include <sys/ioctl.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
#define TESTS_USE_PRINTK
#define TESTS_USE_PRINTF
#include "tmacros.h"
#include <rtems.h>
@@ -88,21 +90,21 @@ static void task_low(rtems_task_argument arg)
rtems_status_code sc = RTEMS_SUCCESSFUL;
rtems_bdbuf_buffer *bd = NULL;
printk("L: try access: 0\n");
printf("L: try access: 0\n");
sc = rtems_bdbuf_get(dd, 0, &bd);
ASSERT_SC(sc);
printk("L: access: 0\n");
printf("L: access: 0\n");
rtems_test_assert(bd->group->bds_per_group == 2);
printk("L: release: 0\n");
printf("L: release: 0\n");
sc = rtems_bdbuf_release(bd);
ASSERT_SC(sc);
printk("L: release done: 0\n");
printf("L: release done: 0\n");
TEST_END();
@@ -114,21 +116,21 @@ static void task_mid(rtems_task_argument arg)
rtems_status_code sc = RTEMS_SUCCESSFUL;
rtems_bdbuf_buffer *bd = NULL;
printk("M: try access: 0\n");
printf("M: try access: 0\n");
sc = rtems_bdbuf_get(dd, 0, &bd);
ASSERT_SC(sc);
printk("M: access: 0\n");
printf("M: access: 0\n");
rtems_test_assert(bd->group->bds_per_group == 1);
printk("M: release: 0\n");
printf("M: release: 0\n");
sc = rtems_bdbuf_release(bd);
ASSERT_SC(sc);
printk("M: release done: 0\n");
printf("M: release done: 0\n");
rtems_task_delete(RTEMS_SELF);
}
@@ -140,21 +142,21 @@ static void task_high(rtems_task_argument arg)
change_block_size();
printk("H: try access: 0\n");
printf("H: try access: 0\n");
sc = rtems_bdbuf_get(dd, 0, &bd);
ASSERT_SC(sc);
printk("H: access: 0\n");
printf("H: access: 0\n");
rtems_test_assert(bd->group->bds_per_group == 1);
printk("H: release: 0\n");
printf("H: release: 0\n");
sc = rtems_bdbuf_release(bd);
ASSERT_SC(sc);
printk("H: release done: 0\n");
printf("H: release done: 0\n");
rtems_task_delete(RTEMS_SELF);
}
@@ -228,12 +230,12 @@ static rtems_task Init(rtems_task_argument argument)
sc = rtems_bdbuf_release(bd);
ASSERT_SC(sc);
printk("I: try access: 0\n");
printf("I: try access: 0\n");
sc = rtems_bdbuf_get(dd, 0, &bd);
ASSERT_SC(sc);
printk("I: access: 0\n");
printf("I: access: 0\n");
sc = rtems_task_set_priority(RTEMS_SELF, PRIORITY_IDLE, &cur_prio);
ASSERT_SC(sc);
@@ -247,12 +249,12 @@ static rtems_task Init(rtems_task_argument argument)
sc = rtems_task_set_priority(RTEMS_SELF, PRIORITY_INIT, &cur_prio);
ASSERT_SC(sc);
printk("I: release: 0\n");
printf("I: release: 0\n");
sc = rtems_bdbuf_release(bd);
ASSERT_SC(sc);
printk("I: release done: 0\n");
printf("I: release done: 0\n");
rtems_task_delete(RTEMS_SELF);
}
+2 -2
View File
@@ -154,7 +154,7 @@ bdbuf_test3_2_thread2(rtems_task_argument arg)
TEST_FAILED();
}
printk("Thread #2 DEBLOCK\n");
printf("Thread #2 DEBLOCK\n");
CONTINUE_MAIN(2);
rc = rtems_bdbuf_release_modified(bd);
@@ -184,7 +184,7 @@ bdbuf_test3_2_thread3(rtems_task_argument arg)
TEST_FAILED();
}
printk("Thread #3 DEBLOCK\n");
printf("Thread #3 DEBLOCK\n");
CONTINUE_MAIN(3);
+2 -2
View File
@@ -165,7 +165,7 @@ bdbuf_test3_3_thread2(rtems_task_argument arg)
TEST_FAILED();
}
printk("Thread #2 DEBLOCK\n");
printf("Thread #2 DEBLOCK\n");
CONTINUE_MAIN(2);
rc = rtems_bdbuf_release(bd);
@@ -195,7 +195,7 @@ bdbuf_test3_3_thread3(rtems_task_argument arg)
TEST_FAILED();
}
printk("Thread #3 DEBLOCK\n");
printf("Thread #3 DEBLOCK\n");
CONTINUE_MAIN(3);
+13 -14
View File
@@ -33,14 +33,14 @@ struct bdbuf_test_descr {
{ bdbuf_test1_3_main },
{ bdbuf_test1_4_main },
{ bdbuf_test1_5_main },
{ bdbuf_test2_1_main },
{ bdbuf_test2_2_main },
{ bdbuf_test3_1_main },
{ bdbuf_test3_2_main },
{ bdbuf_test3_3_main },
{ bdbuf_test4_1_main },
{ bdbuf_test4_2_main },
{ bdbuf_test4_3_main },
@@ -88,7 +88,7 @@ bdbuf_test_start_aux_task(rtems_name name,
printf("Failed to create task\n");
return rc;
}
rc = rtems_task_start(task_id, entry_point, arg);
if (rc != RTEMS_SUCCESSFUL)
{
@@ -126,7 +126,7 @@ run_bdbuf_tests()
if (sc != RTEMS_SUCCESSFUL)
{
printk("Failed to create message queue for test task: %u\n", sc);
printf("Failed to create message queue for test task: %u\n", sc);
return;
}
@@ -134,14 +134,14 @@ run_bdbuf_tests()
sc = rtems_io_register_driver(0, &testdisk, &major);
if (sc != RTEMS_SUCCESSFUL)
{
printk("Failed to register TEST DEVICE: %d\n", sc);
printf("Failed to register TEST DEVICE: %d\n", sc);
return;
}
test_dev = -1;
while ((disk = rtems_disk_next(dev)) != NULL)
{
printk(
printf(
"DEV: %s [%" PRIdrtems_blkdev_bnum "]\n",
disk->name,
disk->size
@@ -185,7 +185,7 @@ run_bdbuf_tests()
&g_test_ctx.test_sync_main[i]);
if (sc != RTEMS_SUCCESSFUL)
{
printk("Failed to create sync sem for test task: %u\n", sc);
printf("Failed to create sync sem for test task: %u\n", sc);
return;
}
}
@@ -197,17 +197,17 @@ run_bdbuf_tests()
&g_test_ctx.test_sync[i]);
if (sc != RTEMS_SUCCESSFUL)
{
printk("Failed to create sync sem for test task #%d: %u\n", i + 1, sc);
printf("Failed to create sync sem for test task #%d: %u\n", i + 1, sc);
return;
}
}
sc = rtems_semaphore_create(rtems_build_name('T', 'S', 'M', 'E'),
0, TEST_SEM_ATTRIBS, 0,
&g_test_ctx.test_end_main);
if (sc != RTEMS_SUCCESSFUL)
{
printk("Failed to create end sync sem for test task: %u\n", sc);
printf("Failed to create end sync sem for test task: %u\n", sc);
return;
}
@@ -249,7 +249,7 @@ bdbuf_test_start_thread(unsigned int idx, rtems_task_entry func)
sc = rtems_task_delete(g_test_ctx.test_task[idx]);
if (sc != RTEMS_SUCCESSFUL)
{
printk("Failed to delete test thread %u in test %s\n",
printf("Failed to delete test thread %u in test %s\n",
idx + 1, g_test_ctx.test_name);
return sc;
}
@@ -275,11 +275,10 @@ bdbuf_test_end()
RTEMS_WAIT, RTEMS_NO_TIMEOUT);
if (sc != RTEMS_SUCCESSFUL)
{
printk("Failed to get a thread stopped\n");
printf("Failed to get a thread stopped\n");
}
g_test_ctx.test_task[i] = OBJECTS_ID_NONE;
}
}
return RTEMS_SUCCESSFUL;
}
+2
View File
@@ -19,6 +19,8 @@
#include "config.h"
#endif
#define TEST_INIT
#include "tmacros.h"
#define CONFIGURE_INIT
+6 -6
View File
@@ -46,19 +46,19 @@ test_disk_ioctl(rtems_disk_device *dd, uint32_t req, void *argp)
r = argp;
printk("DISK_DRV: %s ",
printf("DISK_DRV: %s ",
r->req == RTEMS_BLKDEV_REQ_READ ? "R" :
r->req == RTEMS_BLKDEV_REQ_WRITE ? "W" : "?");
for (i = 0, sg = r->bufs; i < r->bufnum; i++, sg++)
{
printk("[%" PRIu32 "] ", sg->block);
printf("[%" PRIu32 "] ", sg->block);
}
printk("\n");
printf("\n");
break;
}
default:
printk("%s() Unexpected request comes %" PRIu32 "\n",
printf("%s() Unexpected request comes %" PRIu32 "\n",
__FUNCTION__, req);
return -1;
}
@@ -135,7 +135,7 @@ test_disk_initialize(
rc = bdbuf_test_create_drv_rx_queue(&drvq_id);
if (rc != RTEMS_SUCCESSFUL)
{
printk("%s() Failed to create Msg Queue for RX: %u\n",
printf("%s() Failed to create Msg Queue for RX: %u\n",
__FUNCTION__, rc);
return rc;
}
@@ -148,6 +148,6 @@ test_disk_initialize(
return rc;
}
printk("TEST DISK - OK\n");
printf("TEST DISK - OK\n");
return RTEMS_SUCCESSFUL;
}
+2
View File
@@ -24,6 +24,8 @@
#include "config.h"
#endif
#define TEST_INIT
#define TESTS_USE_PRINTK
#include "tmacros.h"
+19 -17
View File
@@ -23,7 +23,9 @@
#include "config.h"
#endif
#define TESTS_USE_PRINTK
#define TEST_INIT
#define TESTS_USE_PRINTF
#include "tmacros.h"
#include <assert.h>
@@ -157,12 +159,12 @@ static rtems_bdbuf_buffer *do_get(char task)
rtems_status_code sc = RTEMS_SUCCESSFUL;
rtems_bdbuf_buffer *bd = NULL;
printk("%c: try get\n", task);
printf("%c: try get\n", task);
sc = rtems_bdbuf_get(dd, 0, &bd);
ASSERT_SC(sc);
printk("%c: get\n", task);
printf("%c: get\n", task);
return bd;
}
@@ -172,7 +174,7 @@ static rtems_bdbuf_buffer *do_get_mod(char task)
rtems_status_code sc = RTEMS_SUCCESSFUL;
rtems_bdbuf_buffer *bd = NULL;
printk("%c: try get modified\n", task);
printf("%c: try get modified\n", task);
sc = rtems_bdbuf_get(dd, 0, &bd);
ASSERT_SC(sc);
@@ -183,7 +185,7 @@ static rtems_bdbuf_buffer *do_get_mod(char task)
sc = rtems_bdbuf_get(dd, 0, &bd);
ASSERT_SC(sc);
printk("%c: get modified\n", task);
printf("%c: get modified\n", task);
return bd;
}
@@ -193,12 +195,12 @@ static rtems_bdbuf_buffer *do_read(char task)
rtems_status_code sc = RTEMS_SUCCESSFUL;
rtems_bdbuf_buffer *bd = NULL;
printk("%c: try read\n", task);
printf("%c: try read\n", task);
sc = rtems_bdbuf_read(dd, 0, &bd);
ASSERT_SC(sc);
printk("%c: read\n", task);
printf("%c: read\n", task);
return bd;
}
@@ -207,41 +209,41 @@ static void do_rel(char task, rtems_bdbuf_buffer *bd)
{
rtems_status_code sc = RTEMS_SUCCESSFUL;
printk("%c: release\n", task);
printf("%c: release\n", task);
sc = rtems_bdbuf_release(bd);
ASSERT_SC(sc);
printk("%c: release done\n", task);
printf("%c: release done\n", task);
}
static void do_rel_mod(char task, rtems_bdbuf_buffer *bd)
{
rtems_status_code sc = RTEMS_SUCCESSFUL;
printk("%c: release modified\n", task);
printf("%c: release modified\n", task);
sc = rtems_bdbuf_release_modified(bd);
ASSERT_SC(sc);
printk("%c: release modified done\n", task);
printf("%c: release modified done\n", task);
}
static void do_sync(char task, rtems_bdbuf_buffer *bd)
{
rtems_status_code sc = RTEMS_SUCCESSFUL;
printk("%c: sync\n", task);
printf("%c: sync\n", task);
sc = rtems_bdbuf_sync(bd);
ASSERT_SC(sc);
printk("%c: sync done\n", task);
printf("%c: sync done\n", task);
}
static void purge(char task)
{
printk("%c: purge\n", task);
printf("%c: purge\n", task);
rtems_bdbuf_purge_dev(dd);
}
@@ -449,7 +451,7 @@ static rtems_task Init(rtems_task_argument argument)
for (i_ac = 0; i_ac < ACCESS_COUNT; ++i_ac) {
for (i_rel = 0; i_rel < RELEASE_COUNT; ++i_rel) {
for (i_w = 0; i_w < WAITER_COUNT; ++i_w) {
printk("test case [access]: %s and %s %s\n", access_assoc_table [i_ac], release_assoc_table [i_rel], waiter_assoc_table [i_w]);
printf("test case [access]: %s and %s %s\n", access_assoc_table [i_ac], release_assoc_table [i_rel], waiter_assoc_table [i_w]);
check_access(access_table [i_ac], release_table [i_rel], waiter_table [i_w]);
}
}
@@ -457,14 +459,14 @@ static rtems_task Init(rtems_task_argument argument)
for (i_rel = 0; i_rel < RELEASE_COUNT; ++i_rel) {
for (i_w = 0; i_w < WAITER_COUNT; ++i_w) {
printk("test case [intermediate]: %s %s\n", release_assoc_table [i_rel], waiter_assoc_table [i_w]);
printf("test case [intermediate]: %s %s\n", release_assoc_table [i_rel], waiter_assoc_table [i_w]);
check_intermediate(release_table [i_rel], waiter_table [i_w]);
}
}
for (i_p = 0; i_p < PURGER_COUNT; ++i_p) {
for (i_w = 0; i_w < WAITER_COUNT; ++i_w) {
printk("test case [transfer]: %s %s\n", purger_assoc_table [i_p], waiter_assoc_table [i_w]);
printf("test case [transfer]: %s %s\n", purger_assoc_table [i_p], waiter_assoc_table [i_w]);
check_transfer(purger_table [i_p], waiter_table [i_w]);
}
}
+2
View File
@@ -24,6 +24,8 @@
#include "config.h"
#endif
#define TEST_INIT
#include "tmacros.h"
#include <sys/stat.h>
+2
View File
@@ -16,6 +16,8 @@
#include "config.h"
#endif
#define TEST_INIT
#include "tmacros.h"
#include <errno.h>
+2
View File
@@ -16,6 +16,8 @@
#include "config.h"
#endif
#define TEST_INIT
#include "tmacros.h"
#include <errno.h>
+2
View File
@@ -16,6 +16,8 @@
#include "config.h"
#endif
#define TEST_INIT
#include "tmacros.h"
#include <errno.h>
+2
View File
@@ -16,6 +16,8 @@
#include "config.h"
#endif
#define TEST_INIT
#include "tmacros.h"
#include <errno.h>
+2
View File
@@ -16,6 +16,8 @@
#include "config.h"
#endif
#define TEST_INIT
#include "tmacros.h"
#include <sys/ioctl.h>
+2
View File
@@ -16,6 +16,8 @@
#include "config.h"
#endif
#define TEST_INIT
#include <rtems/bdbuf.h>
#include "tmacros.h"
+2
View File
@@ -11,6 +11,8 @@
#include "config.h"
#endif
#define TEST_INIT
#include <tmacros.h>
#include <rtems/bspcmdline.h>
+2
View File
@@ -13,6 +13,8 @@
#include "config.h"
#endif
#define TEST_INIT
#include "system.h"
#include <ctype.h>
#include <stdlib.h>
+2
View File
@@ -19,6 +19,8 @@
#include "config.h"
#endif
#define TEST_INIT
#define CONFIGURE_INIT
#include "system.h"
+2
View File
@@ -39,6 +39,8 @@
#include "config.h"
#endif
#define TEST_INIT
#include <crypt.h>
#include <string.h>
+2
View File
@@ -12,6 +12,8 @@
#include "config.h"
#endif
#define TEST_INIT
#define CONFIGURE_INIT
#include "system.h"
@@ -16,6 +16,8 @@
#include "config.h"
#endif
#define TEST_INIT
#include <stdio.h>
#include <bsp.h>
+2
View File
@@ -11,6 +11,8 @@
#include "config.h"
#endif
#define TEST_INIT
#define TESTS_USE_PRINTK
#include <tmacros.h>
#include "test_support.h"

Some files were not shown because too many files have changed in this diff Show More