diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml new file mode 100644 index 00000000..7f32b7e3 --- /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_0_1_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/core/tcp.c b/src/core/tcp.c index 312e37bc..a49d9e08 100644 --- a/src/core/tcp.c +++ b/src/core/tcp.c @@ -1569,7 +1569,7 @@ typedef struct { u8_t total; }tcp_pcb_num_t; -void tcp_pcb_num_cal(tcp_pcb_num_t *tcp_pcb_num) +static void tcp_pcb_num_cal(tcp_pcb_num_t *tcp_pcb_num) { struct tcp_pcb_listen *listen; struct tcp_pcb *pcb; diff --git a/test/unit/esp/arch/cc.h b/test/unit/esp/arch/cc.h new file mode 100644 index 00000000..4cc3ff33 --- /dev/null +++ b/test/unit/esp/arch/cc.h @@ -0,0 +1,24 @@ +/* +Copyright 2018 Espressif Systems (Shanghai) PTE LTD + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +#ifndef _ESP_LWIP_ARCH_CC_H +#define _ESP_LWIP_ARCH_CC_H + +typedef unsigned long mem_ptr_t; + +#include "ports/unix/port/include/arch/cc.h" + +#endif /* _ESP_LWIP_ARCH_CC_H */ \ No newline at end of file diff --git a/test/unit/esp/lwipopts.h b/test/unit/esp/lwipopts.h new file mode 100644 index 00000000..fe7525f5 --- /dev/null +++ b/test/unit/esp/lwipopts.h @@ -0,0 +1,31 @@ +/* +Copyright 2018 Espressif Systems (Shanghai) PTE LTD + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ +#ifndef _ESP_LWIP_HDR_LWIPOPTS_H +#define _ESP_LWIP_HDR_LWIPOPTS_H + +/* esp-lwip branch src and tests compilable */ +#define SNTP_SERVER_DNS 0 +#define LWIP_HAVE_LOOPIF 1 + +/* ESP specific cofiguration */ +#define ESP_LWIP 1 +#define ESP_STATS_DROP 0 +#define ESP_DHCP 0 +#define ESP_STATS_TCP 0 + +#include "../lwipopts.h" + +#endif /* _ESP_LWIP_HDR_LWIPOPTS_H */