blob: df21ba03c7ba6a7fb4cbdde64d81fe55c5f649ce [file] [log] [blame]
Milo Lin0ddb7782022-08-17 20:40:43 -07001#include "aos/json_to_flatbuffer.h"
James Kuszmaul827bd212023-05-15 23:57:39 -07002#include "aos/util/config_validator_lib.h"
Milo Lin0ddb7782022-08-17 20:40:43 -07003
milind-uc6e437a2023-03-01 23:40:40 -08004DEFINE_string(config, "", "Name of the config file to replay using.");
James Kuszmaul827bd212023-05-15 23:57:39 -07005DEFINE_string(validation_config, "{}",
6 "JSON config to use to validate the config.");
Milo Lin0ddb7782022-08-17 20:40:43 -07007/* 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-uc6e437a2023-03-01 23:40:40 -080014 iterating through it with a for loop creating a logger for
15 each one
Milo Lin0ddb7782022-08-17 20:40:43 -070016 Reference superstructure_lib_test.cc*/
17TEST(ConfigValidatorTest, ReadConfig) {
18 ASSERT_TRUE(!FLAGS_config.empty());
19 const aos::FlatbufferDetachedBuffer<aos::Configuration> config =
20 aos::configuration::ReadConfig(FLAGS_config);
21
James Kuszmaul827bd212023-05-15 23:57:39 -070022 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 Lin0ddb7782022-08-17 20:40:43 -070027}
milind-uc6e437a2023-03-01 23:40:40 -080028
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.