test decorator working on linux, but not on windows

packages/Python/lldbsuite/test/lang/c/typedef/Testtypedef.py has this decorator:

@expectedFailureAll(compiler=“clang”, bugnumber=“llvm.org/pr19238”)

On Linux, I’m building with hexagon-clang, and this decorator fires, so the test is xfailed.

On Windows, I’m building with hexagon-clang.exe, and this decorator is evidently not firing, because the test fails instead of being xfailed.

Linux is using Python 2.7.8. Windows is using Python 3.5.1.

You will probably need to debug the python code to figure out why this is happening. Start with this line in lldb/packages/Python/lldbsuite/test/decorators.py

def _decorateTest(mode,
bugnumber=None, oslist=None, hostoslist=None,
compiler=None, compiler_version=None,
archs=None, triple=None,
swig_version=None, py_version=None,

skip_for_compiler = _match_decorator_property(
compiler, self.getCompiler()) and self.expectedCompilerVersion(compiler_version)

Bottom line: lldbutil.is_exe() does not think “foo” is an exe on windows when “foo.exe” is.

print(“***compiler is:”, self.getCompiler(), file=sys.stderr)

***compiler is: C:\lldb\8.0\llvm\tools\lldb\packages\Python\lldbsuite\test\lang\c\typedef

self.getCompiler() is returning the test directory.

So, _decorateTest’s line:

skip_for_compiler = _match_decorator_property(compiler, self.getCompiler()) and self.expectedCompilerVersion(compiler_version)

is trying to match with the test directory.

On Linux I get this:

***compiler is: /prj/dsp/qdsp6/release/internal/branch-8.0/linux64/toolset-4199/Tools/bin/clang-3.9

The path to the compiler (hexagon-clang is a symlink to clang-3.9).

Builder_base.getCompiler is:

def getCompiler():

“”“Returns the compiler in effect the test suite is running with.”“”

compiler = os.environ.get(“CC”, “clang”)

compiler = lldbutil.which(compiler)

return os.path.realpath(compiler)

os.environ.get returns r:/internal/branch-8.0/windows/latest/Tools/bin/hexagon-clang, but lldbutil.which returns None.

def which(program):

“”“Returns the full path to a program; None otherwise.”“”

fpath, fname = os.path.split(program)

if fpath:

if is_exe(program):

return program


for path in os.environ[“PATH”].split(os.pathsep):

exe_file = os.path.join(path, program)

if is_exe(exe_file):

return exe_file

return None

The problem is the compiler – I specified hexagon-clang, not hexagon-clang.exe, so is_exe returns false.

def is_exe(fpath):

“”“Returns True if fpath is an executable.”“”

return os.path.isfile(fpath) and os.access(fpath, os.X_OK)

My run line:

c:\lldb\8.0\35\Debug\libexec\python_d dotest.py -A v60 -C r:/internal/branch-8.0/windows/latest/Tools/bin/hexagon-clang --executable c:\lldb\8.0\35\Debug\bin\lldb.exe -t -v -p Testtypedef.py

Changing it to hexagon-clang.exe solved the problem.