diff mbox series

[v2,10/10] run-pel: Add additional tests with FRU callout section.

Message ID 160207259450.2097386.8481830435250442056.stgit@jupiter
State New
Headers show
Series Add support to report EEH errors to BMC/FSP (eSEL) | expand

Checks

Context Check Description
snowpatch_ozlabs/apply_patch success Successfully applied on branch master (f901fcafae14d38e29f1cc11440086ee678785d0)
snowpatch_ozlabs/snowpatch_job_snowpatch-skiboot success Test snowpatch/job/snowpatch-skiboot on branch master
snowpatch_ozlabs/snowpatch_job_snowpatch-skiboot-dco success Signed-off-by present

Commit Message

Mahesh J Salgaonkar Oct. 7, 2020, 12:09 p.m. UTC
Signed-off-by: Mahesh Salgaonkar <mahesh@linux.ibm.com>
---
 core/test/run-pel.c |   48 ++++++++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 48 insertions(+)
diff mbox series

Patch

diff --git a/core/test/run-pel.c b/core/test/run-pel.c
index 812c8996c..2d04592dc 100644
--- a/core/test/run-pel.c
+++ b/core/test/run-pel.c
@@ -58,6 +58,7 @@  int main(void)
 	struct opal_err_info *opal_err_info = &err_TEST_ERROR;
 	char *buffer;
 	struct elog_user_data_section *tmp;
+	int i;
 
 	dt_root = dt_new_root("");
 	dt_add_property_string(dt_root, "model", "run-pel-unittest");
@@ -113,6 +114,53 @@  int main(void)
 
 	assert(size == create_pel_log(elog, pel_buf, size));
 
+	/* Add single FRU callout with location code only. */
+	i = elog->num_fru_callout++;
+	strcpy(elog->fru_callout[0].loc_code, "Hello World!");
+
+	size = pel_size(elog);
+	pel_buf = realloc(pel_buf, size);
+	assert(pel_buf);
+
+	assert(size == create_pel_log(elog, pel_buf, size));
+
+	/* Add additional FRU callout with loc-code and part-no. */
+	i = elog->num_fru_callout++;
+	strcpy(elog->fru_callout[i].loc_code, "Hello World2!");
+	strcpy(elog->fru_callout[i].part_no, "PARTNO");
+
+	size = pel_size(elog);
+	pel_buf = realloc(pel_buf, size);
+	assert(pel_buf);
+
+	assert(size == create_pel_log(elog, pel_buf, size));
+
+	/* Add additional FRU callout with loc-code, part-no and serial no. */
+	i = elog->num_fru_callout++;
+	strcpy(elog->fru_callout[i].loc_code, "Hello World2!");
+	strcpy(elog->fru_callout[i].part_no, "PARTNO");
+	strcpy(elog->fru_callout[i].serial_no, "SERIALNO");
+
+	size = pel_size(elog);
+	pel_buf = realloc(pel_buf, size);
+	assert(pel_buf);
+
+	assert(size == create_pel_log(elog, pel_buf, size));
+
+	/* Add maximum of 10 FRU callouts */
+	for (i = elog->num_fru_callout; i < PEL_MAX_FRU_CALL_OUTS; i++) {
+		elog->num_fru_callout++;
+		strcpy(elog->fru_callout[i].loc_code, "Hello World2!");
+		strcpy(elog->fru_callout[i].part_no, "PARTNO");
+		strcpy(elog->fru_callout[i].serial_no, "SERIALNO");
+	}
+
+	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);