-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathTESTING
More file actions
84 lines (49 loc) · 2.16 KB
/
TESTING
File metadata and controls
84 lines (49 loc) · 2.16 KB
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
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
[Summary]:
TL;DR: Inspect failing unit tests with GDB.
Build the unit tests with `make test [build=debug]`. This produces a
`test` executable in `$PROJROOT/build/test`. To run tests for a given
component, pass one (or more) of these flags:
-m : Core map data structure.
-p : `procfs` interface.
-k : `krncry` interface.
-n : Map utilities.
-u : Generic utilities.
When debugging with GDB (see whole document), use the `debug.sh`
script in `$PROJROOT/build/test/debug.sh`.
[Unit tests & ASAN]:
Unit tests use the 'Check' library:
https://libcheck.github.io/check/
Check forks off new processes for each unit test. This can be undesirable
because debug builds of MemCry compile with GCC's address sanitizer,
which will fail to report memory leaks if they occur in a child process.
Check will not fork new processes if the environment's `CK_FORK`
variable is set to `no`.
[GDB scripts (essential)]:
MemCry's datastructures are very tedious to navigate with raw gdb.
Instead of writing 50 character long casts, make use these gdb scripts
defined in `$PROJROOT/build/test/init.gdb`:
pmapa <mc_vm_map * m>
Pretty print all areas inside `m`.
pmapo <mc_vm_map * m>
Pretty print all objects of a map `m` and their constituent
areas.
pmapua <mc_vm_map * m>
Pretty print all unmapped areas inside `m`
pmapuo <mc_vm_map * m>
Pretty print all unmapped objects of a map `m` and their
constituent areas.
parean <cm_lst_node<mc_vm_area> * n>
Dump a `mc_vm_area` held by a list node `cm_lst_node`.
pxarean <cm_lst_node<mc_vm_area> * n>
Dump (hex) a `mc_vm_area` held by a list node `cm_lst_node`
pobjn <cm_lst_node<mc_vm_obj> * n>
Dump a `mc_vm_obj` held by a list node `cm_lst_node`.
pxobjn <cm_lst_node<mc_vm_obj> * n>
Dump (hex) a `mc_vm_obj` held by a list node `cm_lst_node`.
pnode <cm_lst_node<cm_lst_node> * n>
Dump a nested list node held by another list node.
pnodea <cm_lst_node<cm_lst_node<mc_vm_area> *> * n>
`mc_vm_obj` stores a list of pointers to its constituent area
nodes. Use `pnodea` to easily print areas in this list.
pxnodea <cm_lst_node<cm_lst_node<mc_vm_area> *> * n>
See above.