Make test more lenient for custom clang version strings
[llvm-project.git] / libc / test / src / unistd / pipe2_test.cpp
blob795ec784e81cb8d34b53e60e4db5ec9a4dde613b
1 //===-- Unittests for pipe2 -----------------------------------------------===//
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 #include "src/errno/libc_errno.h"
9 #include "src/unistd/close.h"
10 #include "src/unistd/pipe2.h"
12 #include "test/UnitTest/ErrnoSetterMatcher.h"
13 #include "test/UnitTest/Test.h"
15 using namespace LIBC_NAMESPACE::testing::ErrnoSetterMatcher;
17 TEST(LlvmLibcPipe2Test, SmokeTest) {
18 int pipefd[2];
19 ASSERT_THAT(LIBC_NAMESPACE::pipe2(pipefd, 0), Succeeds());
20 ASSERT_THAT(LIBC_NAMESPACE::close(pipefd[0]), Succeeds());
21 ASSERT_THAT(LIBC_NAMESPACE::close(pipefd[1]), Succeeds());
24 TEST(LlvmLibcPipe2ErrTest, SmokeTest) {
25 int pipefd[2];
26 ASSERT_THAT(LIBC_NAMESPACE::pipe2(pipefd, -1), Fails(EINVAL));
27 ASSERT_THAT(LIBC_NAMESPACE::pipe2(nullptr, 0), Fails(EFAULT));