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-dmar.c b/generator/sections/gen-section-dmar.c
index dc34696..7c2a85f 100644
--- a/generator/sections/gen-section-dmar.c
+++ b/generator/sections/gen-section-dmar.c
@@ -11,8 +11,10 @@
//Generates a single pseudo-random generic DMAr error section, saving the resulting address to the given
//location. Returns the size of the newly created section.
-size_t generate_section_dmar_generic(void **location)
+size_t generate_section_dmar_generic(void **location,
+ GEN_VALID_BITS_TEST_TYPE validBitsType)
{
+ (void)validBitsType;
//Create random bytes.
int size = 32;
UINT8 *bytes = generate_random_bytes(size);
@@ -35,8 +37,10 @@
//Generates a single pseudo-random VT-d DMAr error section, saving the resulting address to the given
//location. Returns the size of the newly created section.
-size_t generate_section_dmar_vtd(void **location)
+size_t generate_section_dmar_vtd(void **location,
+ GEN_VALID_BITS_TEST_TYPE validBitsType)
{
+ (void)validBitsType;
//Create random bytes.
int size = 144;
UINT8 *bytes = generate_random_bytes(size);
@@ -59,8 +63,10 @@
//Generates a single pseudo-random IOMMU DMAr error section, saving the resulting address to the given
//location. Returns the size of the newly created section.
-size_t generate_section_dmar_iommu(void **location)
+size_t generate_section_dmar_iommu(void **location,
+ GEN_VALID_BITS_TEST_TYPE validBitsType)
{
+ (void)validBitsType;
//Create random bytes.
int size = 144;
UINT8 *bytes = generate_random_bytes(size);