summaryrefslogtreecommitdiffstats
path: root/src/usr/errl/test/errlReportTest.H
blob: 1e22d64198a81ae03b7401cf05ec664869bbc4f5 (plain)
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
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
/* IBM_PROLOG_BEGIN_TAG                                                   */
/* This is an automatically generated prolog.                             */
/*                                                                        */
/* $Source: src/usr/errl/test/errlReportTest.H $                          */
/*                                                                        */
/* IBM CONFIDENTIAL                                                       */
/*                                                                        */
/* COPYRIGHT International Business Machines Corp. 2011,2013              */
/*                                                                        */
/* 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 otherwise         */
/* divested of its trade secrets, irrespective of what has been           */
/* deposited with the U.S. Copyright Office.                              */
/*                                                                        */
/* Origin: 30                                                             */
/*                                                                        */
/* IBM_PROLOG_END_TAG                                                     */
#ifndef __ERRLREPORTTEST_H
#define __ERRLREPORTTEST_H

/**
 *  @file errlReportTest.H
 *
 *  @brief Test case for Error Logging Reporting
*/

#include <cxxtest/TestSuite.H>
#include <errl/errlmanager.H>
#include <errl/errlentry.H>
#include <errl/errlreasoncodes.H>
#include <trace/trace.H>
#include <hbotcompid.H>
#include <errl/errludtarget.H>
#include <targeting/common/target.H>
#include <targeting/common/iterators/rangefilter.H>
#include <targeting/common/predicates/predicates.H>
#include <hwas/common/hwasCallout.H>
#include <kernel/syscalls.H>
#include <sys/time.h>


class ErrlReportTest: public CxxTest::TestSuite
{
public:

    /**
     * @brief Send a small size error log to FSP
     *  - Create an error log with only 192 bytes
     *  - Verify that hostbot created error log and sent it to FSP
     *  - Found an issue with FSI mailbox DMA code to realign data len
     *  - The problem should be fixed in Feature 855338 (fips810)
     */

    void testErrlReport1(void)
    {
        errlHndl_t l_err = NULL;
        uint64_t l_userData1 = 0xDEADBEEF;
        uint64_t l_userData2 = 0xDEADBEEF;

        TS_TRACE( "test testErrlReport1");
        do
        {
            // Create an error log
            l_err = new ERRORLOG::ErrlEntry(
                                    ERRORLOG::ERRL_SEV_INFORMATIONAL,
                                    ERRORLOG::ERRL_TEST_MOD_ID,
                                    ERRORLOG::ERRL_TEST_REASON_CODE,
                                    l_userData1,
                                    l_userData2);
            if (l_err == NULL)
            {
                TS_FAIL("testErrlReport1: createErrlLog() failed.");
                break;
            }

            // Commit error log.
            errlCommit(l_err, CXXTEST_COMP_ID);

        } while(0);
    }


    /**
     * @brief Send multiple error logs back to back to FSP
     *  - Create several error logs and send them to FSP in a loop.
     *  - Verify that error logs are created and sent to FSP
     *  - Verify that FSP received all the error logs and log them properly.
     */
    void testErrlReport2( void )
    {
        errlHndl_t l_err = NULL;
        uint32_t l_loopi = 0 ;

        TS_TRACE( "test testErrlReport2");

        do
        {
            for (l_loopi = 0; l_loopi < 5; l_loopi++)
            {

                 // Create an error log
                 l_err = new ERRORLOG::ErrlEntry(
                                    ERRORLOG::ERRL_SEV_INFORMATIONAL,
                                    ERRORLOG::ERRL_TEST_MOD_ID,
                                    ERRORLOG::ERRL_TEST_REASON_CODE,
                                    l_loopi,
                                    l_loopi);
                 if (l_err == NULL)
                 {
                     TS_FAIL("testErrlReport2: createErrlLog() failed.");
                     break;
                 }

                 // Commit error log
                 errlCommit(l_err, CXXTEST_COMP_ID);
           }
        } while(0);
    }



    /**
     * @brief Send an unrecoverable error log to FSP
     *  - Verify that an error log with severity unrecoverable created successfully
     *  - Verify that the error log is sent to FSP
     *  - Verify that FSP log the error as unrecoverable one.
     *
     */

