aboutsummaryrefslogtreecommitdiffstats
path: root/test/asf
diff options
context:
space:
mode:
authorDave Wallace <dwallacelf@gmail.com>2023-11-08 15:55:56 -0500
committerFlorin Coras <florin.coras@gmail.com>2023-11-14 17:23:49 +0000
commit1b86f0f477692731edaf4da99f3b639c63bbd8d0 (patch)
treeac37985906dc30c38d0bfda3141bde0f75fa192c /test/asf
parent2d725c61286ccb8625ffad5c678cee337f88bceb (diff)
tests: retry unlinking pcap files on os error
Type: test Change-Id: I270798ed68f04bd3974dd39c44e85dad5fa02de0 Signed-off-by: Dave Wallace <dwallacelf@gmail.com>
Diffstat (limited to 'test/asf')
-rw-r--r--test/asf/asfframework.py13
1 files changed, 11 insertions, 2 deletions
diff --git a/test/asf/asfframework.py b/test/asf/asfframework.py
index 024d7f0127d..9839ff58543 100644
--- a/test/asf/asfframework.py
+++ b/test/asf/asfframework.py
@@ -853,8 +853,17 @@ class VppAsfTestCase(CPUInterface, unittest.TestCase):
if hasattr(self, "pg_interfaces") and len(self.pg_interfaces) > 0:
testcase_dir = os.path.dirname(self.pg_interfaces[0].out_path)
for p in Path(testcase_dir).glob("pg*.pcap"):
- self.logger.debug(f"Removing {p}")
- p.unlink()
+ retries = 8
+ while retries > 0:
+ retries = retries - 1
+ self.logger.debug(f"Unlinking {p}")
+ try:
+ p.unlink()
+ break
+ except OSError:
+ self.logger.debug(f"OSError: unlinking {p}")
+ self.sleep(0.25, f"{retries} retries left")
+
self.logger.debug(
f"--- END tearDown() {self.__class__.__name__}.{self._testMethodName}('{self._testMethodDoc}') ---"
)