[all-commits] [llvm/llvm-project] fcb0d8: [lldb/test] Use realpath consistently for test roo...

Jordan Rupprecht via All-commits all-commits at lists.llvm.org
Wed Aug 5 11:36:16 PDT 2020


  Branch: refs/heads/master
  Home:   https://github.com/llvm/llvm-project
  Commit: fcb0d8163a4f3090cb85d77b459887cf1f84cc7e
      https://github.com/llvm/llvm-project/commit/fcb0d8163a4f3090cb85d77b459887cf1f84cc7e
  Author: Jordan Rupprecht <rupprecht at google.com>
  Date:   2020-08-05 (Wed, 05 Aug 2020)

  Changed paths:
    M lldb/packages/Python/lldbsuite/__init__.py
    M lldb/packages/Python/lldbsuite/test/lldbtest.py
    M lldb/test/API/use_lldb_suite.py

  Log Message:
  -----------
  [lldb/test] Use realpath consistently for test root file paths.

LLDB tests assume that tests are in the test tree (the `LLDB_TEST_SRC` env variable, configured by `dotest.py`).
If this assertion doesn't hold, tests fail in strange ways. An early place this goes wrong is in `compute_mydir` which does a simple length-based substring to get the relative path. Later, we use that path to chdir to. If the test file and test tree don't agree in realpath-ness (and therefore length), this will be a cryptic error of chdir-ing to a directory that does not exist.

The actual discrepency is that the places we look for `use_lldb_suite.py` don't use a realpath, but `dotest.py` does (see initialization of `configuration.testdirs`).

It doesn't particularly matter whether we use realpath or abspath to canonicalize things, but many places end up with implicit dependencies on the canonicalized pwd being a realpath, so make them realpath consistently. Also, in the `compute_mydir` method mentioned, raise an error if the path types don't agree.

Reviewed By: JDevlieghere

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




More information about the All-commits mailing list