Main Page
Related Pages
Modules
Namespaces
Namespace List
Namespace Members
All
_
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
y
z
Functions
_
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
y
z
Variables
_
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
y
z
Typedefs
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
r
s
t
u
v
w
y
z
Enumerations
a
b
c
d
e
f
g
h
i
j
l
m
n
o
p
r
s
t
u
v
w
Enumerator
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
r
s
t
u
z
Classes
Class List
Class Hierarchy
Class Members
All
:
[
_
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
y
z
~
Functions
[
_
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
y
z
~
Variables
_
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
y
z
Typedefs
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
r
s
t
u
v
w
y
Enumerations
a
b
c
d
e
f
h
i
k
l
m
n
o
p
r
s
t
u
v
w
Enumerator
_
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
z
Properties
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
r
s
t
u
v
w
Related Functions
:
a
b
c
d
e
f
g
h
i
j
l
m
n
o
p
q
r
s
t
u
v
w
z
Files
File List
File Members
All
_
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
y
z
Functions
_
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
z
Variables
_
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
y
z
Typedefs
_
a
b
c
d
e
f
g
h
i
k
l
m
n
o
p
q
r
s
t
u
v
w
x
z
Enumerations
_
a
b
c
d
e
f
g
h
i
k
l
m
n
o
p
r
s
t
u
v
w
x
Enumerator
_
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
r
s
t
u
v
w
x
Macros
_
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
y
z
grpc
third_party
libuv
test
test-tmpdir.c
Go to the documentation of this file.
1
/* Copyright libuv project contributors. All rights reserved.
2
*
3
* Permission is hereby granted, free of charge, to any person obtaining a copy
4
* of this software and associated documentation files (the "Software"), to
5
* deal in the Software without restriction, including without limitation the
6
* rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
7
* sell copies of the Software, and to permit persons to whom the Software is
8
* furnished to do so, subject to the following conditions:
9
*
10
* The above copyright notice and this permission notice shall be included in
11
* all copies or substantial portions of the Software.
12
*
13
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
14
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
15
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
16
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
17
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
18
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
19
* IN THE SOFTWARE.
20
*/
21
22
#include "
uv.h
"
23
#include "
task.h
"
24
#include <
string.h
>
25
26
#define PATHMAX 4096
27
#define SMALLPATH 1
28
29
TEST_IMPL
(tmpdir) {
30
char
tmpdir[
PATHMAX
];
31
size_t
len
;
32
char
last;
33
int
r
;
34
35
/* Test the normal case */
36
len
=
sizeof
tmpdir;
37
tmpdir[0] =
'\0'
;
38
39
ASSERT
(strlen(tmpdir) == 0);
40
r
=
uv_os_tmpdir
(tmpdir, &
len
);
41
ASSERT
(
r
== 0);
42
ASSERT
(strlen(tmpdir) ==
len
);
43
ASSERT
(
len
> 0);
44
ASSERT
(tmpdir[
len
] ==
'\0'
);
45
46
if
(
len
> 1) {
47
last = tmpdir[
len
- 1];
48
#ifdef _WIN32
49
ASSERT
(last !=
'\\'
);
50
#else
51
ASSERT
(last !=
'/'
);
52
#endif
53
}
54
55
/* Test the case where the buffer is too small */
56
len
=
SMALLPATH
;
57
r
=
uv_os_tmpdir
(tmpdir, &
len
);
58
ASSERT
(
r
== UV_ENOBUFS);
59
ASSERT
(
len
>
SMALLPATH
);
60
61
/* Test invalid inputs */
62
r
=
uv_os_tmpdir
(NULL, &
len
);
63
ASSERT
(
r
== UV_EINVAL);
64
r
=
uv_os_tmpdir
(tmpdir, NULL);
65
ASSERT
(
r
== UV_EINVAL);
66
len
= 0;
67
r
=
uv_os_tmpdir
(tmpdir, &
len
);
68
ASSERT
(
r
== UV_EINVAL);
69
70
#ifdef _WIN32
71
const
char
*
name
=
"TMP"
;
72
char
tmpdir_win[] =
"C:\\xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"
;
73
r
=
uv_os_setenv
(
name
, tmpdir_win);
74
ASSERT
(
r
== 0);
75
char
tmpdirx[
PATHMAX
];
76
size_t
lenx =
sizeof
tmpdirx;
77
r
=
uv_os_tmpdir
(tmpdirx, &lenx);
78
ASSERT
(
r
== 0);
79
#endif
80
81
return
0;
82
}
PATHMAX
#define PATHMAX
Definition:
test-tmpdir.c:26
uv_os_setenv
UV_EXTERN int uv_os_setenv(const char *name, const char *value)
Definition:
unix/core.c:1332
task.h
string.h
ASSERT
#define ASSERT(expr)
Definition:
task.h:102
setup.name
name
Definition:
setup.py:542
TEST_IMPL
TEST_IMPL(tmpdir)
Definition:
test-tmpdir.c:29
uv.h
SMALLPATH
#define SMALLPATH
Definition:
test-tmpdir.c:27
fix_build_deps.r
r
Definition:
fix_build_deps.py:491
len
int len
Definition:
abseil-cpp/absl/base/internal/low_level_alloc_test.cc:46
uv_os_tmpdir
UV_EXTERN int uv_os_tmpdir(char *buffer, size_t *size)
Definition:
unix/core.c:1083
grpc
Author(s):
autogenerated on Thu Mar 13 2025 03:01:30