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

Mahesh Salgaonkar mahesh at linux.ibm.com
Wed Oct 7 23:09:54 AEDT 2020


Signed-off-by: Mahesh Salgaonkar <mahesh at linux.ibm.com>
---
 core/test/run-pel.c |   48 ++++++++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 48 insertions(+)

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);
 




More information about the Skiboot mailing list