xref: /openbmc/openbmc-test-automation/lib/openbmc_ffdc.robot (revision c4d3dc0b5cd44a68a8e2d99f7c06be1f02157640)
1*** Settings ***
2Documentation      This module is for data collection on test case failure
3...                for openbmc systems. Collects data with default name
4...                ffdc_report.txt under directory logs/testSuite/testName/
5...                on failure.
6...                FFDC logging sample layout:
7...                logs
8...                ├── 20160909102538035251_TestWarmreset
9...                │   └── 20160909102538035251_TestWarmResetviaREST
10...                │       ├── 20160909102538035251_BMC_journalctl.log
11...                │       ├── 20160909102538035251_BMC_proc_list
12...                │       └── 20160909102538035251_ffdc_report.txt
13...                └── test_history.txt
14
15Resource           openbmc_ffdc_methods.robot
16Resource           openbmc_ffdc_utils.robot
17
18*** Keywords ***
19
20Log FFDC
21    [Documentation]   Generic FFDC entry point. Place holder to hook in
22    ...               other data collection methods
23    ...               1. Collect Logs if test fails
24    ...               2. Added Test execution history logging
25    ...                  By default this will log Test status PASS/FAIL format
26    ...                  EX: 20160822041250932049:Test:Test case 1:PASS
27    ...                      20160822041250969913:Test:Test case 2:FAIL
28
29    Run Keyword If  '${TEST_STATUS}' == 'FAIL'
30    ...    Log FFDC If Test Case Failed
31
32    Log Test Case Status
33
34
35Log FFDC If Test Case Failed
36    [Documentation]   Main entry point to gather logs on Test case failure
37    ...               1. Set global FFDC time reference for a failure
38    ...               2. Create FFDC work space directory
39    ...               3. Write test info details
40    ...               4. Calls BMC methods to write/collect FFDC data
41
42    ${cur_time}=      Get Current Time Stamp
43    Set Global Variable    ${FFDC_TIME}     ${cur_time}
44    Log To Console    ${\n}FFDC Collection Started \t: ${cur_time}
45
46    # Log directory setup
47    ${suitename}   ${testname}=    Get Test Dir and Name
48
49    Set Global Variable
50    ...   ${FFDC_DIR_PATH}  ${FFDC_LOG_PATH}${suitename}${/}${testname}
51
52    ${prefix}=   Catenate  SEPARATOR=   ${FFDC_DIR_PATH}${/}   ${FFDC_TIME}_
53    Set Global Variable    ${LOG_PREFIX}    ${prefix}
54
55    Create FFDC Directory
56    Header Message
57
58    # -- FFDC processing entry point --
59    Call FFDC Methods
60
61    ${cur_time}=       Get Current Time Stamp
62    Log To Console     FFDC Collection Completed \t: ${cur_time}
63    Log                ${\n}${FFDC_DIR_PATH}
64