xref: /openbmc/openbmc-test-automation/lib/openbmc_ffdc.robot (revision 7916eb3fd577eedd3ef934e45bf8b557197c9907)
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.txt
11...                │       ├── 20160909102538035251_BMC_proc_list.txt
12...                │       ├── 20160909102538035251_BMC_dmesg.txt
13...                │       ├── 20160909102538035251_BMC_inventory.txt
14...                │       ├── 20160909102538035251_BMC_led.txt
15...                │       ├── 20160909102538035251_BMC_record_log.txt
16...                │       ├── 20160909102538035251_BMC_sensor_list.txt
17...                │       ├── 20160909102538035251_BMC_general.txt
18...                │       ├── 20160909102538035251_OS_dmesg.txt
19...                │       ├── 20160909102538035251_OS_msglog.txt
20...                │       ├── 20160909102538035251_OS_cpufrequency.txt
21...                │       ├── 20160909102538035251_OS_boot.txt
22...                │       ├── 20160909102538035251_OS_isusb.txt
23...                │       ├── 20160909102538035251_OS_kern.txt
24...                │       ├── 20160909102538035251_OS_authlog.txt
25...                │       ├── 20160909102538035251_OS_syslog.txt
26...                │       ├── 20160909102538035251_OS_info.txt
27...                │       ├── 20160909102538035251_OS_rsct.txt
28...                │       ├── 20160909102538035251_OS_secure.txt
29...                │       └── 20160909102538035251_OS_esel
30...                └── test_history.txt
31
32Resource           openbmc_ffdc_methods.robot
33Resource           openbmc_ffdc_utils.robot
34Resource           dump_utils.robot
35Library            openbmc_ffdc.py
36# TODO:
37# telnetlib is remove in Python3.13 version.
38#Library            ffdc_cli_robot_script.py
39
40*** Keywords ***
41
42FFDC On Test Case Fail
43    [Documentation]   Generic FFDC entry point. Place holder to hook in
44    ...               other data collection methods
45    ...               1. Collect Logs if test fails or host reaches quiesced
46    ...                  state.
47    ...               2. Added test execution history logging.
48    ...                  By default this will log Test status PASS/FAIL format
49    ...                  EX: 20160822041250932049:Test:Test case 1:PASS
50    ...                      20160822041250969913:Test:Test case 2:FAIL
51    ...               3. Delete error logs and BMC dumps post FFDC collection.
52
53    ${OVERRIDE_FFDC_ON_TEST_CASE_FAIL}=  Get Environment Variable  OVERRIDE_FFDC_ON_TEST_CASE_FAIL  0
54    ${OVERRIDE_FFDC_ON_TEST_CASE_FAIL}=  Convert To Integer  ${OVERRIDE_FFDC_ON_TEST_CASE_FAIL}
55    Return From Keyword If  ${OVERRIDE_FFDC_ON_TEST_CASE_FAIL}
56
57    Run Keyword If  '${TEST_STATUS}' == 'FAIL'  Launch FFDC
58
59    Log Test Case Status
60
61
62Launch FFDC
63    [Documentation]  Call point to call FFDC robot or FFDC script.
64    ...              FFDC_DEFAULT set to 1, by default, in resource.robot
65    ...              FFDC_DEFAULT:1  use legacy ffdc collector
66    ...              FFDC_DEFAULT:0  use new ffdc collector.
67
68    Run Keyword If  ${FFDC_DEFAULT} == ${1}  FFDC    # Keyword from openbmc_ffdc.py
69
70    # TODO:  Python 3.13 compatibility changes needed
71    # ...    ELSE  ffdc_robot_script_cli               # Keyword from ffdc_cli_robot_script.py
72
73