@@ -12,13 +12,15 @@ fn add_empty_result_error_explanation(error_details: &str) -> String {
1212
1313/// Validates that walltime results exist and contain at least one benchmark.
1414/// When `allow_empty` is true, empty benchmark results are allowed.
15- pub fn validate_walltime_results ( profile_folder : & Path , allow_empty : bool ) -> Result < ( ) > {
15+ ///
16+ /// Returns `Ok(true)` if valid results are found, `Ok(false)` if no results are found but `allow_empty` is true
17+ pub fn validate_walltime_results ( profile_folder : & Path , allow_empty : bool ) -> Result < bool > {
1618 let results_dir = profile_folder. join ( "results" ) ;
1719
1820 if !results_dir. exists ( ) {
1921 if allow_empty {
2022 warn ! ( "No walltime results found in profile folder: {results_dir:?}." ) ;
21- return Ok ( ( ) ) ;
23+ return Ok ( false ) ;
2224 }
2325 bail ! ( add_empty_result_error_explanation( & format!(
2426 "No walltime results found in profile folder: {results_dir:?}."
@@ -64,14 +66,14 @@ pub fn validate_walltime_results(profile_folder: &Path, allow_empty: bool) -> Re
6466 if !found_benchmark_results {
6567 if allow_empty {
6668 warn ! ( "No JSON result files found in: {results_dir:?}." ) ;
67- return Ok ( ( ) ) ;
69+ return Ok ( false ) ;
6870 }
6971 bail ! ( add_empty_result_error_explanation( & format!(
7072 "No JSON result files found in: {results_dir:?}."
7173 ) ) ) ;
7274 }
7375
74- Ok ( ( ) )
76+ Ok ( true )
7577}
7678
7779#[ cfg( test) ]
@@ -188,6 +190,7 @@ mod tests {
188190
189191 let result = validate_walltime_results ( profile. path ( ) , false ) ;
190192 assert ! ( result. is_ok( ) ) ;
193+ assert ! ( result. unwrap( ) ) ;
191194 }
192195
193196 #[ test]
@@ -198,6 +201,7 @@ mod tests {
198201
199202 let result = validate_walltime_results ( profile. path ( ) , false ) ;
200203 assert ! ( result. is_ok( ) ) ;
204+ assert ! ( result. unwrap( ) ) ;
201205 }
202206
203207 #[ test]
@@ -209,6 +213,7 @@ mod tests {
209213
210214 let result = validate_walltime_results ( profile. path ( ) , false ) ;
211215 assert ! ( result. is_ok( ) ) ;
216+ assert ! ( result. unwrap( ) ) ;
212217 }
213218
214219 // Failure cases
@@ -290,6 +295,7 @@ mod tests {
290295
291296 let result = validate_walltime_results ( profile. path ( ) , true ) ;
292297 assert ! ( result. is_ok( ) ) ;
298+ assert ! ( !result. unwrap( ) ) ;
293299 }
294300
295301 #[ test]
@@ -299,6 +305,7 @@ mod tests {
299305
300306 let result = validate_walltime_results ( profile. path ( ) , true ) ;
301307 assert ! ( result. is_ok( ) ) ;
308+ assert ! ( !result. unwrap( ) ) ;
302309 }
303310
304311 #[ test]
@@ -308,5 +315,6 @@ mod tests {
308315
309316 let result = validate_walltime_results ( profile. path ( ) , true ) ;
310317 assert ! ( result. is_ok( ) ) ;
318+ assert ! ( !result. unwrap( ) ) ;
311319 }
312320}
0 commit comments