blob: e9b21043f8e73f759f54dac8e32ffa1c38f4ed1b [file] [log] [blame]
Zane Shelley0b8368c2021-03-18 17:33:41 -05001#include <stdio.h>
2
Zane Shelley82be3ab2021-12-07 10:36:08 -06003#include <analyzer/analyzer_main.hpp>
Zane Shelley0b8368c2021-03-18 17:33:41 -05004#include <analyzer/resolution.hpp>
Zane Shelleycb766a42022-01-12 17:50:23 -06005#include <util/pdbg.hpp>
Zane Shelley5d63cef2021-09-17 18:10:17 -05006#include <util/trace.hpp>
7
8#include <regex>
Zane Shelley0b8368c2021-03-18 17:33:41 -05009
10#include "gtest/gtest.h"
11
12// Chip string
13constexpr auto chip_str = "/proc0";
14
15// Unit paths
Zane Shelley5d63cef2021-09-17 18:10:17 -050016constexpr auto proc_str = "";
17constexpr auto iolink_str = "pib/perv24/pauc0/iohs0/smpgroup0";
18constexpr auto omi_str = "pib/perv12/mc0/mi0/mcc0/omi0";
19constexpr auto ocmb_str = "pib/perv12/mc0/mi0/mcc0/omi0/ocmb0";
20constexpr auto core_str = "pib/perv39/eq7/fc1/core1";
Zane Shelley0b8368c2021-03-18 17:33:41 -050021
Zane Shelley0b8368c2021-03-18 17:33:41 -050022using namespace analyzer;
23
24TEST(Resolution, TestSet1)
25{
Zane Shelleycb766a42022-01-12 17:50:23 -060026 pdbg_targets_init(nullptr);
27
Zane Shelley0b8368c2021-03-18 17:33:41 -050028 // Create a few resolutions
29 auto c1 = std::make_shared<HardwareCalloutResolution>(
Zane Shelleyc85716c2021-08-17 10:54:06 -050030 proc_str, callout::Priority::HIGH, false);
Zane Shelley0b8368c2021-03-18 17:33:41 -050031
32 auto c2 = std::make_shared<HardwareCalloutResolution>(
Zane Shelleyc85716c2021-08-17 10:54:06 -050033 omi_str, callout::Priority::MED_A, true);
Zane Shelley0b8368c2021-03-18 17:33:41 -050034
35 auto c3 = std::make_shared<HardwareCalloutResolution>(
Zane Shelleyc85716c2021-08-17 10:54:06 -050036 core_str, callout::Priority::MED, true);
Zane Shelley0b8368c2021-03-18 17:33:41 -050037
38 auto c4 = std::make_shared<ProcedureCalloutResolution>(
Zane Shelleyc85716c2021-08-17 10:54:06 -050039 callout::Procedure::NEXTLVL, callout::Priority::LOW);
Zane Shelley0b8368c2021-03-18 17:33:41 -050040
Zane Shelley84721d92021-09-08 13:30:27 -050041 auto c5 = std::make_shared<ClockCalloutResolution>(
42 callout::ClockType::OSC_REF_CLOCK_1, callout::Priority::LOW, false);
43
44 // l1 = (c1, c2, c5)
Zane Shelley723fa232021-08-09 12:02:06 -050045 auto l1 = std::make_shared<ResolutionList>();
46 l1->push(c1);
47 l1->push(c2);
Zane Shelley84721d92021-09-08 13:30:27 -050048 l1->push(c5);
Zane Shelley0b8368c2021-03-18 17:33:41 -050049
Zane Shelley84721d92021-09-08 13:30:27 -050050 // l2 = (c4, c3, c1, c2, c5)
Zane Shelley723fa232021-08-09 12:02:06 -050051 auto l2 = std::make_shared<ResolutionList>();
52 l2->push(c4);
53 l2->push(c3);
54 l2->push(l1);
Zane Shelley0b8368c2021-03-18 17:33:41 -050055
56 // Get some ServiceData objects
Zane Shelleycb766a42022-01-12 17:50:23 -060057 libhei::Chip chip{util::pdbg::getTrgt(chip_str), 0xdeadbeef};
Zane Shelley0b8368c2021-03-18 17:33:41 -050058 libhei::Signature sig{chip, 0xabcd, 0, 0, libhei::ATTN_TYPE_CHECKSTOP};
Zane Shelley62adf5c2022-01-18 21:06:50 -060059 ServiceData sd1{sig, AnalysisType::SYSTEM_CHECKSTOP,
60 libhei::IsolationData{}};
61 ServiceData sd2{sig, AnalysisType::TERMINATE_IMMEDIATE,
62 libhei::IsolationData{}};
Zane Shelley0b8368c2021-03-18 17:33:41 -050063
64 // Resolve
Zane Shelley723fa232021-08-09 12:02:06 -050065 l1->resolve(sd1);
66 l2->resolve(sd2);
Zane Shelley0b8368c2021-03-18 17:33:41 -050067
68 // Start verifying
69 nlohmann::json j{};
70 std::string s{};
71
Zane Shelleyc85716c2021-08-17 10:54:06 -050072 j = sd1.getCalloutList();
Zane Shelley0b8368c2021-03-18 17:33:41 -050073 s = R"([
74 {
Zane Shelley9a738f72021-11-03 20:45:30 -050075 "Deconfigured": false,
76 "Guarded": false,
Zane Shelley0b8368c2021-03-18 17:33:41 -050077 "LocationCode": "/proc0",
78 "Priority": "H"
79 },
80 {
Zane Shelley1eff9452021-11-03 13:59:54 -050081 "Deconfigured": false,
Zane Shelleycb766a42022-01-12 17:50:23 -060082 "EntityPath": [],
83 "GuardType": "GARD_Unrecoverable",
84 "Guarded": true,
85 "LocationCode": "/proc0/pib/perv12/mc0/mi0/mcc0/omi0",
86 "Priority": "A"
87 },
88 {
89 "Deconfigured": false,
Zane Shelley1eff9452021-11-03 13:59:54 -050090 "Guarded": false,
Zane Shelley84721d92021-09-08 13:30:27 -050091 "LocationCode": "P0",
92 "Priority": "L"
Zane Shelley0b8368c2021-03-18 17:33:41 -050093 }
94])";
Zane Shelley96d54862021-09-17 11:16:12 -050095 EXPECT_EQ(s, j.dump(4));
Zane Shelley0b8368c2021-03-18 17:33:41 -050096
Zane Shelleyc85716c2021-08-17 10:54:06 -050097 j = sd2.getCalloutList();
Zane Shelley0b8368c2021-03-18 17:33:41 -050098 s = R"([
99 {
100 "Priority": "L",
Zane Shelley86ccc452021-11-16 13:10:52 -0600101 "Procedure": "next_level_support"
Zane Shelley0b8368c2021-03-18 17:33:41 -0500102 },
103 {
Zane Shelley9a738f72021-11-03 20:45:30 -0500104 "Deconfigured": false,
Zane Shelleycb766a42022-01-12 17:50:23 -0600105 "EntityPath": [],
106 "GuardType": "GARD_Predictive",
Zane Shelley9a738f72021-11-03 20:45:30 -0500107 "Guarded": true,
Zane Shelleycb766a42022-01-12 17:50:23 -0600108 "LocationCode": "/proc0/pib/perv39/eq7/fc1/core1",
109 "Priority": "M"
110 },
111 {
112 "Deconfigured": false,
113 "Guarded": false,
Zane Shelley0b8368c2021-03-18 17:33:41 -0500114 "LocationCode": "/proc0",
Zane Shelley0b8368c2021-03-18 17:33:41 -0500115 "Priority": "H"
116 },
117 {
Zane Shelley1eff9452021-11-03 13:59:54 -0500118 "Deconfigured": false,
Zane Shelleycb766a42022-01-12 17:50:23 -0600119 "EntityPath": [],
120 "GuardType": "GARD_Predictive",
121 "Guarded": true,
122 "LocationCode": "/proc0/pib/perv12/mc0/mi0/mcc0/omi0",
123 "Priority": "A"
124 },
125 {
126 "Deconfigured": false,
Zane Shelley1eff9452021-11-03 13:59:54 -0500127 "Guarded": false,
Zane Shelley84721d92021-09-08 13:30:27 -0500128 "LocationCode": "P0",
129 "Priority": "L"
Zane Shelley0b8368c2021-03-18 17:33:41 -0500130 }
131])";
Zane Shelley96d54862021-09-17 11:16:12 -0500132 EXPECT_EQ(s, j.dump(4));
133}
134
135TEST(Resolution, HardwareCallout)
136{
Zane Shelleycb766a42022-01-12 17:50:23 -0600137 pdbg_targets_init(nullptr);
138
Zane Shelley96d54862021-09-17 11:16:12 -0500139 auto c1 = std::make_shared<HardwareCalloutResolution>(
140 omi_str, callout::Priority::MED_A, true);
141
Zane Shelleycb766a42022-01-12 17:50:23 -0600142 libhei::Chip chip{util::pdbg::getTrgt(chip_str), 0xdeadbeef};
Zane Shelley96d54862021-09-17 11:16:12 -0500143 libhei::Signature sig{chip, 0xabcd, 0, 0, libhei::ATTN_TYPE_CHECKSTOP};
Zane Shelley62adf5c2022-01-18 21:06:50 -0600144 ServiceData sd{sig, AnalysisType::SYSTEM_CHECKSTOP,
145 libhei::IsolationData{}};
Zane Shelley96d54862021-09-17 11:16:12 -0500146
147 c1->resolve(sd);
148
149 nlohmann::json j{};
150 std::string s{};
151
152 // Callout list
153 j = sd.getCalloutList();
154 s = R"([
155 {
Zane Shelley9a738f72021-11-03 20:45:30 -0500156 "Deconfigured": false,
Zane Shelleycb766a42022-01-12 17:50:23 -0600157 "EntityPath": [],
158 "GuardType": "GARD_Unrecoverable",
Zane Shelley9a738f72021-11-03 20:45:30 -0500159 "Guarded": true,
Zane Shelleycb766a42022-01-12 17:50:23 -0600160 "LocationCode": "/proc0/pib/perv12/mc0/mi0/mcc0/omi0",
Zane Shelley96d54862021-09-17 11:16:12 -0500161 "Priority": "A"
162 }
163])";
164 EXPECT_EQ(s, j.dump(4));
165
166 // Callout FFDC
167 j = sd.getCalloutFFDC();
168 s = R"([
169 {
170 "Callout Type": "Hardware Callout",
Zane Shelleya00426f2021-11-04 10:50:50 -0500171 "Guard": true,
Zane Shelley96d54862021-09-17 11:16:12 -0500172 "Priority": "medium_group_A",
173 "Target": "/proc0/pib/perv12/mc0/mi0/mcc0/omi0"
174 }
175])";
176 EXPECT_EQ(s, j.dump(4));
177}
178
Zane Shelley5d63cef2021-09-17 18:10:17 -0500179TEST(Resolution, ConnectedCallout)
180{
Zane Shelleycb766a42022-01-12 17:50:23 -0600181 pdbg_targets_init(nullptr);
182
Zane Shelley5d63cef2021-09-17 18:10:17 -0500183 auto c1 = std::make_shared<ConnectedCalloutResolution>(
184 callout::BusType::SMP_BUS, iolink_str, callout::Priority::MED_A, true);
185
186 auto c2 = std::make_shared<ConnectedCalloutResolution>(
187 callout::BusType::OMI_BUS, ocmb_str, callout::Priority::MED_B, true);
188
189 auto c3 = std::make_shared<ConnectedCalloutResolution>(
190 callout::BusType::OMI_BUS, omi_str, callout::Priority::MED_C, true);
191
Zane Shelleycb766a42022-01-12 17:50:23 -0600192 libhei::Chip chip{util::pdbg::getTrgt(chip_str), 0xdeadbeef};
Zane Shelley5d63cef2021-09-17 18:10:17 -0500193 libhei::Signature sig{chip, 0xabcd, 0, 0, libhei::ATTN_TYPE_CHECKSTOP};
Zane Shelley62adf5c2022-01-18 21:06:50 -0600194 ServiceData sd{sig, AnalysisType::SYSTEM_CHECKSTOP,
195 libhei::IsolationData{}};
Zane Shelley5d63cef2021-09-17 18:10:17 -0500196
197 nlohmann::json j{};
198 std::string s{};
199
200 c1->resolve(sd);
201 c2->resolve(sd);
202 c3->resolve(sd);
203
204 // Callout list
205 j = sd.getCalloutList();
206 s = R"([
207 {
Zane Shelley9a738f72021-11-03 20:45:30 -0500208 "Deconfigured": false,
Zane Shelleycb766a42022-01-12 17:50:23 -0600209 "EntityPath": [],
210 "GuardType": "GARD_Unrecoverable",
Zane Shelley9a738f72021-11-03 20:45:30 -0500211 "Guarded": true,
Zane Shelleycb766a42022-01-12 17:50:23 -0600212 "LocationCode": "/proc0/pib/perv24/pauc0/iohs0/smpgroup0",
Zane Shelley5d63cef2021-09-17 18:10:17 -0500213 "Priority": "A"
214 },
215 {
Zane Shelley9a738f72021-11-03 20:45:30 -0500216 "Deconfigured": false,
Zane Shelleycb766a42022-01-12 17:50:23 -0600217 "EntityPath": [],
218 "GuardType": "GARD_Unrecoverable",
Zane Shelley9a738f72021-11-03 20:45:30 -0500219 "Guarded": true,
Zane Shelleycb766a42022-01-12 17:50:23 -0600220 "LocationCode": "/proc0/pib/perv12/mc0/mi0/mcc0/omi0",
Zane Shelley5d63cef2021-09-17 18:10:17 -0500221 "Priority": "B"
222 },
223 {
Zane Shelley9a738f72021-11-03 20:45:30 -0500224 "Deconfigured": false,
Zane Shelleycb766a42022-01-12 17:50:23 -0600225 "EntityPath": [],
226 "GuardType": "GARD_Unrecoverable",
Zane Shelley9a738f72021-11-03 20:45:30 -0500227 "Guarded": true,
Zane Shelley5d63cef2021-09-17 18:10:17 -0500228 "LocationCode": "/proc0/pib/perv12/mc0/mi0/mcc0/omi0/ocmb0",
229 "Priority": "C"
230 }
231])";
232 EXPECT_EQ(s, j.dump(4));
233
234 // Callout FFDC
235 j = sd.getCalloutFFDC();
236 s = R"([
237 {
238 "Bus Type": "SMP_BUS",
239 "Callout Type": "Connected Callout",
Zane Shelleya00426f2021-11-04 10:50:50 -0500240 "Guard": true,
Zane Shelley5d63cef2021-09-17 18:10:17 -0500241 "Priority": "medium_group_A",
Zane Shelley37acb282022-01-10 16:05:22 -0600242 "RX Target": "/proc0/pib/perv24/pauc0/iohs0/smpgroup0",
243 "TX Target": "/proc0/pib/perv24/pauc0/iohs0/smpgroup0"
Zane Shelley5d63cef2021-09-17 18:10:17 -0500244 },
245 {
246 "Bus Type": "OMI_BUS",
247 "Callout Type": "Connected Callout",
Zane Shelleya00426f2021-11-04 10:50:50 -0500248 "Guard": true,
Zane Shelley5d63cef2021-09-17 18:10:17 -0500249 "Priority": "medium_group_B",
Zane Shelley37acb282022-01-10 16:05:22 -0600250 "RX Target": "/proc0/pib/perv12/mc0/mi0/mcc0/omi0/ocmb0",
251 "TX Target": "/proc0/pib/perv12/mc0/mi0/mcc0/omi0"
Zane Shelley5d63cef2021-09-17 18:10:17 -0500252 },
253 {
254 "Bus Type": "OMI_BUS",
255 "Callout Type": "Connected Callout",
Zane Shelleya00426f2021-11-04 10:50:50 -0500256 "Guard": true,
Zane Shelley5d63cef2021-09-17 18:10:17 -0500257 "Priority": "medium_group_C",
Zane Shelley37acb282022-01-10 16:05:22 -0600258 "RX Target": "/proc0/pib/perv12/mc0/mi0/mcc0/omi0",
259 "TX Target": "/proc0/pib/perv12/mc0/mi0/mcc0/omi0/ocmb0"
Zane Shelley5d63cef2021-09-17 18:10:17 -0500260 }
261])";
262 EXPECT_EQ(s, j.dump(4));
263}
264
Zane Shelley4757a7b2021-09-20 22:23:38 -0500265TEST(Resolution, BusCallout)
266{
Zane Shelleycb766a42022-01-12 17:50:23 -0600267 pdbg_targets_init(nullptr);
268
Zane Shelley4757a7b2021-09-20 22:23:38 -0500269 auto c1 = std::make_shared<HardwareCalloutResolution>(
270 omi_str, callout::Priority::MED_A, true);
271
272 auto c2 = std::make_shared<ConnectedCalloutResolution>(
273 callout::BusType::OMI_BUS, omi_str, callout::Priority::MED_A, true);
274
275 auto c3 = std::make_shared<BusCalloutResolution>(
276 callout::BusType::OMI_BUS, omi_str, callout::Priority::LOW, false);
277
Zane Shelleycb766a42022-01-12 17:50:23 -0600278 libhei::Chip chip{util::pdbg::getTrgt(chip_str), 0xdeadbeef};
Zane Shelley4757a7b2021-09-20 22:23:38 -0500279 libhei::Signature sig{chip, 0xabcd, 0, 0, libhei::ATTN_TYPE_CHECKSTOP};
Zane Shelley62adf5c2022-01-18 21:06:50 -0600280 ServiceData sd{sig, AnalysisType::SYSTEM_CHECKSTOP,
281 libhei::IsolationData{}};
Zane Shelley4757a7b2021-09-20 22:23:38 -0500282
283 nlohmann::json j{};
284 std::string s{};
285
286 c1->resolve(sd);
287 c2->resolve(sd);
288 c3->resolve(sd);
289
290 // Callout list
291 j = sd.getCalloutList();
292 s = R"([
293 {
Zane Shelley9a738f72021-11-03 20:45:30 -0500294 "Deconfigured": false,
Zane Shelleycb766a42022-01-12 17:50:23 -0600295 "EntityPath": [],
296 "GuardType": "GARD_Unrecoverable",
Zane Shelley9a738f72021-11-03 20:45:30 -0500297 "Guarded": true,
Zane Shelleycb766a42022-01-12 17:50:23 -0600298 "LocationCode": "/proc0/pib/perv12/mc0/mi0/mcc0/omi0",
Zane Shelley4757a7b2021-09-20 22:23:38 -0500299 "Priority": "A"
300 },
301 {
Zane Shelley9a738f72021-11-03 20:45:30 -0500302 "Deconfigured": false,
Zane Shelleycb766a42022-01-12 17:50:23 -0600303 "EntityPath": [],
304 "GuardType": "GARD_Unrecoverable",
Zane Shelley9a738f72021-11-03 20:45:30 -0500305 "Guarded": true,
Zane Shelley4757a7b2021-09-20 22:23:38 -0500306 "LocationCode": "/proc0/pib/perv12/mc0/mi0/mcc0/omi0/ocmb0",
307 "Priority": "A"
308 },
309 {
Zane Shelley1eff9452021-11-03 13:59:54 -0500310 "Deconfigured": false,
311 "Guarded": false,
Zane Shelley4757a7b2021-09-20 22:23:38 -0500312 "LocationCode": "P0",
313 "Priority": "L"
314 }
315])";
316 EXPECT_EQ(s, j.dump(4));
317
318 // Callout FFDC
319 j = sd.getCalloutFFDC();
320 s = R"([
321 {
322 "Callout Type": "Hardware Callout",
Zane Shelleya00426f2021-11-04 10:50:50 -0500323 "Guard": true,
Zane Shelley4757a7b2021-09-20 22:23:38 -0500324 "Priority": "medium_group_A",
325 "Target": "/proc0/pib/perv12/mc0/mi0/mcc0/omi0"
326 },
327 {
328 "Bus Type": "OMI_BUS",
329 "Callout Type": "Connected Callout",
Zane Shelleya00426f2021-11-04 10:50:50 -0500330 "Guard": true,
Zane Shelley4757a7b2021-09-20 22:23:38 -0500331 "Priority": "medium_group_A",
Zane Shelley37acb282022-01-10 16:05:22 -0600332 "RX Target": "/proc0/pib/perv12/mc0/mi0/mcc0/omi0",
333 "TX Target": "/proc0/pib/perv12/mc0/mi0/mcc0/omi0/ocmb0"
Zane Shelley4757a7b2021-09-20 22:23:38 -0500334 },
335 {
336 "Bus Type": "OMI_BUS",
337 "Callout Type": "Bus Callout",
Zane Shelleya00426f2021-11-04 10:50:50 -0500338 "Guard": false,
Zane Shelley4757a7b2021-09-20 22:23:38 -0500339 "Priority": "low",
340 "RX Target": "/proc0/pib/perv12/mc0/mi0/mcc0/omi0",
341 "TX Target": "/proc0/pib/perv12/mc0/mi0/mcc0/omi0/ocmb0"
342 }
343])";
344 EXPECT_EQ(s, j.dump(4));
345}
346
Zane Shelley96d54862021-09-17 11:16:12 -0500347TEST(Resolution, ClockCallout)
348{
Zane Shelleycb766a42022-01-12 17:50:23 -0600349 pdbg_targets_init(nullptr);
350
Zane Shelley96d54862021-09-17 11:16:12 -0500351 auto c1 = std::make_shared<ClockCalloutResolution>(
352 callout::ClockType::OSC_REF_CLOCK_1, callout::Priority::HIGH, false);
353
Zane Shelleycb766a42022-01-12 17:50:23 -0600354 libhei::Chip chip{util::pdbg::getTrgt(chip_str), 0xdeadbeef};
Zane Shelley96d54862021-09-17 11:16:12 -0500355 libhei::Signature sig{chip, 0xabcd, 0, 0, libhei::ATTN_TYPE_CHECKSTOP};
Zane Shelley62adf5c2022-01-18 21:06:50 -0600356 ServiceData sd{sig, AnalysisType::SYSTEM_CHECKSTOP,
357 libhei::IsolationData{}};
Zane Shelley96d54862021-09-17 11:16:12 -0500358
359 c1->resolve(sd);
360
361 nlohmann::json j{};
362 std::string s{};
363
364 // Callout list
365 j = sd.getCalloutList();
366 s = R"([
367 {
Zane Shelley1eff9452021-11-03 13:59:54 -0500368 "Deconfigured": false,
369 "Guarded": false,
Zane Shelley96d54862021-09-17 11:16:12 -0500370 "LocationCode": "P0",
371 "Priority": "H"
372 }
373])";
374 EXPECT_EQ(s, j.dump(4));
375
376 // Callout FFDC
377 j = sd.getCalloutFFDC();
378 s = R"([
379 {
380 "Callout Type": "Clock Callout",
381 "Clock Type": "OSC_REF_CLOCK_1",
Zane Shelley1eff9452021-11-03 13:59:54 -0500382 "Priority": "high"
Zane Shelley96d54862021-09-17 11:16:12 -0500383 }
384])";
385 EXPECT_EQ(s, j.dump(4));
386}
387
388TEST(Resolution, ProcedureCallout)
389{
Zane Shelleycb766a42022-01-12 17:50:23 -0600390 pdbg_targets_init(nullptr);
391
Zane Shelley96d54862021-09-17 11:16:12 -0500392 auto c1 = std::make_shared<ProcedureCalloutResolution>(
393 callout::Procedure::NEXTLVL, callout::Priority::LOW);
394
Zane Shelleycb766a42022-01-12 17:50:23 -0600395 libhei::Chip chip{util::pdbg::getTrgt(chip_str), 0xdeadbeef};
Zane Shelley96d54862021-09-17 11:16:12 -0500396 libhei::Signature sig{chip, 0xabcd, 0, 0, libhei::ATTN_TYPE_CHECKSTOP};
Zane Shelley62adf5c2022-01-18 21:06:50 -0600397 ServiceData sd{sig, AnalysisType::SYSTEM_CHECKSTOP,
398 libhei::IsolationData{}};
Zane Shelley96d54862021-09-17 11:16:12 -0500399
400 c1->resolve(sd);
401
402 nlohmann::json j{};
403 std::string s{};
404
405 // Callout list
406 j = sd.getCalloutList();
407 s = R"([
408 {
409 "Priority": "L",
Zane Shelley86ccc452021-11-16 13:10:52 -0600410 "Procedure": "next_level_support"
Zane Shelley96d54862021-09-17 11:16:12 -0500411 }
412])";
413 EXPECT_EQ(s, j.dump(4));
414
415 // Callout FFDC
416 j = sd.getCalloutFFDC();
417 s = R"([
418 {
419 "Callout Type": "Procedure Callout",
420 "Priority": "low",
Zane Shelley86ccc452021-11-16 13:10:52 -0600421 "Procedure": "next_level_support"
Zane Shelley96d54862021-09-17 11:16:12 -0500422 }
423])";
424 EXPECT_EQ(s, j.dump(4));
Zane Shelley0b8368c2021-03-18 17:33:41 -0500425}
Zane Shelleya4134772022-01-10 17:22:44 -0600426
427TEST(Resolution, PartCallout)
428{
429 pdbg_targets_init(nullptr);
430
431 auto c1 = std::make_shared<PartCalloutResolution>(callout::PartType::PNOR,
432 callout::Priority::MED);
433
434 libhei::Chip chip{util::pdbg::getTrgt(chip_str), 0xdeadbeef};
435 libhei::Signature sig{chip, 0xabcd, 0, 0, libhei::ATTN_TYPE_CHECKSTOP};
Zane Shelley62adf5c2022-01-18 21:06:50 -0600436 ServiceData sd{sig, AnalysisType::SYSTEM_CHECKSTOP,
437 libhei::IsolationData{}};
Zane Shelleya4134772022-01-10 17:22:44 -0600438
439 c1->resolve(sd);
440
441 nlohmann::json j{};
442 std::string s{};
443
444 // Callout list
445 j = sd.getCalloutList();
446 s = R"([
447 {
448 "Deconfigured": false,
449 "Guarded": false,
450 "LocationCode": "/bmc0",
451 "Priority": "M"
452 }
453])";
454 EXPECT_EQ(s, j.dump(4));
455
456 // Callout FFDC
457 j = sd.getCalloutFFDC();
458 s = R"([
459 {
460 "Callout Type": "Part Callout",
461 "Part Type": "PNOR",
462 "Priority": "medium"
463 }
464])";
465 EXPECT_EQ(s, j.dump(4));
466}