ReactOS 0.4.16-dev-297-gc569aee
test_sockets.c File Reference
#include "test_sockets.h"
#include "lwip/mem.h"
#include "lwip/opt.h"
#include "lwip/sockets.h"
#include "lwip/priv/sockets_priv.h"
#include "lwip/stats.h"
#include "lwip/tcpip.h"
#include "lwip/priv/tcp_priv.h"
#include "lwip/api.h"
Include dependency graph for test_sockets.c:

Go to the source code of this file.

Macros

#define NUM_SOCKETS   MEMP_NUM_NETCONN
 

Functions

static int test_sockets_get_used_count (void)
 
static void sockets_setup (void)
 
static void sockets_teardown (void)
 
Suite * sockets_suite (void)
 

Macro Definition Documentation

◆ NUM_SOCKETS

#define NUM_SOCKETS   MEMP_NUM_NETCONN

Definition at line 57 of file test_sockets.c.

Function Documentation

◆ sockets_setup()

static void sockets_setup ( void  )
static

Definition at line 35 of file test_sockets.c.

36{
37 /* expect full free heap */
38 lwip_check_ensure_no_alloc(SKIP_POOL(MEMP_SYS_TIMEOUT));
39}
#define SKIP_POOL(x)
Definition: lwip_check.h:48
void lwip_check_ensure_no_alloc(unsigned int skip)

◆ sockets_suite()

Suite * sockets_suite ( void  )

Definition at line 848 of file test_sockets.c.

849{
850 return create_suite("SOCKETS", NULL, 0, NULL, NULL);
851}
#define NULL
Definition: types.h:112
Suite * create_suite(const char *name, testfunc *tests, size_t num_tests, SFun setup, SFun teardown)

Referenced by main().

◆ sockets_teardown()

static void sockets_teardown ( void  )
static

Definition at line 42 of file test_sockets.c.

43{
44 fail_unless(test_sockets_get_used_count() == 0);
45 /* poll until all memory is released... */
46 tcpip_thread_poll_one();
47 while (tcp_tw_pcbs) {
48 tcp_abort(tcp_tw_pcbs);
49 tcpip_thread_poll_one();
50 }
51 tcpip_thread_poll_one();
52 /* ensure full free heap */
53 lwip_check_ensure_no_alloc(SKIP_POOL(MEMP_SYS_TIMEOUT));
54}
static int test_sockets_get_used_count(void)
Definition: test_sockets.c:15

◆ test_sockets_get_used_count()

static int test_sockets_get_used_count ( void  )
static

Definition at line 15 of file test_sockets.c.

16{
17 int used = 0;
18 int i;
19
20 for (i = 0; i < NUM_SOCKETS; i++) {
21 struct lwip_sock* s = lwip_socket_dbg_get_socket(i);
22 if (s != NULL) {
23 if (s->fd_used) {
24 used++;
25 }
26 }
27 }
28 return used;
29}
static int used
Definition: adh-main.c:39
GLdouble s
Definition: gl.h:2039
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
#define NUM_SOCKETS
Definition: test_sockets.c:57

Referenced by sockets_teardown().