Support to stringify CPER output
Initial commit to add a "message" property that provides a single line
description of some important properties. This makes it easier to parse
multiple CPERs in crowded logs.
For now, "message" is supported for nvidia, arm processor and memory
types. The other types contain generic messages.
Example output:
```
"sections":[
{
"message":"A Corrected CCPLEXSCF NVIDIA Error occurred on CPU 0",
"Nvidia":{
"signature":"CCPLEXSC",
"sections":[
{
"message":"An ARM Processor Error occurred on CPU 0; Error Type(s): {Cache Error at Virtual Addr=0x41D6AA12D528 Physical Addr=0x80003A198DDA10}",
"ArmProcessor":{
"errorInfoNum":1,
"sections":[
{
"message":"A Multi-bit ECC Memory Error occurred at address 0x0000000080000000 at node 0",
```
Change-Id: I395d0370ec60579b8f7fede825b45a3ced8ff18f
Signed-off-by: Aushim Nagarkatti <anagarkatti@nvidia.com>
diff --git a/tests/test-utils.c b/tests/test-utils.c
index 1b2adac..c473978 100644
--- a/tests/test-utils.c
+++ b/tests/test-utils.c
@@ -159,8 +159,10 @@
json_object_object_foreach(ref_obj, key, val)
{
+ // Use json_object_get to increment ref count properly
+ json_object *val_copy = json_object_get(val);
json_object_object_add(jsonSchema, key,
- json_object_get(val));
+ val_copy);
}
json_object_object_del(jsonSchema, "$ref");
@@ -207,6 +209,7 @@
} else {
schema_file = "cper-json-full-log.json";
}
+ printf("start schema_validate_from_file\n");
int size = strlen(schema_file) + 1 + strlen(LIBCPER_JSON_SPEC) + 1;
char *schema_path = malloc(size);
snprintf(schema_path, size, "%s/%s", LIBCPER_JSON_SPEC, schema_file);
@@ -218,14 +221,14 @@
free(schema_path);
return 0;
}
-
+ printf("end iterate_make_required_props\n");
if (iterate_make_required_props(schema, all_valid_bits) < 0) {
cper_print_log("Failed to make required props\n");
json_object_put(schema);
free(schema_path);
return -1;
}
-
+ printf("start jdac_validate\n");
int err = jdac_validate(to_test, schema);
if (err == JDAC_ERR_VALID) {
cper_print_log("validation ok\n");
@@ -233,15 +236,15 @@
free(schema_path);
return 1;
}
-
+ printf("end jdac_validate\n");
cper_print_log("validate failed %d: %s\n", err, jdac_errorstr(err));
- cper_print_log("schema: \n%s\n",
- json_object_to_json_string_ext(schema,
- JSON_C_TO_STRING_PRETTY));
- cper_print_log("to_test: \n%s\n",
- json_object_to_json_string_ext(to_test,
- JSON_C_TO_STRING_PRETTY));
+ // cper_print_log("schema: \n%s\n",
+ // json_object_to_json_string_ext(schema,
+ // JSON_C_TO_STRING_PRETTY));
+ // cper_print_log("to_test: \n%s\n",
+ // json_object_to_json_string_ext(to_test,
+ // JSON_C_TO_STRING_PRETTY));
json_object_put(schema);
free(schema_path);
return 0;