xref: /openbmc/openbmc-test-automation/lib/openbmc_ffdc.robot (revision 5e56f52b0d6d1cb8aa1a1424584d81a270548b21)
14346a413SGeorge Keishing*** Settings ***
269e6f711SGeorge KeishingDocumentation      This module is for data collection on test case failure
369e6f711SGeorge Keishing...                for openbmc systems. Collects data with default name
469e6f711SGeorge Keishing...                ffdc_report.txt under directory logs/testSuite/testName/
569e6f711SGeorge Keishing...                on failure.
669e6f711SGeorge Keishing...                FFDC logging sample layout:
769e6f711SGeorge Keishing...                logs
869e6f711SGeorge Keishing...                ├── 20160909102538035251_TestWarmreset
969e6f711SGeorge Keishing...                │   └── 20160909102538035251_TestWarmResetviaREST
1050070fabSGunnar Mills...                │       ├── 20160909102538035251_BMC_journalctl.txt
1150070fabSGunnar Mills...                │       ├── 20160909102538035251_BMC_proc_list.txt
1250070fabSGunnar Mills...                │       ├── 20160909102538035251_BMC_dmesg.txt
1350070fabSGunnar Mills...                │       ├── 20160909102538035251_BMC_inventory.txt
1450070fabSGunnar Mills...                │       ├── 20160909102538035251_BMC_led.txt
1550070fabSGunnar Mills...                │       ├── 20160909102538035251_BMC_record_log.txt
1650070fabSGunnar Mills...                │       ├── 20160909102538035251_BMC_sensor_list.txt
17aca140d6SGunnar Mills...                │       ├── 20160909102538035251_BMC_general.txt
1850070fabSGunnar Mills...                │       ├── 20160909102538035251_OS_dmesg.txt
1950070fabSGunnar Mills...                │       ├── 20160909102538035251_OS_msglog.txt
2050070fabSGunnar Mills...                │       ├── 20160909102538035251_OS_cpufrequency.txt
2150070fabSGunnar Mills...                │       ├── 20160909102538035251_OS_boot.txt
2250070fabSGunnar Mills...                │       ├── 20160909102538035251_OS_isusb.txt
2350070fabSGunnar Mills...                │       ├── 20160909102538035251_OS_kern.txt
2450070fabSGunnar Mills...                │       ├── 20160909102538035251_OS_authlog.txt
2550070fabSGunnar Mills...                │       ├── 20160909102538035251_OS_syslog.txt
2650070fabSGunnar Mills...                │       ├── 20160909102538035251_OS_info.txt
2750070fabSGunnar Mills...                │       ├── 20160909102538035251_OS_rsct.txt
2892e7b13fSSweta Potthuri...                │       ├── 20160909102538035251_OS_secure.txt
2992e7b13fSSweta Potthuri...                │       └── 20160909102538035251_OS_esel
3069e6f711SGeorge Keishing...                └── test_history.txt
314346a413SGeorge Keishing
3269e6f711SGeorge KeishingResource           openbmc_ffdc_methods.robot
3369e6f711SGeorge KeishingResource           openbmc_ffdc_utils.robot
346a6e76dfSGeorge KeishingResource           dump_utils.robot
35769c2a1bSMichael WalshLibrary            openbmc_ffdc.py
36*5e56f52bSPeter D  PhanLibrary            ffdc_cli_robot_script.py
374346a413SGeorge Keishing
384346a413SGeorge Keishing*** Keywords ***
394346a413SGeorge Keishing
40eac1af2bSGunnar MillsFFDC On Test Case Fail
414346a413SGeorge Keishing    [Documentation]   Generic FFDC entry point. Place holder to hook in
4269e6f711SGeorge Keishing    ...               other data collection methods
4309439a25SRahul Maheshwari    ...               1. Collect Logs if test fails or host reaches quiesced
4409439a25SRahul Maheshwari    ...                  state.
456a6e76dfSGeorge Keishing    ...               2. Added test execution history logging.
4669e6f711SGeorge Keishing    ...                  By default this will log Test status PASS/FAIL format
4769e6f711SGeorge Keishing    ...                  EX: 20160822041250932049:Test:Test case 1:PASS
4869e6f711SGeorge Keishing    ...                      20160822041250969913:Test:Test case 2:FAIL
496a6e76dfSGeorge Keishing    ...               3. Delete error logs and BMC dumps post FFDC collection.
504346a413SGeorge Keishing
517f0dd251SGeorge Keishing    ${OVERRIDE_FFDC_ON_TEST_CASE_FAIL}=  Get Environment Variable  OVERRIDE_FFDC_ON_TEST_CASE_FAIL  0
52fa84c8f0SMichael Walsh    ${OVERRIDE_FFDC_ON_TEST_CASE_FAIL}=  Convert To Integer  ${OVERRIDE_FFDC_ON_TEST_CASE_FAIL}
537f0dd251SGeorge Keishing    Return From Keyword If  ${OVERRIDE_FFDC_ON_TEST_CASE_FAIL}
54fa84c8f0SMichael Walsh
55*5e56f52bSPeter D  Phan    Run Keyword If  '${TEST_STATUS}' == 'FAIL'  Launch FFDC
5669e6f711SGeorge Keishing
5769e6f711SGeorge Keishing    Log Test Case Status
58*5e56f52bSPeter D  Phan
59*5e56f52bSPeter D  Phan
60*5e56f52bSPeter D  PhanLaunch FFDC
61*5e56f52bSPeter D  Phan    [Documentation]  Call point to call FFDC robot or FFDC script.
62*5e56f52bSPeter D  Phan    ...              FFDC_DEFAULT set to 1, by default, in resource.robot
63*5e56f52bSPeter D  Phan    ...              FFDC_DEFAULT:1  use legacy ffdc collector
64*5e56f52bSPeter D  Phan    ...              FFDC_DEFAULT:0  use new ffdc collector.
65*5e56f52bSPeter D  Phan
66*5e56f52bSPeter D  Phan    Run Keyword If  ${FFDC_DEFAULT} == ${1}  FFDC    # Keyword from openbmc_ffdc.py
67*5e56f52bSPeter D  Phan    ...    ELSE  ffdc_robot_script_cli               # Keyword from ffdc_cli_robot_script.py
68*5e56f52bSPeter D  Phan
69