1# Copyright (c) 2020 Intel Corporation
2# SPDX-License-Identifier: Apache-2.0
3
4if [ -z "$RUNNING_FROM_MAIN_SCRIPT" ]; then
5    echo "Do not run this script directly!"
6    echo "Run $ZEPHYR_BASE/scripts/net/run-sample-tests.sh instead."
7    exit 1
8fi
9
10# First the non-tls version
11echo "HTTP client test"
12start_configuration "--ip=192.0.2.2 --ip6=2001:db8::2" || return $?
13start_docker "/usr/local/bin/http-server.py" || return $?
14start_zephyr "$overlay" "-DCONFIG_NET_SAMPLE_SEND_ITERATIONS=5"
15wait_zephyr
16result=$?
17stop_docker
18
19if [ $result -ne 0 ]; then
20	return $result
21fi
22
23return $result
24
25# If everything is ok so far, do the TLS version
26echo "HTTPS client test"
27
28if [ -n "$zephyr_overlay" ]; then
29	overlay="${zephyr_overlay};overlay-tls.conf"
30else
31	overlay="-DOVERLAY_CONFIG=overlay-tls.conf"
32fi
33
34start_configuration "--ip=192.0.2.2 --ip6=2001:db8::2" || return $?
35start_docker "/usr/local/bin/https-server.py 192.0.2.2" \
36             "/usr/local/bin/https-server.py 2001:db8::2" || return $?
37start_zephyr "$overlay" "-DCONFIG_NET_SAMPLE_SEND_ITERATIONS=5"
38wait_zephyr
39result=$?
40stop_docker
41