Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
maestro-core
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container registry
Model registry
Analyze
Contributor analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
maestro
maestro-core
Commits
9b26d7af
Commit
9b26d7af
authored
4 years ago
by
Utz-Uwe Haus
Browse files
Options
Downloads
Patches
Plain Diff
add test for overlapping memlocks
parent
170b530d
Branches
Branches containing commit
Tags
Tags containing commit
2 merge requests
!3
Jsc ci update
,
!2
update JSC-CI branch to devel
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
tests/check_memlock.c
+34
-0
34 additions, 0 deletions
tests/check_memlock.c
with
34 additions
and
0 deletions
tests/check_memlock.c
+
34
−
0
View file @
9b26d7af
...
...
@@ -43,6 +43,8 @@
#include
"maestro.h"
#include
"maestro/i_memlock.h"
#include
<unistd.h>
CHEAT_TEST
(
lock_unlock
,
{
...
...
@@ -77,3 +79,35 @@ CHEAT_TEST(lock_unlock_multi,
free
(
x
);
})
CHEAT_TEST
(
lock_overlapping
,
{
long
pagesize
=
sysconf
(
_SC_PAGESIZE
);
void
*
x
=
malloc
(
3
*
pagesize
);
cheat_assert
(
x
!=
NULL
);
cheat_assert
(
pagesize
>
4
);
cheat_assert
(
MSTRO_OK
==
mstro_memlock_init
(
4
*
pagesize
));
/* one on the first page */
void
*
start1
=
x
;
size_t
len1
=
pagesize
/
2
;
/* one on the same page */
void
*
start2
=
(
void
*
)((
uintptr_t
)
x
+
len1
);
size_t
len2
=
pagesize
/
4
;
/* one extending into the third page */
void
*
start3
=
(
void
*
)((
uintptr_t
)
x
+
len1
+
len2
);
size_t
len3
=
2
*
pagesize
;
cheat_assert
(
MSTRO_OK
==
mstro_memlock
(
start1
,
len1
));
cheat_assert
(
MSTRO_OK
==
mstro_memlock
(
start2
,
len2
));
cheat_assert
(
MSTRO_OK
==
mstro_memlock
(
start3
,
len3
));
cheat_assert
(
MSTRO_OK
==
mstro_memunlock
(
start2
,
len2
));
cheat_assert
(
MSTRO_OK
==
mstro_memunlock
(
start1
,
len1
));
cheat_assert
(
MSTRO_OK
==
mstro_memunlock
(
start3
,
len3
));
free
(
x
);
})
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment