From patchwork Wed Jul 10 01:30:29 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrew Donnellan X-Patchwork-Id: 1130108 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.ozlabs.org (lists.ozlabs.org [IPv6:2401:3900:2:1::3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 45k1pz25qwz9sNT for ; Wed, 10 Jul 2019 11:30:51 +1000 (AEST) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=linux.ibm.com Received: from lists.ozlabs.org (lists.ozlabs.org [IPv6:2401:3900:2:1::3]) by lists.ozlabs.org (Postfix) with ESMTP id 45k1pz0Vn1zDqYj for ; Wed, 10 Jul 2019 11:30:51 +1000 (AEST) X-Original-To: snowpatch@lists.ozlabs.org Delivered-To: snowpatch@lists.ozlabs.org Authentication-Results: lists.ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=linux.ibm.com (client-ip=148.163.156.1; helo=mx0a-001b2d01.pphosted.com; envelope-from=ajd@linux.ibm.com; receiver=) Authentication-Results: lists.ozlabs.org; dmarc=none (p=none dis=none) header.from=linux.ibm.com Received: from mx0a-001b2d01.pphosted.com (mx0a-001b2d01.pphosted.com [148.163.156.1]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by lists.ozlabs.org (Postfix) with ESMTPS id 45k1ps72FCzDqY6 for ; Wed, 10 Jul 2019 11:30:45 +1000 (AEST) Received: from pps.filterd (m0098399.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.16.0.27/8.16.0.27) with SMTP id x6A1RLPc139717 for ; Tue, 9 Jul 2019 21:30:42 -0400 Received: from e06smtp07.uk.ibm.com (e06smtp07.uk.ibm.com [195.75.94.103]) by mx0a-001b2d01.pphosted.com with ESMTP id 2tn5n89d4b-1 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=NOT) for ; Tue, 09 Jul 2019 21:30:42 -0400 Received: from localhost by e06smtp07.uk.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Wed, 10 Jul 2019 02:30:40 +0100 Received: from b06cxnps4076.portsmouth.uk.ibm.com (9.149.109.198) by e06smtp07.uk.ibm.com (192.168.101.137) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; (version=TLSv1/SSLv3 cipher=AES256-GCM-SHA384 bits=256/256) Wed, 10 Jul 2019 02:30:39 +0100 Received: from d06av23.portsmouth.uk.ibm.com (d06av23.portsmouth.uk.ibm.com [9.149.105.59]) by b06cxnps4076.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id x6A1Ucdh53608468 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Wed, 10 Jul 2019 01:30:38 GMT Received: from d06av23.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 318F8A4040; Wed, 10 Jul 2019 01:30:38 +0000 (GMT) Received: from d06av23.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id D0017A4053; Wed, 10 Jul 2019 01:30:37 +0000 (GMT) Received: from ozlabs.au.ibm.com (unknown [9.192.253.14]) by d06av23.portsmouth.uk.ibm.com (Postfix) with ESMTP; Wed, 10 Jul 2019 01:30:37 +0000 (GMT) Received: from intelligence.bha-au.ibmmobiledemo.com (unknown [9.81.199.194]) (using TLSv1.2 with cipher DHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by ozlabs.au.ibm.com (Postfix) with ESMTPSA id 8B176A039D; Wed, 10 Jul 2019 11:30:36 +1000 (AEST) From: Andrew Donnellan To: snowpatch@lists.ozlabs.org Date: Wed, 10 Jul 2019 11:30:29 +1000 X-Mailer: git-send-email 2.20.1 MIME-Version: 1.0 X-TM-AS-GCONF: 00 x-cbid: 19071001-0028-0000-0000-0000038274EE X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 19071001-0029-0000-0000-000024428323 Message-Id: <20190710013029.8104-1-ajd@linux.ibm.com> X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:, , definitions=2019-07-10_01:, , signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 priorityscore=1501 malwarescore=0 suspectscore=1 phishscore=0 bulkscore=0 spamscore=0 clxscore=1015 lowpriorityscore=0 mlxscore=0 impostorscore=0 mlxlogscore=999 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1810050000 definitions=main-1907100016 Subject: [snowpatch] [PATCH] Use dyn Trait to fix build on Rust beta X-BeenThere: snowpatch@lists.ozlabs.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Continuous Integration for patch-based workflows List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: snowpatch-bounces+incoming=patchwork.ozlabs.org@lists.ozlabs.org Sender: "snowpatch" Signed-off-by: Andrew Donnellan --- src/ci.rs | 6 +++--- src/jenkins.rs | 10 +++++----- src/main.rs | 4 ++-- src/settings.rs | 4 ++-- 4 files changed, 12 insertions(+), 12 deletions(-) diff --git a/src/ci.rs b/src/ci.rs index 82af1594f2c7..c455721aec36 100644 --- a/src/ci.rs +++ b/src/ci.rs @@ -28,10 +28,10 @@ pub enum BuildStatus { pub trait CIBackend { fn start_test(&self, job_name: &str, params: Vec<(&str, &str)>) -> Result; - fn get_build_handle(&self, build_queue_entry: &str) -> Result>; - fn get_build_result(&self, build_handle: &str) -> Result>; + fn get_build_handle(&self, build_queue_entry: &str) -> Result>; + fn get_build_result(&self, build_handle: &str) -> Result>; fn get_results_url(&self, build_handle: &str, job: &BTreeMap) -> String; fn get_description(&self, build_handle: &str, job: &BTreeMap) -> Option; - fn wait_build(&self, build_handle: &str) -> Result>; + fn wait_build(&self, build_handle: &str) -> Result>; } diff --git a/src/jenkins.rs b/src/jenkins.rs index b367e0db3a7a..d500fafb8afa 100644 --- a/src/jenkins.rs +++ b/src/jenkins.rs @@ -74,7 +74,7 @@ impl CIBackend for JenkinsBackend { } } - fn get_build_handle(&self, build_queue_entry: &str) -> Result> { + fn get_build_handle(&self, build_queue_entry: &str) -> Result> { loop { let entry = self.get_api_json_object(build_queue_entry)?; match entry.get("executable") { @@ -95,7 +95,7 @@ impl CIBackend for JenkinsBackend { } } - fn get_build_result(&self, build_handle: &str) -> Result> { + fn get_build_result(&self, build_handle: &str) -> Result> { match self .get_api_json_object(build_handle)? .get("result") @@ -157,7 +157,7 @@ impl CIBackend for JenkinsBackend { } } - fn wait_build(&self, build_handle: &str) -> Result> { + fn wait_build(&self, build_handle: &str) -> Result> { // TODO: Implement a timeout? while self.get_build_status(build_handle)? != BuildStatus::Done { sleep(Duration::from_millis(JENKINS_POLLING_INTERVAL)); @@ -193,7 +193,7 @@ impl JenkinsBackend { self.reqwest_client.post(url).headers(self.headers()).send() } - fn get_api_json_object(&self, base_url: &str) -> Result> { + fn get_api_json_object(&self, base_url: &str) -> Result> { let url = format!("{}api/json", base_url); let mut result_str = String::new(); loop { @@ -220,7 +220,7 @@ impl JenkinsBackend { .map_err(|e| format!("Couldn't parse JSON from Jenkins: {}", e).into()) } - pub fn get_build_status(&self, build_handle: &str) -> Result> { + pub fn get_build_status(&self, build_handle: &str) -> Result> { match self.get_api_json_object(build_handle)?["building"].as_bool() { Some(true) => Ok(BuildStatus::Running), Some(false) => Ok(BuildStatus::Done), diff --git a/src/main.rs b/src/main.rs index ea09b07969ba..af5459a12cd4 100644 --- a/src/main.rs +++ b/src/main.rs @@ -103,7 +103,7 @@ struct Args { } fn run_test( - backend: &CIBackend, + backend: &dyn CIBackend, project: &Project, tag: &str, branch_name: &str, @@ -329,7 +329,7 @@ fn test_patch( feature = "cargo-clippy", allow(clippy::cyclomatic_complexity, clippy::cognitive_complexity) )] -fn run() -> Result<(), Box> { +fn run() -> Result<(), Box> { // TODO: env_logger probably has a neater way to set defaults let mut log_builder = Builder::new(); // By default, log at the "info" level for every module diff --git a/src/settings.rs b/src/settings.rs index 40ac67cccf58..e20d2e856834 100644 --- a/src/settings.rs +++ b/src/settings.rs @@ -197,7 +197,7 @@ pub struct Config { pub projects: BTreeMap, } -pub fn parse(path: &str) -> Result> { +pub fn parse(path: &str) -> Result> { let mut toml_config = String::new(); File::open(&path) @@ -224,7 +224,7 @@ mod test { } #[test] - fn parse_example_openpower() -> Result<(), Box> { + fn parse_example_openpower() -> Result<(), Box> { parse("examples/openpower.toml").map(|_| ()) }