[all-commits] [llvm/llvm-project] e8b5b7: [lit] Support relative path arguments

Geoffrey Martin-Noble via All-commits all-commits at lists.llvm.org
Mon Dec 20 11:49:58 PST 2021

  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: e8b5b7218263e7b1c0b0466cc3c71ff88748935d
  Author: Geoffrey Martin-Noble <gcmn at google.com>
  Date:   2021-12-20 (Mon, 20 Dec 2021)

  Changed paths:
    M llvm/utils/lit/lit/cl_arguments.py
    M llvm/utils/lit/lit/util.py

  Log Message:
  [lit] Support relative path arguments

Currently the behavior with relative paths is pretty broken. It differs
between external shell and internal shell because the path resolution
is done with a different working directory. With the internal shell,
it's resolved relative to the directory from which lit is executed,
whereas with the external shell it's resolved relative to where the
test case is executed. To make matters worse, using the internal shell
the filepath to binaries looked up with `which` is returned relative
to the directory from which lit is executed, but then executed from
the test execution directory. That means that relative paths with the
internal shell give a `[Errno 2] No such file or directory` error
instead of the expected `command not found`.

To address these issues this patch makes lit interpret relative paths
as relative to the directory from which lit was invoked and modifies
`which` to return absolute paths, matching the behavior of its
namesake unix function.

See https://groups.google.com/g/llvm-dev/c/KzMWlOXR98Y/m/QJoqn0U5HAAJ

Reviewed By: yln

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

More information about the All-commits mailing list