summaryrefslogtreecommitdiffhomepage
path: root/test
diff options
context:
space:
mode:
authorAndrei Vagin <avagin@google.com>2019-01-14 16:11:13 -0800
committerShentubot <shentubot@google.com>2019-01-14 16:13:14 -0800
commit343ebe9789087b099ea7feae19879f5c24e59bf1 (patch)
treeeb424461eabd0f04c41672f44763d31995fc8de2 /test
parenta46b6d453d198b96949342a81750114bfa5a5429 (diff)
Fix a few compilation warnings
test/syscalls/linux/wait.cc:626:8: warning: lambda capture 'this' is not used 302 [this, stack] { ASSERT_THAT(FreeStack(stack), SyscallSucceeds()); }); 303 ^~~~~ test/syscalls/linux/priority.cc:195:17: warning: lambda capture 'kParentPriority' is not required to be captured for this use 273 ScopedThread([kParentPriority, kChildPriority]() { 274 ^~~~~~~~~~~~~~~~ PiperOrigin-RevId: 229275900 Change-Id: I6f0c88efc7891c6c729378a2fa70f70b1b9046a7
Diffstat (limited to 'test')
-rw-r--r--test/syscalls/linux/priority.cc3
-rw-r--r--test/syscalls/linux/wait.cc32
2 files changed, 18 insertions, 17 deletions
diff --git a/test/syscalls/linux/priority.cc b/test/syscalls/linux/priority.cc
index 69a58a422..3906c7132 100644
--- a/test/syscalls/linux/priority.cc
+++ b/test/syscalls/linux/priority.cc
@@ -192,7 +192,7 @@ TEST(GetpriorityTest, CloneMaintainsPriority) {
ASSERT_THAT(setpriority(PRIO_PROCESS, getpid(), kParentPriority),
SyscallSucceeds());
- ScopedThread([kParentPriority, kChildPriority]() {
+ ScopedThread th([]() {
// Check that priority equals that of parent thread
pid_t my_tid;
EXPECT_THAT(my_tid = syscall(__NR_gettid), SyscallSucceeds());
@@ -203,6 +203,7 @@ TEST(GetpriorityTest, CloneMaintainsPriority) {
EXPECT_THAT(setpriority(PRIO_PROCESS, my_tid, kChildPriority),
SyscallSucceeds());
});
+ th.Join();
// Check that parent's priority reemained the same even though
// the child's priority was altered
diff --git a/test/syscalls/linux/wait.cc b/test/syscalls/linux/wait.cc
index 2da0bf130..d1a4237d2 100644
--- a/test/syscalls/linux/wait.cc
+++ b/test/syscalls/linux/wait.cc
@@ -201,8 +201,8 @@ TEST_P(WaitAnyChildTest, MultipleFork) {
TEST_P(WaitAnyChildTest, CloneSIGCHLD) {
uintptr_t stack;
ASSERT_THAT(stack = AllocStack(), SyscallSucceeds());
- auto free = Cleanup(
- [this, stack] { ASSERT_THAT(FreeStack(stack), SyscallSucceeds()); });
+ auto free =
+ Cleanup([stack] { ASSERT_THAT(FreeStack(stack), SyscallSucceeds()); });
int child;
ASSERT_THAT(child = CloneAndExit(0, stack, SIGCHLD), SyscallSucceeds());
@@ -217,8 +217,8 @@ TEST_P(WaitAnyChildTest, ForkAndClone) {
uintptr_t stack;
ASSERT_THAT(stack = AllocStack(), SyscallSucceeds());
- auto free = Cleanup(
- [this, stack] { ASSERT_THAT(FreeStack(stack), SyscallSucceeds()); });
+ auto free =
+ Cleanup([stack] { ASSERT_THAT(FreeStack(stack), SyscallSucceeds()); });
int thread;
// Send SIGCHLD for normal wait semantics.
@@ -438,8 +438,8 @@ TEST_P(WaitSpecificChildTest, AfterExit) {
TEST_P(WaitSpecificChildTest, CloneSIGCHLD) {
uintptr_t stack;
ASSERT_THAT(stack = AllocStack(), SyscallSucceeds());
- auto free = Cleanup(
- [this, stack] { ASSERT_THAT(FreeStack(stack), SyscallSucceeds()); });
+ auto free =
+ Cleanup([stack] { ASSERT_THAT(FreeStack(stack), SyscallSucceeds()); });
int child;
ASSERT_THAT(child = CloneAndExit(0, stack, SIGCHLD), SyscallSucceeds());
@@ -453,8 +453,8 @@ TEST_P(WaitSpecificChildTest, CloneSIGCHLD) {
TEST_P(WaitSpecificChildTest, CloneNoSIGCHLD) {
uintptr_t stack;
ASSERT_THAT(stack = AllocStack(), SyscallSucceeds());
- auto free = Cleanup(
- [this, stack] { ASSERT_THAT(FreeStack(stack), SyscallSucceeds()); });
+ auto free =
+ Cleanup([stack] { ASSERT_THAT(FreeStack(stack), SyscallSucceeds()); });
int child;
ASSERT_THAT(child = CloneAndExit(0, stack, 0), SyscallSucceeds());
@@ -469,8 +469,8 @@ TEST_P(WaitSpecificChildTest, CloneNoSIGCHLD) {
TEST_P(WaitSpecificChildTest, CloneAfterExit) {
uintptr_t stack;
ASSERT_THAT(stack = AllocStack(), SyscallSucceeds());
- auto free = Cleanup(
- [this, stack] { ASSERT_THAT(FreeStack(stack), SyscallSucceeds()); });
+ auto free =
+ Cleanup([stack] { ASSERT_THAT(FreeStack(stack), SyscallSucceeds()); });
int child;
// Send SIGCHLD for normal wait semantics.
@@ -485,8 +485,8 @@ TEST_P(WaitSpecificChildTest, CloneAfterExit) {
TEST_P(WaitSpecificChildTest, CloneThread) {
uintptr_t stack;
ASSERT_THAT(stack = AllocStack(), SyscallSucceeds());
- auto free = Cleanup(
- [this, stack] { ASSERT_THAT(FreeStack(stack), SyscallSucceeds()); });
+ auto free =
+ Cleanup([stack] { ASSERT_THAT(FreeStack(stack), SyscallSucceeds()); });
int child;
ASSERT_THAT(child = CloneAndExit(15, stack, CLONE_THREAD), SyscallSucceeds());
@@ -521,8 +521,8 @@ TEST_P(WaitSpecificChildTest, AfterChildExecve) {
uintptr_t stack;
ASSERT_THAT(stack = AllocStack(), SyscallSucceeds());
- auto free = Cleanup(
- [this, stack] { ASSERT_THAT(FreeStack(stack), SyscallSucceeds()); });
+ auto free =
+ Cleanup([stack] { ASSERT_THAT(FreeStack(stack), SyscallSucceeds()); });
pid_t const child = fork();
if (child == 0) {
@@ -622,8 +622,8 @@ TEST(WaitTest, SignalExit) {
TEST(WaitTest, CloneWCLONE) {
uintptr_t stack;
ASSERT_THAT(stack = AllocStack(), SyscallSucceeds());
- auto free = Cleanup(
- [this, stack] { ASSERT_THAT(FreeStack(stack), SyscallSucceeds()); });
+ auto free =
+ Cleanup([stack] { ASSERT_THAT(FreeStack(stack), SyscallSucceeds()); });
int child;
ASSERT_THAT(child = CloneAndExit(0, stack, 0), SyscallSucceeds());