[all-commits] [llvm/llvm-project] 713752: [lldb] Use shutil.which in Shell tests find_execut...

David Spickett via All-commits all-commits at lists.llvm.org
Fri Apr 29 03:01:40 PDT 2022


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 713752610edd3d8766f56e2704bb7241434cd15b
      https://github.com/llvm/llvm-project/commit/713752610edd3d8766f56e2704bb7241434cd15b
  Author: David Spickett <david.spickett at linaro.org>
  Date:   2022-04-29 (Fri, 29 Apr 2022)

  Changed paths:
    M lldb/test/Shell/helper/build.py

  Log Message:
  -----------
  [lldb] Use shutil.which in Shell tests find_executable

In build.py we have our own find_executable that looks
a lot like the distutils one that I switched to shutil.which.

This find_executable isn't quite the same as shutil.which
so I've refactored it to call that in the correct way.

Note that the path passed to shutil.which is in the form that
PATH would be, meaning separators are allowed.
```
>>> shutil.which("gcc", path="/home/david.spickett:/bin")
'/bin/gcc'
```

We just need to make sure it doesn't ignore the existing PATH
and normalise the result if it does find the binary.

The .exe extension is automatically added to the binary name
if we are on Windows.

Depends on D124601

Reviewed By: JDevlieghere

Differential Revision: https://reviews.llvm.org/D124604




More information about the All-commits mailing list