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
10echo "Starting MQTT test"
11
12start_configuration || return $?
13start_docker \
14    "/usr/local/sbin/mosquitto -v -c /usr/local/etc/mosquitto/mosquitto.conf" || return $?
15
16start_zephyr -DOVERLAY_CONFIG=overlay-sample.conf "$overlay"
17
18wait_zephyr
19result=$?
20
21if [ $result -ne 0 ]; then
22	return $result
23fi
24
25stop_docker
26
27# test TLS
28echo "Starting MQTT TLS test"
29
30start_docker \
31    "/usr/local/sbin/mosquitto -v -c /usr/local/etc/mosquitto/mosquitto-tls.conf" || return $?
32
33start_zephyr -DOVERLAY_CONFIG="overlay-tls.conf overlay-sample.conf" "$overlay"
34
35wait_zephyr
36result=$?
37
38if [ $result -ne 0 ]; then
39	return $result
40fi
41
42stop_docker
43return $result
44
45# FIXME: proxy test does not work as expected
46
47# TLS and SOCKS5, mosquitto TLS is already running
48echo "Starting MQTT TLS + proxy test"
49
50start_docker "/usr/sbin/danted" || return $?
51
52start_zephyr -DOVERLAY_CONFIG="overlay-tls.conf overlay-sample.conf overlay-socks5.conf" "$overlay" || return $?
53
54wait_zephyr
55result=$?
56
57stop_docker
58