Coverage Report

Created: 2026-07-25 06:21

next uncovered line (L), next uncovered region (R), next uncovered branch (B)
/src/ipmi-fru-parser/fru_area.cpp
Line
Count
Source
1
#include "fru_area.hpp"
2
3
#include "frup.hpp"
4
5
#include <phosphor-logging/lg2.hpp>
6
7
#include <cstdint>
8
#include <cstring>
9
10
IPMIFruArea::IPMIFruArea(const uint8_t fruID, const ipmi_fru_area_type type) :
11
1.09k
    fruID(fruID), type(type)
12
1.09k
{
13
1.09k
    if (type == IPMI_FRU_AREA_INTERNAL_USE)
14
218
    {
15
218
        name = "INTERNAL_";
16
218
    }
17
872
    else if (type == IPMI_FRU_AREA_CHASSIS_INFO)
18
218
    {
19
218
        name = "CHASSIS_";
20
218
    }
21
654
    else if (type == IPMI_FRU_AREA_BOARD_INFO)
22
218
    {
23
218
        name = "BOARD_";
24
218
    }
25
436
    else if (type == IPMI_FRU_AREA_PRODUCT_INFO)
26
218
    {
27
218
        name = "PRODUCT_";
28
218
    }
29
218
    else if (type == IPMI_FRU_AREA_MULTI_RECORD)
30
218
    {
31
218
        name = "MULTI_";
32
218
    }
33
0
    else
34
0
    {
35
0
        name = IPMI_FRU_AREA_TYPE_MAX;
36
0
        lg2::error("type: {TYPE} is an invalid Area", "TYPE", type);
37
0
    }
38
1.09k
}
39
40
void IPMIFruArea::setData(const uint8_t* value, const size_t length)
41
372
{
42
372
    data.reserve(length); // pre-allocate the space.
43
372
    data.insert(data.begin(), value, value + length);
44
372
}