[all-commits] [llvm/llvm-project] b51321: [lldb] Fix TestCompletion's pid completion failing...

Raphael Isemann via All-commits all-commits at lists.llvm.org
Mon Aug 31 03:23:28 PDT 2020


  Branch: refs/heads/master
  Home:   https://github.com/llvm/llvm-project
  Commit: b51321ccc894f6ed512c27cb43b1f04883d5ed0e
      https://github.com/llvm/llvm-project/commit/b51321ccc894f6ed512c27cb43b1f04883d5ed0e
  Author: Raphael Isemann <teemperor at gmail.com>
  Date:   2020-08-31 (Mon, 31 Aug 2020)

  Changed paths:
    M lldb/packages/Python/lldbsuite/test/lldbtest.py
    M lldb/test/API/functionalities/completion/TestCompletion.py

  Log Message:
  -----------
  [lldb] Fix TestCompletion's pid completion failing randomly

TestCompletion is randomly failing on some bots. The error message however states
that the computed completions actually do contain the expected pid we're
looking for, so there shouldn't be any test failure.

The reason for that turns out to be that complete_from_to is actually used
for testing two different features. It can be used for testing what the
common prefix for the list of completions is and *also* for checking all the
possible completions that are returned for a command. Which one of the two
things should be checked can't be defined by a parameter to the function, but
is instead guessed by the test method instead based on the results that were
returned. If there is a common prefix in all completions, then that prefix
is searched and otherwise all completions are searched.

For TestCompletion's pid test this behaviour leads to the strange test failures.
If all the pid's that our test LLDB can see have a common prefix (e.g., it
can only see pids [123, 122, 10004, 10000] -> common prefix '1'), then
complete_from_to check that the common prefix contains our pid, which is
always fails ('1' doesn't contain '123' or any other valid pid). If there
isn't a common prefix (e.g., pids are [123, 122, 10004, 777]) then
complete_from_to will check the list of completions instead which works correctly.

This patch is fixing this by adding a simple check method that doesn't
have this behaviour and is simply searching the returned list of completions.
This should get the bots green while I'm working on a proper fix that fixes
complete_from_to.




More information about the All-commits mailing list