]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/blob - packages/Python/lldbsuite/test/expression_command/persistent_variables/TestPersistentVariables.py
Vendor import of lldb trunk r290819:
[FreeBSD/FreeBSD.git] / packages / Python / lldbsuite / test / expression_command / persistent_variables / TestPersistentVariables.py
1 """
2 Test that lldb persistent variables works correctly.
3 """
4
5 from __future__ import print_function
6
7
8 import os
9 import time
10 import lldb
11 from lldbsuite.test.lldbtest import *
12
13
14 class PersistentVariablesTestCase(TestBase):
15
16     mydir = TestBase.compute_mydir(__file__)
17
18     def test_persistent_variables(self):
19         """Test that lldb persistent variables works correctly."""
20         self.build()
21
22         self.runCmd("file a.out", CURRENT_EXECUTABLE_SET)
23
24         self.runCmd("breakpoint set --source-pattern-regexp break")
25
26         self.runCmd("run", RUN_SUCCEEDED)
27
28         self.runCmd("expression int $i = i")
29
30         self.expect("expression $i == i",
31                     startstr="(bool) $0 = true")
32
33         self.expect("expression $i + 1",
34                     startstr="(int) $1 = 6")
35
36         self.expect("expression $i + 3",
37                     startstr="(int) $2 = 8")
38
39         self.expect("expression $2 + $1",
40                     startstr="(int) $3 = 14")
41
42         self.expect("expression $3",
43                     startstr="(int) $3 = 14")
44
45         self.expect("expression $2",
46                     startstr="(int) $2 = 8")
47
48         self.expect("expression (int)-2",
49                     startstr="(int) $4 = -2")
50
51         self.expect("expression $4 > (int)31",
52                     startstr="(bool) $5 = false")
53
54         self.expect("expression (long)$4",
55                     startstr="(long) $6 = -2")