summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorElliott Hughes <enh@google.com>2014-08-21 19:23:53 -0700
committerElliott Hughes <enh@google.com>2014-08-21 19:23:53 -0700
commit84d0683a824fa02dbaa6d1b56a79223804b54e80 (patch)
tree546a8464ef24976cd86f9e825c7b05acbade3cb1 /tests
parent2d80400a9e8454038a3ec29959436184be0c4c65 (diff)
downloadbionic-84d0683a824fa02dbaa6d1b56a79223804b54e80.zip
bionic-84d0683a824fa02dbaa6d1b56a79223804b54e80.tar.gz
bionic-84d0683a824fa02dbaa6d1b56a79223804b54e80.tar.bz2
Fix unistd.getpid_caching_and_clone.
This test only works if you're root (strictly: if you have permission to CLONE_NEWNS), so it's useful to us when we're doing ad hoc testing (since that's usually done as root), but it's not useful as part of CTS or when running the tests on the host. Bug: 16705621 Bug: 17170200 Change-Id: Ia92c871b15f7e45fc174bb59bc95540fd00ae745
Diffstat (limited to 'tests')
-rw-r--r--tests/unistd_test.cpp4
1 files changed, 4 insertions, 0 deletions
diff --git a/tests/unistd_test.cpp b/tests/unistd_test.cpp
index 2a65657..8195ea8 100644
--- a/tests/unistd_test.cpp
+++ b/tests/unistd_test.cpp
@@ -431,6 +431,10 @@ TEST(unistd, getpid_caching_and_clone) {
void* child_stack[1024];
int clone_result = clone(GetPidCachingCloneStartRoutine, &child_stack[1024], CLONE_NEWNS | SIGCHLD, NULL);
+ if (clone_result == -1 && errno == EPERM && getuid() != 0) {
+ GTEST_LOG_(INFO) << "This test only works if you have permission to CLONE_NEWNS; try running as root.\n";
+ return;
+ }
ASSERT_NE(clone_result, -1);
ASSERT_EQ(parent_pid, getpid());