From 5ddce1f19667e20e197dd05cef8587aedc27ade1 Mon Sep 17 00:00:00 2001 From: Sebastian Huber Date: Tue, 22 Oct 2013 11:06:19 +0200 Subject: [PATCH] loopback01: Initialize via IFCONFIG(8) --- testsuite/loopback01/test_main.c | 41 ++++++++++++++------------------ 1 file changed, 18 insertions(+), 23 deletions(-) diff --git a/testsuite/loopback01/test_main.c b/testsuite/loopback01/test_main.c index 6f58f329..396b8ef9 100644 --- a/testsuite/loopback01/test_main.c +++ b/testsuite/loopback01/test_main.c @@ -6,12 +6,14 @@ #include #include +#include #include #include #define TEST_NAME "LIBBSD LOOPBACK 1" #include +#include #include #include #include @@ -19,31 +21,11 @@ #include #include #include +#include -/* for old configuration structure */ -#include +#include -/* - * Network configuration - */ -struct rtems_bsdnet_config rtems_bsdnet_config = { - NULL, /* Network interface */ - NULL, /* Use fixed network configuration */ - 0, /* Default network task priority */ - 0, /* Default mbuf capacity */ - 0, /* Default mbuf cluster capacity */ - "testSystem", /* Host name */ - "nowhere.com", /* Domain name */ - "127.0.0.1", /* Gateway */ - "127.0.0.1", /* Log host */ - {"127.0.0.1" }, /* Name server(s) */ - {"127.0.0.1" }, /* NTP server(s) */ - 0, - 0, - 0, - 0, - 0 -}; +#include /* * Thread-safe output routines @@ -216,6 +198,16 @@ static void test_main(void) { rtems_status_code sc; rtems_task_priority old; + int exit_code; + char *lo0[] = { + "ifconfig", + "lo0", + "inet", + "127.0.0.1", + "netmask", + "255.255.255.0", + NULL + }; sc = rtems_semaphore_create( rtems_build_name('P','m','t','x'), @@ -240,6 +232,9 @@ static void test_main(void) printf("Should fail with `connection refused'.\n"); clientWorker(0); + exit_code = rtems_bsd_command_ifconfig(nitems(lo0) - 1, lo0); + assert(exit_code == EX_OK); + printf("\nStart server.\n"); spawnTask(serverTask, 150, 0);