From 55dda99829666b8896e869d8e2be0bf5832173b6 Mon Sep 17 00:00:00 2001 From: Matthew G McGovern Date: Tue, 21 Jan 2025 11:46:08 -0800 Subject: [PATCH] Downloader: request work path with space --- microsoft/testsuites/dpdk/common.py | 11 ++++++-- microsoft/testsuites/dpdk/dpdktestpmd.py | 36 +++++++++++++++++++----- 2 files changed, 37 insertions(+), 10 deletions(-) diff --git a/microsoft/testsuites/dpdk/common.py b/microsoft/testsuites/dpdk/common.py index 2a7be6a511..6afb326e0c 100644 --- a/microsoft/testsuites/dpdk/common.py +++ b/microsoft/testsuites/dpdk/common.py @@ -99,9 +99,10 @@ def download(self) -> PurePath: # NOTE: fail on exists is set to True. # The expectation is that the parent Installer class should # remove any lingering installations + work_path = self._node.get_working_path_with_required_space(5) self.asset_path = self._node.tools[Git].clone( self._git_repo, - cwd=self._node.get_working_path(), + cwd=self._node.get_pure_path(work_path), ref=self._git_ref, fail_on_exists=False, ) @@ -123,7 +124,9 @@ def __init__( # then extract it def download(self) -> PurePath: node = self._node - work_path = self._node.get_working_path() + work_path = self._node.get_pure_path( + self._node.get_working_path_with_required_space(5) + ) is_tarball = False for suffix in [".tar.gz", ".tar.bz2", ".tar"]: if self._tar_url.endswith(suffix): @@ -137,7 +140,9 @@ def download(self) -> PurePath: ).is_true() if self._is_remote_tarball: tarfile = node.tools[Wget].get( - self._tar_url, overwrite=False, file_path=str(node.get_working_path()) + self._tar_url, + overwrite=False, + file_path=str(work_path), ) remote_path = node.get_pure_path(tarfile) self.tar_filename = remote_path.name diff --git a/microsoft/testsuites/dpdk/dpdktestpmd.py b/microsoft/testsuites/dpdk/dpdktestpmd.py index 8d5f8629d2..66e953ba10 100644 --- a/microsoft/testsuites/dpdk/dpdktestpmd.py +++ b/microsoft/testsuites/dpdk/dpdktestpmd.py @@ -267,17 +267,17 @@ def _install(self) -> None: self.dpdk_build_path = node.tools[Meson].setup( args=sample_apps, build_dir="build", cwd=self.asset_path ) - node.tools[Ninja].run( + install_result = node.tools[Ninja].run( cwd=self.dpdk_build_path, shell=True, timeout=1800, - expected_exit_code=0, - expected_exit_code_failure_message=( - "ninja build for dpdk failed. check build spew for missing headers " - "or dependencies. Also check that this ninja version requirement " - "has not changed for dpdk." - ), ) + # there are enough known installation failures to make + # raising each as a seperate useful message annoying. + # Also enough to make raising a single generic message useless. + # Use this function to parse and raise them. + _check_for_dpdk_build_errors(result=install_result) + # using sudo and pip modules can get weird on some distros, # whether you install with pip3 --user or not. # to work around, add the user python path to sudo one @@ -1007,3 +1007,25 @@ def _discard_first_and_last_sample(data: List[int]) -> List[int]: def _mean(data: List[int]) -> int: return sum(data) // len(data) + + +def _check_for_dpdk_build_errors(result: ExecutableResult) -> None: + # check for common build errors and raise specific error messages for them + errors = [ + # build unexpectedly ran out of space + "final link failed: No space left on device", + # elftools module not found (new OS version or package name change) + "Exception: elftools module not found", + ] + if result.exit_code == 0: + return + # check for known common issues + for error in errors: + if error in result.stdout: + fail(f"DPDK source build issue: {error}") + # otherwise, raise a generic error asking for triage + fail( + "ninja build for dpdk failed. check build spew for missing headers " + "or dependencies. Also check that this ninja version requirement " + "has not changed for dpdk." + )