blob: e261d545a06c2488e6c9ff2bd67087bf999c5069 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
|
// Copyright 2018 Google LLC
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
#ifndef GVISOR_TEST_SYSCALLS_READV_COMMON_H_
#define GVISOR_TEST_SYSCALLS_READV_COMMON_H_
#include <stddef.h>
namespace gvisor {
namespace testing {
// A NUL-terminated std::string containing the data used by tests using the following
// test helpers.
extern const char kReadvTestData[];
// The size of kReadvTestData, including the terminating NUL.
extern const size_t kReadvTestDataSize;
// ReadAllOneBuffer asserts that it can read kReadvTestData from an fd using
// exactly one iovec.
void ReadAllOneBuffer(int fd);
// ReadAllOneLargeBuffer asserts that it can read kReadvTestData from an fd
// using exactly one iovec containing an overly large buffer.
void ReadAllOneLargeBuffer(int fd);
// ReadOneHalfAtATime asserts that it can read test_data_from an fd using
// exactly two iovecs that are roughly equivalent in size.
void ReadOneHalfAtATime(int fd);
// ReadOneBufferPerByte asserts that it can read kReadvTestData from an fd
// using one iovec per byte.
void ReadOneBufferPerByte(int fd);
// ReadBuffersOverlapping asserts that it can read kReadvTestData from an fd
// where two iovecs are overlapping.
void ReadBuffersOverlapping(int fd);
// ReadBuffersDiscontinuous asserts that it can read kReadvTestData from an fd
// where each iovec is discontinuous from the next by 1 byte.
void ReadBuffersDiscontinuous(int fd);
// ReadIovecsCompletelyFilled asserts that the previous iovec is completely
// filled before moving onto the next.
void ReadIovecsCompletelyFilled(int fd);
} // namespace testing
} // namespace gvisor
#endif // GVISOR_TEST_SYSCALLS_READV_COMMON_H_
|