Loads, parses, and validates one `.suite` file. The suite file path and containing directory are stored on the returned config so later discovery can be resolved relative to the suite file.
(path: impl AsRef<Path>)
| 104 | /// The suite file path and containing directory are stored on the returned |
| 105 | /// config so later discovery can be resolved relative to the suite file. |
| 106 | pub fn from_file(path: impl AsRef<Path>) -> Result<Self> { |
| 107 | let suite_path = path.as_ref().to_path_buf(); |
| 108 | let contents = fs::read_to_string(&suite_path).map_err(|e| { |
| 109 | DataFusionError::External( |
| 110 | format!("failed to read suite file {}: {e}", suite_path.display()).into(), |
| 111 | ) |
| 112 | })?; |
| 113 | let mut suite: Self = toml::from_str(&contents).map_err(|e| { |
| 114 | DataFusionError::External( |
| 115 | format!("failed to parse suite file {}: {e}", suite_path.display()) |
| 116 | .into(), |
| 117 | ) |
| 118 | })?; |
| 119 | |
| 120 | suite.suite_dir = suite_path |
| 121 | .parent() |
| 122 | .map(Path::to_path_buf) |
| 123 | .unwrap_or_else(|| PathBuf::from(".")); |
| 124 | suite.suite_path = suite_path; |
| 125 | suite.validate()?; |
| 126 | |
| 127 | Ok(suite) |
| 128 | } |
| 129 | |
| 130 | /// Returns the directory recursively searched for query benchmark files. |
| 131 | pub fn query_search_root(&self) -> &Path { |