-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
JIRA: CI-329
- Loading branch information
Showing
7 changed files
with
199 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
#!/usr/bin/env bash | ||
|
||
set -e | ||
|
||
b_log "Building lwip-test" | ||
|
||
LWIP_CONTRIB_TAG="STABLE-2_1_0_RELEASE" | ||
LWIP_CONTRIB_PKG_URL="https://git.savannah.nongnu.org/cgit/lwip/lwip-contrib.git/snapshot/lwip-contrib-${LWIP_CONTRIB_TAG}.tar.gz" | ||
LWIP_CONTRIB_PKG_MIRROR_URL="https://files.phoesys.com/ports/lwip-contrib.tar.gz" | ||
|
||
PREFIX_LWIP_TEST="${PREFIX_PROJECT}/phoenix-rtos-ports/lwip-tests" | ||
PREFIX_LWIP_TEST_BUILD="${PREFIX_BUILD}/lwip-test" | ||
PREFIX_LWIP_CONTRIB="${PREFIX_LWIP_TEST_BUILD}/contrib-lwip" | ||
PREFIX_LWIP_CHECK="${PREFIX_LWIP_CONTRIB}/ports/unix/check" | ||
PREFIX_LWIP_TEST_MARKERS="${PREFIX_LWIP_TEST_BUILD}/markers" | ||
|
||
# Set variables used by Makefile | ||
CHECK_H_PATH="${PREFIX_BUILD}/check/include" | ||
CONTRIBDIR="${PREFIX_BUILD}/lwip-test/contrib-lwip" | ||
MBEDTLSDIR="${PREFIX_BUILD}/mbedtls/mbedtls-2.28.0" | ||
LWIPDIR="${PREFIX_PROJECT}/phoenix-rtos-lwip/lib-lwip/src" | ||
|
||
export CHECK_H_PATH CONTRIBDIR MBEDTLSDIR LWIPDIR | ||
|
||
# | ||
# Download and unpack lwip-contrib | ||
# | ||
if [ ! -f "${PREFIX_LWIP_TEST}/lwip-contrib.tar.gz" ]; then | ||
if ! wget "$LWIP_CONTRIB_PKG_URL" -O "${PREFIX_LWIP_TEST}/lwip-contrib.tar.gz" --no-check-certificate; then | ||
wget "$LWIP_CONTRIB_PKG_MIRROR_URL" -P "$PREFIX_LWIP_TEST" --no-check-certificate | ||
fi | ||
fi | ||
|
||
mkdir -p "$PREFIX_LWIP_TEST_BUILD" | ||
if [ ! -d "$PREFIX_LWIP_CONTRIB" ]; then | ||
tar xzf "${PREFIX_LWIP_TEST}/lwip-contrib.tar.gz" -C "$PREFIX_LWIP_TEST_BUILD" && \ | ||
mv "${PREFIX_LWIP_TEST_BUILD}/lwip-contrib-$LWIP_CONTRIB_TAG" "${PREFIX_LWIP_TEST_BUILD}/contrib-lwip" | ||
fi | ||
|
||
# | ||
# Apply patches | ||
# | ||
mkdir -p "$PREFIX_LWIP_TEST_MARKERS" | ||
for patchfile in "$PREFIX_LWIP_TEST"/patch/*; do | ||
if [ ! -f "${PREFIX_LWIP_TEST_MARKERS}/$(basename "$patchfile").applied" ]; then | ||
echo "applying patch: $patchfile" | ||
patch -d "${PREFIX_LWIP_CONTRIB}/" -p1 < "$patchfile" | ||
touch "${PREFIX_LWIP_TEST_MARKERS}/$(basename "$patchfile").applied" | ||
fi | ||
done | ||
|
||
make check -C "$PREFIX_LWIP_CHECK" | ||
"${CROSS}strip" -s "${PREFIX_LWIP_CHECK}/lwip_unittests" -o "${PREFIX_PROG_STRIPPED}/lwip_unittests" | ||
cp -a "${PREFIX_LWIP_CHECK}/lwip_unittests" "${PREFIX_PROG}/lwip_unittests" | ||
|
||
b_install "${PREFIX_PROG_STRIPPED}/lwip_unittests" /bin |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
--- contrib_orginal/ports/Common.allports.mk 2024-01-09 16:16:39.398560526 +0100 | ||
+++ contrib/ports/Common.allports.mk 2024-01-15 15:32:10.693335127 +0100 | ||
@@ -29,11 +29,9 @@ | ||
# Author: Adam Dunkels <adam@sics.se> | ||
# | ||
|
||
-#CC=gcc | ||
-#CC=clang | ||
CCDEP?=$(CC) | ||
|
||
-CFLAGS+=-g -DLWIP_DEBUG -Wall -pedantic -Werror \ | ||
+CFLAGS+=-g -DLWIP_DEBUG -Wall -pedantic \ | ||
-Wparentheses -Wsequence-point -Wswitch-default \ | ||
-Wextra -Wundef -Wshadow -Wpointer-arith -Wcast-qual \ | ||
-Wc++-compat -Wwrite-strings -Wold-style-definition -Wcast-align \ | ||
@@ -48,7 +46,7 @@ | ||
#CFLAGS:=$(CFLAGS) -fsanitize=address -fstack-protector -fstack-check -fsanitize=undefined -fno-sanitize=alignment | ||
else | ||
# we cannot sanitize alignment on x86-64 targets because clang wants 64 bit alignment | ||
-CFLAGS+= -fsanitize=address -fsanitize=undefined -fno-sanitize=alignment -Wdocumentation -Wno-documentation-deprecated-sync | ||
+# CFLAGS+= -fsanitize=address -fsanitize=undefined -fno-sanitize=alignment -Wdocumentation -Wno-documentation-deprecated-sync | ||
endif | ||
|
||
CONTRIBDIR?=../../.. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
--- contrib_orginal/ports/unix/Common.mk 2024-01-09 16:16:39.402560579 +0100 | ||
+++ contrib/ports/unix/Common.mk 2024-01-10 20:01:40.592109932 +0100 | ||
@@ -42,10 +42,12 @@ | ||
UNIX_COMMON_MK_DIR := $(dir $(abspath $(lastword $(MAKEFILE_LIST)))) | ||
include $(UNIX_COMMON_MK_DIR)../Common.allports.mk | ||
|
||
-LDFLAGS+=-lutil | ||
+# Util lib not necessary | ||
+# LDFLAGS+=-lutil | ||
|
||
UNAME_S:= $(shell uname -s) | ||
ifneq ($(UNAME_S),Darwin) | ||
# Darwin doesn't have pthreads or POSIX real-time extensions libs | ||
-LDFLAGS+=-pthread -lrt | ||
+# Phoenix do not need real-time extensions libs and -pthread linker flag | ||
+# LDFLAGS+=-pthread -lrt | ||
endif |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
--- contrib_orginal/ports/unix/check/Makefile 2024-01-09 16:16:39.402560579 +0100 | ||
+++ contrib/ports/unix/check/Makefile 2024-01-15 17:00:03.544552858 +0100 | ||
@@ -33,7 +33,7 @@ | ||
.PHONY: all clean check | ||
|
||
# The include path to sys_arch.h and lwipopts.h must be first, so this must be before Common.mk | ||
-CFLAGS=-DLWIP_NOASSERT_ON_ERROR -I/usr/include/check -I$(LWIPDIR)/../test/unit | ||
+CFLAGS+=-DLWIP_NOASSERT_ON_ERROR -I$(LWIPDIR)/../../include/arch -I$(LWIPDIR)/../../include/default-opts/testsuite -I$(CHECK_H_PATH) | ||
|
||
# Ignore 'too many arguments for format' warnings which happen with GCCs | ||
# from check 0.15.2 on fail_if/fail_unless macros with text. | ||
@@ -46,18 +46,21 @@ | ||
endif | ||
|
||
# Prevent compiling sys_arch.c of unix port because unit test provide their own port | ||
-SYSARCH?= | ||
+PORTDIR = $(LWIPDIR)/../../port | ||
+SYSARCH?=$(wildcard $(PORTDIR)/*.c) | ||
include ../Common.mk | ||
|
||
-LDFLAGS:=-lcheck -lm $(LDFLAGS) | ||
+LDFLAGS+= -lcheck --static | ||
|
||
ifneq ($(UNAME_S),Darwin) | ||
# check installed via brew on Darwin doesn't have a separate subunit library (must be statically linked) | ||
-LDFLAGS+=-lsubunit | ||
+# Subunit not ported, tests can work without it | ||
+# LDFLAGS+=-lsubunit | ||
endif | ||
|
||
TESTDIR=$(LWIPDIR)/../test/unit | ||
include $(TESTDIR)/Filelists.mk | ||
+include $(LWIPDIR)/../test/unit/Filelists.mk | ||
TESTOBJS=$(notdir $(TESTFILES:.c=.o)) | ||
|
||
clean: | ||
@@ -83,4 +86,3 @@ | ||
endif | ||
|
||
check: lwip_unittests | ||
- @./lwip_unittests |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
--- contrib_orginal/ports/unix/check/config.h 2024-01-09 16:16:39.402560579 +0100 | ||
+++ contrib/ports/unix/check/config.h 2024-01-11 12:56:06.185539301 +0100 | ||
@@ -1,2 +1,2 @@ | ||
/* Enable this to simplify debugging */ | ||
-/* #define LWIP_UNITTESTS_NOFORK */ | ||
+#define LWIP_UNITTESTS_NOFORK |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
--- contrib_orginal/ports/unix/port/netif/sio.c 2024-01-09 16:16:39.406560629 +0100 | ||
+++ contrib/ports/unix/port/netif/sio.c 2024-01-11 13:57:17.473232246 +0100 | ||
@@ -44,7 +44,7 @@ | ||
#include <fcntl.h> | ||
#include <signal.h> | ||
#include <string.h> | ||
-#include <sys/signal.h> | ||
+#include <signal.h> | ||
#include <sys/types.h> | ||
|
||
#ifndef LWIP_HAVE_SLIPIF | ||
@@ -161,11 +161,20 @@ | ||
} | ||
/* Make the file descriptor asynchronous (the manual page says only | ||
O_APPEND and O_NONBLOCK, will work with F_SETFL...) */ | ||
- if ( fcntl( fd, F_SETFL, FASYNC ) != 0) | ||
+ | ||
+ | ||
+/* | ||
+ * FASYNC is not standardized by OPEN GROUP and not supported by Phoenix-RTOS | ||
+ * Comment out this code to make it compile, this code is excluded anyway since PPP_SUPPORT is defined | ||
+ */ | ||
+ | ||
+/* | ||
+ if ( fcntl( fd, F_SETFL, FASYNC ) != 0) | ||
{ | ||
perror( device ); | ||
exit( -1 ); | ||
} | ||
+*/ | ||
#else | ||
if ( fcntl( fd, F_SETFL, 0 ) != 0) | ||
{ | ||
@@ -175,6 +184,19 @@ | ||
|
||
#endif /* ! (PPP_SUPPORT || LWIP_HAVE_SLIPIF) */ | ||
|
||
+ | ||
+/* | ||
+ * Phoenix-RTOS patch | ||
+ * | ||
+ * CRTSCTS termios cflag is BSD specific, | ||
+ * This compilation is for Phoenix-RTOS which does not support this flag. | ||
+ * This macro has a chance to be forward compatible if Phoenix-RTOS will support it in the future. | ||
+ */ | ||
+#ifndef CRTSCTS | ||
+#define CRTSCTS 0 | ||
+#endif | ||
+ | ||
+ | ||
tcgetattr( fd,&oldtio ); /* save current port settings */ | ||
/* set new port settings */ | ||
/* see 'man termios' for further settings */ |