Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

samples: net: sockets: Allow to build and test with POSIX subsys #18736

Merged
merged 1 commit into from
Aug 30, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 13 additions & 5 deletions samples/net/sockets/big_http_download/sample.yaml
Original file line number Diff line number Diff line change
@@ -1,10 +1,18 @@
sample:
description: BSD Sockets big HTTP download example
name: big_http_download
common:
filter: TOOLCHAIN_HAS_NEWLIB == 1
harness: net
min_ram: 32
min_flash: 128
tags: net socket
tests:
sample.net.sockets.big_http_download:
filter: TOOLCHAIN_HAS_NEWLIB == 1
harness: net
min_ram: 32
min_flash: 128
tags: net socket
extra_configs:
- CONFIG_NET_SOCKETS_POSIX_NAMES=y
sample.net.sockets.big_http_download.posix:
filter: and not CONFIG_NET_SOCKETS_OFFLOAD
extra_configs:
- CONFIG_NET_SOCKETS_POSIX_NAMES=n
- CONFIG_POSIX_API=y
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@

#include "mbedtls/md.h"

#ifndef __ZEPHYR__
#if !defined(__ZEPHYR__) || defined(CONFIG_POSIX_API)

#include <netinet/in.h>
#include <sys/socket.h>
Expand Down
18 changes: 13 additions & 5 deletions samples/net/sockets/dumb_http_server/sample.yaml
Original file line number Diff line number Diff line change
@@ -1,10 +1,18 @@
sample:
description: BSD Sockets API dumb HTTP server example
name: socket_dumb_http_server
common:
filter: TOOLCHAIN_HAS_NEWLIB == 1
harness: net
min_ram: 32
min_flash: 96
tags: net socket
tests:
sample.net.sockets.dumb_http_server:
filter: TOOLCHAIN_HAS_NEWLIB == 1
harness: net
min_ram: 32
min_flash: 96
tags: net socket
extra_configs:
- CONFIG_NET_SOCKETS_POSIX_NAMES=y
sample.net.sockets.dumb_http_server.posix:
filter: and not CONFIG_NET_SOCKETS_OFFLOAD
extra_configs:
- CONFIG_NET_SOCKETS_POSIX_NAMES=n
- CONFIG_POSIX_API=y
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
#include <stdlib.h>
#include <errno.h>

#ifndef __ZEPHYR__
#if !defined(__ZEPHYR__) || defined(CONFIG_POSIX_API)

#include <netinet/in.h>
#include <sys/socket.h>
Expand Down
15 changes: 12 additions & 3 deletions samples/net/sockets/echo_async/sample.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,17 @@ sample:
description: BSD Sockets API TCP echo server sample
using non-blocking sockets
name: socket_echo_async
common:
filter: TOOLCHAIN_HAS_NEWLIB == 1
harness: net
platform_whitelist: qemu_x86
tags: net socket
tests:
sample.net.sockets.echo_async:
harness: net
platform_whitelist: qemu_x86
tags: net socket
extra_configs:
- CONFIG_NET_SOCKETS_POSIX_NAMES=y
sample.net.sockets.echo_async.posix:
filter: and not CONFIG_NET_SOCKETS_OFFLOAD
extra_configs:
- CONFIG_NET_SOCKETS_POSIX_NAMES=n
- CONFIG_POSIX_API=y
2 changes: 1 addition & 1 deletion samples/net/sockets/echo_async/src/socket_echo.c
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
#include <errno.h>
#include <stdlib.h>

#ifndef __ZEPHYR__
#if !defined(__ZEPHYR__) || defined(CONFIG_POSIX_API)

#include <netinet/in.h>
#include <sys/socket.h>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,11 @@
#include <errno.h>
#include <stdlib.h>

#ifndef __ZEPHYR__
#if !defined(__ZEPHYR__) || defined(CONFIG_POSIX_API)

#include <netinet/in.h>
#include <sys/socket.h>
#include <sys/select.h>
#include <arpa/inet.h>
#include <unistd.h>
#include <fcntl.h>
Expand Down
21 changes: 16 additions & 5 deletions samples/net/sockets/http_get/sample.yaml
Original file line number Diff line number Diff line change
@@ -1,10 +1,21 @@
sample:
description: BSD Sockets API HTTP GET example
name: socket_http_get
common:
filter: TOOLCHAIN_HAS_NEWLIB == 1
harness: net
min_ram: 32
min_flash: 80
tags: net socket
tests:
sample.net.sockets.http_get:
filter: TOOLCHAIN_HAS_NEWLIB == 1
harness: net
min_ram: 32
min_flash: 80
tags: net socket
extra_configs:
- CONFIG_NET_SOCKETS_POSIX_NAMES=y
# Forcibly defines CONFIG_POSIX_API, which is incompatible with
# CONFIG_NET_SOCKETS_POSIX_NAMES.
platform_exclude: cc3220sf_launchxl
sample.net.sockets.http_get.posix:
filter: and not CONFIG_NET_SOCKETS_OFFLOAD
extra_configs:
- CONFIG_NET_SOCKETS_POSIX_NAMES=n
- CONFIG_POSIX_API=y
2 changes: 1 addition & 1 deletion samples/net/sockets/http_get/src/http_get.c
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
#include <stdio.h>
#include <stdlib.h>

#ifndef __ZEPHYR__
#if !defined(__ZEPHYR__) || defined(CONFIG_POSIX_API)

#include <netinet/in.h>
#include <sys/socket.h>
Expand Down