From 861c2c78f0860cfadee4a350eaff7bf7c73b5f88 Mon Sep 17 00:00:00 2001 From: Jukka Rissanen Date: Thu, 29 Oct 2020 18:48:46 +0200 Subject: [PATCH] net: scripts: Add gPTP support to sample testing Allow gPTP sample to be run via run-sample-tests.sh script. This makes it possible to do simple smoke testing and verify that gPTP stack is not broken. Signed-off-by: Jukka Rissanen --- scripts/net/run-sample-tests.sh | 27 ++++++++++++++++++++++++++- west.yml | 2 +- 2 files changed, 27 insertions(+), 2 deletions(-) diff --git a/scripts/net/run-sample-tests.sh b/scripts/net/run-sample-tests.sh index 1f083717abb..0bcb3485845 100755 --- a/scripts/net/run-sample-tests.sh +++ b/scripts/net/run-sample-tests.sh @@ -146,7 +146,10 @@ start_zephyr () cmake -GNinja -DBOARD=native_posix -B build "$@" . && \ ninja -C build - ninja -C build run & + # Run the binary directly so that ninja does not print errors that + # could be confusing. + #ninja -C build run & + build/zephyr/zephyr.exe & zephyr_pid=$! sleep 3 @@ -361,6 +364,28 @@ docker_exec () return $result ;; + gptp) + start_configuration || return $? + start_docker \ + "/usr/local/sbin/ptp4l -2 -f /etc/gptp.cfg -m -q -l 6 -S -i eth0" \ + || return $? + + # For native_posix gPTP run, the delay threshold needs to be huge + start_zephyr "$overlay" "-DCONFIG_NET_SAMPLE_RUN_DURATION=10" \ + "-DCONFIG_NET_GPTP_NEIGHBOR_PROP_DELAY_THR=12000000" + + wait_zephyr + gptp_result=$? + + if [ $gptp_result -eq 1 -o $gptp_result -eq 2 ]; then + result=0 + else + result=1 + fi + + stop_docker + ;; + *) echo "No sample test corresponding to directory '$1' found" >&2 return 1 diff --git a/west.yml b/west.yml index 14a6e5dc37d..28a2e060bb5 100644 --- a/west.yml +++ b/west.yml @@ -99,7 +99,7 @@ manifest: revision: f28a637db12c4b12fb2b18bddc6b2a0deaa95251 path: modules/lib/mcumgr - name: net-tools - revision: e53774b71288a85f7321bfbfa57cae6d3419f022 + revision: c72fbf3300264a8a4bb48be314ca93765c863a19 path: tools/net-tools - name: hal_nxp revision: 56915d2942a3af7205b3c4991a8b87e915de7f59