From 851908fe61db4a58d3be41329c99713e4f87b10b Mon Sep 17 00:00:00 2001 From: Ilias Apalodimas Date: Thu, 25 Oct 2018 10:24:07 +0300 Subject: add ptp tests and clock sync Signed-off-by: Ilias Apalodimas --- execs/iproute-build.yaml | 27 +++++++++++++++++++++++++++ execs/sync-clocks.yaml | 14 ++++++++++++++ execs/tas.yaml | 27 --------------------------- multinodes/lng03-lng04-ubuntu-18.04.yaml | 9 +++++++-- scripts/lava-common.sh | 16 +++++++++++++++- scripts/run-ptp.sh | 14 ++++++++++++++ 6 files changed, 77 insertions(+), 30 deletions(-) create mode 100644 execs/iproute-build.yaml create mode 100644 execs/sync-clocks.yaml delete mode 100644 execs/tas.yaml create mode 100755 scripts/run-ptp.sh diff --git a/execs/iproute-build.yaml b/execs/iproute-build.yaml new file mode 100644 index 0000000..3881e35 --- /dev/null +++ b/execs/iproute-build.yaml @@ -0,0 +1,27 @@ +metadata: + name: 802.1Qbv iproute2 + format: "Lava-Test-Shell Test Definition 1.0" + description: "Install latest iproute2 with TAS support" + version: 1.0 + +install: + deps: + - autotools-dev + - autoconf + - libtool + - autogen + - gcc + - git + - g++ + - make + - libssl-dev + - libconfig-dev + - m4 + - pkg-config + - locales-all + - libpcap-dev + +run: + steps: + - echo "Building iproute2" + - ./scripts/build-iproute2.sh diff --git a/execs/sync-clocks.yaml b/execs/sync-clocks.yaml new file mode 100644 index 0000000..7e7fb93 --- /dev/null +++ b/execs/sync-clocks.yaml @@ -0,0 +1,14 @@ +metadata: + name: ptp4linux clock sync + format: "Lava-Test-Shell Test Definition 1.0" + description: "Sync clocks between servers using 802.1AS" + version: 1.0 + +install: + deps: + - linuxptp + +run: + steps: + - echo "Syncing clocks" + - ./scripts/run-ptp.sh diff --git a/execs/tas.yaml b/execs/tas.yaml deleted file mode 100644 index 3881e35..0000000 --- a/execs/tas.yaml +++ /dev/null @@ -1,27 +0,0 @@ -metadata: - name: 802.1Qbv iproute2 - format: "Lava-Test-Shell Test Definition 1.0" - description: "Install latest iproute2 with TAS support" - version: 1.0 - -install: - deps: - - autotools-dev - - autoconf - - libtool - - autogen - - gcc - - git - - g++ - - make - - libssl-dev - - libconfig-dev - - m4 - - pkg-config - - locales-all - - libpcap-dev - -run: - steps: - - echo "Building iproute2" - - ./scripts/build-iproute2.sh diff --git a/multinodes/lng03-lng04-ubuntu-18.04.yaml b/multinodes/lng03-lng04-ubuntu-18.04.yaml index d0f7604..cf10ae2 100644 --- a/multinodes/lng03-lng04-ubuntu-18.04.yaml +++ b/multinodes/lng03-lng04-ubuntu-18.04.yaml @@ -90,8 +90,13 @@ actions: - repository: https://git.linaro.org/people/ilias.apalodimas/lava-sessions.git/ from: git - path: execs/tas.yaml - name: TAS-scheduler + path: execs/iproute-build.yaml + name: TAS-build-iproute + + - repository: https://git.linaro.org/people/ilias.apalodimas/lava-sessions.git/ + from: git + path: execs/sync-clocks.yaml + name: ptp-clock-sync - repository: https://git.linaro.org/lava-team/hacking-session.git from: git 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 & -- cgit v1.2.3