[all-commits] [llvm/llvm-project] 327a18: [lldb][test] Prevent \n in calls to lldb's expect(...

Jordan Rupprecht via All-commits all-commits at lists.llvm.org
Tue Nov 19 15:18:06 PST 2019


  Branch: refs/heads/master
  Home:   https://github.com/llvm/llvm-project
  Commit: 327a18ca0a000e4f99d02d0042ca2106db635a68
      https://github.com/llvm/llvm-project/commit/327a18ca0a000e4f99d02d0042ca2106db635a68
  Author: Jordan Rupprecht <rupprecht at google.com>
  Date:   2019-11-19 (Tue, 19 Nov 2019)

  Changed paths:
    M lldb/packages/Python/lldbsuite/test/lldbpexpect.py
    M lldb/packages/Python/lldbsuite/test/terminal/TestEditline.py

  Log Message:
  -----------
  [lldb][test] Prevent \n in calls to lldb's expect() test helper.

Summary:
expect() forwards its command to sendline(). This can be problematic if the command already contains a newline: sendline() unconditionally adds a newline to the command, which causes the command to run twice (hitting enter in lldb runs the previous command). The expect() helper looks for the prompt and finds the first one, but because the command has run a second time, the buffer will contain the contents of the second time the command ran, causing potential erroneous matching.

Simplify the editline test, which was using different commands to workaround this misunderstanding.

Reviewers: labath

Reviewed By: labath

Subscribers: merge_guards_bot, lldb-commits

Tags: #lldb

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




More information about the All-commits mailing list