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 |
| 29 | ... during execution |
| 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} |
| 34 | [return] ${suite_name} ${test_name} |
| 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 |
| 46 | ... ${FFDC_FILE_PATH} ${FFDC_DIR_PATH}${/}${FFDC_TIME}_ffdc_report.txt |
| 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} |
| 60 | [return] ${cur_time} |
| 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 |
| 67 | ... robot framework during execution |
| 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 |
| 106 | [Documentation] BMC IP, Model and other information |
| 107 | |
| 108 | Write Data to File ${\n}-----------------------${\n} |
| 109 | Write Data to File Test Setup Information: |
| 110 | Write Data to File ${\n}-----------------------${\n} |
| 111 | Write Data to File OPENBMC HOST \t: ${OPENBMC_HOST}${\n} |
| 112 | Write Data to File |
| 113 | ... SYSTEM TYPE \t: ${OPENBMC_MODEL.replace('./data/','').replace('.py','')}${\n}${\n} |