blob: daa064a88394805e25f118357e34f365cf475ca3 [file] [log] [blame]
Elliott Hughes11952072013-10-24 15:15:14 -07001/*
2 * Copyright (C) 2013 The Android Open Source Project
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16
17#include <gtest/gtest.h>
18
19#include <errno.h>
Christopher Ferrisf04935c2013-12-20 18:43:21 -080020#include <signal.h>
Elliott Hughes11952072013-10-24 15:15:14 -070021#include <sys/epoll.h>
22
23TEST(sys_epoll, smoke) {
24 int epoll_fd = epoll_create(1);
25 ASSERT_NE(-1, epoll_fd) << strerror(errno);
26 epoll_event events[1];
27
28 // Regular epoll_wait.
29 ASSERT_EQ(0, epoll_wait(epoll_fd, events, 1, 1));
30
31 // epoll_pwait without a sigset (which is equivalent to epoll_wait).
32 ASSERT_EQ(0, epoll_pwait(epoll_fd, events, 1, 1, NULL));
33
34 // epoll_pwait with a sigset.
35 sigset_t ss;
36 sigemptyset(&ss);
37 sigaddset(&ss, SIGPIPE);
38 ASSERT_EQ(0, epoll_pwait(epoll_fd, events, 1, 1, &ss));
39}