From 74e2fa3225bef404b36b5a10b9871666002b6bac Mon Sep 17 00:00:00 2001 From: xueyunfei Date: Mon, 8 Apr 2019 11:55:05 +0800 Subject: [PATCH] fix the poll define and run standard lwip unit tests --- .gitlab-ci.yml | 32 ++++++++++++++++++++++++++++++++ src/include/lwip/sockets.h | 4 +++- 2 files changed, 35 insertions(+), 1 deletion(-) create mode 100644 .gitlab-ci.yml diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml new file mode 100644 index 00000000..0bbb2c1a --- /dev/null +++ b/.gitlab-ci.yml @@ -0,0 +1,32 @@ +stages: + - host_test +image: ${CI_DOCKER_REGISTRY}/esp32-ci-env + +variables: +# tag in lwip-contrib repo, which supports our esp-lwip branch (and it's cherry-picked commits from release branches) + LWIP_CONTRIB_TAG: STABLE-2_1_0_RELEASE +# test timeout is seconds + TEST_TIMEOUT: 200 + +before_script: + # Use CI Tools + - curl -sSL ${CIT_LOADER_URL} | sh + - source citools/import_functions + +run_lwip_unittests: + stage: host_test + tags: + - host_test + dependencies: [] + script: + # have to clone lwip-contrib repo, as it contains unit test infrastructure + - cit_add_ssh_key "${GITLAB_KEY}" "$(cit_parse_url_host ${LWIP_CONTRIB_MIRROR})" "$(cit_parse_url_port ${LWIP_CONTRIB_MIRROR})" + - git clone "${LWIP_CONTRIB_MIRROR}" lwip-contrib && cd lwip-contrib && git checkout tags/${LWIP_CONTRIB_TAG} + - cd ports/unix/check/ + # updating environment + - export LWIPDIR=../../../../src && export CK_DEFAULT_TIMEOUT=${TEST_TIMEOUT} + - export TESTFILES=`find $LWIPDIR/../test/unit -name '*.c' | tr '\n' ' '` + - export CFLAGS=-I$LWIPDIR/../test/unit/esp + # build and run tests + - make "TESTFILES=$TESTFILES" check + diff --git a/src/include/lwip/sockets.h b/src/include/lwip/sockets.h index d70d36c4..0ff1d135 100644 --- a/src/include/lwip/sockets.h +++ b/src/include/lwip/sockets.h @@ -40,7 +40,7 @@ #define LWIP_HDR_SOCKETS_H #include "lwip/opt.h" - +#include "sys/poll.h" #if LWIP_SOCKET /* don't build if not configured for use in lwipopts.h */ #include "lwip/ip_addr.h" @@ -503,6 +503,7 @@ typedef struct fd_set #define POLLWRNORM 0x80 #define POLLWRBAND 0x100 #define POLLHUP 0x200 +#ifdef NO_POLLFD typedef unsigned int nfds_t; struct pollfd { @@ -510,6 +511,7 @@ struct pollfd short events; short revents; }; +#endif/* NO_POLLFD*/ #endif /** LWIP_TIMEVAL_PRIVATE: if you want to use the struct timeval provided