blob: 99ecc2823fbadd3a6048aa78b9315131927a3e3f [file] [log] [blame]
Zane Shelleyd195b712022-01-26 13:26:34 -06001#include <stdio.h>
2
3#include <analyzer/plugins/plugin.hpp>
4#include <hei_util.hpp>
5#include <util/pdbg.hpp>
6#include <util/trace.hpp>
7
8#include "gtest/gtest.h"
9
10using namespace analyzer;
11
12static const auto nodeId =
13 static_cast<libhei::NodeId_t>(libhei::hash<libhei::NodeId_t>("TOD_ERROR"));
14
15TEST(TodStepCheckFault, TestSet1)
16{
17 pdbg_targets_init(nullptr);
18
19 libhei::Chip chip1{util::pdbg::getTrgt("/proc1"), P10_20};
20
21 // TOD_ERROR(0)[16]
22 libhei::Signature sig{chip1, nodeId, 0, 16, libhei::ATTN_TYPE_CHECKSTOP};
23
24 auto plugin =
25 PluginMap::getSingleton().get(chip1.getType(), "tod_step_check_fault");
26
27 libhei::IsolationData isoData{};
28 isoData.addSignature(sig);
29 ServiceData sd{sig, AnalysisType::SYSTEM_CHECKSTOP, isoData};
30
31 // Call the plugin.
32 plugin(1, chip1, 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,
Zane Shelley3f363d42022-02-10 16:20:37 -060042 "EntityPath": [],
43 "GuardType": "GARD_Unrecoverable",
44 "Guarded": true,
Zane Shelleyd195b712022-01-26 13:26:34 -060045 "LocationCode": "/proc1",
46 "Priority": "M"
47 }
48])";
49 EXPECT_EQ(s, j.dump(4));
50
51 // Callout FFDC
52 j = sd.getCalloutFFDC();
53 s = R"([
54 {
Zane Shelleyd195b712022-01-26 13:26:34 -060055 "Callout Type": "Hardware Callout",
Zane Shelley3f363d42022-02-10 16:20:37 -060056 "Guard": true,
Zane Shelleyd195b712022-01-26 13:26:34 -060057 "Priority": "medium",
58 "Target": "/proc1"
59 }
60])";
61 EXPECT_EQ(s, j.dump(4));
62}