Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
L
lxc
Project
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Chen Yisong
lxc
Commits
84226232
Unverified
Commit
84226232
authored
Aug 25, 2018
by
Christian Brauner
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
tests: s/LXC_NUMSTRLEN64/INTTYPE_TO_STRLEN()/
Signed-off-by:
Christian Brauner
<
christian.brauner@ubuntu.com
>
parent
d33968ad
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
16 additions
and
15 deletions
+16
-15
lxc-test-utils.c
src/tests/lxc-test-utils.c
+16
-15
No files found.
src/tests/lxc-test-utils.c
View file @
84226232
...
@@ -39,6 +39,7 @@
...
@@ -39,6 +39,7 @@
#include <unistd.h>
#include <unistd.h>
#include "lxctest.h"
#include "lxctest.h"
#include "macro.h"
#include "utils.h"
#include "utils.h"
void
test_lxc_deslashify
(
void
)
void
test_lxc_deslashify
(
void
)
...
@@ -81,7 +82,7 @@ void test_lxc_deslashify(void)
...
@@ -81,7 +82,7 @@ void test_lxc_deslashify(void)
}
}
/* /proc/int_as_str/ns/mnt\0 = (5 + 21 + 7 + 1) */
/* /proc/int_as_str/ns/mnt\0 = (5 + 21 + 7 + 1) */
#define __MNTNS_LEN (5 +
(LXC_NUMSTRLEN64
) + 7 + 1)
#define __MNTNS_LEN (5 +
INTTYPE_TO_STRLEN(pid_t
) + 7 + 1)
void
test_detect_ramfs_rootfs
(
void
)
void
test_detect_ramfs_rootfs
(
void
)
{
{
size_t
i
;
size_t
i
;
...
@@ -246,19 +247,19 @@ void test_lxc_safe_uint(void)
...
@@ -246,19 +247,19 @@ void test_lxc_safe_uint(void)
{
{
int
ret
;
int
ret
;
unsigned
int
n
;
unsigned
int
n
;
char
numstr
[
LXC_NUMSTRLEN64
];
char
numstr
[
INTTYPE_TO_STRLEN
(
uint64_t
)
];
lxc_test_assert_abort
((
-
EINVAL
==
lxc_safe_uint
(
" -123"
,
&
n
)));
lxc_test_assert_abort
((
-
EINVAL
==
lxc_safe_uint
(
" -123"
,
&
n
)));
lxc_test_assert_abort
((
-
EINVAL
==
lxc_safe_uint
(
"-123"
,
&
n
)));
lxc_test_assert_abort
((
-
EINVAL
==
lxc_safe_uint
(
"-123"
,
&
n
)));
ret
=
snprintf
(
numstr
,
LXC_NUMSTRLEN64
,
"%"
PRIu64
,
(
uint64_t
)
UINT_MAX
);
ret
=
snprintf
(
numstr
,
INTTYPE_TO_STRLEN
(
uint64_t
)
,
"%"
PRIu64
,
(
uint64_t
)
UINT_MAX
);
if
(
ret
<
0
||
ret
>=
LXC_NUMSTRLEN64
)
if
(
ret
<
0
||
ret
>=
INTTYPE_TO_STRLEN
(
uint64_t
)
)
exit
(
EXIT_FAILURE
);
exit
(
EXIT_FAILURE
);
lxc_test_assert_abort
((
0
==
lxc_safe_uint
(
numstr
,
&
n
))
&&
n
==
UINT_MAX
);
lxc_test_assert_abort
((
0
==
lxc_safe_uint
(
numstr
,
&
n
))
&&
n
==
UINT_MAX
);
ret
=
snprintf
(
numstr
,
LXC_NUMSTRLEN64
,
"%"
PRIu64
,
(
uint64_t
)
UINT_MAX
+
1
);
ret
=
snprintf
(
numstr
,
INTTYPE_TO_STRLEN
(
uint64_t
)
,
"%"
PRIu64
,
(
uint64_t
)
UINT_MAX
+
1
);
if
(
ret
<
0
||
ret
>=
LXC_NUMSTRLEN64
)
if
(
ret
<
0
||
ret
>=
INTTYPE_TO_STRLEN
(
uint64_t
)
)
exit
(
EXIT_FAILURE
);
exit
(
EXIT_FAILURE
);
lxc_test_assert_abort
((
-
ERANGE
==
lxc_safe_uint
(
numstr
,
&
n
)));
lxc_test_assert_abort
((
-
ERANGE
==
lxc_safe_uint
(
numstr
,
&
n
)));
...
@@ -282,28 +283,28 @@ void test_lxc_safe_int(void)
...
@@ -282,28 +283,28 @@ void test_lxc_safe_int(void)
{
{
int
ret
;
int
ret
;
signed
int
n
;
signed
int
n
;
char
numstr
[
LXC_NUMSTRLEN64
];
char
numstr
[
INTTYPE_TO_STRLEN
(
uint64_t
)
];
ret
=
snprintf
(
numstr
,
LXC_NUMSTRLEN64
,
"%"
PRIu64
,
(
uint64_t
)
INT_MAX
);
ret
=
snprintf
(
numstr
,
INTTYPE_TO_STRLEN
(
uint64_t
)
,
"%"
PRIu64
,
(
uint64_t
)
INT_MAX
);
if
(
ret
<
0
||
ret
>=
LXC_NUMSTRLEN64
)
if
(
ret
<
0
||
ret
>=
INTTYPE_TO_STRLEN
(
uint64_t
)
)
exit
(
EXIT_FAILURE
);
exit
(
EXIT_FAILURE
);
lxc_test_assert_abort
((
0
==
lxc_safe_int
(
numstr
,
&
n
))
&&
n
==
INT_MAX
);
lxc_test_assert_abort
((
0
==
lxc_safe_int
(
numstr
,
&
n
))
&&
n
==
INT_MAX
);
ret
=
snprintf
(
numstr
,
LXC_NUMSTRLEN64
,
"%"
PRIu64
,
(
uint64_t
)
INT_MAX
+
1
);
ret
=
snprintf
(
numstr
,
INTTYPE_TO_STRLEN
(
uint64_t
)
,
"%"
PRIu64
,
(
uint64_t
)
INT_MAX
+
1
);
if
(
ret
<
0
||
ret
>=
LXC_NUMSTRLEN64
)
if
(
ret
<
0
||
ret
>=
INTTYPE_TO_STRLEN
(
uint64_t
)
)
exit
(
EXIT_FAILURE
);
exit
(
EXIT_FAILURE
);
lxc_test_assert_abort
((
-
ERANGE
==
lxc_safe_int
(
numstr
,
&
n
)));
lxc_test_assert_abort
((
-
ERANGE
==
lxc_safe_int
(
numstr
,
&
n
)));
ret
=
snprintf
(
numstr
,
LXC_NUMSTRLEN64
,
"%"
PRId64
,
(
int64_t
)
INT_MIN
);
ret
=
snprintf
(
numstr
,
INTTYPE_TO_STRLEN
(
int64_t
)
,
"%"
PRId64
,
(
int64_t
)
INT_MIN
);
if
(
ret
<
0
||
ret
>=
LXC_NUMSTRLEN64
)
if
(
ret
<
0
||
ret
>=
INTTYPE_TO_STRLEN
(
int64_t
)
)
exit
(
EXIT_FAILURE
);
exit
(
EXIT_FAILURE
);
lxc_test_assert_abort
((
0
==
lxc_safe_int
(
numstr
,
&
n
))
&&
n
==
INT_MIN
);
lxc_test_assert_abort
((
0
==
lxc_safe_int
(
numstr
,
&
n
))
&&
n
==
INT_MIN
);
ret
=
snprintf
(
numstr
,
LXC_NUMSTRLEN64
,
"%"
PRId64
,
(
int64_t
)
INT_MIN
-
1
);
ret
=
snprintf
(
numstr
,
INTTYPE_TO_STRLEN
(
int64_t
)
,
"%"
PRId64
,
(
int64_t
)
INT_MIN
-
1
);
if
(
ret
<
0
||
ret
>=
LXC_NUMSTRLEN64
)
if
(
ret
<
0
||
ret
>=
INTTYPE_TO_STRLEN
(
int64_t
)
)
exit
(
EXIT_FAILURE
);
exit
(
EXIT_FAILURE
);
lxc_test_assert_abort
((
-
ERANGE
==
lxc_safe_int
(
numstr
,
&
n
)));
lxc_test_assert_abort
((
-
ERANGE
==
lxc_safe_int
(
numstr
,
&
n
)));
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment