1 //===-- PipeTest.cpp ------------------------------------------------------===//
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
7 //===----------------------------------------------------------------------===//
9 #include "lldb/Host/Pipe.h"
10 #include "TestingSupport/SubsystemRAII.h"
11 #include "lldb/Host/FileSystem.h"
12 #include "lldb/Host/HostInfo.h"
13 #include "gtest/gtest.h"
15 using namespace lldb_private
;
17 class PipeTest
: public testing::Test
{
19 SubsystemRAII
<FileSystem
, HostInfo
> subsystems
;
22 TEST_F(PipeTest
, CreateWithUniqueName
) {
24 llvm::SmallString
<0> name
;
25 ASSERT_THAT_ERROR(pipe
.CreateWithUniqueName("PipeTest-CreateWithUniqueName",
26 /*child_process_inherit=*/false,
34 TEST_F(PipeTest
, OpenAsReader
) {
36 llvm::SmallString
<0> name
;
37 ASSERT_THAT_ERROR(pipe
.CreateWithUniqueName("PipeTest-OpenAsReader",
38 /*child_process_inherit=*/false,
43 // Ensure name is not null-terminated
44 size_t name_len
= name
.size();
46 llvm::StringRef
name_ref(name
.data(), name_len
);
48 pipe
.OpenAsReader(name_ref
, /*child_process_inherit=*/false).ToError(),