Lines Matching +full:test +full:- +full:config

36 #include "utils/config/exceptions.hpp"
37 #include "utils/config/nodes.ipp"
38 #include "utils/config/tree.ipp"
51 namespace config = utils::config;
67 static optional< config::tree > defaults;
71 class bytes_node : public config::native_leaf_node< units::bytes > {
75 /// \return A dynamically-allocated node.
80 new_node->_value = _value; in deep_copy()
101 class delta_node : public config::typed_leaf_node< datetime::delta > {
105 /// \return A dynamically-allocated node.
110 new_node->_value = _value; in deep_copy()
126 throw config::value_error(F("Invalid time delta %s") % raw_value); in set_string()
162 class user_node : public config::string_node {
165 /// \return A dynamically-allocated node.
170 new_node->_value = _value; in deep_copy()
178 /// \throw config::value_error If the value is not valid.
183 throw config::value_error("Invalid required user value"); in validate()
193 class paths_set_node : public config::base_set_node< fs::path > {
196 /// \return A dynamically-allocated node.
201 new_node->_value = _value; in deep_copy()
211 /// \throw config::value_error If the value is invalid.
218 throw config::value_error(e.what()); in parse_one()
226 /// \throw config::value_error If the value is not valid.
234 throw config::value_error(F("Relative path '%s' not allowed") % in validate()
241 /// Initializes a tree to hold test case requirements.
245 init_tree(config::tree& tree) in init_tree()
247 tree.define< config::strings_set_node >("allowed_architectures"); in init_tree()
248 tree.define< config::strings_set_node >("allowed_platforms"); in init_tree()
250 tree.define< config::string_node >("description"); in init_tree()
251 tree.define< config::string_node >("execenv"); in init_tree()
252 tree.define< config::string_node >("execenv_jail_params"); in init_tree()
253 tree.define< config::bool_node >("has_cleanup"); in init_tree()
254 tree.define< config::bool_node >("is_exclusive"); in init_tree()
255 tree.define< config::strings_set_node >("required_configs"); in init_tree()
269 set_defaults(config::tree& tree) in set_defaults()
271 tree.set< config::strings_set_node >("allowed_architectures", in set_defaults()
273 tree.set< config::strings_set_node >("allowed_platforms", in set_defaults()
275 tree.set< config::string_node >("description", ""); in set_defaults()
276 tree.set< config::string_node >("execenv", ""); in set_defaults()
277 tree.set< config::string_node >("execenv_jail_params", ""); in set_defaults()
278 tree.set< config::bool_node >("has_cleanup", false); in set_defaults()
279 tree.set< config::bool_node >("is_exclusive", false); in set_defaults()
280 tree.set< config::strings_set_node >("required_configs", in set_defaults()
297 const config::tree&
301 config::tree props; in get_defaults()
316 /// \return A read-write reference to the value in the node.
321 lookup_rw(config::tree& tree, const std::string& key) in lookup_rw()
325 } catch (const config::unknown_key_error& e) { in lookup_rw()
327 } catch (const config::value_error& e) { in lookup_rw()
344 set(config::tree& tree, const std::string& key, in set()
349 } catch (const config::unknown_key_error& e) { in set()
351 } catch (const config::value_error& e) { in set()
364 config::tree props;
368 /// \param props_ Metadata properties of the test.
369 impl(const utils::config::tree& props_) : in impl()
390 /// \param props Metadata properties of the test.
391 model::metadata::metadata(const utils::config::tree& props) : in metadata()
412 return metadata(_pimpl->props.combine(overrides._pimpl->props)); in apply_overrides()
416 /// Returns the architectures allowed by the test.
422 if (_pimpl->props.is_set("allowed_architectures")) { in allowed_architectures()
423 return _pimpl->props.lookup< config::strings_set_node >( in allowed_architectures()
426 return get_defaults().lookup< config::strings_set_node >( in allowed_architectures()
432 /// Returns the platforms allowed by the test.
438 if (_pimpl->props.is_set("allowed_platforms")) { in allowed_platforms()
439 return _pimpl->props.lookup< config::strings_set_node >( in allowed_platforms()
442 return get_defaults().lookup< config::strings_set_node >( in allowed_platforms()
448 /// Returns all the user-defined metadata properties.
454 return _pimpl->props.all_properties("custom", true); in custom()
458 /// Returns the description of the test.
464 if (_pimpl->props.is_set("description")) { in description()
465 return _pimpl->props.lookup< config::string_node >("description"); in description()
467 return get_defaults().lookup< config::string_node >("description"); in description()
478 if (_pimpl->props.is_set("execenv")) { in execenv()
479 return _pimpl->props.lookup< config::string_node >("execenv"); in execenv()
481 return get_defaults().lookup< config::string_node >("execenv"); in execenv()
486 /// Returns execenv jail(8) parameters string to run a test with.
492 if (_pimpl->props.is_set("execenv_jail_params")) { in execenv_jail_params()
493 return _pimpl->props.lookup< config::string_node >( in execenv_jail_params()
496 return get_defaults().lookup< config::string_node >( in execenv_jail_params()
502 /// Returns whether the test has a cleanup part or not.
508 if (_pimpl->props.is_set("has_cleanup")) { in has_cleanup()
509 return _pimpl->props.lookup< config::bool_node >("has_cleanup"); in has_cleanup()
511 return get_defaults().lookup< config::bool_node >("has_cleanup"); in has_cleanup()
516 /// Returns whether the test has a specific execenv apart from default one.
518 /// \return True if there is a non-host execenv configured; false otherwise.
527 /// Returns whether the test is exclusive or not.
529 /// \return True if the test has to be run on its own, not concurrently with any
534 if (_pimpl->props.is_set("is_exclusive")) { in is_exclusive()
535 return _pimpl->props.lookup< config::bool_node >("is_exclusive"); in is_exclusive()
537 return get_defaults().lookup< config::bool_node >("is_exclusive"); in is_exclusive()
542 /// Returns the list of configuration variables needed by the test.
548 if (_pimpl->props.is_set("required_configs")) { in required_configs()
549 return _pimpl->props.lookup< config::strings_set_node >( in required_configs()
552 return get_defaults().lookup< config::strings_set_node >( in required_configs()
558 /// Returns the amount of free disk space required by the test.
564 if (_pimpl->props.is_set("required_disk_space")) { in required_disk_space()
565 return _pimpl->props.lookup< bytes_node >("required_disk_space"); in required_disk_space()
572 /// Returns the list of files needed by the test.
578 if (_pimpl->props.is_set("required_files")) { in required_files()
579 return _pimpl->props.lookup< paths_set_node >("required_files"); in required_files()
586 /// Returns the amount of memory required by the test.
592 if (_pimpl->props.is_set("required_memory")) { in required_memory()
593 return _pimpl->props.lookup< bytes_node >("required_memory"); in required_memory()
600 /// Returns the list of programs needed by the test.
606 if (_pimpl->props.is_set("required_programs")) { in required_programs()
607 return _pimpl->props.lookup< paths_set_node >("required_programs"); in required_programs()
614 /// Returns the user required by the test.
620 if (_pimpl->props.is_set("required_user")) { in required_user()
621 return _pimpl->props.lookup< user_node >("required_user"); in required_user()
628 /// Returns the timeout of the test.
635 if (_pimpl->props.is_set("timeout")) { in timeout()
636 return _pimpl->props.lookup< delta_node >("timeout"); in timeout()
649 const config::tree fully_specified = get_defaults().combine(_pimpl->props); in to_properties()
708 config::tree props;
724 props(base._pimpl->props.deep_copy()), in impl()
761 if (!_pimpl->props.is_set("allowed_architectures")) { in add_allowed_architecture()
762 _pimpl->props.set< config::strings_set_node >( in add_allowed_architecture()
764 get_defaults().lookup< config::strings_set_node >( in add_allowed_architecture()
767 lookup_rw< config::strings_set_node >( in add_allowed_architecture()
768 _pimpl->props, "allowed_architectures").insert(arch); in add_allowed_architecture()
783 if (!_pimpl->props.is_set("allowed_platforms")) { in add_allowed_platform()
784 _pimpl->props.set< config::strings_set_node >( in add_allowed_platform()
786 get_defaults().lookup< config::strings_set_node >( in add_allowed_platform()
789 lookup_rw< config::strings_set_node >( in add_allowed_platform()
790 _pimpl->props, "allowed_platforms").insert(platform); in add_allowed_platform()
795 /// Accumulates a single user-defined property.
807 _pimpl->props.set_string(F("custom.%s") % key, value); in add_custom()
822 if (!_pimpl->props.is_set("required_configs")) { in add_required_config()
823 _pimpl->props.set< config::strings_set_node >( in add_required_config()
825 get_defaults().lookup< config::strings_set_node >( in add_required_config()
828 lookup_rw< config::strings_set_node >( in add_required_config()
829 _pimpl->props, "required_configs").insert(var); in add_required_config()
844 if (!_pimpl->props.is_set("required_files")) { in add_required_file()
845 _pimpl->props.set< paths_set_node >( in add_required_file()
849 lookup_rw< paths_set_node >(_pimpl->props, "required_files").insert(path); in add_required_file()
864 if (!_pimpl->props.is_set("required_programs")) { in add_required_program()
865 _pimpl->props.set< paths_set_node >( in add_required_program()
869 lookup_rw< paths_set_node >(_pimpl->props, in add_required_program()
875 /// Sets the architectures allowed by the test.
886 set< config::strings_set_node >(_pimpl->props, "allowed_architectures", as); in set_allowed_architectures()
891 /// Sets the platforms allowed by the test.
901 set< config::strings_set_node >(_pimpl->props, "allowed_platforms", ps); in set_allowed_platforms()
906 /// Sets the user-defined properties.
918 _pimpl->props.set_string(F("custom.%s") % (*iter).first, in set_custom()
924 /// Sets the description of the test.
926 /// \param description Textual description of the test.
934 set< config::string_node >(_pimpl->props, "description", description); in set_description()
949 set< config::string_node >(_pimpl->props, "execenv", name); in set_execenv()
954 /// Sets execenv jail(8) parameters string to run the test with.
964 set< config::string_node >(_pimpl->props, "execenv_jail_params", params); in set_execenv_jail_params()
969 /// Sets whether the test has a cleanup part or not.
971 /// \param cleanup True if the test has a cleanup part; false otherwise.
979 set< config::bool_node >(_pimpl->props, "has_cleanup", cleanup); in set_has_cleanup()
984 /// Sets whether the test is exclusive or not.
986 /// \param exclusive True if the test is exclusive; false otherwise.
994 set< config::bool_node >(_pimpl->props, "is_exclusive", exclusive); in set_is_exclusive()
999 /// Sets the list of configuration variables needed by the test.
1009 set< config::strings_set_node >(_pimpl->props, "required_configs", vars); in set_required_configs()
1014 /// Sets the amount of free disk space required by the test.
1024 set< bytes_node >(_pimpl->props, "required_disk_space", bytes); in set_required_disk_space()
1029 /// Sets the list of files needed by the test.
1039 set< paths_set_node >(_pimpl->props, "required_files", files); in set_required_files()
1044 /// Sets the amount of memory required by the test.
1054 set< bytes_node >(_pimpl->props, "required_memory", bytes); in set_required_memory()
1059 /// Sets the list of programs needed by the test.
1069 set< paths_set_node >(_pimpl->props, "required_programs", progs); in set_required_programs()
1074 /// Sets the user required by the test.
1084 set< user_node >(_pimpl->props, "required_user", user); in set_required_user()
1102 _pimpl->props.set_string(key, value); in set_string()
1103 } catch (const config::unknown_key_error& e) { in set_string()
1105 } catch (const config::value_error& e) { in set_string()
1113 /// Sets the timeout of the test.
1123 set< delta_node >(_pimpl->props, "timeout", timeout); in set_timeout()
1140 PRE(!_pimpl->built); in build()
1141 _pimpl->built = true; in build()
1143 return metadata(_pimpl->props); in build()