George Keishing | 69e6f71 | 2016-09-12 06:30:09 -0500 | [diff] [blame] | 1 | *** Settings *** |
| 2 | Documentation Utility keywords for FFDC |
| 3 | |
| 4 | Library String |
| 5 | Library DateTime |
| 6 | Library openbmc_ffdc_list.py |
| 7 | Resource resource.txt |
| 8 | Resource connection_client.robot |
| 9 | |
| 10 | *** Variables *** |
| 11 | |
| 12 | ${PRINT_LINE} ------------------------------------------------------------------------ |
| 13 | |
| 14 | ${MSG_INTRO} This report contains the following information: |
| 15 | ${MSG_DETAIL} ${\n}\t\t[ Detailed Logs Captured Section ] |
| 16 | ${HEADER_MSG} ${\n}\t\t--------------------------- |
| 17 | ... ${\n}\t\t FIRST FAILURE DATA CAPTURE |
| 18 | ... ${\n}\t\t--------------------------- |
| 19 | ${FOOTER_MSG} ${\n}${PRINT_LINE} ${\n} |
| 20 | |
| 21 | ${FFDC_LOG_PATH} ${EXECDIR}${/}logs${/} |
| 22 | ${TEST_HISTORY} ${FFDC_LOG_PATH}${/}test_history.txt |
| 23 | |
| 24 | *** Keywords *** |
| 25 | |
| 26 | Get Test Dir and Name |
| 27 | [Documentation] SUITE_NAME and TEST_NAME are automatic variables |
| 28 | ... and is populated dynamically by the robot framework |
Gunnar Mills | bb398ac | 2016-11-14 11:50:22 -0600 | [diff] [blame] | 29 | ... during execution |
George Keishing | 69e6f71 | 2016-09-12 06:30:09 -0500 | [diff] [blame] | 30 | ${suite_name}= Get strip string ${SUITE_NAME} |
| 31 | ${suite_name}= Catenate SEPARATOR= ${FFDC_TIME}_ ${suite_name} |
| 32 | ${test_name}= Get strip string ${TEST_NAME} |
| 33 | ${test_name}= Catenate SEPARATOR= ${FFDC_TIME}_ ${test_name} |
Gunnar Mills | c9ea936 | 2016-12-13 16:21:13 -0600 | [diff] [blame] | 34 | [Return] ${suite_name} ${test_name} |
George Keishing | 69e6f71 | 2016-09-12 06:30:09 -0500 | [diff] [blame] | 35 | |
| 36 | |
| 37 | Create FFDC Directory |
| 38 | [Documentation] Creates directory and report file |
| 39 | Create Directory ${FFDC_DIR_PATH} |
| 40 | Create FFDC Report File |
| 41 | |
| 42 | |
| 43 | Create FFDC Report File |
| 44 | [Documentation] Create a generic file name for ffdc |
| 45 | Set Suite Variable |
Gunnar Mills | aca140d | 2016-10-26 13:05:10 -0500 | [diff] [blame] | 46 | ... ${FFDC_FILE_PATH} ${FFDC_DIR_PATH}${/}${FFDC_TIME}_BMC_general.txt |
George Keishing | 69e6f71 | 2016-09-12 06:30:09 -0500 | [diff] [blame] | 47 | Create File ${FFDC_FILE_PATH} |
| 48 | |
| 49 | |
| 50 | Write Data to File |
| 51 | [Documentation] Write data to the ffdc report document |
| 52 | [Arguments] ${data}= ${filepath}=${FFDC_FILE_PATH} |
| 53 | Append To File ${filepath} ${data} |
| 54 | |
| 55 | |
| 56 | Get Current Time Stamp |
| 57 | [Documentation] Get the current time stamp data |
| 58 | ${cur_time}= Get Current Date result_format=%Y-%m-%d %H:%M:%S:%f |
| 59 | ${cur_time}= Get strip string ${cur_time} |
Gunnar Mills | c9ea936 | 2016-12-13 16:21:13 -0600 | [diff] [blame] | 60 | [Return] ${cur_time} |
George Keishing | 69e6f71 | 2016-09-12 06:30:09 -0500 | [diff] [blame] | 61 | |
| 62 | |
| 63 | Header Message |
| 64 | [Documentation] Write header message to the report document manifest. |
| 65 | ... TEST_NAME, TEST_MESSAGE,SUITE_SOURCE,TEST_DOCUMENTATION |
| 66 | ... are auto variables and are populated dynamically by the |
Gunnar Mills | bb398ac | 2016-11-14 11:50:22 -0600 | [diff] [blame] | 67 | ... robot framework during execution |
George Keishing | 69e6f71 | 2016-09-12 06:30:09 -0500 | [diff] [blame] | 68 | ... 1. Writes opening statement headers msg |
| 69 | ... 2. Add Test setup and config information |
| 70 | ... 3. Types of data collection |
| 71 | |
| 72 | Write Data to File ${HEADER_MSG} |
| 73 | Write Data to File ${FOOTER_MSG} |
| 74 | Write Data to File Test Suite File\t\t: ${SUITE_NAME} ${\n} |
| 75 | Write Data to File Test Case Name\t\t: ${TEST_NAME}${\n} |
| 76 | Write Data to File Test Source File\t: ${SUITE_SOURCE}${\n} |
| 77 | Write Data to File Failure Time Stamp\t: ${FFDC_TIME}${\n} |
| 78 | Write Data to File Test Error Message\t: ${TEST_MESSAGE}${\n} |
| 79 | Write Data to File Test Documentation\t:${\n}${TEST_DOCUMENTATION}${\n} |
| 80 | Write Data to File ${FOOTER_MSG} |
| 81 | |
| 82 | Test Setup Info |
| 83 | |
| 84 | Write Data to File ${\n}${MSG_INTRO}${\n} |
| 85 | |
| 86 | # --- FFDC header notes --- |
| 87 | @{entries}= Get ffdc cmd index |
| 88 | :FOR ${index} IN @{entries} |
| 89 | \ Write Data to File * ${index.upper()} |
| 90 | \ Write Data to File ${\n} |
| 91 | |
| 92 | Write Data to File ${MSG_DETAIL} |
| 93 | |
| 94 | |
| 95 | Write Cmd Output to FFDC File |
| 96 | [Documentation] Write cmd output data to the report document |
| 97 | [Arguments] ${name_str} ${cmd} |
| 98 | |
| 99 | Write Data to File ${FOOTER_MSG} |
| 100 | Write Data to File ${ENTRY_INDEX.upper()} : ${name_str}\t |
| 101 | Write Data to File Executed : ${cmd} |
| 102 | Write Data to File ${FOOTER_MSG} |
| 103 | |
| 104 | |
| 105 | Test Setup Info |
Gunnar Mills | bb398ac | 2016-11-14 11:50:22 -0600 | [diff] [blame] | 106 | [Documentation] BMC IP, Model and other information |
George Keishing | 69e6f71 | 2016-09-12 06:30:09 -0500 | [diff] [blame] | 107 | |
Gunnar Mills | bb398ac | 2016-11-14 11:50:22 -0600 | [diff] [blame] | 108 | Write Data to File ${\n}-----------------------${\n} |
George Keishing | 69e6f71 | 2016-09-12 06:30:09 -0500 | [diff] [blame] | 109 | Write Data to File Test Setup Information: |
Gunnar Mills | bb398ac | 2016-11-14 11:50:22 -0600 | [diff] [blame] | 110 | Write Data to File ${\n}-----------------------${\n} |
George Keishing | 69e6f71 | 2016-09-12 06:30:09 -0500 | [diff] [blame] | 111 | Write Data to File OPENBMC HOST \t: ${OPENBMC_HOST}${\n} |
Gunnar Mills | bb398ac | 2016-11-14 11:50:22 -0600 | [diff] [blame] | 112 | Write Data to File |
George Keishing | 69e6f71 | 2016-09-12 06:30:09 -0500 | [diff] [blame] | 113 | ... SYSTEM TYPE \t: ${OPENBMC_MODEL.replace('./data/','').replace('.py','')}${\n}${\n} |