1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
|
"""
Test lldb data formatter subsystem.
"""
from __future__ import print_function
import lldb
from lldbsuite.test.decorators import *
from lldbsuite.test.lldbtest import *
from lldbsuite.test import lldbutil
class LibcxxVariantDataFormatterTestCase(TestBase):
mydir = TestBase.compute_mydir(__file__)
@add_test_categories(["libc++"])
## We are skipping clang version less that 5.0 since this test requires -std=c++17
@skipIf(oslist=no_match(["macosx"]), compiler="clang", compiler_version=['<', '5.0'])
## We are skipping gcc version less that 5.1 since this test requires -std=c++17
@skipIf(compiler="gcc", compiler_version=['<', '5.1'])
## std::get is unavailable for std::variant before macOS 10.14
@skipIf(macos_version=["<", "10.14"])
def test_with_run_command(self):
"""Test that that file and class static variables display correctly."""
self.build()
(self.target, self.process, _, bkpt) = lldbutil.run_to_source_breakpoint(self, '// break here',
lldb.SBFileSpec("main.cpp", False))
self.runCmd( "frame variable has_variant" )
output = self.res.GetOutput()
## The variable has_variant tells us if the test program
## detected we have a sufficient libc++ version to support variant
## false means we do not and therefore should skip the test
if output.find("(bool) has_variant = false") != -1 :
self.skipTest( "std::variant not supported" )
lldbutil.continue_to_breakpoint(self.process, bkpt)
self.expect("frame variable v1",
substrs=['v1 = Active Type = int {',
'Value = 12',
'}'])
self.expect("frame variable v1_ref",
substrs=['v1_ref = Active Type = int : {',
'Value = 12',
'}'])
self.expect("frame variable v_v1",
substrs=['v_v1 = Active Type = std::__1::variant<int, double, char> {',
'Value = Active Type = int {',
'Value = 12',
'}',
'}'])
lldbutil.continue_to_breakpoint(self.process, bkpt)
self.expect("frame variable v1",
substrs=['v1 = Active Type = double {',
'Value = 2',
'}'])
lldbutil.continue_to_breakpoint(self.process, bkpt)
self.expect("frame variable v2",
substrs=['v2 = Active Type = double {',
'Value = 2',
'}'])
self.expect("frame variable v3",
substrs=['v3 = Active Type = char {',
'Value = \'A\'',
'}'])
self.expect("frame variable v_no_value",
substrs=['v_no_value = No Value'])
|