Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
W
wendelin.core
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Joshua
wendelin.core
Commits
8461fbf0
Commit
8461fbf0
authored
Jul 10, 2019
by
Kirill Smelkov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
.
parent
675e6415
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
30 additions
and
6 deletions
+30
-6
bigfile/tests/test_virtmem.c
bigfile/tests/test_virtmem.c
+30
-6
No files found.
bigfile/tests/test_virtmem.c
View file @
8461fbf0
...
...
@@ -224,15 +224,39 @@ int M(VMA *vma, pgoff_t idx) { return bitmap_test_bit(vma->page_ismappedv, idx)
} while (0)
/* check that ram has MRU pages as specified by pagev */
void
_check_mru
(
RAM
*
ram
,
Page
*
pagev
[],
int
pagec
)
{
// XXX
void
_check_mru
(
RAM
*
ram
,
Page
*
mruok
[],
int
nok
,
const
char
*
func
,
const
char
*
file
,
int
line
)
{
Page
**
mruv
=
NULL
,
*
page
;
int
n
=
0
,
i
;
struct
list_head
*
hlru
=
ram
->
lru_list
.
prev
;
// collect actual mru
while
(
hlru
!=
&
ram
->
lru_list
)
{
page
=
list_entry
(
hlru
,
typeof
(
*
page
),
lru
);
n
++
;
mruv
=
realloc
(
mruv
,
n
*
sizeof
(
*
mruv
));
mruv
[
n
-
1
]
=
page
;
}
if
(
!
(
n
==
nok
&&
memcmp
(
mruv
,
mruok
,
n
)))
{
fprintf
(
stderr
,
"check_mru: different
\n
"
);
fprintf
(
stderr
,
"have: ["
);
for
(
i
=
0
;
i
<
n
;
i
++
)
fprintf
(
stderr
,
"%sp%ld"
,
(
i
>
0
?
", "
:
""
),
mruv
[
i
]
->
f_pgoffset
);
fprintf
(
stderr
,
"]
\n
"
);
fprintf
(
stderr
,
"want: ["
);
for
(
i
=
0
;
i
<
nok
;
i
++
)
fprintf
(
stderr
,
"%sp%ld"
,
(
i
>
0
?
", "
:
""
),
mruok
[
i
]
->
f_pgoffset
);
fprintf
(
stderr
,
"]
\n
"
);
_gen_result
(
0
,
func
,
file
,
line
,
"check_mru failed"
);
}
free
(
mruv
);
}
// XXX + fail with line
// CHECK_MRU(ram, ...pagev)
#define CHECK_MRU(ram, ...) do { \
Page *__
pagev[] = {__VA_ARGS__};
\
_check_mru(ram, __
pagev, ARRAY_SIZE(__pagev));
\
#define CHECK_MRU(ram, ...) do {
\
Page *__
mruok[] = {__VA_ARGS__};
\
_check_mru(ram, __
mruok, ARRAY_SIZE(__mruok), __func__, __FILE__, __LINE__);
\
} while(0)
...
...
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