Skip to content

Commit

Permalink
[lldb] Go back to process-directed signals in MainLoopTest.cpp
Browse files Browse the repository at this point in the history
Thread-directed signals are not caught by kqueue (used on Mac). This
reverts half of D133181.
  • Loading branch information
labath committed Sep 6, 2022
1 parent c141c03 commit 65596ce
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions lldb/unittests/Host/MainLoopTest.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -197,7 +197,7 @@ TEST_F(MainLoopTest, Signal) {

auto handle = loop.RegisterSignal(SIGUSR1, make_callback(), error);
ASSERT_TRUE(error.Success());
pthread_kill(pthread_self(), SIGUSR1);
kill(getpid(), SIGUSR1);
ASSERT_TRUE(loop.Run().Success());
ASSERT_EQ(1u, callback_count);
}
Expand All @@ -215,8 +215,8 @@ TEST_F(MainLoopTest, UnmonitoredSignal) {

auto handle = loop.RegisterSignal(SIGUSR1, make_callback(), error);
ASSERT_TRUE(error.Success());
pthread_kill(pthread_self(), SIGUSR2);
pthread_kill(pthread_self(), SIGUSR1);
kill(getpid(), SIGUSR2);
kill(getpid(), SIGUSR1);
ASSERT_TRUE(loop.Run().Success());
ASSERT_EQ(1u, callback_count);
}
Expand All @@ -238,7 +238,7 @@ TEST_F(MainLoopTest, TwoSignalCallbacks) {
SIGUSR1, [&](MainLoopBase &loop) { ++callback2_count; }, error);
ASSERT_TRUE(error.Success());

pthread_kill(pthread_self(), SIGUSR1);
kill(getpid(), SIGUSR1);
ASSERT_TRUE(loop.Run().Success());
ASSERT_EQ(1u, callback_count);
ASSERT_EQ(1u, callback2_count);
Expand All @@ -251,15 +251,15 @@ TEST_F(MainLoopTest, TwoSignalCallbacks) {
SIGUSR1, [&](MainLoopBase &loop) { ++callback3_count; }, error);
ASSERT_TRUE(error.Success());

pthread_kill(pthread_self(), SIGUSR1);
kill(getpid(), SIGUSR1);
ASSERT_TRUE(loop.Run().Success());
ASSERT_EQ(2u, callback_count);
ASSERT_EQ(1u, callback2_count);
ASSERT_EQ(1u, callback3_count);
}

// Both extra callbacks should be unregistered now.
pthread_kill(pthread_self(), SIGUSR1);
kill(getpid(), SIGUSR1);
ASSERT_TRUE(loop.Run().Success());
ASSERT_EQ(3u, callback_count);
ASSERT_EQ(1u, callback2_count);
Expand Down

0 comments on commit 65596ce

Please sign in to comment.