1 #include <stdio.h> 2 3 #include <analyzer/analyzer_main.hpp> 4 #include <analyzer/plugins/plugin.hpp> 5 #include <analyzer/ras-data/ras-data-parser.hpp> 6 #include <hei_util.hpp> 7 #include <util/pdbg.hpp> 8 #include <util/trace.hpp> 9 10 #include "gtest/gtest.h" 11 12 namespace analyzer 13 { 14 // Forward reference of filterRootCause 15 bool filterRootCause(AnalysisType i_type, 16 const libhei::IsolationData& i_isoData, 17 libhei::Signature& o_rootCause, 18 const RasDataParser& i_rasData); 19 } // namespace analyzer 20 21 using namespace analyzer; 22 23 static const auto eqCoreFir = static_cast<libhei::NodeId_t>( 24 libhei::hash<libhei::NodeId_t>("EQ_CORE_FIR")); 25 26 static const auto rdfFir = 27 static_cast<libhei::NodeId_t>(libhei::hash<libhei::NodeId_t>("RDFFIR")); 28 29 TEST(RootCauseFilter, Filter1) 30 { 31 pdbg_targets_init(nullptr); 32 33 // Checkstop signature on the proc 34 auto proc0 = util::pdbg::getTrgt("/proc0"); 35 libhei::Chip procChip0{proc0, P10_20}; 36 37 // EQ_CORE_FIR[14]: ME = 0 checkstop 38 libhei::Signature checkstopSig{procChip0, eqCoreFir, 0, 14, 39 libhei::ATTN_TYPE_CHECKSTOP}; 40 41 // Root cause signature on the ocmb 42 auto ocmb0 = 43 util::pdbg::getTrgt("proc0/pib/perv12/mc0/mi0/mcc0/omi0/ocmb0"); 44 libhei::Chip ocmbChip0{ocmb0, EXPLORER_20}; 45 46 // RDFFIR[14]: Mainline read UE 47 libhei::Signature ueSig{ocmbChip0, rdfFir, 0, 14, 48 libhei::ATTN_TYPE_RECOVERABLE}; 49 50 // Add the signatures to the isolation data 51 libhei::IsolationData isoData{}; 52 isoData.addSignature(checkstopSig); 53 isoData.addSignature(ueSig); 54 55 RasDataParser rasData{}; 56 libhei::Signature rootCause; 57 bool attnFound = filterRootCause(AnalysisType::SYSTEM_CHECKSTOP, isoData, 58 rootCause, rasData); 59 EXPECT_TRUE(attnFound); 60 EXPECT_EQ(ueSig.toUint32(), rootCause.toUint32()); 61 } 62