1 //===-- Unittests for wait4 -----------------------------------------------===// 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/wait/wait4.h" 10 #include "test/UnitTest/ErrnoSetterMatcher.h" 11 #include "test/UnitTest/Test.h" 12 13 #include <sys/wait.h> 14 15 // The test here is a simpl test for WNOHANG functionality. For a more 16 // involved test, look at fork_test. 17 TEST(LlvmLibcwait4Test,NoHangTest)18TEST(LlvmLibcwait4Test, NoHangTest) { 19 using LIBC_NAMESPACE::testing::ErrnoSetterMatcher::Fails; 20 int status; 21 ASSERT_THAT(LIBC_NAMESPACE::wait4(-1, &status, WNOHANG, nullptr), 22 Fails(ECHILD)); 23 } 24