James Kuszmaul | fa398af | 2023-05-16 20:27:39 -0700 | [diff] [blame^] | 1 | def config_validator_test(name, config, logger_sets = [{}], check_for_not_logged_channels = False, extension = ".bfbs", visibility = None): |
Milo Lin | 0ddb778 | 2022-08-17 20:40:43 -0700 | [diff] [blame] | 2 | ''' |
| 3 | Macro to take a config and pass it to the config validator to validate that it will work on a real system. |
| 4 | |
Milo Lin | 0ddb778 | 2022-08-17 20:40:43 -0700 | [diff] [blame] | 5 | Args: |
| 6 | name: name that the config validator uses, e.g. "test_config", |
| 7 | config: config rule that needs to be validated, e.g. "//aos/events:pingpong_config", |
| 8 | ''' |
milind-u | c6e437a | 2023-03-01 23:40:40 -0800 | [diff] [blame] | 9 | config_file = config + extension |
James Kuszmaul | 827bd21 | 2023-05-15 23:57:39 -0700 | [diff] [blame] | 10 | config_json = json.encode({"logging": {"all_channels_logged": check_for_not_logged_channels, "logger_sets": logger_sets}}) |
James Kuszmaul | fa398af | 2023-05-16 20:27:39 -0700 | [diff] [blame^] | 11 | native.cc_test( |
Milo Lin | 0ddb778 | 2022-08-17 20:40:43 -0700 | [diff] [blame] | 12 | name = name, |
James Kuszmaul | fa398af | 2023-05-16 20:27:39 -0700 | [diff] [blame^] | 13 | deps = ["//aos/util:config_validator"], |
| 14 | args = ["--config=$(location %s)" % config_file, "--validation_config='%s'" % config_json], |
| 15 | data = [config_file], |
Milo Lin | 0ddb778 | 2022-08-17 20:40:43 -0700 | [diff] [blame] | 16 | visibility = visibility, |
| 17 | ) |