mirror of
https://git.rtems.org/rtems-libbsd/
synced 2025-07-24 01:35:05 +08:00
testsuite: Simplify tests
This commit is contained in:
parent
c2f6513a05
commit
fafa9e2716
@ -40,21 +40,11 @@
|
|||||||
#include <machine/rtems-bsd-commands.h>
|
#include <machine/rtems-bsd-commands.h>
|
||||||
|
|
||||||
#include <rtems/libcsupport.h>
|
#include <rtems/libcsupport.h>
|
||||||
#include <rtems/stackchk.h>
|
|
||||||
|
|
||||||
#define TEST_NAME "LIBBSD COMMANDS 1"
|
#define TEST_NAME "LIBBSD COMMANDS 1"
|
||||||
|
|
||||||
#define ARGC(x) (nitems(x) - 1)
|
#define ARGC(x) (nitems(x) - 1)
|
||||||
|
|
||||||
static void
|
|
||||||
set_self_prio(rtems_task_priority prio)
|
|
||||||
{
|
|
||||||
rtems_status_code sc;
|
|
||||||
|
|
||||||
sc = rtems_task_set_priority(RTEMS_SELF, prio, &prio);
|
|
||||||
assert(sc == RTEMS_SUCCESSFUL);
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
static void
|
||||||
test_route_without_if(void)
|
test_route_without_if(void)
|
||||||
{
|
{
|
||||||
@ -270,12 +260,6 @@ test_netstat(void)
|
|||||||
static void
|
static void
|
||||||
test_main(void)
|
test_main(void)
|
||||||
{
|
{
|
||||||
/*
|
|
||||||
* Let other tasks run to complete background work that frees allocated
|
|
||||||
* resources.
|
|
||||||
*/
|
|
||||||
set_self_prio(RTEMS_MAXIMUM_PRIORITY - 1);
|
|
||||||
|
|
||||||
test_route_without_if();
|
test_route_without_if();
|
||||||
test_ifconfig_lo0();
|
test_ifconfig_lo0();
|
||||||
test_route_with_lo0();
|
test_route_with_lo0();
|
||||||
@ -283,10 +267,6 @@ test_main(void)
|
|||||||
test_ping6();
|
test_ping6();
|
||||||
test_netstat();
|
test_netstat();
|
||||||
|
|
||||||
rtems_stack_checker_report_usage_with_plugin(NULL,
|
|
||||||
rtems_printf_plugin);
|
|
||||||
|
|
||||||
puts("*** END OF " TEST_NAME " TEST ***");
|
|
||||||
exit(0);
|
exit(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -6,14 +6,38 @@
|
|||||||
#define RTEMS_BSD_TEST_DEFAULT_INIT_H
|
#define RTEMS_BSD_TEST_DEFAULT_INIT_H
|
||||||
|
|
||||||
#include <bsp.h>
|
#include <bsp.h>
|
||||||
|
#include <assert.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
|
#include <rtems/stackchk.h>
|
||||||
#include <rtems/bsd/bsd.h>
|
#include <rtems/bsd/bsd.h>
|
||||||
|
|
||||||
|
static void default_set_self_prio( rtems_task_priority prio )
|
||||||
|
{
|
||||||
|
rtems_status_code sc;
|
||||||
|
|
||||||
|
sc = rtems_task_set_priority(RTEMS_SELF, prio, &prio);
|
||||||
|
assert(sc == RTEMS_SUCCESSFUL);
|
||||||
|
}
|
||||||
|
|
||||||
|
static void default_on_exit( int exit_code, void *arg )
|
||||||
|
{
|
||||||
|
rtems_stack_checker_report_usage_with_plugin(
|
||||||
|
NULL,
|
||||||
|
rtems_printf_plugin
|
||||||
|
);
|
||||||
|
|
||||||
|
if ( exit_code == 0 ) {
|
||||||
|
puts( "*** END OF TEST " TEST_NAME " ***" );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
rtems_task Init(
|
rtems_task Init(
|
||||||
rtems_task_argument ignored
|
rtems_task_argument ignored
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
|
rtems_status_code sc;
|
||||||
|
|
||||||
puts( "*** " TEST_NAME " TEST ***" );
|
puts( "*** " TEST_NAME " TEST ***" );
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -22,13 +46,21 @@ rtems_task Init(
|
|||||||
* just requires including irq-server.[ch] in their build.
|
* just requires including irq-server.[ch] in their build.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
on_exit( default_on_exit, NULL );
|
||||||
|
|
||||||
|
/* Let other tasks run to complete background work */
|
||||||
|
default_set_self_prio( RTEMS_MAXIMUM_PRIORITY - 1 );
|
||||||
|
|
||||||
rtems_bsd_initialize_with_interrupt_server();
|
rtems_bsd_initialize_with_interrupt_server();
|
||||||
|
|
||||||
|
/* Let the callout timer allocate its resources */
|
||||||
|
sc = rtems_task_wake_after( 2 );
|
||||||
|
assert(sc == RTEMS_SUCCESSFUL);
|
||||||
|
|
||||||
test_main();
|
test_main();
|
||||||
/* should not return */
|
/* should not return */
|
||||||
|
|
||||||
printf( "*** Test main returned and should not have ***\n" );
|
assert( 0 );
|
||||||
exit( 5 );
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* configuration information */
|
/* configuration information */
|
||||||
|
@ -14,7 +14,6 @@ static void test_main(void)
|
|||||||
puts( "Sleeping to see what happens" );
|
puts( "Sleeping to see what happens" );
|
||||||
sleep( 5 );
|
sleep( 5 );
|
||||||
|
|
||||||
puts( "*** END OF " TEST_NAME " TEST ***" );
|
|
||||||
exit( 0 );
|
exit( 0 );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -295,7 +295,6 @@ static void test_main(void)
|
|||||||
spawnTask(clientTask, 120, 6);
|
spawnTask(clientTask, 120, 6);
|
||||||
waitForClientEvents(argToClientEvent(4) | argToClientEvent(5) | argToClientEvent(6));
|
waitForClientEvents(argToClientEvent(4) | argToClientEvent(5) | argToClientEvent(6));
|
||||||
|
|
||||||
puts( "*** END OF " TEST_NAME " TEST ***" );
|
|
||||||
exit( 0 );
|
exit( 0 );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -22,7 +22,6 @@ static void test_main(void)
|
|||||||
|
|
||||||
rtems_shell_main_loop( &env );
|
rtems_shell_main_loop( &env );
|
||||||
|
|
||||||
puts( "*** END OF " TEST_NAME " TEST ***" );
|
|
||||||
exit( 0 );
|
exit( 0 );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -43,7 +43,6 @@
|
|||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
|
||||||
#include <rtems/libcsupport.h>
|
#include <rtems/libcsupport.h>
|
||||||
#include <rtems/stackchk.h>
|
|
||||||
#include <rtems.h>
|
#include <rtems.h>
|
||||||
|
|
||||||
#define TEST_NAME "LIBBSD RWLOCK 1"
|
#define TEST_NAME "LIBBSD RWLOCK 1"
|
||||||
@ -506,12 +505,7 @@ test_rw_sleep_timeout(test_context *ctx)
|
|||||||
static void
|
static void
|
||||||
alloc_basic_resources(void)
|
alloc_basic_resources(void)
|
||||||
{
|
{
|
||||||
rtems_status_code sc;
|
|
||||||
|
|
||||||
curthread;
|
curthread;
|
||||||
|
|
||||||
sc = rtems_task_wake_after(2);
|
|
||||||
assert(sc == RTEMS_SUCCESSFUL);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
@ -548,10 +542,6 @@ test_main(void)
|
|||||||
|
|
||||||
assert(rtems_resource_snapshot_check(&snapshot_0));
|
assert(rtems_resource_snapshot_check(&snapshot_0));
|
||||||
|
|
||||||
rtems_stack_checker_report_usage_with_plugin(NULL,
|
|
||||||
rtems_printf_plugin);
|
|
||||||
|
|
||||||
puts("*** END OF " TEST_NAME " TEST ***");
|
|
||||||
exit(0);
|
exit(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -53,7 +53,6 @@
|
|||||||
#include <machine/rtems-bsd-commands.h>
|
#include <machine/rtems-bsd-commands.h>
|
||||||
|
|
||||||
#include <rtems/libcsupport.h>
|
#include <rtems/libcsupport.h>
|
||||||
#include <rtems/stackchk.h>
|
|
||||||
#include <rtems.h>
|
#include <rtems.h>
|
||||||
|
|
||||||
#define TEST_NAME "LIBBSD SELECT AND POLL AND KQUEUE 1"
|
#define TEST_NAME "LIBBSD SELECT AND POLL AND KQUEUE 1"
|
||||||
@ -987,10 +986,6 @@ test_main(void)
|
|||||||
test_kqueue_write(ctx);
|
test_kqueue_write(ctx);
|
||||||
test_kqueue_close(ctx);
|
test_kqueue_close(ctx);
|
||||||
|
|
||||||
rtems_stack_checker_report_usage_with_plugin(NULL,
|
|
||||||
rtems_printf_plugin);
|
|
||||||
|
|
||||||
puts("*** END OF " TEST_NAME " TEST ***");
|
|
||||||
exit(0);
|
exit(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -43,7 +43,6 @@
|
|||||||
#include <inttypes.h>
|
#include <inttypes.h>
|
||||||
|
|
||||||
#include <rtems/libcsupport.h>
|
#include <rtems/libcsupport.h>
|
||||||
#include <rtems/stackchk.h>
|
|
||||||
|
|
||||||
#define TEST_NAME "LIBBSD SLEEP 1"
|
#define TEST_NAME "LIBBSD SLEEP 1"
|
||||||
|
|
||||||
@ -209,12 +208,7 @@ test_wakeup(void)
|
|||||||
static void
|
static void
|
||||||
alloc_basic_resources(void)
|
alloc_basic_resources(void)
|
||||||
{
|
{
|
||||||
rtems_status_code sc;
|
|
||||||
|
|
||||||
curthread;
|
curthread;
|
||||||
|
|
||||||
sc = rtems_task_wake_after(2);
|
|
||||||
assert(sc == RTEMS_SUCCESSFUL);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
@ -234,10 +228,6 @@ test_main(void)
|
|||||||
|
|
||||||
assert(rtems_resource_snapshot_check(&snapshot));
|
assert(rtems_resource_snapshot_check(&snapshot));
|
||||||
|
|
||||||
rtems_stack_checker_report_usage_with_plugin(NULL,
|
|
||||||
rtems_printf_plugin);
|
|
||||||
|
|
||||||
puts("*** END OF " TEST_NAME " TEST ***");
|
|
||||||
exit(0);
|
exit(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1718,7 +1718,6 @@ test_main(void)
|
|||||||
test_warn();
|
test_warn();
|
||||||
test_err();
|
test_err();
|
||||||
|
|
||||||
puts("*** END OF " TEST_NAME " TEST ***");
|
|
||||||
exit(0);
|
exit(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -283,21 +283,14 @@ test_rtems_bsd_get_curthread_or_null(void)
|
|||||||
static void
|
static void
|
||||||
test_main(void)
|
test_main(void)
|
||||||
{
|
{
|
||||||
rtems_status_code sc;
|
|
||||||
rtems_task_priority prio = RTEMS_MAXIMUM_PRIORITY - 1;
|
|
||||||
|
|
||||||
main_task_id = rtems_task_self();
|
main_task_id = rtems_task_self();
|
||||||
|
|
||||||
sc = rtems_task_set_priority(RTEMS_SELF, prio, &prio);
|
|
||||||
assert(sc == RTEMS_SUCCESSFUL);
|
|
||||||
|
|
||||||
test_non_bsd_thread();
|
test_non_bsd_thread();
|
||||||
test_kproc_start();
|
test_kproc_start();
|
||||||
test_kthread_start();
|
test_kthread_start();
|
||||||
test_kthread_add();
|
test_kthread_add();
|
||||||
test_rtems_bsd_get_curthread_or_null();
|
test_rtems_bsd_get_curthread_or_null();
|
||||||
|
|
||||||
puts("*** END OF " TEST_NAME " TEST ***");
|
|
||||||
exit(0);
|
exit(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user