Fix some json schema validation bugs
There were a couple of places where we would add null objects when
they were not allowed. Fix them.
Change-Id: I7c4c12ea1fa2913014e79603995267a9e560e288
Signed-off-by: Ed Tanous <etanous@nvidia.com>
diff --git a/tests/ir-tests.cpp b/tests/ir-tests.cpp
index 97dad1b..d255353 100644
--- a/tests/ir-tests.cpp
+++ b/tests/ir-tests.cpp
@@ -194,13 +194,14 @@
//Validate against schema.
std::string error_message;
-
- int valid = schema_validate_from_file(LIBCPER_JSON_SPEC, jsonData,
- error_message);
+ std::unique_ptr<valijson::Schema> schema =
+ load_schema(AddRequiredProps::YES, single_section);
+ int valid = schema_validate_from_file(*schema, jsonData, error_message);
json_object_put(ir);
ASSERT_TRUE(valid)
<< "IR validation test failed (single section mode = "
- << single_section << ") with message: " << error_message;
+ << single_section << ") with message: " << error_message
+ << jsonData.dump(4) << "\n";
}
std::string to_hex(char *input, size_t size)