ANDROID: futex: Skip when futex_waitv/shmget not implemented
getshm and futex_waitv are not implemented in Android. These rely on System V shared memory functions which is disallowed by selinux. Bug: 31590178 Bug: 189333904 Bug: 234151152 Change-Id: I9930a5b336fe1368afd6e5744d6246577cb4b7c8 Signed-off-by: Edward Liaw <edliaw@google.com>
This commit is contained in:
@@ -96,6 +96,11 @@ int main(int argc, char *argv[])
|
||||
/* Testing an anon page shared memory */
|
||||
shm_id = shmget(IPC_PRIVATE, 4096, IPC_CREAT | 0666);
|
||||
if (shm_id < 0) {
|
||||
if (errno == ENOSYS) {
|
||||
ksft_test_result_skip("shmget returned: %d %s\n",
|
||||
errno, strerror(errno));
|
||||
goto skip_anon_page_shared_memory_test;
|
||||
}
|
||||
perror("shmget");
|
||||
exit(1);
|
||||
}
|
||||
@@ -121,6 +126,7 @@ int main(int argc, char *argv[])
|
||||
ksft_test_result_pass("futex_wake shared (page anon) succeeds\n");
|
||||
}
|
||||
|
||||
skip_anon_page_shared_memory_test:
|
||||
|
||||
/* Testing a file backed shared memory */
|
||||
fd = open(SHM_PATH, O_RDWR | O_CREAT, S_IRUSR | S_IWUSR);
|
||||
|
||||
@@ -64,9 +64,14 @@ void *get_pi_lock(void *arg)
|
||||
static void test_timeout(int res, int *ret, char *test_name, int err)
|
||||
{
|
||||
if (!res || errno != err) {
|
||||
ksft_test_result_fail("%s returned %d\n", test_name,
|
||||
res < 0 ? errno : res);
|
||||
*ret = RET_FAIL;
|
||||
if (errno == ENOSYS) {
|
||||
ksft_test_result_skip("%s returned %d\n", test_name,
|
||||
errno);
|
||||
} else {
|
||||
ksft_test_result_fail("%s returned %d\n", test_name,
|
||||
res < 0 ? errno : res);
|
||||
*ret = RET_FAIL;
|
||||
}
|
||||
} else {
|
||||
ksft_test_result_pass("%s succeeds\n", test_name);
|
||||
}
|
||||
|
||||
@@ -98,10 +98,15 @@ int main(int argc, char *argv[])
|
||||
info("Calling futex_waitv on f1: %u @ %p with val=%u\n", f1, &f1, f1+1);
|
||||
res = futex_waitv(&waitv, 1, 0, &to, CLOCK_MONOTONIC);
|
||||
if (!res || errno != EWOULDBLOCK) {
|
||||
ksft_test_result_pass("futex_waitv returned: %d %s\n",
|
||||
res ? errno : res,
|
||||
res ? strerror(errno) : "");
|
||||
ret = RET_FAIL;
|
||||
if (errno == ENOSYS) {
|
||||
ksft_test_result_skip("futex_waitv returned %d\n",
|
||||
errno);
|
||||
} else {
|
||||
ksft_test_result_fail("futex_waitv returned: %d %s\n",
|
||||
res ? errno : res,
|
||||
res ? strerror(errno) : "");
|
||||
ret = RET_FAIL;
|
||||
}
|
||||
} else {
|
||||
ksft_test_result_pass("futex_waitv\n");
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user