Skip to content

Commit

Permalink
Option to not raise exception if clang -v fails (#684)
Browse files Browse the repository at this point in the history
@erwei-xilinx is hitting an undiagnosable error when `clang -v` is run.
This PR makes the script just continue in this case, as it is not
important that we get the version information.
  • Loading branch information
newling authored Aug 16, 2024
1 parent 382053a commit 9109a1f
Showing 1 changed file with 9 additions and 4 deletions.
13 changes: 9 additions & 4 deletions build_tools/ci/cpu_comparison/run_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ def find_executable(install_dir: Path, executable_name):
)


def shell_out(cmd: list, workdir=None, verbose=False):
def shell_out(cmd: list, workdir=None, verbose=False, raiseOnError=True):
if workdir is None:
workdir = Path.cwd()
if not isinstance(cmd, list):
Expand All @@ -78,7 +78,11 @@ def shell_out(cmd: list, workdir=None, verbose=False):
if stderr_decode:
print("Standard error from script:")
print(stderr_decode)
if handle.returncode != 0:
if not raiseOnError and handle.returncode != 0:
print(
f"Error executing script, error code was {handle.returncode}. Not raising an error."
)
if raiseOnError and handle.returncode != 0:
raise RuntimeError(
f"Error executing script, error code was {handle.returncode}"
)
Expand Down Expand Up @@ -302,12 +306,13 @@ def __init__(
if xrt_hash:
self.xrt_hash = xrt_hash[0]

# Try and get the peano commit hash. This is a bit of a hack.
# Try and get the peano commit hash. This is a bit of a hack, if it fails
# peano_commit_has is left as "undetermined".
self.peano_commit_hash = "undetermined"
peano_clang_path = peano_dir / "bin" / "clang"
if peano_clang_path.exists():
_, clang_v_output = shell_out(
[peano_clang_path, "-v"], verbose=self.verbose
[peano_clang_path, "-v"], verbose=self.verbose, raiseOnError=False
)
peano_commit_hash = re.findall(
r"clang version \d+\.\d+\.\d+ \(https://github.com/Xilinx/llvm-aie (\w+)\)",
Expand Down

0 comments on commit 9109a1f

Please sign in to comment.