1 #include <stdio.h>
2
3 #include <analyzer/plugins/plugin.hpp>
4 #include <analyzer/ras-data/ras-data-parser.hpp>
5 #include <hei_util.hpp>
6 #include <util/pdbg.hpp>
7 #include <util/trace.hpp>
8
9 #include "gtest/gtest.h"
10
11 using namespace analyzer;
12
13 static const auto dstlfirId = static_cast<libhei::NodeId_t>(
14 libhei::hash<libhei::NodeId_t>("MC_DSTL_FIR"));
15
16 // Test multiple channel timeouts on at the same time
TEST(ChnlTimeout,MultipleTimeouts)17 TEST(ChnlTimeout, MultipleTimeouts)
18 {
19 pdbg_targets_init(nullptr);
20
21 libhei::Chip proc0{util::pdbg::getTrgt("/proc0"), P10_20};
22
23 libhei::Signature sig1{proc0, dstlfirId, 0, 22, libhei::ATTN_TYPE_UNIT_CS};
24 libhei::Signature sig2{proc0, dstlfirId, 0, 23, libhei::ATTN_TYPE_UNIT_CS};
25
26 libhei::IsolationData isoData{};
27 isoData.addSignature(sig1);
28 isoData.addSignature(sig2);
29 ServiceData sd{sig1, AnalysisType::SYSTEM_CHECKSTOP, isoData};
30
31 RasDataParser rasData{};
32 rasData.getResolution(sig1)->resolve(sd);
33
34 nlohmann::json j{};
35 std::string s{};
36
37 // Callout list
38 j = sd.getCalloutList();
39 s = R"([
40 {
41 "Deconfigured": false,
42 "EntityPath": [],
43 "GuardType": "GARD_Unrecoverable",
44 "Guarded": true,
45 "LocationCode": "/proc0/pib/perv12/mc0/mi0/mcc0/omi0",
46 "Priority": "H"
47 },
48 {
49 "Deconfigured": false,
50 "Guarded": false,
51 "LocationCode": "/proc0/pib/perv12/mc0/mi0/mcc0/omi0/ocmb0",
52 "Priority": "L"
53 },
54 {
55 "Deconfigured": false,
56 "Guarded": false,
57 "LocationCode": "P0",
58 "Priority": "L"
59 }
60 ])";
61 EXPECT_EQ(s, j.dump(4));
62
63 // Callout FFDC
64 j = sd.getCalloutFFDC();
65 s = R"([
66 {
67 "Bus Type": "OMI_BUS",
68 "Callout Type": "Bus Callout",
69 "Guard": false,
70 "Priority": "low",
71 "RX Target": "/proc0/pib/perv12/mc0/mi0/mcc0/omi0",
72 "TX Target": "/proc0/pib/perv12/mc0/mi0/mcc0/omi0/ocmb0"
73 },
74 {
75 "Callout Type": "Hardware Callout",
76 "Guard": true,
77 "Priority": "high",
78 "Target": "/proc0/pib/perv12/mc0/mi0/mcc0/omi0"
79 }
80 ])";
81 EXPECT_EQ(s, j.dump(4));
82 }
83
84 // Test multiple channel timeouts on different MC_DSTL_FIR instances
TEST(ChnlTimeout,DifferentInst)85 TEST(ChnlTimeout, DifferentInst)
86 {
87 pdbg_targets_init(nullptr);
88
89 libhei::Chip proc0{util::pdbg::getTrgt("/proc0"), P10_20};
90
91 libhei::Signature sig1{proc0, dstlfirId, 0, 22, libhei::ATTN_TYPE_UNIT_CS};
92 libhei::Signature sig2{proc0, dstlfirId, 1, 22, libhei::ATTN_TYPE_UNIT_CS};
93
94 libhei::IsolationData isoData{};
95 isoData.addSignature(sig1);
96 isoData.addSignature(sig2);
97 ServiceData sd{sig1, AnalysisType::SYSTEM_CHECKSTOP, isoData};
98
99 RasDataParser rasData{};
100 rasData.getResolution(sig1)->resolve(sd);
101
102 nlohmann::json j{};
103 std::string s{};
104
105 // Callout list
106 j = sd.getCalloutList();
107 s = R"([
108 {
109 "Deconfigured": false,
110 "EntityPath": [],
111 "GuardType": "GARD_Unrecoverable",
112 "Guarded": true,
113 "LocationCode": "/proc0/pib/perv12/mc0/mi0/mcc0/omi0",
114 "Priority": "H"
115 },
116 {
117 "Deconfigured": false,
118 "Guarded": false,
119 "LocationCode": "/proc0/pib/perv12/mc0/mi0/mcc0/omi0/ocmb0",
120 "Priority": "L"
121 },
122 {
123 "Deconfigured": false,
124 "Guarded": false,
125 "LocationCode": "P0",
126 "Priority": "L"
127 }
128 ])";
129 EXPECT_EQ(s, j.dump(4));
130
131 // Callout FFDC
132 j = sd.getCalloutFFDC();
133 s = R"([
134 {
135 "Bus Type": "OMI_BUS",
136 "Callout Type": "Bus Callout",
137 "Guard": false,
138 "Priority": "low",
139 "RX Target": "/proc0/pib/perv12/mc0/mi0/mcc0/omi0",
140 "TX Target": "/proc0/pib/perv12/mc0/mi0/mcc0/omi0/ocmb0"
141 },
142 {
143 "Callout Type": "Hardware Callout",
144 "Guard": true,
145 "Priority": "high",
146 "Target": "/proc0/pib/perv12/mc0/mi0/mcc0/omi0"
147 }
148 ])";
149 EXPECT_EQ(s, j.dump(4));
150 }
151
152 // Test multiple channel timeouts on different processors
TEST(ChnlTimeout,DifferentProc)153 TEST(ChnlTimeout, DifferentProc)
154 {
155 pdbg_targets_init(nullptr);
156
157 libhei::Chip proc0{util::pdbg::getTrgt("/proc0"), P10_20};
158 libhei::Chip proc1{util::pdbg::getTrgt("/proc1"), P10_20};
159
160 libhei::Signature sig1{proc0, dstlfirId, 0, 22, libhei::ATTN_TYPE_UNIT_CS};
161 libhei::Signature sig2{proc1, dstlfirId, 0, 22, libhei::ATTN_TYPE_UNIT_CS};
162
163 libhei::IsolationData isoData{};
164 isoData.addSignature(sig1);
165 isoData.addSignature(sig2);
166 ServiceData sd{sig1, AnalysisType::SYSTEM_CHECKSTOP, isoData};
167
168 RasDataParser rasData{};
169 rasData.getResolution(sig1)->resolve(sd);
170
171 nlohmann::json j{};
172 std::string s{};
173
174 // Callout list
175 j = sd.getCalloutList();
176 s = R"([
177 {
178 "Deconfigured": false,
179 "Guarded": false,
180 "LocationCode": "/proc0/pib/perv12/mc0/mi0/mcc0/omi0",
181 "Priority": "L"
182 },
183 {
184 "Deconfigured": false,
185 "EntityPath": [],
186 "GuardType": "GARD_Unrecoverable",
187 "Guarded": true,
188 "LocationCode": "/proc0/pib/perv12/mc0/mi0/mcc0/omi0/ocmb0",
189 "Priority": "H"
190 },
191 {
192 "Deconfigured": false,
193 "Guarded": false,
194 "LocationCode": "P0",
195 "Priority": "L"
196 }
197 ])";
198 EXPECT_EQ(s, j.dump(4));
199
200 // Callout FFDC
201 j = sd.getCalloutFFDC();
202 s = R"([
203 {
204 "Bus Type": "OMI_BUS",
205 "Callout Type": "Bus Callout",
206 "Guard": false,
207 "Priority": "low",
208 "RX Target": "/proc0/pib/perv12/mc0/mi0/mcc0/omi0",
209 "TX Target": "/proc0/pib/perv12/mc0/mi0/mcc0/omi0/ocmb0"
210 },
211 {
212 "Bus Type": "OMI_BUS",
213 "Callout Type": "Connected Callout",
214 "Guard": true,
215 "Priority": "high",
216 "RX Target": "/proc0/pib/perv12/mc0/mi0/mcc0/omi0",
217 "TX Target": "/proc0/pib/perv12/mc0/mi0/mcc0/omi0/ocmb0"
218 }
219 ])";
220 EXPECT_EQ(s, j.dump(4));
221 }
222
223 // Test a single channel timeout
TEST(ChnlTimeout,SingleTimeout)224 TEST(ChnlTimeout, SingleTimeout)
225 {
226 pdbg_targets_init(nullptr);
227
228 libhei::Chip proc0{util::pdbg::getTrgt("/proc0"), P10_20};
229
230 libhei::Signature sig1{proc0, dstlfirId, 0, 22, libhei::ATTN_TYPE_UNIT_CS};
231
232 libhei::IsolationData isoData{};
233 isoData.addSignature(sig1);
234 ServiceData sd{sig1, AnalysisType::SYSTEM_CHECKSTOP, isoData};
235
236 RasDataParser rasData{};
237 rasData.getResolution(sig1)->resolve(sd);
238
239 nlohmann::json j{};
240 std::string s{};
241
242 // Callout list
243 j = sd.getCalloutList();
244 s = R"([
245 {
246 "Deconfigured": false,
247 "Guarded": false,
248 "LocationCode": "/proc0/pib/perv12/mc0/mi0/mcc0/omi0",
249 "Priority": "L"
250 },
251 {
252 "Deconfigured": false,
253 "EntityPath": [],
254 "GuardType": "GARD_Unrecoverable",
255 "Guarded": true,
256 "LocationCode": "/proc0/pib/perv12/mc0/mi0/mcc0/omi0/ocmb0",
257 "Priority": "H"
258 },
259 {
260 "Deconfigured": false,
261 "Guarded": false,
262 "LocationCode": "P0",
263 "Priority": "L"
264 }
265 ])";
266 EXPECT_EQ(s, j.dump(4));
267
268 // Callout FFDC
269 j = sd.getCalloutFFDC();
270 s = R"([
271 {
272 "Bus Type": "OMI_BUS",
273 "Callout Type": "Bus Callout",
274 "Guard": false,
275 "Priority": "low",
276 "RX Target": "/proc0/pib/perv12/mc0/mi0/mcc0/omi0",
277 "TX Target": "/proc0/pib/perv12/mc0/mi0/mcc0/omi0/ocmb0"
278 },
279 {
280 "Bus Type": "OMI_BUS",
281 "Callout Type": "Connected Callout",
282 "Guard": true,
283 "Priority": "high",
284 "RX Target": "/proc0/pib/perv12/mc0/mi0/mcc0/omi0",
285 "TX Target": "/proc0/pib/perv12/mc0/mi0/mcc0/omi0/ocmb0"
286 }
287 ])";
288 EXPECT_EQ(s, j.dump(4));
289 }
290