[snowpatch] [PATCH] Include branch name in test results sent to Patchwork
Andrew Donnellan
andrew.donnellan at au1.ibm.com
Wed Apr 20 18:56:23 AEST 2016
If a project is configured to test on multiple branches and a patch applies
to more than one base branch, only one result for each Jenkins job will
appear in Patchwork since the test name is the same.
Reformat the Patchwork test names to be of the format "branch/test_name" so
we can distinguish between different base branches.
Closes: #25 ("Test names sent to Patchwork need to differ per branch")
Reported-by: Russell Currey <ruscur at russell.cc>
Signed-off-by: Andrew Donnellan <andrew.donnellan at au1.ibm.com>
---
src/main.rs | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/src/main.rs b/src/main.rs
index d0177af..e9c2035 100644
--- a/src/main.rs
+++ b/src/main.rs
@@ -79,7 +79,7 @@ struct Args {
flag_project: String,
}
-fn run_tests(settings: &Config, project: &Project, tag: &str) -> Vec<TestResult> {
+fn run_tests(settings: &Config, project: &Project, tag: &str, branch_name: &str) -> Vec<TestResult> {
let mut results: Vec<TestResult> = Vec::new();
let jenkins = JenkinsBackend { base_url: &settings.jenkins.url };
let project = project.clone();
@@ -112,7 +112,7 @@ fn run_tests(settings: &Config, project: &Project, tag: &str) -> Vec<TestResult>
jenkins.wait_build(&build_url_real);
println!("Job done!");
results.push(TestResult {
- test_name: job_name.to_string(),
+ test_name: format!("{}/{}", branch_name.to_string(), job_name.to_string()),
state: TestState::SUCCESS.string(), // TODO: get this from Jenkins
url: None, // TODO: link to Jenkins job log
summary: Some("TODO: get this summary from Jenkins".to_string()),
@@ -201,7 +201,7 @@ fn test_patch(settings: &Config, project: &Project, path: &Path) -> Vec<TestResu
// We've set up a remote branch, time to kick off tests
let test = thread::Builder::new().name(tag.to_string()).spawn(move || {
- return run_tests(&settings_clone, &project, &tag);
+ return run_tests(&settings_clone, &project, &tag, &branch_name);
}).unwrap();
results.append(&mut test.join().unwrap());
--
Andrew Donnellan OzLabs, ADL Canberra
andrew.donnellan at au1.ibm.com IBM Australia Limited
More information about the snowpatch
mailing list