diff options
author | Stewart Smith <stewart@linux.vnet.ibm.com> | 2014-12-19 14:26:38 +1100 |
---|---|---|
committer | Stewart Smith <stewart@linux.vnet.ibm.com> | 2014-12-19 14:26:38 +1100 |
commit | 41b9ec15d028592eadd283ddd5d955cfa0d20e7f (patch) | |
tree | 581d0bb7529ad419e1558fc3a199e37981238e4e | |
parent | d93c709f7dcba03aedc55f740098a6a32cef473d (diff) | |
download | skiboot-41b9ec15d028592eadd283ddd5d955cfa0d20e7f.zip skiboot-41b9ec15d028592eadd283ddd5d955cfa0d20e7f.tar.gz skiboot-41b9ec15d028592eadd283ddd5d955cfa0d20e7f.tar.bz2 |
Add another pel test to test user section
This increases our code coverage of pel.c from 81.3% to 98.7%
Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com>
-rw-r--r-- | core/test/run-pel.c | 33 |
1 files changed, 33 insertions, 0 deletions
diff --git a/core/test/run-pel.c b/core/test/run-pel.c index 7087d64..68fedfa 100644 --- a/core/test/run-pel.c +++ b/core/test/run-pel.c @@ -57,6 +57,8 @@ int main(void) size_t size; struct errorlog *elog; struct opal_err_info *opal_err_info = &err_TEST_ERROR; + char *buffer; + struct elog_user_data_section *tmp; elog = malloc(sizeof(struct errorlog)); pel_buf = malloc(PEL_MIN_SIZE + 4); @@ -81,5 +83,36 @@ int main(void) assert(size <= PEL_MIN_SIZE + 4); assert(size == create_pel_log(elog, pel_buf, size)); + memset(elog, 0, sizeof(struct errorlog)); + + elog->error_event_type = opal_err_info->err_type; + elog->component_id = opal_err_info->cmp_id; + elog->subsystem_id = opal_err_info->subsystem; + elog->event_severity = opal_err_info->sev; + elog->event_subtype = opal_err_info->event_subtype; + elog->reason_code = opal_err_info->reason_code; + elog->elog_origin = ORG_SAPPHIRE; + + size = pel_size(elog); + pel_buf = realloc(pel_buf, size); + assert(pel_buf); + + buffer = elog->user_data_dump + elog->user_section_size; + tmp = (struct elog_user_data_section *)buffer; + tmp->tag = 0x44455343; /* ASCII of DESC */ + tmp->size = size + sizeof(struct elog_user_data_section) - 1; + strcpy(tmp->data_dump, "Hello World!"); + elog->user_section_size += tmp->size; + elog->user_section_count++; + + size = pel_size(elog); + pel_buf = realloc(pel_buf, size); + assert(pel_buf); + + assert(size == create_pel_log(elog, pel_buf, size)); + + free(pel_buf); + free(elog); + return 0; } |