diff options
author | Ilias Apalodimas <ilias.apalodimas@linaro.org> | 2018-10-25 10:24:07 +0300 |
---|---|---|
committer | Ilias Apalodimas <ilias.apalodimas@linaro.org> | 2018-10-25 11:19:50 +0300 |
commit | 851908fe61db4a58d3be41329c99713e4f87b10b (patch) | |
tree | 0c0eaf51491690ef95d183f07e379cdbfe19754b /scripts | |
parent | 7ce4d61d7adbcfa9c55bdaaac00dad2ce15ea893 (diff) |
add ptp tests and clock sync
Signed-off-by: Ilias Apalodimas <ilias.apalodimas@linaro.org>
Diffstat (limited to 'scripts')
-rwxr-xr-x | scripts/lava-common.sh | 16 | ||||
-rwxr-xr-x | scripts/run-ptp.sh | 14 |
2 files changed, 29 insertions, 1 deletions
diff --git a/scripts/lava-common.sh b/scripts/lava-common.sh index 86c7f86..8b3eacd 100755 --- a/scripts/lava-common.sh +++ b/scripts/lava-common.sh @@ -1,4 +1,4 @@ -#!/bin/sh +#!/bin/bash lava_result() { reason=$1 @@ -8,3 +8,17 @@ lava_result() { lava-test-case "$reason" --result "$result" [ "$stop_session" = 'yes' ] && lava-test-raise "$reason" && exit 1 } + +find_vland_iface() { + # lv must match lava vlan name + lv='vlan_one' + pattern=$(lava-vland-names | awk -F ',' -v vlan="$lv" '$0 ~ vlan {print $2}') + + iface_str=$(lava-vland-self | grep "$pattern") + mac=$(echo $iface_str | awk -F ',' '{print $2}') + for i in $(ls /sys/class/net/); do + new_mac=$(cat /sys/class/net/"$i"/address) + [ "$new_mac" == "$mac" ] && iface="$i" && break + done + echo $iface +} diff --git a/scripts/run-ptp.sh b/scripts/run-ptp.sh new file mode 100755 index 0000000..ebaeed7 --- /dev/null +++ b/scripts/run-ptp.sh @@ -0,0 +1,14 @@ +#!/bin/bash + +. scripts/lava-common.sh + +# stop the default service +systemctl stop ptp4l +iface=$(find_vland_iface) + +echo "[global]" > testptp.cfg +echo "[$iface]" >> testptp.cfg +echo "#" >> testptp.cfg +echo "transportSpecific 1" >> testptp.cfg +# Run all as masters and let them select +ptp4l -f testptp.cfg -i "$iface" -m & |