Convert files to hex
It was pointed out in code review these files would be easier to review
diffs on if they were in hex format on disk. This commit converts all
the existing files to "cperhex" which is cper in hex hexadecimal format
using the command 'xxd -p -l 64'
Change-Id: I5e762ec27a02b3d918b926a966074da8178d73b8
Signed-off-by: Ed Tanous <etanous@nvidia.com>
diff --git a/examples/arm.cper b/examples/arm.cper
deleted file mode 100644
index 2aaeb99..0000000
--- a/examples/arm.cper
+++ /dev/null
Binary files differ
diff --git a/examples/arm.cperhex b/examples/arm.cperhex
new file mode 100644
index 0000000..190b1d3
--- /dev/null
+++ b/examples/arm.cperhex
@@ -0,0 +1,15 @@
+435045520000ffffffff01000300000003000000d40100005300180010065593
+0000000000000000000000000000000000000000000000000000000000000000
+0000000000000000000000000000000000000000000000000000000000000000
+8595250800000000040000000000000000000000000000000000000000000000
+c80000000c010000462e030078000000163d9ee111bce4119caac2051d5d46b0
+9baa689ff4b3c83be10e045a48a46ee90300000016495d73691d74163927663a
+0304774a1f3b0d000a000000030002000c0100000200000095fa8ae0f099633e
+e8b628cc32d2927200000000705116220020150002f1570d5505408b77050000
+6b2c97bdd0eafcdb01db94bc4b020c4c0020150001b47a065500dd0a00000000
+ee123ed90f1adaeaae9635b0a2818b44002015000115ec065500980a00000000
+44114d5eeb370c816dbc24ee47685b8a818f0100600000005d6f8396aec7a7fb
+2693333214a0ef388e36a0eac0dff5416e15ae5329f2d08661531c0f1ac40b40
+573e736bde62a46c98445659234b9a916149e48a3bb4109c072dac22f1b76248
+f5d5b3d337573fd09c9629bfe1c351420c35cc47eadde4f1901308000a000000
+f60f834e4e53eae47ca91d601c3338123b061918
\ No newline at end of file
diff --git a/examples/ccixper.cper b/examples/ccixper.cper
deleted file mode 100644
index 03361e2..0000000
--- a/examples/ccixper.cper
+++ /dev/null
Binary files differ
diff --git a/examples/ccixper.cperhex b/examples/ccixper.cperhex
new file mode 100644
index 0000000..f055a79
--- /dev/null
+++ b/examples/ccixper.cperhex
@@ -0,0 +1,11 @@
+435045520000ffffffff01000000000003000000580100000200110007100873
+0000000000000000000000000000000000000000000000000000000000000000
+0000000000000000000000000000000000000000000000000000000000000000
+c89acc5d00000000040000000000000000000000000000000000000000000000
+c80000009000000028e20300e2000000f65e3391fbeb7844a6a688b728cf75d7
+7063d63b089ca7307e8ac060e64bf42400000000042334491622577f5d634c23
+10754224746b4500900000000500000000000000511000008fe1549475426936
+5d829009be737a9943dbcb69b56c826d4e4f1ea0401a1bcffb6f6370b1cda60f
+4f37180daa93a6ed6e715623ddd9902c28aecc68c8e737c3569b330868da17b7
+112fc4bbc26aa830dbff54b8d8e4e40093b0695b97a01fee3b52f6a32c0d5a3d
+3c1ef8ff88a12f63a0831c78680078fbb1e15648827536bd
\ No newline at end of file
diff --git a/examples/cxlcomponent-media.cper b/examples/cxlcomponent-media.cper
deleted file mode 100644
index a59c22c..0000000
--- a/examples/cxlcomponent-media.cper
+++ /dev/null
Binary files differ
diff --git a/examples/cxlcomponent-media.cperhex b/examples/cxlcomponent-media.cperhex
new file mode 100644
index 0000000..1ef5dc0
--- /dev/null
+++ b/examples/cxlcomponent-media.cperhex
@@ -0,0 +1,9 @@
+435045520000ffffffff01000300000003000000190100005700080007032408
+0000000000000000000000000000000000000000000000000000000000000000
+0000000000000000000000000000000000000000000000000000000000000000
+9b66466a00000000040000000000000000000000000000000000000000000000
+c800000051000000ff540300e4000000770acdfb60c27f4185a9088b1621eba6
+1ef8ff88a12f63a0831c78680078fbb1020000001e1b336b67775a41084e0663
+12225c5b675e1a0051000000050000000000000051f0fc7b8fe1549475406900
+5d829009be737a9943dbcb69b56c826d4e4f1ea0401a1bcffb6f6370b1cda60f
+4f37180daa93a6ed6e715623ddd9902c28aecc68c8e737c356
\ No newline at end of file
diff --git a/examples/cxlprotocol.cper b/examples/cxlprotocol.cper
deleted file mode 100644
index e16ba10..0000000
--- a/examples/cxlprotocol.cper
+++ /dev/null
Binary files differ
diff --git a/examples/cxlprotocol.cperhex b/examples/cxlprotocol.cperhex
new file mode 100644
index 0000000..23551f6
--- /dev/null
+++ b/examples/cxlprotocol.cperhex
@@ -0,0 +1,13 @@
+435045520000ffffffff01000000000003000000880100003200050002099158
+0000000000000000000000000000000000000000000000000000000000000000
+0000000000000000000000000000000000000000000000000000000000000000
+c0d8752400000000040000000000000000000000000000000000000000000000
+c8000000c00000009ad803004b000000b4efb980b552e34da77768784b771048
+df422781646537fe3d3386899e72aa4500000000112e40267d1771234b526620
+2555284148493c003d000000000000000000000000000000e154947542000000
+829009be737a9943dbcb68b5000000004f1ea0401a1bcffb6f6370b1cda60f4f
+37180daa93a6ed6e715623ddd9902c28aecc68c8e737c3569b330868da17b711
+2fc4bbc26aa830dbff54b8d8e4e40093b0695b9731001b00000000000d5a3d3c
+1ef8ff88a12f63a0831c78680078fbb1e15648827536bdc82c61f439bb3276da
+2a7562cba4c66b28e2e390e25c8b933de1dcbf57127d1f3fde13789945ee7370
+63d63b089ca7307e
\ No newline at end of file
diff --git a/examples/dmargeneric.cper b/examples/dmargeneric.cper
deleted file mode 100644
index 2dff86f..0000000
--- a/examples/dmargeneric.cper
+++ /dev/null
Binary files differ
diff --git a/examples/dmargeneric.cperhex b/examples/dmargeneric.cperhex
new file mode 100644
index 0000000..ffa9645
--- /dev/null
+++ b/examples/dmargeneric.cperhex
@@ -0,0 +1,8 @@
+435045520000ffffffff01000100000003000000e80000001400080009023056
+0000000000000000000000000000000000000000000000000000000000000000
+0000000000000000000000000000000000000000000000000000000000000000
+69e7b12100000000040000000000000000000000000000000000000000000000
+c80000002000000070b103000f000000f7fe515b9dc734448f1baa62de3e2c64
+68c8e737c3569b330868da17b7112fc4030000002a0b6d771e0b53305e01176c
+0e7a6e194a49550071dbd0600501010219b7e2cdb151f0fc0000000000000000
+0000000000000000
\ No newline at end of file
diff --git a/examples/dmariommu.cper b/examples/dmariommu.cper
deleted file mode 100644
index 4e67007..0000000
--- a/examples/dmariommu.cper
+++ /dev/null
Binary files differ
diff --git a/examples/dmariommu.cperhex b/examples/dmariommu.cperhex
new file mode 100644
index 0000000..a382fd1
--- /dev/null
+++ b/examples/dmariommu.cperhex
@@ -0,0 +1,11 @@
+435045520000ffffffff01000000000003000000580100005800120015017356
+0000000000000000000000000000000000000000000000000000000000000000
+0000000000000000000000000000000000000000000000000000000000000000
+bd3d771500000000040000000000000000000000000000000000000000000000
+c8000000900000006b28030090000000e1846f03377f8c42a79e575fdfaa84ec
+737063d63b089ca7307e8ac060e64bf40300000020042334491622577f5d634c
+2310754224746b00710000000000000019b7e2cdb151f0fc7b8fe15494754269
+00000000000000009943dbcb69b56c826d4e4f1ea0401a1b0000000000000000
+0000000000000000ed6e715623ddd9902c28aecc68c8e737c3569b330868da17
+b7112fc4bbc26aa830dbff54b8d8e4e40093b0695b97a01fee3b52f6a32c0d5a
+3d3c1ef8ff88a12f63a0831c78680078fbb1e15648827536
\ No newline at end of file
diff --git a/examples/dmarvtd.cper b/examples/dmarvtd.cper
deleted file mode 100644
index 04e450f..0000000
--- a/examples/dmarvtd.cper
+++ /dev/null
Binary files differ
diff --git a/examples/dmarvtd.cperhex b/examples/dmarvtd.cperhex
new file mode 100644
index 0000000..32a1a8a
--- /dev/null
+++ b/examples/dmarvtd.cperhex
@@ -0,0 +1,11 @@
+435045520000ffffffff01000000000003000000580100005800120015017356
+0000000000000000000000000000000000000000000000000000000000000000
+0000000000000000000000000000000000000000000000000000000000000000
+bd3d771500000000040000000000000000000000000000000000000000000000
+c8000000900000006b28030090000000371d7671b232cd45a7d0b0fedd93e8cf
+737063d63b089ca7307e8ac060e64bf40300000020042334491622577f5d634c
+2310754224746b0071dbd0603225daa119b7e2cdb151f0fc7b8fe15494754269
+365d829009be737a9943dbcb00000000000000000000000000f06f6370b1cda6
+0f4f00000daa9306ed6e715623ddd9902c28aecc68c8e737c3569b330868da17
+b7112fc4bbc26aa830dbff54b8d8e4e40093b0695b97a01fee3b52f6a32c0d5a
+3d3c1ef8ff88a12f63a0831c78680078fbb1e15648827536
\ No newline at end of file
diff --git a/examples/firmware.cper b/examples/firmware.cper
deleted file mode 100644
index 4581c7c..0000000
--- a/examples/firmware.cper
+++ /dev/null
Binary files differ
diff --git a/examples/firmware.cperhex b/examples/firmware.cperhex
new file mode 100644
index 0000000..a196f95
--- /dev/null
+++ b/examples/firmware.cperhex
@@ -0,0 +1,8 @@
+435045520000ffffffff01000300000003000000e80000001300110030064103
+0000000000000000000000000000000000000000000000000000000000000000
+0000000000000000000000000000000000000000000000000000000000000000
+435b8e3100000000040000000000000000000000000000000000000000000000
+c800000020000000fb6f0300b1000000962a2181ed09964994718d729c8e69ed
+28aecc68c8e737c3569b330868da17b70300000060250f2a0b6d771e0b53305e
+01176c0e7a6e1900020200000000000000000000000000007b8fe15494754269
+365d829009be737a
\ No newline at end of file
diff --git a/examples/generic.cper b/examples/generic.cper
deleted file mode 100644
index 63def5f..0000000
--- a/examples/generic.cper
+++ /dev/null
Binary files differ
diff --git a/examples/generic.cperhex b/examples/generic.cperhex
new file mode 100644
index 0000000..f9dbb5d
--- /dev/null
+++ b/examples/generic.cperhex
@@ -0,0 +1,13 @@
+435045520000ffffffff01000100000003000000880100000600100029055116
+0000000000000000000000000000000000000000000000000000000000000000
+0000000000000000000000000000000000000000000000000000000000000000
+c7c9301d00000000040000000000000000000000000000000000000000000000
+c8000000c0000000891003003c000000adcc7698b447db4bb65e16f193c4f3db
+3f31bb02440035ce1072b64c16442050020000004c204c49322133797c5a456d
+381a2f2f2f1922005515000000000000c0c52bb501870000e65ae1c721bab0aa
+14064c1c0f736e4d0c3767567c7d2974337b5c6c4f3a4066135c755e05636310
+68272b7712113c1d471b733c18143042070c2e563d653c48392a1e3d0d014d75
+2777643809184d472a380341433203493528176a0d4b3246744f7a0148476d66
+3f49173f605b06021309424d323c165f5b2549606f721e6339185b0157495f00
+1f53254682d5a0589b67b70612ae18090235981282d39eff507a3921e825df07
+78054dfadaee5275
\ No newline at end of file
diff --git a/examples/ia32x64.cper b/examples/ia32x64.cper
deleted file mode 100644
index efc92d0..0000000
--- a/examples/ia32x64.cper
+++ /dev/null
Binary files differ
diff --git a/examples/ia32x64.cperhex b/examples/ia32x64.cperhex
new file mode 100644
index 0000000..e15f789
--- /dev/null
+++ b/examples/ia32x64.cperhex
@@ -0,0 +1,35 @@
+435045520000ffffffff01000100000003000000500400001200080003061926
+0000000000000000000000000000000000000000000000000000000000000000
+0000000000000000000000000000000000000000000000000000000000000000
+dc3fe02e00000000040000000000000000000000000000000000000000000000
+c800000088030000c35003009a000000b0a03edc44a19747b95b53fa242b6e1d
+c3beb8f61f0403e3551075ef5b8618ca00000000653e6e431d765d3a15760b76
+660b315c64040a000e04000000000000c46be571ff2975ecf5f02acb531cb93a
+2826be5c8638198d4d056fbd5299c91704ae8803d8fdefcd0000000000000000
+0000000000000000f50157a5efe3de43ac72249b573fad2c1500000000000000
+ff00df3f00000000451627e8e0c46888dc843441b106cee276491716077a5cc0
+8d8b03cbc551580ab3f8f31cb1c5a249aa595eef92ffa63c1500000000000000
+ff07dfff070000004144789b15987a1af90a25297ca6a1053e210932619ab1a4
+f7f639ac4435e08535b506fc1f5e62459f250a3b9adb63c31500000000000000
+ff00df3f0000000077539712fc81b7ca94d83f48fef11e2ed656f96c32baf847
+28c891761e561c950300f40070c836af1135a12f6377855ce3b717dbfe3fa390
+b5c2e6d1578f85ff35b95da682945593c9f6c22c6d488950ffa02bfedfcf8e94
+917465e803eae739a445df26d934b9a22b7bce98c357e9c3f714c1d6e34f6a74
+c3d05dc6ba44ff5e89de8462133d043eb9d3d67c2abf3f22d400f8b74f632c12
+3389d9edcdd84c57b7d0b9ca0ebe08c791de43bb9e83dd7283d629d33955e56c
+debe59ac0000000076bc18847a204b0bfe8ec79c11a40e957a3868b38d4d1f6c
+0c7918a31e1bf194d709185229635d27f224c403c9d298430a00f7984e16045a
+8f1cfdae37ee420ef75b6020bebe47b0e20bb4abde4cefe84de6809bfc84f58c
+a0f23ad7e07ce6d7d746f7960400400092284781109467912f641524f0b6162a
+8df6a673cd7ebac414be025aa54c5538749cb9853021165f852b8375e1999f6f
+8f45e25cc39c20d75b2232006f8738e323f26853137eb298aa350d8b06002000
+b9b579d98cd4fbbed56a450d4e68ffb6bb12356daadfa2b76a706365cd554286
+0abb5f96905b5565c59a72130300f400ff2c2fdecee6483f4aad0c9fef93a9ab
+f23f3b4d94a0132f12263284f0f009ef1c38cdeb1e162a68c33607b3c9b05ebc
+f0990984391cb34b43e5d033d6d923f211f0dd2f060798ca3e9f7d0750dbc340
+74cdc4ade978f82c5dc86033a18326b27303e27a0b7a444919c150699c14a910
+e16ebdcae6b5f7437e57771fda9dd24da0b4c7ab2e0bf447cc45b168595a783a
+c83504aeebfbf26900000000065a7aa60e41523c4d4684198b3582e48ffa1e58
+3023061b1ef88471610c9d6767170e755960b2a6a636bf326b4116fa3c35526c
+58598776510be7b317851a7e9c28f4f588a69b2fdc5b61479c7741d8ac944404
+edcb7b3ed662f1eee70c6c84346079bd
\ No newline at end of file
diff --git a/examples/memory.cper b/examples/memory.cper
deleted file mode 100644
index 3e8f35f..0000000
--- a/examples/memory.cper
+++ /dev/null
Binary files differ
diff --git a/examples/memory.cperhex b/examples/memory.cperhex
new file mode 100644
index 0000000..16aa8ca
--- /dev/null
+++ b/examples/memory.cperhex
@@ -0,0 +1,9 @@
+435045520000ffffffff01000300000003000000180100005700080007032408
+0000000000000000000000000000000000000000000000000000000000000000
+0000000000000000000000000000000000000000000000000000000000000000
+9b66466a00000000040000000000000000000000000000000000000000000000
+c800000050000000ff540300e40000001411bca5646fde4eb8633e83ed7c83b1
+1ef8ff88a12f63a0831c78680078fbb1020000001e1b336b67775a41084e0663
+12225c5b675e1a00555527000000000000136200000000007b8fe15494754269
+365d829009be737a9943dbcb69b56c826d4e4f1ea0401a1bcffb6f6370b1cda6
+0f4f37180daa93a6ed6e715623ddd9900320aecc68c8e737
\ No newline at end of file
diff --git a/examples/memory2.cper b/examples/memory2.cper
deleted file mode 100644
index 5488ff3..0000000
--- a/examples/memory2.cper
+++ /dev/null
Binary files differ
diff --git a/examples/memory2.cperhex b/examples/memory2.cperhex
new file mode 100644
index 0000000..ff2d630
--- /dev/null
+++ b/examples/memory2.cperhex
@@ -0,0 +1,10 @@
+435045520000ffffffff01000000000003000000280100003200040030092892
+0000000000000000000000000000000000000000000000000000000000000000
+0000000000000000000000000000000000000000000000000000000000000000
+54b3d93800000000040000000000000000000000000000000000000000000000
+c800000060000000f6a303005a000000fc04ec61e64813d825c98daa44750b12
+5648827536bdc82c61f439bb3276da2a030000005e1a1d76531e3e6b160d6f1c
+5d59316f041c4e00555505000000000000186200000000007b8fe15494754269
+365d829009be737a9943dbcb69b56c826d4e4f1ea0401a1bcffb6f6370b1cda6
+0f4f37180d000100ed6e715623ddd9902c28aecc68c8e737c3569b330868da17
+b7112fc4bbc26aa8
\ No newline at end of file
diff --git a/examples/nvidia.cper b/examples/nvidia.cper
deleted file mode 100644
index 3537cec..0000000
--- a/examples/nvidia.cper
+++ /dev/null
Binary files differ
diff --git a/examples/nvidia.cperhex b/examples/nvidia.cperhex
new file mode 100644
index 0000000..62817a7
--- /dev/null
+++ b/examples/nvidia.cperhex
@@ -0,0 +1,11 @@
+435045520000ffffffff01000300000003000000480100001500010003092848
+0000000000000000000000000000000000000000000000000000000000000000
+0000000000000000000000000000000000000000000000000000000000000000
+a08dc95400000000040000000000000000000000000000000000000000000000
+c800000080000000c82c030039000000f244526d1227ec11bea7cb3fdb95c786
+3de1dcbf57127d1f3fde13789945ee73020000001508322975053e346f543856
+6f15272004233400504349652d44504300000000000000007b8fe15400750600
+365d829009be737a9943dbcb69b56c826d4e4f1ea0401a1bcffb6f6370b1cda6
+0f4f37180daa93a6ed6e715623ddd9902c28aecc68c8e737c3569b330868da17
+b7112fc4bbc26aa830dbff54b8d8e4e40093b0695b97a01fee3b52f6a32c0d5a
+3d3c1ef8ff88a12f
\ No newline at end of file
diff --git a/examples/pcibus.cper b/examples/pcibus.cper
deleted file mode 100644
index 4909820..0000000
--- a/examples/pcibus.cper
+++ /dev/null
Binary files differ
diff --git a/examples/pcibus.cperhex b/examples/pcibus.cperhex
new file mode 100644
index 0000000..f402b12
--- /dev/null
+++ b/examples/pcibus.cperhex
@@ -0,0 +1,9 @@
+435045520000ffffffff01000000000003000000100100001000040016089276
+0000000000000000000000000000000000000000000000000000000000000000
+0000000000000000000000000000000000000000000000000000000000000000
+ae8a8f5600000000040000000000000000000000000000000000000000000000
+c8000000480000002fc403006a000000633975c5843b9540bf78eddad3f9c9dd
+52f6a32c0d5a3d3c1ef8ff88a12f63a002000000482001560506516a1e1b336b
+67775a41084e0600550100000000000000116200000000000400e15400000000
+365d829009be737a9943dbcb69b56c820000000000000001cffb6f6370b1cda6
+0f4f37180daa93a6ed6e715623ddd990
\ No newline at end of file
diff --git a/examples/pcidev.cper b/examples/pcidev.cper
deleted file mode 100644
index 1a6c4be..0000000
--- a/examples/pcidev.cper
+++ /dev/null
Binary files differ
diff --git a/examples/pcidev.cperhex b/examples/pcidev.cperhex
new file mode 100644
index 0000000..5a98497
--- /dev/null
+++ b/examples/pcidev.cperhex
@@ -0,0 +1,10 @@
+435045520000ffffffff01000300000003000000300100004200200027043651
+0000000000000000000000000000000000000000000000000000000000000000
+0000000000000000000000000000000000000000000000000000000000000000
+69f9400800000000040000000000000000000000000000000000000000000000
+c800000068000000f8ff03002f00000085465eeb66ca6947b6a226068b001326
+61f439bb3276da2a7562cba4c66b28e202000000160d6f1c5d59316f041c4e73
+760f723c144d450015000000000000000017310000000000e15494754269365d
+829009000000000001000000030000004f1ea0401a1bcffb6f6370b1cda60f4f
+37180daa93a6ed6e715623ddd9902c28aecc68c8e737c3569b330868da17b711
+2fc4bbc26aa830dbff54b8d8e4e40093
\ No newline at end of file
diff --git a/examples/pcie.cper b/examples/pcie.cper
deleted file mode 100644
index cdd4b3d..0000000
--- a/examples/pcie.cper
+++ /dev/null
Binary files differ
diff --git a/examples/pcie.cperhex b/examples/pcie.cperhex
new file mode 100644
index 0000000..0ddfe3b
--- /dev/null
+++ b/examples/pcie.cperhex
@@ -0,0 +1,13 @@
+435045520000ffffffff01000000000003000000980100001300210026041255
+0000000000000000000000000000000000000000000000000000000000000000
+0000000000000000000000000000000000000000000000000000000000000000
+9a7f435b00000000040000000000000000000000000000000000000000000000
+c8000000d00000009cbf0300e300000054e995d9c1bb0f43ad91b44dcb3c6f35
+6668938aa36c6e3f2b9dcf0ef92fd4d80200000048493c43480a02686e353b6f
+5c022d6c276d1200550000000000000007000000336200007b8fe15400000000
+365d829009be737a9943dbcb69b06c006d4e4f1ea0401a1bcffb6f6370b1cda6
+0f4f37180daa93a6ed6e715623ddd9902c28aecc68c8e737c3569b330868da17
+b7112fc4bbc26aa830dbff54b8d8e4e40093b0695b97a01fee3b52f6a32c0d5a
+3d3c1ef8ff88a12f63a0831c78680078fbb1e15648827536bdc82c61f439bb32
+76da2a7562cba4c66b28e2e390e25c8b933de1dcbf57127d1f3fde13789945ee
+737063d63b089ca7307e8ac060e64bf4242cd0e383e260a2
\ No newline at end of file
diff --git a/examples/unknown.cper b/examples/unknown.cper
deleted file mode 100644
index 4588c62..0000000
--- a/examples/unknown.cper
+++ /dev/null
Binary files differ
diff --git a/examples/unknown.cperhex b/examples/unknown.cperhex
new file mode 100644
index 0000000..2a32da8
--- /dev/null
+++ b/examples/unknown.cperhex
@@ -0,0 +1,10 @@
+435045520000ffffffff01000200000003000000390100005200060005020047
+0000000000000000000000000000000000000000000000000000000000000000
+0000000000000000000000000000000000000000000000000000000000000000
+52084c2900000000040000000000000000000000000000000000000000000000
+c800000071000000831c030000000000e15648827536bdc82c61f439bb3276da
+2a7562cba4c66b28e2e390e25c8b933d020000006f041c4e73760f723c144d45
+2d29201508322900dbd0603225daa119b7e2cdb151f0fc7b8fe1549475426936
+5d829009be737a9943dbcb69b56c826d4e4f1ea0401a1bcffb6f6370b1cda60f
+4f37180daa93a6ed6e715623ddd9902c28aecc68c8e737c3569b330868da17b7
+112fc4bbc26aa830dbff54b8d8e4e40093b0695b97a01fee3b
\ No newline at end of file
diff --git a/tests/ir-tests.cpp b/tests/ir-tests.cpp
index fa1f9f3..00bbf6a 100644
--- a/tests/ir-tests.cpp
+++ b/tests/ir-tests.cpp
@@ -8,6 +8,7 @@
#include "gtest/gtest.h"
#include "test-utils.hpp"
#include <json.h>
+#include <charconv>
#include <nlohmann/json.hpp>
#include <filesystem>
#include <fstream>
@@ -16,6 +17,7 @@
#include <libcper/generator/cper-generate.h>
#include <libcper/sections/cper-section.h>
#include <libcper/generator/sections/gen-section.h>
+#include <format>
namespace fs = std::filesystem;
@@ -31,7 +33,7 @@
//Generate full CPER record for the given type.
fs::path file_path = LIBCPER_EXAMPLES;
file_path /= section_name;
- fs::path cper_out = file_path.replace_extension("cper");
+ fs::path cper_out = file_path.replace_extension("cperhex");
fs::path json_out = file_path.replace_extension("json");
char *buf;
@@ -47,15 +49,21 @@
return;
}
- char buffer[1024];
- size_t bytesRead;
- while ((bytesRead = fread(buffer, 1, sizeof(buffer), record)) > 0) {
- outFile.write(buffer, bytesRead);
- if (!outFile) {
- std::cerr << "Failed to write to output file."
- << std::endl;
- outFile.close();
- return;
+ std::vector<unsigned char> file_data;
+ fseek(record, 0, SEEK_END);
+ size_t file_size = ftell(record);
+ rewind(record);
+ file_data.resize(file_size);
+ if (fread(file_data.data(), 1, file_data.size(), record) != file_size) {
+ std::cerr << "Failed to read CPER data from memstream."
+ << std::endl;
+ FAIL();
+ return;
+ }
+ for (size_t index = 0; index < file_data.size(); index++) {
+ outFile << std::format("{:02x}", file_data[index]);
+ if (index % 30 == 29) {
+ outFile << "\n";
}
}
outFile.close();
@@ -84,29 +92,51 @@
jsonOutFile.close();
}
+std::vector<unsigned char> string_to_binary(const std::string &source)
+{
+ std::vector<unsigned char> retval;
+ bool uppernibble = true;
+ for (const char c : source) {
+ unsigned char val = 0;
+ if (c == '\n') {
+ continue;
+ }
+ std::from_chars_result r = std::from_chars(&c, &c + 1, val, 16);
+ EXPECT_TRUE(r.ec == std::error_code())
+ << "Invalid hex character in test file: " << c;
+
+ if (uppernibble) {
+ retval.push_back(val << 4);
+ } else {
+ retval.back() += val;
+ }
+ uppernibble = !uppernibble;
+ }
+ return retval;
+}
+
//Tests fixed CPER sections for IR validity with an example set.
void cper_example_section_ir_test(const char *section_name)
{
//Open CPER record for the given type.
fs::path fpath = LIBCPER_EXAMPLES;
fpath /= section_name;
- fs::path cper = fpath.replace_extension("cper");
+ fs::path cper = fpath.replace_extension("cperhex");
fs::path json = fpath.replace_extension("json");
- // Do a C style read to obtain FILE*
- FILE *record = fopen(cper.string().c_str(), "rb");
- if (record == NULL) {
- std::cerr
- << "cper_example_section_ir_test: File cannot be opened/does not exist "
- << cper << std::endl;
- FAIL() << "cper_example_section_ir_test: File cannot be opened/does not exist";
+ std::ifstream cper_file(cper, std::ios::binary);
+ if (!cper_file.is_open()) {
+ std::cerr << "Failed to open CPER file: " << cper << std::endl;
+ FAIL() << "Failed to open CPER file";
return;
}
+ std::string cper_str((std::istreambuf_iterator<char>(cper_file)),
+ std::istreambuf_iterator<char>());
+ std::vector<unsigned char> cper_bin = string_to_binary(cper_str);
//Convert to IR, free resources.
- json_object *ir = cper_to_ir(record);
+ json_object *ir = cper_buf_to_ir(cper_bin.data(), cper_bin.size());
if (ir == NULL) {
- fclose(record);
std::cerr << "Empty JSON from CPER bin" << std::endl;
FAIL();
return;
@@ -117,12 +147,10 @@
std::cerr << "cper_example_section_ir_test: JSON parse error:"
<< std::endl;
FAIL() << "cper_example_section_ir_test: JSON parse error:";
- fclose(record);
json_object_put(ir);
return;
}
- fclose(record);
//Open json example file
nlohmann::json jGolden = loadJson(json.string().c_str());