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# Running gPTP sample using Docker testing
11
12start_configuration || return $?
13start_docker \
14	"/usr/local/sbin/ptp4l -2 -f /etc/gptp.cfg -m -q -l 6 -S -i eth0" \
15	|| return $?
16
17# For native_posix gPTP run, the delay threshold needs to be huge
18start_zephyr "$overlay" "-DCONFIG_NET_SAMPLE_RUN_DURATION=10" \
19	         "-DCONFIG_NET_GPTP_NEIGHBOR_PROP_DELAY_THR=12000000"
20
21wait_zephyr
22gptp_result=$?
23
24if [ $gptp_result -eq 1 -o $gptp_result -eq 2 ]; then
25	result=0
26else
27	result=1
28fi
29
30stop_docker
31