xref: /openbmc/libcper/tests/ir-tests.c (revision da75128c6e2e9a9639d381441573d2e20e3a1ddf)
1 /**
2  * Defines tests for validating CPER-JSON IR output from the cper-parse library.
3  *
4  * Author: Lawrence.Tang@arm.com
5  **/
6 
7 #include "test-utils.h"
8 #include "string.h"
9 #include "assert.h"
10 #include <ctype.h>
11 #include <json.h>
12 #include <libcper/cper-parse.h>
13 #include <libcper/generator/cper-generate.h>
14 #include <libcper/generator/sections/gen-section.h>
15 #include <libcper/json-schema.h>
16 #include <libcper/sections/cper-section.h>
17 
18 #include "base64_test.h"
19 
20 /*
21 * Test templates.
22 */
23 static const GEN_VALID_BITS_TEST_TYPE allValidbitsSet = ALL_VALID;
24 static const GEN_VALID_BITS_TEST_TYPE fixedValidbitsSet = SOME_VALID;
25 static const int GEN_EXAMPLES = 0;
26 
27 static const char *cper_ext = "cperhex";
28 static const char *json_ext = "json";
29 
30 struct file_info {
31 	char *cper_out;
32 	char *json_out;
33 };
34 
free_file_info(struct file_info * info)35 void free_file_info(struct file_info *info)
36 {
37 	if (info == NULL) {
38 		return;
39 	}
40 	free(info->cper_out);
41 	free(info->json_out);
42 	free(info);
43 }
44 
file_info_init(const char * section_name)45 struct file_info *file_info_init(const char *section_name)
46 {
47 	struct file_info *info = NULL;
48 	char *buf = NULL;
49 	size_t size;
50 	int ret;
51 
52 	info = (struct file_info *)calloc(1, sizeof(struct file_info));
53 	if (info == NULL) {
54 		goto fail;
55 	}
56 
57 	size = strlen(LIBCPER_EXAMPLES) + 1 + strlen(section_name) + 1 +
58 	       strlen(cper_ext) + 1;
59 	info->cper_out = (char *)malloc(size);
60 	ret = snprintf(info->cper_out, size, "%s/%s.%s", LIBCPER_EXAMPLES,
61 		       section_name, cper_ext);
62 	if (ret != (int)size - 1) {
63 		printf("snprintf0 failed\n");
64 		goto fail;
65 	}
66 	size = strlen(LIBCPER_EXAMPLES) + 1 + strlen(section_name) + 1 +
67 	       strlen(json_ext) + 1;
68 	info->json_out = (char *)malloc(size);
69 	ret = snprintf(info->json_out, size, "%s/%s.%s", LIBCPER_EXAMPLES,
70 		       section_name, json_ext);
71 	if (ret != (int)size - 1) {
72 		printf("snprintf3 failed\n");
73 		goto fail;
74 	}
75 	free(buf);
76 	return info;
77 
78 fail:
79 	free(buf);
80 	free_file_info(info);
81 	return NULL;
82 }
83 
cper_create_examples(const char * section_name)84 void cper_create_examples(const char *section_name)
85 {
86 	//Generate full CPER record for the given type.
87 	json_object *ir = NULL;
88 	size_t size;
89 	size_t file_size;
90 	FILE *outFile = NULL;
91 	unsigned char *file_data;
92 	FILE *record = NULL;
93 	char *buf = NULL;
94 	struct file_info *info = file_info_init(section_name);
95 	if (info == NULL) {
96 		goto done;
97 	}
98 
99 	record = generate_record_memstream(&section_name, 1, &buf, &size, 0,
100 					   fixedValidbitsSet);
101 
102 	// Write example CPER to disk
103 	outFile = fopen(info->cper_out, "wb");
104 	if (outFile == NULL) {
105 		printf("Failed to create/open CPER output file: %s\n",
106 		       info->cper_out);
107 		goto done;
108 	}
109 
110 	fseek(record, 0, SEEK_END);
111 	file_size = ftell(record);
112 	rewind(record);
113 	file_data = malloc(file_size);
114 	if (fread(file_data, 1, file_size, record) != file_size) {
115 		printf("Failed to read CPER data from memstream.");
116 		fclose(outFile);
117 		outFile = NULL;
118 		assert(0);
119 
120 		goto done;
121 	}
122 	for (size_t index = 0; index < file_size; index++) {
123 		char hex_str[3];
124 		int out = snprintf(hex_str, sizeof(hex_str), "%02x",
125 				   file_data[index]);
126 		if (out != 2) {
127 			printf("snprintf1 failed\n");
128 			goto done;
129 		}
130 		fwrite(hex_str, sizeof(char), 2, outFile);
131 		if (index % 30 == 29) {
132 			fwrite("\n", sizeof(char), 1, outFile);
133 		}
134 	}
135 	fclose(outFile);
136 	outFile = NULL;
137 
138 	//Convert to IR, free resources.
139 	rewind(record);
140 	ir = cper_to_ir(record);
141 	if (ir == NULL) {
142 		printf("Empty JSON from CPER bin2\n");
143 		assert(0);
144 		goto done;
145 	}
146 
147 	//Write json output to disk
148 	json_object_to_file_ext(info->json_out, ir, JSON_C_TO_STRING_PRETTY);
149 	json_object_put(ir);
150 
151 done:
152 	free_file_info(info);
153 	if (record != NULL) {
154 		fclose(record);
155 	}
156 	if (outFile != NULL) {
157 		fclose(outFile);
158 	}
159 	free(buf);
160 }
161 
hex2int(char ch)162 int hex2int(char ch)
163 {
164 	if ((ch >= '0') && (ch <= '9')) {
165 		return ch - '0';
166 	}
167 	if ((ch >= 'A') && (ch <= 'F')) {
168 		return ch - 'A' + 10;
169 	}
170 	if ((ch >= 'a') && (ch <= 'f')) {
171 		return ch - 'a' + 10;
172 	}
173 	return -1;
174 }
175 
string_to_binary(const char * source,size_t length,unsigned char ** retval)176 int string_to_binary(const char *source, size_t length, unsigned char **retval)
177 {
178 	size_t retval_size = length * 2;
179 	*retval = malloc(retval_size);
180 	int uppernibble = 1;
181 
182 	size_t ret_index = 0;
183 
184 	for (size_t i = 0; i < length; i++) {
185 		char c = source[i];
186 		if (c == '\n') {
187 			continue;
188 		}
189 		int val = hex2int(c);
190 		if (val < 0) {
191 			printf("Invalid hex character in test file: %c\n", c);
192 			return -1;
193 		}
194 
195 		if (uppernibble) {
196 			(*retval)[ret_index] = (unsigned char)(val << 4);
197 		} else {
198 			(*retval)[ret_index] += (unsigned char)val;
199 			ret_index++;
200 		}
201 		uppernibble = !uppernibble;
202 	}
203 	return ret_index;
204 }
205 
206 //Tests fixed CPER sections for IR validity with an example set.
cper_example_section_ir_test(const char * section_name)207 void cper_example_section_ir_test(const char *section_name)
208 {
209 	//Open CPER record for the given type.
210 	struct file_info *info = file_info_init(section_name);
211 	if (info == NULL) {
212 		return;
213 	}
214 
215 	FILE *cper_file = fopen(info->cper_out, "rb");
216 	if (cper_file == NULL) {
217 		printf("Failed to open CPER file: %s\n", info->cper_out);
218 		free_file_info(info);
219 		assert(0);
220 		return;
221 	}
222 	fseek(cper_file, 0, SEEK_END);
223 	size_t length = ftell(cper_file);
224 	fseek(cper_file, 0, SEEK_SET);
225 	char *buffer = (char *)malloc(length);
226 	if (!buffer) {
227 		free_file_info(info);
228 		return;
229 	}
230 	if (fread(buffer, 1, length, cper_file) != length) {
231 		printf("Failed to read CPER file: %s\n", info->cper_out);
232 		free(buffer);
233 		free_file_info(info);
234 		return;
235 	}
236 	fclose(cper_file);
237 
238 	unsigned char *cper_bin;
239 	int cper_bin_len = string_to_binary(buffer, length, &cper_bin);
240 	if (cper_bin_len <= 0) {
241 		free(buffer);
242 		free_file_info(info);
243 		assert(0);
244 		return;
245 	}
246 	printf("cper_bin: %s\n", cper_bin);
247 	printf("cper_bin_len: %d\n", cper_bin_len);
248 
249 	//Convert to IR, free resources.
250 	json_object *ir = cper_buf_to_ir(cper_bin, cper_bin_len);
251 	if (ir == NULL) {
252 		printf("Empty JSON from CPER bin3\n");
253 		free(cper_bin);
254 		free(buffer);
255 		free_file_info(info);
256 		assert(0);
257 		return;
258 	}
259 
260 	json_object *expected = json_object_from_file(info->json_out);
261 	assert(expected != NULL);
262 	if (expected == NULL) {
263 		free(buffer);
264 		free(cper_bin);
265 		free_file_info(info);
266 		const char *str = json_object_to_json_string(ir);
267 
268 		const char *expected_str = json_object_to_json_string(expected);
269 		assert(strcmp(str, expected_str) == 0);
270 		return;
271 	}
272 
273 	assert(json_object_equal(ir, expected));
274 	free(buffer);
275 	free(cper_bin);
276 	json_object_put(ir);
277 	json_object_put(expected);
278 	free_file_info(info);
279 }
280 
281 //Tests a single randomly generated CPER section of the given type to ensure CPER-JSON IR validity.
cper_log_section_ir_test(const char * section_name,int single_section,GEN_VALID_BITS_TEST_TYPE validBitsType)282 void cper_log_section_ir_test(const char *section_name, int single_section,
283 			      GEN_VALID_BITS_TEST_TYPE validBitsType)
284 {
285 	//Generate full CPER record for the given type.
286 	char *buf;
287 	size_t size;
288 	FILE *record = generate_record_memstream(&section_name, 1, &buf, &size,
289 						 single_section, validBitsType);
290 
291 	//Convert to IR, free resources.
292 	json_object *ir;
293 	if (single_section) {
294 		ir = cper_single_section_to_ir(record);
295 	} else {
296 		ir = cper_to_ir(record);
297 	}
298 
299 	fclose(record);
300 	free(buf);
301 
302 	//Validate against schema.
303 	int valid = schema_validate_from_file(ir, single_section,
304 					      /*all_valid_bits*/ 1);
305 	json_object_put(ir);
306 
307 	if (valid < 0) {
308 		printf("IR validation test failed (single section mode = %d)\n",
309 		       single_section);
310 		assert(0);
311 	}
312 }
313 
314 //Tests a single randomly generated CPER section of the given type to ensure CPER-JSON IR validity.
cper_buf_log_section_ir_test(const char * section_name,int single_section,GEN_VALID_BITS_TEST_TYPE validBitsType)315 void cper_buf_log_section_ir_test(const char *section_name, int single_section,
316 				  GEN_VALID_BITS_TEST_TYPE validBitsType)
317 {
318 	//Generate full CPER record for the given type.
319 	char *buf;
320 	size_t size;
321 	FILE *record = generate_record_memstream(&section_name, 1, &buf, &size,
322 						 single_section, validBitsType);
323 
324 	//Convert.
325 	json_object *ir;
326 	if (single_section) {
327 		ir = cper_buf_single_section_to_ir((UINT8 *)buf, size);
328 	} else {
329 		ir = cper_buf_to_ir((UINT8 *)buf, size);
330 	}
331 	fclose(record);
332 	free(buf);
333 
334 	if (!ir) {
335 		printf("IR validation test failed (%d) : json object empty \n",
336 		       single_section);
337 		assert(0);
338 	}
339 
340 	//Validate against schema.
341 	int valid = schema_validate_from_file(ir, single_section,
342 					      /*all_valid_bits*/ 1);
343 	json_object_put(ir);
344 
345 	if (valid < 0) {
346 		printf("IR validation test failed (single section mode = %d)\n",
347 		       single_section);
348 		assert(0);
349 	}
350 }
351 
to_hex(const unsigned char * input,size_t size,char ** out)352 int to_hex(const unsigned char *input, size_t size, char **out)
353 {
354 	*out = (char *)malloc(size * 2);
355 	if (out == NULL) {
356 		return -1;
357 	}
358 	int out_index = 0;
359 	for (size_t i = 0; i < size; i++) {
360 		unsigned char c = input[i];
361 		char hex_str[3];
362 		int n = snprintf(hex_str, sizeof(hex_str), "%02x", c);
363 		if (n != 2) {
364 			printf("snprintf2 failed with code %d\n", n);
365 			return -1;
366 		}
367 		(*out)[out_index] = hex_str[0];
368 		out_index++;
369 		(*out)[out_index] = hex_str[1];
370 		out_index++;
371 	}
372 	return out_index;
373 }
374 
375 //Checks for binary round-trip equality for a given randomly generated CPER record.
cper_log_section_binary_test(const char * section_name,int single_section,GEN_VALID_BITS_TEST_TYPE validBitsType)376 void cper_log_section_binary_test(const char *section_name, int single_section,
377 				  GEN_VALID_BITS_TEST_TYPE validBitsType)
378 {
379 	//Generate CPER record for the given type.
380 	char *buf;
381 	size_t size;
382 	FILE *record = generate_record_memstream(&section_name, 1, &buf, &size,
383 						 single_section, validBitsType);
384 	if (record == NULL) {
385 		printf("Could not generate memstream for binary test");
386 		return;
387 	}
388 
389 	//Convert to IR.
390 	json_object *ir;
391 	if (single_section) {
392 		ir = cper_single_section_to_ir(record);
393 	} else {
394 		ir = cper_to_ir(record);
395 	}
396 
397 	//Now convert back to binary, and get a stream out.
398 	char *cper_buf;
399 	size_t cper_buf_size;
400 	FILE *stream = open_memstream(&cper_buf, &cper_buf_size);
401 	if (single_section) {
402 		ir_single_section_to_cper(ir, stream);
403 	} else {
404 		ir_to_cper(ir, stream);
405 	}
406 	fclose(stream);
407 
408 	printf("size: %zu, cper_buf_size: %zu\n", size, cper_buf_size);
409 
410 	char *buf_hex;
411 	int buf_hex_len = to_hex((unsigned char *)buf, size, &buf_hex);
412 	char *cper_buf_hex;
413 	int cper_buf_hex_len =
414 		to_hex((unsigned char *)cper_buf, cper_buf_size, &cper_buf_hex);
415 
416 	printf("%.*s\n", cper_buf_hex_len, cper_buf_hex);
417 	printf("%.*s\n", buf_hex_len, buf_hex);
418 	assert(buf_hex_len == cper_buf_hex_len);
419 	assert(memcmp(buf_hex, cper_buf_hex, buf_hex_len) == 0);
420 
421 	free(buf_hex);
422 	free(cper_buf_hex);
423 
424 	//Free everything up.
425 	fclose(record);
426 	free(buf);
427 	free(cper_buf);
428 	json_object_put(ir);
429 }
430 
431 //Tests randomly generated CPER sections for IR validity of a given type, in both single section mode and full CPER log mode.
cper_log_section_dual_ir_test(const char * section_name)432 void cper_log_section_dual_ir_test(const char *section_name)
433 {
434 	// Test with file based APIs
435 	cper_log_section_ir_test(section_name, 0, allValidbitsSet);
436 	cper_log_section_ir_test(section_name, 1, allValidbitsSet);
437 
438 	// Test with buffer based APIs
439 	cper_buf_log_section_ir_test(section_name, 0, allValidbitsSet);
440 	cper_buf_log_section_ir_test(section_name, 1, allValidbitsSet);
441 
442 	//Validate against examples
443 	cper_example_section_ir_test(section_name);
444 }
445 
446 //Tests randomly generated CPER sections for binary compatibility of a given type, in both single section mode and full CPER log mode.
cper_log_section_dual_binary_test(const char * section_name)447 void cper_log_section_dual_binary_test(const char *section_name)
448 {
449 	cper_log_section_binary_test(section_name, 0, allValidbitsSet);
450 	cper_log_section_binary_test(section_name, 1, allValidbitsSet);
451 }
452 
453 /*
454 * Non-single section assertions.
455 */
CompileTimeAssertions_TwoWayConversion(void)456 void CompileTimeAssertions_TwoWayConversion(void)
457 {
458 	for (size_t i = 0; i < section_definitions_len; i++) {
459 		//If a conversion one way exists, a conversion the other way must exist.
460 		if (section_definitions[i].ToCPER != NULL) {
461 			assert(section_definitions[i].ToIR != NULL);
462 		}
463 		if (section_definitions[i].ToIR != NULL) {
464 			assert(section_definitions[i].ToCPER != NULL);
465 		}
466 	}
467 }
468 
CompileTimeAssertions_ShortcodeNoSpaces(void)469 void CompileTimeAssertions_ShortcodeNoSpaces(void)
470 {
471 	for (size_t i = 0; i < generator_definitions_len; i++) {
472 		for (int j = 0;
473 		     generator_definitions[i].ShortName[j + 1] != '\0'; j++) {
474 			assert(isspace(generator_definitions[i].ShortName[j]) ==
475 			       0);
476 		}
477 	}
478 }
479 
480 /*
481 * Single section tests.
482 */
483 
484 //Generic processor tests.
GenericProcessorTests_IRValid(void)485 void GenericProcessorTests_IRValid(void)
486 {
487 	cper_log_section_dual_ir_test("generic");
488 }
GenericProcessorTests_BinaryEqual(void)489 void GenericProcessorTests_BinaryEqual(void)
490 {
491 	cper_log_section_dual_binary_test("generic");
492 }
493 
494 //IA32/x64 tests.
IA32x64Tests_IRValid(void)495 void IA32x64Tests_IRValid(void)
496 {
497 	cper_log_section_dual_ir_test("ia32x64");
498 }
IA32x64Tests_BinaryEqual(void)499 void IA32x64Tests_BinaryEqual(void)
500 {
501 	cper_log_section_dual_binary_test("ia32x64");
502 }
503 
504 // void IPFTests_IRValid() {
505 //     cper_log_section_dual_ir_test("ipf");
506 // }
507 
508 //ARM tests.
ArmTests_IRValid(void)509 void ArmTests_IRValid(void)
510 {
511 	cper_log_section_dual_ir_test("arm");
512 }
ArmTests_BinaryEqual(void)513 void ArmTests_BinaryEqual(void)
514 {
515 	cper_log_section_dual_binary_test("arm");
516 }
517 
518 //Memory tests.
MemoryTests_IRValid(void)519 void MemoryTests_IRValid(void)
520 {
521 	cper_log_section_dual_ir_test("memory");
522 }
MemoryTests_BinaryEqual(void)523 void MemoryTests_BinaryEqual(void)
524 {
525 	cper_log_section_dual_binary_test("memory");
526 }
527 
528 //Memory 2 tests.
Memory2Tests_IRValid(void)529 void Memory2Tests_IRValid(void)
530 {
531 	cper_log_section_dual_ir_test("memory2");
532 }
Memory2Tests_BinaryEqual(void)533 void Memory2Tests_BinaryEqual(void)
534 {
535 	cper_log_section_dual_binary_test("memory2");
536 }
537 
538 //PCIe tests.
PCIeTests_IRValid(void)539 void PCIeTests_IRValid(void)
540 {
541 	cper_log_section_dual_ir_test("pcie");
542 }
PCIeTests_BinaryEqual(void)543 void PCIeTests_BinaryEqual(void)
544 {
545 	cper_log_section_dual_binary_test("pcie");
546 }
547 
548 //Firmware tests.
FirmwareTests_IRValid(void)549 void FirmwareTests_IRValid(void)
550 {
551 	cper_log_section_dual_ir_test("firmware");
552 }
FirmwareTests_BinaryEqual(void)553 void FirmwareTests_BinaryEqual(void)
554 {
555 	cper_log_section_dual_binary_test("firmware");
556 }
557 
558 //PCI Bus tests.
PCIBusTests_IRValid(void)559 void PCIBusTests_IRValid(void)
560 {
561 	cper_log_section_dual_ir_test("pcibus");
562 }
PCIBusTests_BinaryEqual(void)563 void PCIBusTests_BinaryEqual(void)
564 {
565 	cper_log_section_dual_binary_test("pcibus");
566 }
567 
568 //PCI Device tests.
PCIDevTests_IRValid(void)569 void PCIDevTests_IRValid(void)
570 {
571 	cper_log_section_dual_ir_test("pcidev");
572 }
PCIDevTests_BinaryEqual(void)573 void PCIDevTests_BinaryEqual(void)
574 {
575 	cper_log_section_dual_binary_test("pcidev");
576 }
577 
578 //Generic DMAr tests.
DMArGenericTests_IRValid(void)579 void DMArGenericTests_IRValid(void)
580 {
581 	cper_log_section_dual_ir_test("dmargeneric");
582 }
DMArGenericTests_BinaryEqual(void)583 void DMArGenericTests_BinaryEqual(void)
584 {
585 	cper_log_section_dual_binary_test("dmargeneric");
586 }
587 
588 //VT-d DMAr tests.
DMArVtdTests_IRValid(void)589 void DMArVtdTests_IRValid(void)
590 {
591 	cper_log_section_dual_ir_test("dmarvtd");
592 }
DMArVtdTests_BinaryEqual(void)593 void DMArVtdTests_BinaryEqual(void)
594 {
595 	cper_log_section_dual_binary_test("dmarvtd");
596 }
597 
598 //IOMMU DMAr tests.
DMArIOMMUTests_IRValid(void)599 void DMArIOMMUTests_IRValid(void)
600 {
601 	cper_log_section_dual_ir_test("dmariommu");
602 }
DMArIOMMUTests_BinaryEqual(void)603 void DMArIOMMUTests_BinaryEqual(void)
604 {
605 	cper_log_section_dual_binary_test("dmariommu");
606 }
607 
608 //CCIX PER tests.
CCIXPERTests_IRValid(void)609 void CCIXPERTests_IRValid(void)
610 {
611 	cper_log_section_dual_ir_test("ccixper");
612 }
CCIXPERTests_BinaryEqual(void)613 void CCIXPERTests_BinaryEqual(void)
614 {
615 	cper_log_section_dual_binary_test("ccixper");
616 }
617 
618 //CXL Protocol tests.
CXLProtocolTests_IRValid(void)619 void CXLProtocolTests_IRValid(void)
620 {
621 	cper_log_section_dual_ir_test("cxlprotocol");
622 }
CXLProtocolTests_BinaryEqual(void)623 void CXLProtocolTests_BinaryEqual(void)
624 {
625 	cper_log_section_dual_binary_test("cxlprotocol");
626 }
627 
628 //CXL Component tests.
CXLComponentTests_IRValid(void)629 void CXLComponentTests_IRValid(void)
630 {
631 	cper_log_section_dual_ir_test("cxlcomponent-media");
632 }
CXLComponentTests_BinaryEqual(void)633 void CXLComponentTests_BinaryEqual(void)
634 {
635 	cper_log_section_dual_binary_test("cxlcomponent-media");
636 }
637 
638 //NVIDIA section tests.
NVIDIASectionTests_IRValid(void)639 void NVIDIASectionTests_IRValid(void)
640 {
641 	cper_log_section_dual_ir_test("nvidia");
642 }
NVIDIASectionTests_BinaryEqual(void)643 void NVIDIASectionTests_BinaryEqual(void)
644 {
645 	cper_log_section_dual_binary_test("nvidia");
646 }
647 
NVIDIACMETSectionTests_IRValid(void)648 void NVIDIACMETSectionTests_IRValid(void)
649 {
650 	cper_example_section_ir_test("nvidia_cmet_info");
651 }
652 
653 //Memory section test for validation bits.
MemoryValidationBitsSectionTests_IRValid()654 void MemoryValidationBitsSectionTests_IRValid()
655 {
656 	cper_example_section_ir_test("memory-validation-bits");
657 }
658 
659 //Unknown section tests.
UnknownSectionTests_IRValid(void)660 void UnknownSectionTests_IRValid(void)
661 {
662 	cper_log_section_dual_ir_test("unknown");
663 }
UnknownSectionTests_BinaryEqual(void)664 void UnknownSectionTests_BinaryEqual(void)
665 {
666 	cper_log_section_dual_binary_test("unknown");
667 }
668 
669 //Entrypoint for the testing program.
main(void)670 int main(void)
671 {
672 	if (GEN_EXAMPLES) {
673 		cper_create_examples("generic");
674 		cper_create_examples("arm");
675 		cper_create_examples("ia32x64");
676 		cper_create_examples("memory");
677 		cper_create_examples("memory2");
678 		cper_create_examples("pcie");
679 		cper_create_examples("firmware");
680 		cper_create_examples("pcibus");
681 		cper_create_examples("pcidev");
682 		cper_create_examples("dmargeneric");
683 		cper_create_examples("dmarvtd");
684 		cper_create_examples("dmariommu");
685 		cper_create_examples("ccixper");
686 		cper_create_examples("cxlprotocol");
687 		cper_create_examples("cxlcomponent-media");
688 		cper_create_examples("nvidia");
689 		cper_create_examples("unknown");
690 	}
691 	test_base64_encode_good();
692 	test_base64_decode_good();
693 	GenericProcessorTests_IRValid();
694 	GenericProcessorTests_BinaryEqual();
695 	IA32x64Tests_IRValid();
696 	IA32x64Tests_BinaryEqual();
697 	ArmTests_IRValid();
698 	ArmTests_BinaryEqual();
699 	MemoryTests_IRValid();
700 	MemoryTests_BinaryEqual();
701 	Memory2Tests_IRValid();
702 	Memory2Tests_BinaryEqual();
703 	PCIeTests_IRValid();
704 	PCIeTests_BinaryEqual();
705 	FirmwareTests_IRValid();
706 	FirmwareTests_BinaryEqual();
707 	PCIBusTests_IRValid();
708 	PCIBusTests_BinaryEqual();
709 	PCIDevTests_IRValid();
710 	PCIDevTests_BinaryEqual();
711 	DMArGenericTests_IRValid();
712 	DMArGenericTests_BinaryEqual();
713 	DMArVtdTests_IRValid();
714 	DMArVtdTests_BinaryEqual();
715 	DMArIOMMUTests_IRValid();
716 	DMArIOMMUTests_BinaryEqual();
717 	CCIXPERTests_IRValid();
718 	CCIXPERTests_BinaryEqual();
719 	CXLProtocolTests_IRValid();
720 	CXLProtocolTests_BinaryEqual();
721 	CXLComponentTests_IRValid();
722 	CXLComponentTests_BinaryEqual();
723 	NVIDIASectionTests_IRValid();
724 	NVIDIASectionTests_BinaryEqual();
725 	NVIDIACMETSectionTests_IRValid();
726 	MemoryValidationBitsSectionTests_IRValid();
727 	UnknownSectionTests_IRValid();
728 	UnknownSectionTests_BinaryEqual();
729 	CompileTimeAssertions_TwoWayConversion();
730 	CompileTimeAssertions_ShortcodeNoSpaces();
731 
732 	printf("\n\nTest completed successfully.\n");
733 
734 	return 0;
735 }
736