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