diff options
Diffstat (limited to 'plugins/tests')
-rw-r--r-- | plugins/tests/test_check_swap.c | 23 | ||||
-rwxr-xr-x | plugins/tests/test_check_swap.t | 6 | ||||
-rw-r--r-- | plugins/tests/var/proc_meminfo | 55 |
3 files changed, 84 insertions, 0 deletions
diff --git a/plugins/tests/test_check_swap.c b/plugins/tests/test_check_swap.c new file mode 100644 index 00000000..319cadbf --- /dev/null +++ b/plugins/tests/test_check_swap.c | |||
@@ -0,0 +1,23 @@ | |||
1 | |||
2 | #include "../check_swap.d/check_swap.h" | ||
3 | #include "../../tap/tap.h" | ||
4 | |||
5 | void print_usage() {}; | ||
6 | void print_help(swap_config config) { | ||
7 | (void) config; | ||
8 | }; | ||
9 | |||
10 | const char *progname = "test_check_swap"; | ||
11 | |||
12 | int main() { | ||
13 | swap_config config = swap_config_init(); | ||
14 | |||
15 | swap_result test_data = getSwapFromProcMeminfo(config, "./var/proc_meminfo"); | ||
16 | |||
17 | plan_tests(4); | ||
18 | |||
19 | ok(test_data.errorcode == 0, "Test whether we manage to retrieve swap data"); | ||
20 | ok(test_data.metrics.total == 34233905152, "Is the total Swap correct"); | ||
21 | ok(test_data.metrics.free == 34233905152, "Is the free Swap correct"); | ||
22 | ok(test_data.metrics.used == 0, "Is the used Swap correct"); | ||
23 | } | ||
diff --git a/plugins/tests/test_check_swap.t b/plugins/tests/test_check_swap.t new file mode 100755 index 00000000..826fae01 --- /dev/null +++ b/plugins/tests/test_check_swap.t | |||
@@ -0,0 +1,6 @@ | |||
1 | #!/usr/bin/perl | ||
2 | use Test::More; | ||
3 | if (! -e "./test_check_swap") { | ||
4 | plan skip_all => "./test_check_swap not compiled - please enable libtap library to test"; | ||
5 | } | ||
6 | exec "./test_check_swap"; | ||
diff --git a/plugins/tests/var/proc_meminfo b/plugins/tests/var/proc_meminfo new file mode 100644 index 00000000..6c5a618d --- /dev/null +++ b/plugins/tests/var/proc_meminfo | |||
@@ -0,0 +1,55 @@ | |||
1 | MemTotal: 32767776 kB | ||
2 | MemFree: 1693508 kB | ||
3 | MemAvailable: 23807480 kB | ||
4 | Buffers: 438456 kB | ||
5 | Cached: 19124976 kB | ||
6 | SwapCached: 0 kB | ||
7 | Active: 7860680 kB | ||
8 | Inactive: 18886776 kB | ||
9 | Active(anon): 6108756 kB | ||
10 | Inactive(anon): 1364500 kB | ||
11 | Active(file): 1751924 kB | ||
12 | Inactive(file): 17522276 kB | ||
13 | Unevictable: 8548 kB | ||
14 | Mlocked: 8548 kB | ||
15 | SwapTotal: 33431548 kB | ||
16 | SwapFree: 33431548 kB | ||
17 | Zswap: 0 kB | ||
18 | Zswapped: 0 kB | ||
19 | Dirty: 784 kB | ||
20 | Writeback: 0 kB | ||
21 | AnonPages: 7139968 kB | ||
22 | Mapped: 1094916 kB | ||
23 | Shmem: 284160 kB | ||
24 | KReclaimable: 3303788 kB | ||
25 | Slab: 3801908 kB | ||
26 | SReclaimable: 3303788 kB | ||
27 | SUnreclaim: 498120 kB | ||
28 | KernelStack: 32992 kB | ||
29 | PageTables: 68160 kB | ||
30 | SecPageTables: 0 kB | ||
31 | NFS_Unstable: 0 kB | ||
32 | Bounce: 0 kB | ||
33 | WritebackTmp: 0 kB | ||
34 | CommitLimit: 49815436 kB | ||
35 | Committed_AS: 16888536 kB | ||
36 | VmallocTotal: 34359738367 kB | ||
37 | VmallocUsed: 91200 kB | ||
38 | VmallocChunk: 0 kB | ||
39 | Percpu: 41472 kB | ||
40 | HardwareCorrupted: 0 kB | ||
41 | AnonHugePages: 1708032 kB | ||
42 | ShmemHugePages: 0 kB | ||
43 | ShmemPmdMapped: 0 kB | ||
44 | FileHugePages: 0 kB | ||
45 | FilePmdMapped: 0 kB | ||
46 | Unaccepted: 0 kB | ||
47 | HugePages_Total: 0 | ||
48 | HugePages_Free: 0 | ||
49 | HugePages_Rsvd: 0 | ||
50 | HugePages_Surp: 0 | ||
51 | Hugepagesize: 2048 kB | ||
52 | Hugetlb: 0 kB | ||
53 | DirectMap4k: 860468 kB | ||
54 | DirectMap2M: 20023296 kB | ||
55 | DirectMap1G: 12582912 kB | ||