From patchwork Thu Jun 6 07:15:30 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrew Donnellan X-Patchwork-Id: 1110906 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.ozlabs.org (lists.ozlabs.org [203.11.71.2]) (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 45KH4v1zs6z9sDX for ; Thu, 6 Jun 2019 17:15:59 +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 45KH4t5JgjzDqg6 for ; Thu, 6 Jun 2019 17:15:58 +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.158.5; 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 (mx0b-001b2d01.pphosted.com [148.163.158.5]) (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 45KH4l0TX8zDqfp for ; Thu, 6 Jun 2019 17:15:50 +1000 (AEST) Received: from pps.filterd (m0098416.ppops.net [127.0.0.1]) by mx0b-001b2d01.pphosted.com (8.16.0.27/8.16.0.27) with SMTP id x566wecQ075927 for ; Thu, 6 Jun 2019 03:15:45 -0400 Received: from e06smtp02.uk.ibm.com (e06smtp02.uk.ibm.com [195.75.94.98]) by mx0b-001b2d01.pphosted.com with ESMTP id 2sxv7edcqv-1 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=NOT) for ; Thu, 06 Jun 2019 03:15:45 -0400 Received: from localhost by e06smtp02.uk.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Thu, 6 Jun 2019 08:15:44 +0100 Received: from b06cxnps4076.portsmouth.uk.ibm.com (9.149.109.198) by e06smtp02.uk.ibm.com (192.168.101.132) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; (version=TLSv1/SSLv3 cipher=AES256-GCM-SHA384 bits=256/256) Thu, 6 Jun 2019 08:15:42 +0100 Received: from d06av22.portsmouth.uk.ibm.com (d06av22.portsmouth.uk.ibm.com [9.149.105.58]) by b06cxnps4076.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id x567FfMS49283226 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK) for ; Thu, 6 Jun 2019 07:15:41 GMT Received: from d06av22.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id D71524C044 for ; Thu, 6 Jun 2019 07:15:40 +0000 (GMT) Received: from d06av22.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 880124C06E for ; Thu, 6 Jun 2019 07:15:40 +0000 (GMT) Received: from ozlabs.au.ibm.com (unknown [9.192.253.14]) by d06av22.portsmouth.uk.ibm.com (Postfix) with ESMTP for ; Thu, 6 Jun 2019 07:15:40 +0000 (GMT) Received: from intelligence.ozlabs.ibm.com (unknown [9.102.62.69]) (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 C0064A01BD for ; Thu, 6 Jun 2019 17:15:37 +1000 (AEST) From: Andrew Donnellan To: snowpatch@lists.ozlabs.org Date: Thu, 6 Jun 2019 17:15:30 +1000 X-Mailer: git-send-email 2.20.1 MIME-Version: 1.0 X-TM-AS-GCONF: 00 x-cbid: 19060607-0008-0000-0000-000002F035B6 X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 19060607-0009-0000-0000-0000225D2087 Message-Id: <20190606071530.17869-1-ajd@linux.ibm.com> X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:, , definitions=2019-06-06_06:, , 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=643 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1810050000 definitions=main-1906060052 Subject: [snowpatch] [PATCH] main: Run multiple branch tests in parallel 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" Spawn multiple Jenkins tests for different branches in parallel for the same patch. This is very very simplistic but should significantly enhance Jenkins utilisation. Signed-off-by: Andrew Donnellan --- src/main.rs | 25 ++++++++++++++++++++----- 1 file changed, 20 insertions(+), 5 deletions(-) diff --git a/src/main.rs b/src/main.rs index 5ec0c37b2d7f..68ba9f9d5f47 100644 --- a/src/main.rs +++ b/src/main.rs @@ -208,6 +208,9 @@ fn test_patch( push_opts.remote_callbacks(push_callbacks); let mut successfully_applied = false; + + let mut test_threads = vec![]; + for branch_name in project.branches.clone() { let tag = format!("{}_{}", tag, branch_name); info!("Configuring local branch for {}.", tag); @@ -297,18 +300,30 @@ fn test_patch( &base, hefty_tests, ) - }) - .unwrap(); - results.append(&mut test.join().unwrap()); + }); - // Delete the remote branch now it's not needed any more - git::push_to_remote(&mut remote, &branch, true, &mut push_opts).unwrap(); + match test { + Ok(thread) => test_threads.push((thread, branch)), + Err(e) => { + error!("Error spawning thread: {}", e); + git::push_to_remote(&mut remote, &branch, true, &mut push_opts).unwrap(); + } + } if !test_all_branches { break; } } + // Wait for results + for (thread, branch) in test_threads { + results.append(&mut thread.join().unwrap()); + + // Delete the remote branch now it's not needed any more + git::push_to_remote(&mut remote, &branch, true, &mut push_opts).unwrap(); + } + + if !successfully_applied { results.push(TestResult { state: TestState::Fail,