diff mbox series

[7/8] Implement sending results to Patchwork for --patch

Message ID 20180720115728.19312-7-ruscur@russell.cc
State Accepted
Headers show
Series [1/8] Convert from hyper to reqwest | expand

Commit Message

Russell Currey July 20, 2018, 11:57 a.m. UTC
Signed-off-by: Russell Currey <ruscur@russell.cc>
---
 src/main.rs | 11 ++++++++++-
 1 file changed, 10 insertions(+), 1 deletion(-)

Comments

Andrew Donnellan July 23, 2018, 1:16 a.m. UTC | #1
On 20/07/18 21:57, Russell Currey wrote:
> Signed-off-by: Russell Currey <ruscur@russell.cc>

Looks good to me

Reviewed-by: Andrew Donnellan <andrew.donnellan@au1.ibm.com>

> ---
>   src/main.rs | 11 ++++++++++-
>   1 file changed, 10 insertions(+), 1 deletion(-)
> 
> diff --git a/src/main.rs b/src/main.rs
> index 5d34b36..e3b36f2 100644
> --- a/src/main.rs
> +++ b/src/main.rs
> @@ -374,7 +374,16 @@ fn main() {
>               Some(project) => {
>                   let dependencies = patchwork.get_patch_dependencies(&patch);
>                   let mbox = patchwork.get_patches_mbox(dependencies);
> -                test_patch(&settings, &client, project, &mbox, true);
> +                let results = test_patch(&settings, &client, project, &mbox, true);
> +
> +                // Delete the temporary directory with the patch in it
> +                fs::remove_dir_all(mbox.parent().unwrap())
> +                    .unwrap_or_else(|err| error!("Couldn't delete temp directory: {}", err));
> +                if project.push_results {
> +                    for result in results {
> +                        patchwork.post_test_result(result, &patch.checks).unwrap();
> +                    }
> +                }
>               }
>           }
>           return;
>
diff mbox series

Patch

diff --git a/src/main.rs b/src/main.rs
index 5d34b36..e3b36f2 100644
--- a/src/main.rs
+++ b/src/main.rs
@@ -374,7 +374,16 @@  fn main() {
             Some(project) => {
                 let dependencies = patchwork.get_patch_dependencies(&patch);
                 let mbox = patchwork.get_patches_mbox(dependencies);
-                test_patch(&settings, &client, project, &mbox, true);
+                let results = test_patch(&settings, &client, project, &mbox, true);
+
+                // Delete the temporary directory with the patch in it
+                fs::remove_dir_all(mbox.parent().unwrap())
+                    .unwrap_or_else(|err| error!("Couldn't delete temp directory: {}", err));
+                if project.push_results {
+                    for result in results {
+                        patchwork.post_test_result(result, &patch.checks).unwrap();
+                    }
+                }
             }
         }
         return;