From patchwork Thu Feb 8 02:01:38 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrew Donnellan X-Patchwork-Id: 870704 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.2 with cipher ADH-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 3zcM3T2CrWz9t32 for ; Thu, 8 Feb 2018 13:05:25 +1100 (AEDT) Received: from bilbo.ozlabs.org (lists.ozlabs.org [IPv6:2401:3900:2:1::3]) by lists.ozlabs.org (Postfix) with ESMTP id 3zcM3S6qkVzF15t for ; Thu, 8 Feb 2018 13:05:24 +1100 (AEDT) X-Original-To: snowpatch@lists.ozlabs.org Delivered-To: snowpatch@lists.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=au1.ibm.com (client-ip=148.163.156.1; helo=mx0a-001b2d01.pphosted.com; envelope-from=andrew.donnellan@au1.ibm.com; receiver=) 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 3zcLzj2DLPzF15j for ; Thu, 8 Feb 2018 13:02:08 +1100 (AEDT) Received: from pps.filterd (m0098404.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.16.0.22/8.16.0.22) with SMTP id w18219Ao120952 for ; Wed, 7 Feb 2018 21:02:06 -0500 Received: from e06smtp13.uk.ibm.com (e06smtp13.uk.ibm.com [195.75.94.109]) by mx0a-001b2d01.pphosted.com with ESMTP id 2g0d9ur960-1 (version=TLSv1.2 cipher=AES256-SHA bits=256 verify=NOT) for ; Wed, 07 Feb 2018 21:02:05 -0500 Received: from localhost by e06smtp13.uk.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Thu, 8 Feb 2018 02:02:03 -0000 Received: from b06cxnps4075.portsmouth.uk.ibm.com (9.149.109.197) by e06smtp13.uk.ibm.com (192.168.101.143) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; Thu, 8 Feb 2018 02:02:01 -0000 Received: from d06av25.portsmouth.uk.ibm.com (d06av25.portsmouth.uk.ibm.com [9.149.105.61]) by b06cxnps4075.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id w18220Xa37289998; Thu, 8 Feb 2018 02:02:00 GMT Received: from d06av25.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id C068011C073; Thu, 8 Feb 2018 01:55:22 +0000 (GMT) Received: from d06av25.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 3054311C052; Thu, 8 Feb 2018 01:55:22 +0000 (GMT) Received: from ozlabs.au.ibm.com (unknown [9.192.253.14]) by d06av25.portsmouth.uk.ibm.com (Postfix) with ESMTP; Thu, 8 Feb 2018 01:55:22 +0000 (GMT) Received: from intelligence.ozlabs.ibm.com (haven.au.ibm.com [9.192.254.114]) (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 B15C3A025B; Thu, 8 Feb 2018 13:01:58 +1100 (AEDT) From: Andrew Donnellan To: snowpatch@lists.ozlabs.org Date: Thu, 8 Feb 2018 13:01:38 +1100 X-Mailer: git-send-email 2.11.0 In-Reply-To: <20180208020140.20903-1-andrew.donnellan@au1.ibm.com> References: <20180208020140.20903-1-andrew.donnellan@au1.ibm.com> X-TM-AS-GCONF: 00 x-cbid: 18020802-0012-0000-0000-000005AC83AC X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 18020802-0013-0000-0000-000019283C9B Message-Id: <20180208020140.20903-2-andrew.donnellan@au1.ibm.com> X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10432:, , definitions=2018-02-07_09:, , 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=1011 lowpriorityscore=0 impostorscore=0 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1709140000 definitions=main-1802080018 X-Mailman-Approved-At: Thu, 08 Feb 2018 13:05:20 +1100 Subject: [snowpatch] [PATCH 2/4] Hefty tests X-BeenThere: snowpatch@lists.ozlabs.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: Continuous Integration for patch-based workflows List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: snowpatch-bounces+incoming=patchwork.ozlabs.org@lists.ozlabs.org Sender: "snowpatch" From: Russell Currey Hefty tests are a method of defining a test that should not be run on every patch of a series. Testing every patch in a series can be a large resource commitment, and in a lot of cases should just be a smoke test for bisectability. If "hefty = true" is set in a job, then it will only be run on "complete" series - a single patch, or the last patch in a series and its dependencies. Signed-off-by: Russell Currey [ajd: rebase on serde and patchwork API changes] Signed-off-by: Andrew Donnellan --- examples/openpower.toml | 2 ++ src/main.rs | 24 +++++++++++++++++------- src/settings.rs | 10 ++++++++++ 3 files changed, 29 insertions(+), 7 deletions(-) diff --git a/examples/openpower.toml b/examples/openpower.toml index 98e383a5d606..c3aedc5f0a57 100644 --- a/examples/openpower.toml +++ b/examples/openpower.toml @@ -67,6 +67,7 @@ token = "33333333333333333333333333333333" remote = "GIT_REPO" branch = "GIT_REF" artifact = "snowpatch.txt" + hefty = true DEFCONFIG_TO_USE = "pseries_le_defconfig" [[projects.linuxppc-dev.jobs]] @@ -74,4 +75,5 @@ token = "33333333333333333333333333333333" remote = "GIT_REPO" branch = "GIT_REF" artifact = "snowpatch.txt" + hefty = false DEFCONFIG_TO_USE = "ppc64le_defconfig" diff --git a/src/main.rs b/src/main.rs index 2bdf2ac4b314..82beac6b2ab3 100644 --- a/src/main.rs +++ b/src/main.rs @@ -103,7 +103,7 @@ struct Args { } fn run_tests(settings: &Config, client: Arc, project: &Project, tag: &str, - branch_name: &str) -> Vec { + branch_name: &str, hefty_tests: bool) -> Vec { let mut results: Vec = Vec::new(); let jenkins = JenkinsBackend { base_url: settings.jenkins.url.clone(), @@ -113,6 +113,10 @@ fn run_tests(settings: &Config, client: Arc, project: &Project, tag: &st }; let project = project.clone(); for job in &project.jobs { + if !hefty_tests && job.hefty { + debug!("Skipping hefty test {}", job.title); + continue; + } let mut jenkins_params = Vec::<(&str, &str)>::new(); for (param_name, param_value) in job.parameters.iter() { // TODO(ajd): do this more neatly @@ -149,7 +153,8 @@ fn run_tests(settings: &Config, client: Arc, project: &Project, tag: &st results } -fn test_patch(settings: &Config, client: &Arc, project: &Project, path: &Path) -> Vec { +fn test_patch(settings: &Config, client: &Arc, project: &Project, + path: &Path, hefty_tests: bool) -> Vec { let repo = project.get_repo().unwrap(); let mut results: Vec = Vec::new(); if !path.is_file() { @@ -235,7 +240,8 @@ fn test_patch(settings: &Config, client: &Arc, project: &Project, path: // We've set up a remote branch, time to kick off tests let test = thread::Builder::new().name(tag.to_string()).spawn(move || { - run_tests(&settings_clone, client, &project, &tag, &branch_name) + run_tests(&settings_clone, client, &project, &tag, &branch_name, + hefty_tests) }).unwrap(); results.append(&mut test.join().unwrap()); @@ -317,7 +323,7 @@ fn main() { match settings.projects.get(&args.flag_project) { None => panic!("Couldn't find project {}", args.flag_project), Some(project) => { - test_patch(&settings, &client, project, patch); + test_patch(&settings, &client, project, patch, true); } } @@ -336,7 +342,7 @@ fn main() { } else { patchwork.get_patch_mbox(&patch) }; - test_patch(&settings, &client, project, &mbox); + test_patch(&settings, &client, project, &mbox, true); } } return; @@ -354,7 +360,7 @@ fn main() { Some(project) => { let dependencies = patchwork.get_patch_dependencies(&patch); let mbox = patchwork.get_patches_mbox(dependencies); - test_patch(&settings, &client, project, &mbox); + test_patch(&settings, &client, project, &mbox, true); } } return; @@ -401,6 +407,7 @@ fn main() { }, Some(project) => { // TODO(ajd): Refactor this. + let hefty_tests; let mbox = if patch.has_series() { debug!("Patch {} has a series at {}!", &patch.name, &patch.series[0].url); let series = patchwork.get_series_by_url(&patch.series[0].url); @@ -411,19 +418,22 @@ fn main() { continue; } let dependencies = patchwork.get_patch_dependencies(&patch); + hefty_tests = dependencies.len() == series.patches.len(); patchwork.get_patches_mbox(dependencies) }, Err(e) => { debug!("Series is not OK: {}", e); + hefty_tests = true; patchwork.get_patch_mbox(&patch) } } } else { + hefty_tests = true; patchwork.get_patch_mbox(&patch) }; - let results = test_patch(&settings, &client, project, &mbox); + let results = test_patch(&settings, &client, project, &mbox, hefty_tests); // Delete the temporary directory with the patch in it fs::remove_dir_all(mbox.parent().unwrap()).unwrap_or_else( diff --git a/src/settings.rs b/src/settings.rs index ad5f483d579b..7e3c87ddd0ac 100644 --- a/src/settings.rs +++ b/src/settings.rs @@ -80,6 +80,7 @@ pub struct Job { pub title: String, pub remote: String, pub branch: String, + pub hefty: bool, pub parameters: BTreeMap, } @@ -103,6 +104,7 @@ impl<'de> Deserialize<'de> for Job { let mut title = None; let mut remote = None; let mut branch = None; + let mut hefty = None; let mut parameters = BTreeMap::new(); while let Some(key) = map.next_key::()? { match key.as_str() { @@ -130,6 +132,12 @@ impl<'de> Deserialize<'de> for Job { } branch = Some(map.next_value()?); } + "hefty" => { + if hefty.is_some() { + return Err(de::Error::duplicate_field("hefty")); + } + hefty = Some(map.next_value()?); + } _ => { parameters.insert(key, map.next_value()?); } @@ -140,12 +148,14 @@ impl<'de> Deserialize<'de> for Job { let remote = remote.ok_or_else(|| de::Error::missing_field("remote"))?; let branch = branch.ok_or_else(|| de::Error::missing_field("branch"))?; let title = title.unwrap_or(job.clone()); + let hefty = hefty.unwrap_or(false); Ok(Job { job: job, title: title, remote: remote, branch: branch, + hefty: hefty, parameters: parameters, }) }