[Lldb-commits] [lldb] r359751 - [test] Convert TestWatchpointSetErrorCases.py to lit
Jonas Devlieghere via lldb-commits
lldb-commits at lists.llvm.org
Wed May 1 18:54:06 PDT 2019
Author: jdevlieghere
Date: Wed May 1 18:54:05 2019
New Revision: 359751
URL: http://llvm.org/viewvc/llvm-project?rev=359751&view=rev
Log:
[test] Convert TestWatchpointSetErrorCases.py to lit
This test is flaky on GreenDragon. Since it was a pexpect test and
straightforward enough to convert, I went ahead and converted it to a
lit test.
Differential revision: https://reviews.llvm.org/D61414
Added:
lldb/trunk/lit/Watchpoint/
lldb/trunk/lit/Watchpoint/Inputs/
lldb/trunk/lit/Watchpoint/Inputs/main.cpp
lldb/trunk/lit/Watchpoint/SetErrorCases.test
Removed:
lldb/trunk/packages/Python/lldbsuite/test/functionalities/watchpoint/watchpoint_set_command/TestWatchpointSetErrorCases.py
Added: lldb/trunk/lit/Watchpoint/Inputs/main.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/lit/Watchpoint/Inputs/main.cpp?rev=359751&view=auto
==============================================================================
--- lldb/trunk/lit/Watchpoint/Inputs/main.cpp (added)
+++ lldb/trunk/lit/Watchpoint/Inputs/main.cpp Wed May 1 18:54:05 2019
@@ -0,0 +1,13 @@
+#include <stdio.h>
+
+int main (int argc, char const *argv[])
+{
+ struct {
+ int a;
+ int b;
+ int c;
+ } MyAggregateDataType;
+
+ printf ("Set break point at this line.\n");
+ return 0;
+}
Added: lldb/trunk/lit/Watchpoint/SetErrorCases.test
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/lit/Watchpoint/SetErrorCases.test?rev=359751&view=auto
==============================================================================
--- lldb/trunk/lit/Watchpoint/SetErrorCases.test (added)
+++ lldb/trunk/lit/Watchpoint/SetErrorCases.test Wed May 1 18:54:05 2019
@@ -0,0 +1,28 @@
+# RUN: %clangxx %p/Inputs/main.cpp -g -o %t.out
+# RUN: %lldb -b -o 'settings set interpreter.stop-command-source-on-error false' -s %s %t.out 2>&1 | FileCheck %s
+
+settings show interpreter.stop-command-source-on-error
+# CHECK: interpreter.stop-command-source-on-error (boolean) = false
+
+b main.cpp:11
+run
+# CHECK: stopped
+# CHECK-NEXT: stop reason = breakpoint
+
+watchpoint set
+# CHECK: Commands for setting a watchpoint.
+# CHECK: The following subcommands are supported:
+# CHECK: Set a watchpoint on an address by supplying an expression.
+# CHECK: Set a watchpoint on a variable.
+
+watchpoint set variable -w read_write
+# CHECK: error: required argument missing
+
+watchpoint set expression -w write --
+# CHECK: error: expression evaluation of address to watch failed
+
+watchpoint set expression MyAggregateDataType
+# CHECK: error: expression did not evaluate to an address
+
+watchpoint set variable -s -128
+# CHECK: error: invalid enumeration value
Removed: lldb/trunk/packages/Python/lldbsuite/test/functionalities/watchpoint/watchpoint_set_command/TestWatchpointSetErrorCases.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/functionalities/watchpoint/watchpoint_set_command/TestWatchpointSetErrorCases.py?rev=359750&view=auto
==============================================================================
--- lldb/trunk/packages/Python/lldbsuite/test/functionalities/watchpoint/watchpoint_set_command/TestWatchpointSetErrorCases.py (original)
+++ lldb/trunk/packages/Python/lldbsuite/test/functionalities/watchpoint/watchpoint_set_command/TestWatchpointSetErrorCases.py (removed)
@@ -1,74 +0,0 @@
-"""
-Test error cases for the 'watchpoint set' command to make sure it errors out when necessary.
-"""
-
-from __future__ import print_function
-
-
-import os
-import time
-import lldb
-from lldbsuite.test.decorators import *
-from lldbsuite.test.lldbtest import *
-import lldbsuite.test.lldbutil as lldbutil
-
-
-class WatchpointSetErrorTestCase(TestBase):
-
- mydir = TestBase.compute_mydir(__file__)
-
- def setUp(self):
- # Call super's setUp().
- TestBase.setUp(self)
- # Our simple source filename.
- self.source = 'main.cpp'
- # Find the line number to break inside main().
- self.line = line_number(
- self.source, '// Set break point at this line.')
- # Build dictionary to have unique executable names for each test
- # method.
-
- def test_error_cases_with_watchpoint_set(self):
- """Test error cases with the 'watchpoint set' command."""
- self.build()
- self.setTearDownCleanup()
-
- exe = self.getBuildArtifact("a.out")
- self.runCmd("file " + exe, CURRENT_EXECUTABLE_SET)
-
- # Add a breakpoint to set a watchpoint when stopped on the breakpoint.
- lldbutil.run_break_set_by_file_and_line(
- self, None, self.line, num_expected_locations=1)
-
- # Run the program.
- self.runCmd("run", RUN_SUCCEEDED)
-
- # We should be stopped again due to the breakpoint.
- # The stop reason of the thread should be breakpoint.
- self.expect("thread list", STOPPED_DUE_TO_BREAKPOINT,
- substrs=['stopped',
- 'stop reason = breakpoint'])
-
- # Try some error conditions:
-
- # 'watchpoint set' is now a multiword command.
- self.expect("watchpoint set",
- substrs=['The following subcommands are supported:',
- 'expression',
- 'variable'])
- self.runCmd("watchpoint set variable -w read_write", check=False)
-
- # 'watchpoint set expression' with '-w' or '-s' specified now needs
- # an option terminator and a raw expression after that.
- self.expect("watchpoint set expression -w write --", error=True,
- startstr='error: ')
-
- # It's an error if the expression did not evaluate to an address.
- self.expect(
- "watchpoint set expression MyAggregateDataType",
- error=True,
- startstr='error: expression did not evaluate to an address')
-
- # Wrong size parameter is an error.
- self.expect("watchpoint set variable -s -128", error=True,
- substrs=['invalid enumeration value'])
More information about the lldb-commits
mailing list