mirror of
https://github.com/lwip-tcpip/lwip.git
synced 2025-04-17 11:42:56 +00:00
tried to add basic socket unit tests (nonsense only for now); made LOCK_TCPIP_CORE()/UNLOCK_TCPIP_CORE() overridable for that
This commit is contained in:
parent
2d8e17aa89
commit
8313c4d870
@ -50,12 +50,14 @@ extern "C" {
|
||||
#endif
|
||||
|
||||
#if LWIP_TCPIP_CORE_LOCKING
|
||||
#ifndef LOCK_TCPIP_CORE
|
||||
/** The global semaphore to lock the stack. */
|
||||
extern sys_mutex_t lock_tcpip_core;
|
||||
/** Lock lwIP core mutex (needs @ref LWIP_TCPIP_CORE_LOCKING 1) */
|
||||
#define LOCK_TCPIP_CORE() sys_mutex_lock(&lock_tcpip_core)
|
||||
/** Unlock lwIP core mutex (needs @ref LWIP_TCPIP_CORE_LOCKING 1) */
|
||||
#define UNLOCK_TCPIP_CORE() sys_mutex_unlock(&lock_tcpip_core)
|
||||
#endif
|
||||
#else /* LWIP_TCPIP_CORE_LOCKING */
|
||||
#define LOCK_TCPIP_CORE()
|
||||
#define UNLOCK_TCPIP_CORE()
|
||||
|
68
test/unit/api/test_sockets.c
Normal file
68
test/unit/api/test_sockets.c
Normal file
@ -0,0 +1,68 @@
|
||||
#include "test_sockets.h"
|
||||
|
||||
#include "lwip/sockets.h"
|
||||
#include "lwip/stats.h"
|
||||
|
||||
#include "lwip/tcpip.h"
|
||||
|
||||
|
||||
/* Setups/teardown functions */
|
||||
|
||||
static void
|
||||
sockets_setup(void)
|
||||
{
|
||||
}
|
||||
|
||||
static void
|
||||
sockets_teardown(void)
|
||||
{
|
||||
}
|
||||
|
||||
#ifndef NUM_SOCKETS
|
||||
#define NUM_SOCKETS MEMP_NUM_NETCONN
|
||||
#endif
|
||||
|
||||
/* Verify basic sockets functionality
|
||||
*/
|
||||
START_TEST(test_sockets_basics)
|
||||
{
|
||||
int s, i, ret;
|
||||
int s2[NUM_SOCKETS];
|
||||
LWIP_UNUSED_ARG(_i);
|
||||
|
||||
s = lwip_socket(AF_INET, SOCK_STREAM, 0);
|
||||
fail_unless(s >= 0);
|
||||
lwip_close(s);
|
||||
|
||||
for (i = 0; i < NUM_SOCKETS; i++) {
|
||||
s2[i] = lwip_socket(AF_INET, SOCK_STREAM, 0);
|
||||
fail_unless(s2[i] >= 0);
|
||||
}
|
||||
|
||||
/* all sockets used, now it should fail */
|
||||
s = lwip_socket(AF_INET, SOCK_STREAM, 0);
|
||||
fail_unless(s == -1);
|
||||
/* close one socket */
|
||||
ret = lwip_close(s2[0]);
|
||||
fail_unless(ret == 0);
|
||||
/* now it should succeed */
|
||||
s2[0] = lwip_socket(AF_INET, SOCK_STREAM, 0);
|
||||
fail_unless(s2[0] >= 0);
|
||||
|
||||
/* close all sockets */
|
||||
for (i = 0; i < NUM_SOCKETS; i++) {
|
||||
ret = lwip_close(s2[i]);
|
||||
fail_unless(ret == 0);
|
||||
}
|
||||
}
|
||||
END_TEST
|
||||
|
||||
/** Create the suite including all tests for this module */
|
||||
Suite *
|
||||
sockets_suite(void)
|
||||
{
|
||||
testfunc tests[] = {
|
||||
TESTFUNC(test_sockets_basics)
|
||||
};
|
||||
return create_suite("SOCKETS", tests, sizeof(tests)/sizeof(testfunc), sockets_setup, sockets_teardown);
|
||||
}
|
8
test/unit/api/test_sockets.h
Normal file
8
test/unit/api/test_sockets.h
Normal file
@ -0,0 +1,8 @@
|
||||
#ifndef LWIP_HDR_TEST_SOCKETS_H
|
||||
#define LWIP_HDR_TEST_SOCKETS_H
|
||||
|
||||
#include "../lwip_check.h"
|
||||
|
||||
Suite *sockets_suite(void);
|
||||
|
||||
#endif
|
332
test/unit/arch/sys_arch.c
Normal file
332
test/unit/arch/sys_arch.c
Normal file
@ -0,0 +1,332 @@
|
||||
/*
|
||||
* Copyright (c) 2017 Simon Goldschmidt
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without modification,
|
||||
* are permitted provided that the following conditions are met:
|
||||
*
|
||||
* 1. Redistributions of source code must retain the above copyright notice,
|
||||
* this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright notice,
|
||||
* this list of conditions and the following disclaimer in the documentation
|
||||
* and/or other materials provided with the distribution.
|
||||
* 3. The name of the author may not be used to endorse or promote products
|
||||
* derived from this software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED
|
||||
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
|
||||
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT
|
||||
* SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
||||
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT
|
||||
* OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
|
||||
* IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY
|
||||
* OF SUCH DAMAGE.
|
||||
*
|
||||
* This file is part of the lwIP TCP/IP stack.
|
||||
*
|
||||
* Author: Simon Goldschmidt
|
||||
*
|
||||
*/
|
||||
|
||||
|
||||
#include <lwip/opt.h>
|
||||
#include <lwip/arch.h>
|
||||
#include "sys_arch.h"
|
||||
#include <lwip/stats.h>
|
||||
#include <lwip/debug.h>
|
||||
#include <lwip/sys.h>
|
||||
|
||||
#include <string.h>
|
||||
|
||||
test_sys_arch_waiting_fn the_waiting_fn;
|
||||
|
||||
void test_sys_arch_wait_callback(test_sys_arch_waiting_fn waiting_fn)
|
||||
{
|
||||
the_waiting_fn = waiting_fn;
|
||||
}
|
||||
|
||||
u32_t sys_jiffies(void)
|
||||
{
|
||||
return (u32_t)0; /* todo */
|
||||
}
|
||||
|
||||
u32_t sys_now(void)
|
||||
{
|
||||
return (u32_t)0; /* todo */
|
||||
}
|
||||
|
||||
void sys_init(void)
|
||||
{
|
||||
}
|
||||
|
||||
#if !NO_SYS
|
||||
|
||||
err_t sys_sem_new(sys_sem_t *sem, u8_t count)
|
||||
{
|
||||
LWIP_ASSERT("sem != NULL", sem != NULL);
|
||||
*sem = count + 1;
|
||||
return ERR_OK;
|
||||
}
|
||||
|
||||
void sys_sem_free(sys_sem_t *sem)
|
||||
{
|
||||
LWIP_ASSERT("sem != NULL", sem != NULL);
|
||||
*sem = 0;
|
||||
}
|
||||
|
||||
void sys_sem_set_invalid(sys_sem_t *sem)
|
||||
{
|
||||
LWIP_ASSERT("sem != NULL", sem != NULL);
|
||||
*sem = 0;
|
||||
}
|
||||
|
||||
/* semaphores are 1-based because RAM is initialized as 0, which would be valid */
|
||||
u32_t sys_arch_sem_wait(sys_sem_t *sem, u32_t timeout)
|
||||
{
|
||||
u32_t ret = 0;
|
||||
LWIP_ASSERT("sem != NULL", sem != NULL);
|
||||
LWIP_ASSERT("*sem > 0", *sem > 0);
|
||||
if (*sem == 1) {
|
||||
/* need to wait */
|
||||
if(!timeout)
|
||||
{
|
||||
/* wait infinite */
|
||||
LWIP_ASSERT("cannot wait without waiting callback", the_waiting_fn != NULL);
|
||||
do {
|
||||
int expectSomething = the_waiting_fn(sem);
|
||||
LWIP_ASSERT("*sem > 0", *sem > 0);
|
||||
LWIP_ASSERT("expecting a semaphore count but it's 0", !expectSomething || (*sem > 1));
|
||||
ret++;
|
||||
} while(*sem == 1);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (the_waiting_fn) {
|
||||
int expectSomething = the_waiting_fn(sem);
|
||||
LWIP_ASSERT("expecting a semaphore count but it's 0", !expectSomething || (*sem > 1));
|
||||
}
|
||||
LWIP_ASSERT("*sem > 0", *sem > 0);
|
||||
if (*sem == 1) {
|
||||
return SYS_ARCH_TIMEOUT;
|
||||
}
|
||||
ret = 1;
|
||||
}
|
||||
}
|
||||
LWIP_ASSERT("*sem > 0", *sem > 0);
|
||||
*sem--;
|
||||
LWIP_ASSERT("*sem > 0", *sem > 0);
|
||||
/* return the time we waited for the sem */
|
||||
return ret;
|
||||
}
|
||||
|
||||
void sys_sem_signal(sys_sem_t *sem)
|
||||
{
|
||||
LWIP_ASSERT("sem != NULL", sem != NULL);
|
||||
LWIP_ASSERT("*sem > 0", *sem > 0);
|
||||
*sem++;
|
||||
LWIP_ASSERT("*sem > 0", *sem > 0);
|
||||
}
|
||||
|
||||
err_t sys_mutex_new(sys_mutex_t *mutex)
|
||||
{
|
||||
LWIP_ASSERT("mutex != NULL", mutex != NULL);
|
||||
*mutex = 1; /* 1 allocated */
|
||||
return ERR_OK;
|
||||
}
|
||||
|
||||
void sys_mutex_free(sys_mutex_t *mutex)
|
||||
{
|
||||
/* parameter check */
|
||||
LWIP_ASSERT("mutex != NULL", mutex != NULL);
|
||||
LWIP_ASSERT("*mutex >= 1", *mutex >= 1);
|
||||
*mutex = 0;
|
||||
}
|
||||
|
||||
void sys_mutex_set_invalid(sys_mutex_t *mutex)
|
||||
{
|
||||
LWIP_ASSERT("mutex != NULL", mutex != NULL);
|
||||
*mutex = 0;
|
||||
}
|
||||
|
||||
void sys_mutex_lock(sys_mutex_t *mutex)
|
||||
{
|
||||
/* nothing to do, no multithreading supported */
|
||||
LWIP_ASSERT("mutex != NULL", mutex != NULL);
|
||||
LWIP_ASSERT("*mutex >= 1", *mutex >= 1);
|
||||
/* we count up just to check the correct pairing of lock/unlock */
|
||||
*mutex++;
|
||||
LWIP_ASSERT("*mutex >= 1", *mutex >= 1);
|
||||
}
|
||||
|
||||
void sys_mutex_unlock(sys_mutex_t *mutex)
|
||||
{
|
||||
/* nothing to do, no multithreading supported */
|
||||
LWIP_ASSERT("mutex != NULL", mutex != NULL);
|
||||
LWIP_ASSERT("*mutex >= 1", *mutex >= 1);
|
||||
/* we count down just to check the correct pairing of lock/unlock */
|
||||
*mutex--;
|
||||
LWIP_ASSERT("*mutex >= 1", *mutex >= 1);
|
||||
}
|
||||
|
||||
|
||||
sys_thread_t sys_thread_new(const char *name, lwip_thread_fn function, void *arg, int stacksize, int prio)
|
||||
{
|
||||
LWIP_UNUSED_ARG(name);
|
||||
LWIP_UNUSED_ARG(function);
|
||||
LWIP_UNUSED_ARG(arg);
|
||||
LWIP_UNUSED_ARG(stacksize);
|
||||
LWIP_UNUSED_ARG(prio);
|
||||
/* threads not supported */
|
||||
return 0;
|
||||
}
|
||||
|
||||
err_t sys_mbox_new(sys_mbox_t *mbox, int size)
|
||||
{
|
||||
int mboxsize = size;
|
||||
LWIP_ASSERT("mbox != NULL", mbox != NULL);
|
||||
LWIP_ASSERT("size >= 0", size >= 0);
|
||||
if (size == 0) {
|
||||
mboxsize = 1024;
|
||||
}
|
||||
mbox->head = mbox->tail = 0;
|
||||
mbox->sem = mbox; /* just point to something for sys_mbox_valid() */
|
||||
mbox->q_mem = (void**)malloc(sizeof(void*)*mboxsize);
|
||||
mbox->size = mboxsize;
|
||||
mbox->used = 0;
|
||||
|
||||
memset(mbox->q_mem, 0, sizeof(void*)*mboxsize);
|
||||
return ERR_OK;
|
||||
}
|
||||
|
||||
void sys_mbox_free(sys_mbox_t *mbox)
|
||||
{
|
||||
/* parameter check */
|
||||
LWIP_ASSERT("mbox != NULL", mbox != NULL);
|
||||
LWIP_ASSERT("mbox->sem != NULL", mbox->sem != NULL);
|
||||
LWIP_ASSERT("mbox->sem == mbox", mbox->sem == mbox);
|
||||
LWIP_ASSERT("mbox->q_mem != NULL", mbox->q_mem != NULL);
|
||||
mbox->sem = NULL;
|
||||
free(mbox->q_mem);
|
||||
mbox->q_mem = NULL;
|
||||
}
|
||||
|
||||
void sys_mbox_set_invalid(sys_mbox_t *mbox)
|
||||
{
|
||||
LWIP_ASSERT("mbox != NULL", mbox != NULL);
|
||||
LWIP_ASSERT("mbox->q_mem == NULL", mbox->q_mem == NULL);
|
||||
mbox->sem = NULL;
|
||||
mbox->q_mem = NULL;
|
||||
}
|
||||
|
||||
void sys_mbox_post(sys_mbox_t *q, void *msg)
|
||||
{
|
||||
LWIP_ASSERT("q != SYS_MBOX_NULL", q != SYS_MBOX_NULL);
|
||||
LWIP_ASSERT("q->sem != q", q->sem != q);
|
||||
LWIP_ASSERT("q->q_mem != NULL", q->q_mem != NULL);
|
||||
LWIP_ASSERT("q->used >= 0", q->used >= 0);
|
||||
LWIP_ASSERT("q->size > 0", q->size > 0);
|
||||
|
||||
LWIP_ASSERT("mbox already full", q->used < q->size);
|
||||
|
||||
q->q_mem[q->head] = msg;
|
||||
q->head++;
|
||||
if (q->head >= (unsigned int)q->size) {
|
||||
q->head = 0;
|
||||
}
|
||||
LWIP_ASSERT("mbox is full!", q->head != q->tail);
|
||||
q->used++;
|
||||
}
|
||||
|
||||
err_t sys_mbox_trypost(sys_mbox_t *q, void *msg)
|
||||
{
|
||||
LWIP_ASSERT("q != SYS_MBOX_NULL", q != SYS_MBOX_NULL);
|
||||
LWIP_ASSERT("q->sem != q", q->sem != q);
|
||||
LWIP_ASSERT("q->q_mem != NULL", q->q_mem != NULL);
|
||||
LWIP_ASSERT("q->used >= 0", q->used >= 0);
|
||||
LWIP_ASSERT("q->size > 0", q->size > 0);
|
||||
LWIP_ASSERT("q->used <= q->size", q->used <= q->size);
|
||||
|
||||
if (q->used == q->size) {
|
||||
return ERR_MEM;
|
||||
}
|
||||
sys_mbox_post(q, msg);
|
||||
return ERR_OK;
|
||||
}
|
||||
|
||||
u32_t sys_arch_mbox_fetch(sys_mbox_t *q, void **msg, u32_t timeout)
|
||||
{
|
||||
u32_t ret = 0;
|
||||
u32_t ret2;
|
||||
LWIP_ASSERT("q != SYS_MBOX_NULL", q != SYS_MBOX_NULL);
|
||||
LWIP_ASSERT("q->sem != q", q->sem != q);
|
||||
LWIP_ASSERT("q->q_mem != NULL", q->q_mem != NULL);
|
||||
LWIP_ASSERT("q->used >= 0", q->used >= 0);
|
||||
LWIP_ASSERT("q->size > 0", q->size > 0);
|
||||
|
||||
if (q->used == 0) {
|
||||
/* need to wait */
|
||||
/* need to wait */
|
||||
if(!timeout)
|
||||
{
|
||||
/* wait infinite */
|
||||
LWIP_ASSERT("cannot wait without waiting callback", the_waiting_fn != NULL);
|
||||
do {
|
||||
int expectSomething = the_waiting_fn(q);
|
||||
LWIP_ASSERT("q->used >= 0", q->used >= 0);
|
||||
LWIP_ASSERT("expecting item available but it's 0", !expectSomething || (q->used > 0));
|
||||
ret++;
|
||||
} while(q->used == 0);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (the_waiting_fn) {
|
||||
int expectSomething = the_waiting_fn(q);
|
||||
LWIP_ASSERT("expecting item available count but it's 0", !expectSomething || (q->used > 0));
|
||||
}
|
||||
LWIP_ASSERT("q->used >= 0", q->used >= 0);
|
||||
if (q->used == 0) {
|
||||
if(msg) {
|
||||
*msg = NULL;
|
||||
}
|
||||
return SYS_ARCH_TIMEOUT;
|
||||
}
|
||||
ret = 1;
|
||||
}
|
||||
}
|
||||
LWIP_ASSERT("q->used > 0", q->used > 0);
|
||||
ret2 = sys_arch_mbox_tryfetch(q, msg);
|
||||
LWIP_ASSERT("got no message", ret2 == 0);
|
||||
return ret;
|
||||
}
|
||||
|
||||
u32_t sys_arch_mbox_tryfetch(sys_mbox_t *q, void **msg)
|
||||
{
|
||||
LWIP_ASSERT("q != SYS_MBOX_NULL", q != SYS_MBOX_NULL);
|
||||
LWIP_ASSERT("q->sem == q", q->sem == q);
|
||||
LWIP_ASSERT("q->q_mem != NULL", q->q_mem != NULL);
|
||||
LWIP_ASSERT("q->used >= 0", q->used >= 0);
|
||||
LWIP_ASSERT("q->size > 0", q->size > 0);
|
||||
|
||||
if (!q->used) {
|
||||
return SYS_ARCH_TIMEOUT;
|
||||
}
|
||||
if(msg) {
|
||||
*msg = q->q_mem[q->tail];
|
||||
}
|
||||
|
||||
q->tail++;
|
||||
if (q->tail >= (unsigned int)q->size) {
|
||||
q->tail = 0;
|
||||
}
|
||||
q->used--;
|
||||
LWIP_ASSERT("q->used >= 0", q->used >= 0);
|
||||
return 0;
|
||||
}
|
||||
|
||||
#if LWIP_NETCONN_SEM_PER_THREAD
|
||||
#error LWIP_NETCONN_SEM_PER_THREAD==1 not supported
|
||||
#endif /* LWIP_NETCONN_SEM_PER_THREAD */
|
||||
|
||||
#endif /* !NO_SYS */
|
72
test/unit/arch/sys_arch.h
Normal file
72
test/unit/arch/sys_arch.h
Normal file
@ -0,0 +1,72 @@
|
||||
/*
|
||||
* Copyright (c) 2017 Simon Goldschmidt
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without modification,
|
||||
* are permitted provided that the following conditions are met:
|
||||
*
|
||||
* 1. Redistributions of source code must retain the above copyright notice,
|
||||
* this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright notice,
|
||||
* this list of conditions and the following disclaimer in the documentation
|
||||
* and/or other materials provided with the distribution.
|
||||
* 3. The name of the author may not be used to endorse or promote products
|
||||
* derived from this software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED
|
||||
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
|
||||
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT
|
||||
* SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
||||
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT
|
||||
* OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
|
||||
* IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY
|
||||
* OF SUCH DAMAGE.
|
||||
*
|
||||
* This file is part of the lwIP TCP/IP stack.
|
||||
*
|
||||
* Author: Simon Goldschmidt
|
||||
*
|
||||
*/
|
||||
#ifndef LWIP_HDR_TEST_SYS_ARCH_H
|
||||
#define LWIP_HDR_TEST_SYS_ARCH_H
|
||||
|
||||
typedef int sys_sem_t;
|
||||
#define sys_sem_valid(sema) ((sema) != NULL)
|
||||
|
||||
typedef int sys_mutex_t;
|
||||
#define sys_mutex_valid(mutex) (((mutex) != NULL)
|
||||
|
||||
struct lwip_mbox {
|
||||
void* sem;
|
||||
void** q_mem;
|
||||
unsigned int head, tail;
|
||||
int size;
|
||||
int used;
|
||||
};
|
||||
typedef struct lwip_mbox sys_mbox_t;
|
||||
#define SYS_MBOX_NULL NULL
|
||||
#define sys_mbox_valid(mbox) ((mbox != NULL) && ((mbox)->sem != NULL) && ((mbox)->sem != (void*)-1))
|
||||
|
||||
/* DWORD (thread id) is used for sys_thread_t but we won't include windows.h */
|
||||
typedef u32_t sys_thread_t;
|
||||
|
||||
#define SYS_ARCH_DECL_PROTECT(lev)
|
||||
#define SYS_ARCH_PROTECT(lev)
|
||||
#define SYS_ARCH_UNPROTECT(lev)
|
||||
|
||||
/* to implement doing something while waiting:
|
||||
* pass a function to test_sys_arch_wait_callback() that returns
|
||||
* '0' if waiting again and
|
||||
* '1' if now there should be something to do (used for asserting)
|
||||
*/
|
||||
typedef int (*test_sys_arch_waiting_fn)(void* wait_element);
|
||||
void test_sys_arch_wait_callback(test_sys_arch_waiting_fn waiting_fn);
|
||||
|
||||
/* no multithreading supported: define to nothing */
|
||||
#define LOCK_TCPIP_CORE()
|
||||
#define UNLOCK_TCPIP_CORE()
|
||||
|
||||
#endif /* LWIP_HDR_TEST_SYS_ARCH_H */
|
||||
|
@ -8,6 +8,7 @@
|
||||
#include "etharp/test_etharp.h"
|
||||
#include "dhcp/test_dhcp.h"
|
||||
#include "mdns/test_mdns.h"
|
||||
#include "api/test_sockets.h"
|
||||
|
||||
#include "lwip/init.h"
|
||||
|
||||
@ -44,7 +45,8 @@ int main(void)
|
||||
pbuf_suite,
|
||||
etharp_suite,
|
||||
dhcp_suite,
|
||||
mdns_suite
|
||||
mdns_suite,
|
||||
sockets_suite
|
||||
};
|
||||
size_t num = sizeof(suites)/sizeof(void*);
|
||||
LWIP_ASSERT("No suites defined", num > 0);
|
||||
|
@ -33,10 +33,10 @@
|
||||
#define LWIP_HDR_LWIPOPTS_H
|
||||
|
||||
/* Prevent having to link sys_arch.c (we don't test the API layers in unit tests) */
|
||||
#define NO_SYS 1
|
||||
#define NO_SYS 0
|
||||
#define SYS_LIGHTWEIGHT_PROT 0
|
||||
#define LWIP_NETCONN 0
|
||||
#define LWIP_SOCKET 0
|
||||
#define LWIP_NETCONN 1
|
||||
#define LWIP_SOCKET 1
|
||||
|
||||
/* Enable DHCP to test it, disable UDP checksum to easier inject packets */
|
||||
#define LWIP_DHCP 1
|
||||
|
Loading…
x
Reference in New Issue
Block a user