    void testErrlReport3(void)
    {
        errlHndl_t l_err = NULL;
        uint64_t l_userData1 = 0xEEEEEEEE;
        uint64_t l_userData2 = 0xEEEEEEEE;

        TS_TRACE( "test testErrlReport3");
        do
        {
            // Create an error log
            l_err = new ERRORLOG::ErrlEntry(
                                    ERRORLOG::ERRL_SEV_UNRECOVERABLE,
                                    ERRORLOG::ERRL_TEST_MOD_ID,
                                    ERRORLOG::ERRL_TEST_REASON_CODE,
                                    l_userData1,
                                    l_userData2);
            if (l_err == NULL)
            {
                TS_FAIL("testErrlReport3: createErrlLog() failed");
                break;
            }

            // Commit error log.
            errlCommit(l_err, CXXTEST_COMP_ID);
        } while(0);
    }


    /**
     * @brief Send a critical system terminate error log from Hostboot to FSP
     *  - Verify that hostbot errorlog is sent to FSP.
     *  - Verify that FSP logged the error as critical system terminate one.
     *
     */

    void testErrlReport4(void)
    {
        errlHndl_t l_err = NULL;
        uint64_t l_userData1 = 0xAAAAAAAA;
        uint64_t l_userData2 = 0xBBBBBBBB;

        TS_TRACE( "test testErrlReport4");
        do
        {
            // Create an error log
            l_err = new ERRORLOG::ErrlEntry(
                                    ERRORLOG::ERRL_SEV_CRITICAL_SYS_TERM,
                                    ERRORLOG::ERRL_TEST_MOD_ID,
                                    ERRORLOG::ERRL_TEST_REASON_CODE,
                                    l_userData1,
                                    l_userData2);
            if (l_err == NULL)
            {
                TS_FAIL("testErrlReport4: createErrlLog() failed.");
                break;
            }

            // Commit error log.
            errlCommit(l_err, CXXTEST_COMP_ID);
        } while(0);
    }

    /**
     * @brief Send a big size error log to FSP
     *  - Verfiy that an error log with ffdc and traces is created successfully
     *  - Verify that the error log is sent to FSP
     *  - Verify that FSP logged the error with correct data successfully
     */
    void testErrlReport5(void)
    {
        bool l_rc;
        ERRORLOG::ErrlUD * pffdc;
        uint64_t l_userData1 = 0xFFFFFFFF;
        uint64_t l_userData2 = 0xFFFFFFFF;

        TS_TRACE( "test testErrlReport5");
        do
        {
            // Create an error log
            errlHndl_t l_err = new ERRORLOG::ErrlEntry(
                                    ERRORLOG::ERRL_SEV_UNRECOVERABLE,
                                    ERRORLOG::ERRL_TEST_MOD_ID,
                                    ERRORLOG::ERRL_TEST_REASON_CODE,
                                    l_userData1,
                                    l_userData2);


            // Make sure log is created
            if (l_err == NULL)
            {
                TS_FAIL("testErrlReport5: createErrlLog() failed");
                break;
            }

            // add FFDC
            const char * l_str = "Error log report testing.";
            pffdc = l_err->addFFDC( DEVFW_COMP_ID, l_str, strlen( l_str ), 0, 0);
            if ( NULL == pffdc )
            {
                TS_FAIL("testErrlReport5: addFFDC() failed");
                break;
            }

            // Collect traces
            l_rc = l_err->collectTrace(  "XSCOM" , 0x7D0 );
            if( !l_rc )
            {
                TS_FAIL( "testErrlReport5: collectTrace(XSCOM) returns false." );
                break;
            }

            l_rc = l_err->collectTrace(  "TARG" , 4003 );
            if( !l_rc )
            {
                TS_FAIL( "testErrlReport5: collectTrace(TARG,4003) returns false" );
                break;
            }

            // Add null data.
            pffdc = l_err->addFFDC( ERRL_COMP_ID, NULL, 0,  9, 10 );
            if ( NULL != pffdc )
            {
                TS_FAIL(" addFFDC() returned non null");
                break;
            }

            // Commit error log.
            errlCommit(l_err, CXXTEST_COMP_ID);

        } while(0);
    }

};

#endif
OpenPOWER on IntegriCloud