1 //===-- Failure unittests for select --------------------------------------===// 2 // 3 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. 4 // See https://llvm.org/LICENSE.txt for license information. 5 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception 6 // 7 //===----------------------------------------------------------------------===// 8 9 #include "src/sys/select/select.h" 10 #include "src/unistd/read.h" 11 #include "test/UnitTest/ErrnoSetterMatcher.h" 12 #include "test/UnitTest/Test.h" 13 14 #include <sys/select.h> 15 #include <unistd.h> 16 17 using LIBC_NAMESPACE::testing::ErrnoSetterMatcher::Fails; 18 TEST(LlvmLibcSelectTest,SelectInvalidFD)19TEST(LlvmLibcSelectTest, SelectInvalidFD) { 20 fd_set set; 21 FD_ZERO(&set); 22 struct timeval timeout { 23 0, 0 24 }; 25 ASSERT_THAT(LIBC_NAMESPACE::select(-1, &set, nullptr, nullptr, &timeout), 26 Fails(EINVAL)); 27 } 28