GCC Code Coverage Report


Directory: ./
File: tests/unit/02_shmem/shmem_mngo_01.c
Date: 2026-12-01 10:07:21
Exec Total Coverage
Lines: 11 11 100.0%
Functions: 1 1 100.0%
Branches: 5 10 50.0%

Line Branch Exec Source
1 /*********************************************************************************/
2 /* Copyright 2009-2023 Barcelona Supercomputing Center */
3 /* */
4 /* This file is part of the DLB library. */
5 /* */
6 /* DLB is free software: you can redistribute it and/or modify */
7 /* it under the terms of the GNU Lesser General Public License as published by */
8 /* the Free Software Foundation, either version 3 of the License, or */
9 /* (at your option) any later version. */
10 /* */
11 /* DLB is distributed in the hope that it will be useful, */
12 /* but WITHOUT ANY WARRANTY; without even the implied warranty of */
13 /* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the */
14 /* GNU Lesser General Public License for more details. */
15 /* */
16 /* You should have received a copy of the GNU Lesser General Public License */
17 /* along with DLB. If not, see <https://www.gnu.org/licenses/>. */
18 /*********************************************************************************/
19
20 #include "unique_shmem.h"
21
22 #include "LB_comm/shmem.h"
23 #include "LB_comm/shmem_mngo.h"
24 #include "apis/dlb_errors.h"
25 #include "support/mask_utils.h"
26
27 #include <assert.h>
28 #include <sched.h>
29 #include <sys/types.h>
30
31 1 int main(int argc, char *argv[]) {
32
33 enum { SYS_SIZE = 2 };
34
35 1 mu_init();
36 1 mu_testing_set_sys_size(SYS_SIZE);
37
38 1 pid_t pid1 = 1;
39 size_t manager_id_1;
40
41 /* Initialize shmem mngo (first instance) */
42
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 1 times.
1 assert(shmem_mngo_init(SHMEM_KEY, pid1, 0, &manager_id_1) == DLB_SUCCESS);
43
44 /* Simulate inbox is full (read) */
45 {
46 }
47
48 1 pid_t pid2 = 2;
49 size_t manager_id_2;
50
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 1 times.
1 assert(shmem_mngo_init(SHMEM_KEY, pid2, 1, &manager_id_2) == DLB_SUCCESS);
51 /* Simulate inbox is full (broadcast) */
52 {
53 }
54
55 /* Simulate inbox is empty */
56 {
57 }
58
59 /* Simulate perform operation with mid bigger than max */
60 {
61 }
62
63 /* Initialize shmem when all slots are allocated */
64 {
65 1 pid_t pid3 = 3;
66 size_t manager_id_3;
67
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 1 times.
1 assert(DLB_ERR_NOSHMEM ==
68 shmem_mngo_init(SHMEM_KEY, pid3, 3, &manager_id_3));
69 }
70
71 /* Finalize shmem mngo */
72
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 1 times.
1 assert(shmem_mngo_fini(manager_id_1) == DLB_SUCCESS);
73
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 1 times.
1 assert(shmem_mngo_fini(manager_id_2) == DLB_SUCCESS);
74 }
75