Milo Lin | 0ddb778 | 2022-08-17 20:40:43 -0700 | [diff] [blame] | 1 | #include "aos/json_to_flatbuffer.h" |
James Kuszmaul | 827bd21 | 2023-05-15 23:57:39 -0700 | [diff] [blame] | 2 | #include "aos/util/config_validator_lib.h" |
Milo Lin | 0ddb778 | 2022-08-17 20:40:43 -0700 | [diff] [blame] | 3 | |
milind-u | c6e437a | 2023-03-01 23:40:40 -0800 | [diff] [blame] | 4 | DEFINE_string(config, "", "Name of the config file to replay using."); |
James Kuszmaul | 827bd21 | 2023-05-15 23:57:39 -0700 | [diff] [blame] | 5 | DEFINE_string(validation_config, "{}", |
| 6 | "JSON config to use to validate the config."); |
Milo Lin | 0ddb778 | 2022-08-17 20:40:43 -0700 | [diff] [blame] | 7 | /* This binary is used to validate that all of the |
| 8 | needed remote timestamps channels are in the config |
| 9 | to log the timestamps. |
| 10 | Future versions of the validator will provide the option |
| 11 | to confirm that the timestamps in the config are able to |
| 12 | replay all of the data in the log |
| 13 | This can be done by getting a list of all of the nodes and |
milind-u | c6e437a | 2023-03-01 23:40:40 -0800 | [diff] [blame] | 14 | iterating through it with a for loop creating a logger for |
| 15 | each one |
Milo Lin | 0ddb778 | 2022-08-17 20:40:43 -0700 | [diff] [blame] | 16 | Reference superstructure_lib_test.cc*/ |
| 17 | TEST(ConfigValidatorTest, ReadConfig) { |
| 18 | ASSERT_TRUE(!FLAGS_config.empty()); |
| 19 | const aos::FlatbufferDetachedBuffer<aos::Configuration> config = |
| 20 | aos::configuration::ReadConfig(FLAGS_config); |
| 21 | |
James Kuszmaul | 827bd21 | 2023-05-15 23:57:39 -0700 | [diff] [blame] | 22 | const aos::FlatbufferDetachedBuffer<aos::util::ConfigValidatorConfig> |
| 23 | validator_config = |
| 24 | aos::JsonToFlatbuffer<aos::util::ConfigValidatorConfig>( |
| 25 | FLAGS_validation_config); |
| 26 | aos::util::ConfigIsValid(&config.message(), &validator_config.message()); |
Milo Lin | 0ddb778 | 2022-08-17 20:40:43 -0700 | [diff] [blame] | 27 | } |
milind-u | c6e437a | 2023-03-01 23:40:40 -0800 | [diff] [blame] | 28 | |
| 29 | // TODO(milind): add more tests, the above one doesn't |
| 30 | // catch an error like forgetting to add a forwarded message to |
| 31 | // the destination node's config. |