Remove validation bits
Discard invalid properties from json decode. JSON output should only
contain valid properties. This saves time in preventing post
processing of output for valid fields.
Ensure round trip validity with validation bits removed and required
properties populated.
Fix bugs in json decode.
Overhaul unit tests to use valijson. Add tests with static examples
to validate against schema. Use and nlohmann for better schema
validation over intrinsic libcper validation.
Example json output before:
{
"ValidationBits": {
"LevelValid": false,
"CorrectedValid": true
},
"Level": 1,
"Corrected": true
}
After:
{
"Corrected": true
}
Change-Id: I188bdc2827a57d938c22a431238fadfcdc939ab8
Signed-off-by: Aushim Nagarkatti <anagarkatti@nvidia.com>
diff --git a/generator/sections/gen-section-pci-bus.c b/generator/sections/gen-section-pci-bus.c
index 1e424bf..ca0f255 100644
--- a/generator/sections/gen-section-pci-bus.c
+++ b/generator/sections/gen-section-pci-bus.c
@@ -11,7 +11,8 @@
//Generates a single pseudo-random PCI/PCI-X bus error section, saving the resulting address to the given
//location. Returns the size of the newly created section.
-size_t generate_section_pci_bus(void **location)
+size_t generate_section_pci_bus(void **location,
+ GEN_VALID_BITS_TEST_TYPE validBitsType)
{
//Create random bytes.
int size = 72;
@@ -20,6 +21,11 @@
//Set reserved areas to zero.
UINT64 *validation = (UINT64 *)bytes;
*validation &= 0x1FF; //Validation 9-63
+ if (validBitsType == ALL_VALID) {
+ *validation = 0x1FF;
+ } else if (validBitsType == SOME_VALID) {
+ *validation = 0x155;
+ }
UINT32 *reserved = (UINT32 *)(bytes + 20);
*reserved = 0;
UINT64 *bus_command = (UINT64 *)(bytes + 40);