From 8c6699779b614d82654ba3f6500becc022de917f Mon Sep 17 00:00:00 2001 From: Andy Fingerhut Date: Sun, 2 Mar 2025 21:17:15 -0500 Subject: [PATCH 1/6] Fix a bug of printing the wrong packets during a test failure Signed-off-by: Andy Fingerhut --- src/ptf/dataplane.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/ptf/dataplane.py b/src/ptf/dataplane.py index a1c1b3f..61bfdaf 100644 --- a/src/ptf/dataplane.py +++ b/src/ptf/dataplane.py @@ -881,10 +881,10 @@ def format(self): ) for recent_packet in self.recent_packets: print("------------------------------") - if isinstance(self.expected_packet, packet.Packet): + if isinstance(self.recent_packet, packet.Packet): # Dissect this packet as if it were an instance of # the expected packet's class. - packet.ls(self.expected_packet.__class__(recent_packet)) + packet.ls(self.recent_packet.__class__(recent_packet)) print("--") packet.hexdump(recent_packet) else: From a16698c1ceaab34dfdd04cbb5c9c329113d2f5b1 Mon Sep 17 00:00:00 2001 From: Andy Fingerhut Date: Mon, 3 Mar 2025 00:22:43 -0500 Subject: [PATCH 2/6] Finish the fix Signed-off-by: Andy Fingerhut --- src/ptf/dataplane.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/ptf/dataplane.py b/src/ptf/dataplane.py index 61bfdaf..8f0cc6b 100644 --- a/src/ptf/dataplane.py +++ b/src/ptf/dataplane.py @@ -881,10 +881,10 @@ def format(self): ) for recent_packet in self.recent_packets: print("------------------------------") - if isinstance(self.recent_packet, packet.Packet): + if isinstance(recent_packet, packet.Packet): # Dissect this packet as if it were an instance of # the expected packet's class. - packet.ls(self.recent_packet.__class__(recent_packet)) + packet.ls(recent_packet.__class__(recent_packet)) print("--") packet.hexdump(recent_packet) else: From 616c52bba85068b591e6e654ab89010225b02797 Mon Sep 17 00:00:00 2001 From: Andy Fingerhut Date: Mon, 3 Mar 2025 00:34:23 -0500 Subject: [PATCH 3/6] Try a simpler way to install nnpy that seems to work for BMv2 Signed-off-by: Andy Fingerhut --- CI/install-nnpy.sh | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/CI/install-nnpy.sh b/CI/install-nnpy.sh index a9fa0a2..b7d0d76 100755 --- a/CI/install-nnpy.sh +++ b/CI/install-nnpy.sh @@ -1,8 +1,3 @@ #!/bin/sh set -e -git clone https://github.com/nanomsg/nnpy.git -cd nnpy -python3 -m pip install cffi -python3 -m pip install --upgrade cffi -python3 -m pip install . -cd .. +pip3 install nnpy cffi From 7ef7a85ee888e4b28600b940f7e125bbbe8bb0d1 Mon Sep 17 00:00:00 2001 From: Andy Fingerhut Date: Mon, 3 Mar 2025 00:44:20 -0500 Subject: [PATCH 4/6] Try another variation Signed-off-by: Andy Fingerhut --- CI/install-nnpy.sh | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/CI/install-nnpy.sh b/CI/install-nnpy.sh index b7d0d76..2dc9e9c 100755 --- a/CI/install-nnpy.sh +++ b/CI/install-nnpy.sh @@ -1,3 +1,4 @@ #!/bin/sh set -e -pip3 install nnpy cffi +python3 -m pip install cffi +python3 -m pip install nnpy From 478c217920729a36ea9466f92dd3e18078c6bc79 Mon Sep 17 00:00:00 2001 From: Andy Fingerhut Date: Thu, 6 Mar 2025 03:43:31 +0000 Subject: [PATCH 5/6] Use Python venv in CI tests Without this, I have seen many failures recently on Ubuntu 22.04 that I do not know the root cause of, but using a venv gives consistently passing results. Signed-off-by: Andy Fingerhut --- .github/workflows/build.yml | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 91e3f50..e5788de 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -47,7 +47,9 @@ jobs: - name: Dependencies run: | - sudo apt-get install cmake libffi-dev ethtool python3-dev + sudo apt-get install cmake libffi-dev ethtool python3-dev python3-venv + python3 -m venv $HOME/ptf-test-venv + source $HOME/ptf-test-venv/bin/activate python3 -m pip install --upgrade pip setuptools nose2 wheel python -m pip install scapy==${{ matrix.scapy_version }} @@ -57,6 +59,7 @@ jobs: - name: Install run: | + source $HOME/ptf-test-venv/bin/activate python3 -m pip install . ptf --version @@ -66,6 +69,7 @@ jobs: - name: Script run: | + source $HOME/ptf-test-venv/bin/activate pip --verbose list python3 CI/check-nnpy.py ./CI/run_tests.sh From ce1f04efab4345c9519ccf56db54cd193114b72b Mon Sep 17 00:00:00 2001 From: Andy Fingerhut Date: Thu, 6 Mar 2025 10:15:06 -0500 Subject: [PATCH 6/6] Revert install-nnpy.sh back to original Signed-off-by: Andy Fingerhut --- CI/install-nnpy.sh | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/CI/install-nnpy.sh b/CI/install-nnpy.sh index 2dc9e9c..a9fa0a2 100755 --- a/CI/install-nnpy.sh +++ b/CI/install-nnpy.sh @@ -1,4 +1,8 @@ #!/bin/sh set -e +git clone https://github.com/nanomsg/nnpy.git +cd nnpy python3 -m pip install cffi -python3 -m pip install nnpy +python3 -m pip install --upgrade cffi +python3 -m pip install . +cd ..