From 9420cb5c18d3e32ab3c1e1cf695a246d16be5891 Mon Sep 17 00:00:00 2001 From: Graham Christensen Date: Sat, 17 Mar 2018 10:47:10 -0400 Subject: [PATCH 1/2] clarify what _no_ log means: not a partial loog --- ofborg/src/tasks/githubcommentposter.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/ofborg/src/tasks/githubcommentposter.rs b/ofborg/src/tasks/githubcommentposter.rs index a98a5e4..306c2c4 100644 --- a/ofborg/src/tasks/githubcommentposter.rs +++ b/ofborg/src/tasks/githubcommentposter.rs @@ -113,7 +113,7 @@ fn result_to_comment(result: &BuildResult) -> String { if result.output.len() > 0 { reply.extend(partial_log_segment(&result.output)); } else { - reply.push("No log is available.".to_owned()); + reply.push("No partial log is available.".to_owned()); reply.push("".to_owned()); } @@ -416,7 +416,7 @@ patching script interpreter paths in /nix/store/pcja75y9isdvgz5i00pkrpif9rxzxc29 The following builds were skipped because they don't evaluate on x86_64-linux: not-attempted -No log is available. +No partial log is available. " ); } From 29fadfaa4b08dc5c5f3f48bee0cd9a2828b6d8d4 Mon Sep 17 00:00:00 2001 From: Graham Christensen Date: Sat, 17 Mar 2018 13:25:06 -0400 Subject: [PATCH 2/2] Extract the file to lines function --- ofborg/src/nix.rs | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/ofborg/src/nix.rs b/ofborg/src/nix.rs index a163db7..32b7520 100644 --- a/ofborg/src/nix.rs +++ b/ofborg/src/nix.rs @@ -291,6 +291,15 @@ mod tests { Fail, } + fn lines_from_file(file: File) -> Vec { + BufReader::new(file) + .lines() + .into_iter() + .filter(|line| line.is_ok()) + .map(|line| line.unwrap()) + .collect() + } + fn assert_run(res: Result, expected: Expect, require: Vec<&str>) { let expectation_held: bool = match expected { Expect::Pass => res.is_ok(), @@ -302,12 +311,7 @@ mod tests { Err(file) => file, }; - let lines: Vec = BufReader::new(file) - .lines() - .into_iter() - .filter(|line| line.is_ok()) - .map(|line| line.unwrap()) - .collect(); + let lines = lines_from_file(file); let buildlog = lines .into_iter()