1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
|
// IBM_PROLOG_BEGIN_TAG
// This is an automatically generated prolog.
//
// $Source: src/usr/hwpf/test/hwpftest.H $
//
// IBM CONFIDENTIAL
//
// COPYRIGHT International Business Machines Corp. 2011
//
// p1
//
// Object Code Only (OCO) source materials
// Licensed Internal Code Source Materials
// IBM HostBoot Licensed Internal Code
//
// The source code for this program is not published or other-
// wise divested of its trade secrets, irrespective of what has
// been deposited with the U.S. Copyright Office.
//
// Origin: 30
//
// IBM_PROLOG_END
#ifndef __HWPFTEST_H
#define __HWPFTEST_H
/**
* @file hwpftest.H
*
* @brief Test case for HWPF implementation
*/
#include <cxxtest/TestSuite.H>
#include <fapi.H>
#include <fapiPlatHwpInvoker.H>
#include <errl/errlentry.H>
#include <errl/errlmanager.H>
#include <targeting/targetservice.H>
using namespace fapi;
using namespace TARGETING;
class HwpfTest: public CxxTest::TestSuite
{
public:
/**
* @brief Test HWPF trace
*/
void testHwpf1()
{
// Trace into all the FAPI trace buffers
uint32_t l_val = 4;
const char * l_pStr = "test-str";
FAPI_INF("Test INF Trace");
FAPI_INF("Test INF Trace. hex: 0x%x", l_val);
FAPI_INF("Test INF Trace. string: %s", l_pStr);
FAPI_INF("Test INF Trace. 0x%x, %s", l_val, l_pStr);
FAPI_IMP("Test IMP Trace");
FAPI_IMP("Test IMP Trace. hex: 0x%x", l_val);
FAPI_IMP("Test IMP Trace. string: %s", l_pStr);
FAPI_IMP("Test IMP Trace. 0x%x, %s", l_val, l_pStr);
FAPI_ERR("Test ERR Trace");
FAPI_ERR("Test ERR Trace. hex: 0x%x", l_val);
FAPI_ERR("Test ERR Trace. string: %s", l_pStr);
FAPI_ERR("Test ERR Trace. 0x%x, %s", l_val, l_pStr);
FAPI_DBG("Test DBG Trace");
FAPI_DBG("Test DBG Trace. hex: 0x%x", l_val);
FAPI_DBG("Test DBG Trace. string: %s", l_pStr);
FAPI_DBG("Test DBG Trace. 0x%x, %s", l_val, l_pStr);
return;
}
/**
* @brief Test HWPF: call a test procedure
*/
void testHwpf2()
{
// Call a test hardware procedure
errlHndl_t l_err = NULL;
// Set processor chip to the master
TARGETING::Target* l_testTarget = MASTER_PROCESSOR_CHIP_TARGET_SENTINEL;
// Call the test hardware procedure
l_err = invokeHwpInitialTest(l_testTarget);
if (l_err)
{
TS_FAIL("testHwpf2: Unit Test failed. invokeHwpInitialTest failed. Error logged");
// Commit/delete error
errlCommit(l_err);
}
else
{
TS_TRACE("testHwpf2: Unit test passed! invokeHwpInitialTest");
}
}
/**
* @brief Test HWPF: call a test procedure that generates an error
*/
void testHwpf3()
{
// Call a test hardware procedure
errlHndl_t l_err = NULL;
// Set processor chip to the master
TARGETING::Target* l_testTarget = MASTER_PROCESSOR_CHIP_TARGET_SENTINEL;
// Call the procedure that generates an error to test out error handling
l_err = invokeHwpTestError(l_testTarget);
if (l_err)
{
TS_TRACE("testHwpf3: Unit Test passed. invokeHwpTestError failed. Error logged");
// Commit/delete error
errlCommit(l_err);
}
else
{
TS_FAIL("testHwpf3: Unit Test failed. invokeHwpTestError passed. Error logged");
}
}
};
#endif
|