Skip to content

Commit 06522a6

Browse files
committed
Use static var to check progress total
Use the changes implemented in #79912 to use a static variable from `Progress` to ensure that the report was created with a non-deterministic total.
1 parent bb71954 commit 06522a6

File tree

1 file changed

+12
-13
lines changed

1 file changed

+12
-13
lines changed

lldb/unittests/Core/ProgressReportTest.cpp

Lines changed: 12 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -21,19 +21,18 @@ using namespace lldb;
2121
using namespace lldb_private;
2222

2323
class ProgressReportTest : public ::testing::Test {
24-
SubsystemRAII<FileSystem, HostInfo, PlatformMacOSX> subsystems;
25-
26-
// The debugger's initialization function can't be called with no arguments
27-
// so calling it using SubsystemRAII will cause the test build to fail as
28-
// SubsystemRAII will call Initialize with no arguments. As such we set it up
29-
// here the usual way.
30-
void SetUp() override { Debugger::Initialize(nullptr); }
31-
void TearDown() override { Debugger::Terminate(); }
24+
SubsystemRAII<FileSystem, HostInfo, PlatformMacOSX> subsystems;
25+
26+
// The debugger's initialization function can't be called with no arguments
27+
// so calling it using SubsystemRAII will cause the test build to fail as
28+
// SubsystemRAII will call Initialize with no arguments. As such we set it up
29+
// here the usual way.
30+
void SetUp() override { Debugger::Initialize(nullptr); }
31+
void TearDown() override { Debugger::Terminate(); }
3232
};
3333

3434
TEST_F(ProgressReportTest, TestReportCreation) {
3535
std::chrono::milliseconds timeout(100);
36-
const unsigned long long NO_TOTAL = 1;
3736

3837
// Set up the debugger, make sure that was done properly
3938
ArchSpec arch("x86_64-apple-macosx-");
@@ -52,7 +51,7 @@ TEST_F(ProgressReportTest, TestReportCreation) {
5251
listener_sp->StartListeningForEvents(&broadcaster,
5352
Debugger::eBroadcastBitProgress);
5453
EXPECT_TRUE(
55-
broadcaster.EventTypeHasListeners(Debugger::eBroadcastBitProgress));
54+
broadcaster.EventTypeHasListeners(Debugger::eBroadcastBitProgress));
5655

5756
EventSP event_sp;
5857
const ProgressEventData *data;
@@ -76,7 +75,7 @@ TEST_F(ProgressReportTest, TestReportCreation) {
7675
ASSERT_EQ(data->GetDetails(), "Starting report 1");
7776
ASSERT_FALSE(data->IsFinite());
7877
ASSERT_FALSE(data->GetCompleted());
79-
ASSERT_EQ(data->GetTotal(), NO_TOTAL);
78+
ASSERT_EQ(data->GetTotal(), Progress::kNonDeterministicTotal);
8079
ASSERT_EQ(data->GetMessage(), "Progress report 1: Starting report 1");
8180

8281
EXPECT_TRUE(listener_sp->GetEvent(event_sp, timeout));
@@ -85,15 +84,15 @@ TEST_F(ProgressReportTest, TestReportCreation) {
8584
ASSERT_EQ(data->GetDetails(), "Starting report 2");
8685
ASSERT_FALSE(data->IsFinite());
8786
ASSERT_FALSE(data->GetCompleted());
88-
ASSERT_EQ(data->GetTotal(), NO_TOTAL);
87+
ASSERT_EQ(data->GetTotal(), Progress::kNonDeterministicTotal);
8988
ASSERT_EQ(data->GetMessage(), "Progress report 2: Starting report 2");
9089

9190
EXPECT_TRUE(listener_sp->GetEvent(event_sp, timeout));
9291
data = ProgressEventData::GetEventDataFromEvent(event_sp.get());
9392
ASSERT_EQ(data->GetDetails(), "Starting report 3");
9493
ASSERT_FALSE(data->IsFinite());
9594
ASSERT_FALSE(data->GetCompleted());
96-
ASSERT_EQ(data->GetTotal(), NO_TOTAL);
95+
ASSERT_EQ(data->GetTotal(), Progress::kNonDeterministicTotal);
9796
ASSERT_EQ(data->GetMessage(), "Progress report 3: Starting report 3");
9897

9998
// Progress report objects should be destroyed at this point so

0 commit comments

Comments
 (0)