From: Seva Alekseyev Date: Fri, 8 Sep 2023 15:44:11 +0000 (-0400) Subject: Dwarfdump test on Windows (#499) X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=14e933dfb7a1116a42c7378ab22b37a33688eca1;p=pyelftools.git Dwarfdump test on Windows (#499) --- diff --git a/scripts/dwarfdump.py b/scripts/dwarfdump.py index fec7524..bf05bdb 100644 --- a/scripts/dwarfdump.py +++ b/scripts/dwarfdump.py @@ -14,7 +14,7 @@ # This code is in the public domain #------------------------------------------------------------------------------- import argparse -import os, sys, posixpath +import os, sys import traceback # For running from development directory. It should take precedence over the @@ -147,13 +147,13 @@ def _desc_decl_file(attr, die): if dir_index >= 0: dir = bytes2str(includes[dir_index]) if dir.startswith('.'): - dir = posixpath.join(_cu_comp_dir(cu), dir) + dir = os.path.join(_cu_comp_dir(cu), dir) else: dir = _cu_comp_dir(cu) file_name = bytes2str(file_entry.name) else: raise DWARFError("Invalid source filename entry index in a decl_file attribute") - return "\"%s\"" % (posixpath.join(dir, file_name),) + return "\"%s\"" % (os.path.join(dir, file_name),) def _desc_ranges(attr, die): diff --git a/test/run_dwarfdump_tests.py b/test/run_dwarfdump_tests.py index e9710c2..629db01 100644 --- a/test/run_dwarfdump_tests.py +++ b/test/run_dwarfdump_tests.py @@ -32,7 +32,8 @@ testlog.addHandler(logging.StreamHandler(sys.stdout)) if platform.system() == "Darwin": # MacOS raise NotImplementedError("Not supported on MacOS") elif platform.system() == "Windows": - raise NotImplementedError("Not supported on Windows") + # Point the environment variable DWARFDUMP at a Windows build of llvm-dwarfdump + DWARFDUMP_PATH = os.environ.get('DWARFDUMP', "llvm-dwarfdump.exe") else: DWARFDUMP_PATH = 'test/external_tools/llvm-dwarfdump'