From c0c1136d70b7550f31a906559ad8f21b9a4b4ad6 Mon Sep 17 00:00:00 2001 From: Rolf Bjarne Kvinge Date: Fri, 27 Jan 2017 10:52:49 +0100 Subject: [PATCH] [xharness] Get the INCLUDE_ make variables and disable tests accordingly. (#1578) --- tests/xharness/Harness.cs | 8 +++++++- tests/xharness/Jenkins.cs | 31 ++++++++++++++++++++++++++----- 2 files changed, 33 insertions(+), 6 deletions(-) diff --git a/tests/xharness/Harness.cs b/tests/xharness/Harness.cs index 49878d9b32..66e3fac845 100644 --- a/tests/xharness/Harness.cs +++ b/tests/xharness/Harness.cs @@ -68,7 +68,10 @@ namespace xharness public string MONO_PATH { get; set; } // Use same name as in Makefiles, so that a grep finds it. public string WATCH_MONO_PATH { get; set; } // Use same name as in Makefiles, so that a grep finds it. public string TVOS_MONO_PATH { get; set; } // Use same name as in Makefiles, so that a grep finds it. + public bool INCLUDE_IOS { get; set; } + public bool INCLUDE_TVOS { get; set; } public bool INCLUDE_WATCH { get; set; } + public bool INCLUDE_MAC { get; set; } public string JENKINS_RESULTS_DIRECTORY { get; set; } // Use same name as in Makefiles, so that a grep finds it. public string MAC_DESTDIR { get; set; } public string IOS_DESTDIR { get; set; } @@ -235,8 +238,11 @@ namespace xharness MONO_PATH = Path.GetFullPath (Path.Combine (src_root, "external", "mono")); WATCH_MONO_PATH = make_config ["WATCH_MONO_PATH"]; TVOS_MONO_PATH = MONO_PATH; - INCLUDE_WATCH = make_config.ContainsKey ("INCLUDE_WATCH") && !string.IsNullOrEmpty (make_config ["INCLUDE_WATCH"]); + INCLUDE_IOS = make_config.ContainsKey ("INCLUDE_IOS") && !string.IsNullOrEmpty (make_config ["INCLUDE_IOS"]); + INCLUDE_TVOS = make_config.ContainsKey ("INCLUDE_TVOS") && !string.IsNullOrEmpty (make_config ["INCLUDE_TVOS"]); JENKINS_RESULTS_DIRECTORY = make_config ["JENKINS_RESULTS_DIRECTORY"]; + INCLUDE_WATCH = make_config.ContainsKey ("INCLUDE_WATCH") && !string.IsNullOrEmpty (make_config ["INCLUDE_WATCH"]); + INCLUDE_MAC = make_config.ContainsKey ("INCLUDE_MAC") && !string.IsNullOrEmpty (make_config ["INCLUDE_MAC"]); MAC_DESTDIR = make_config ["MAC_DESTDIR"]; IOS_DESTDIR = make_config ["IOS_DESTDIR"]; } diff --git a/tests/xharness/Jenkins.cs b/tests/xharness/Jenkins.cs index 665f8065ac..a5a9551f7b 100644 --- a/tests/xharness/Jenkins.cs +++ b/tests/xharness/Jenkins.cs @@ -208,17 +208,38 @@ namespace xharness { int pull_request; - if (!int.TryParse (Environment.GetEnvironmentVariable ("ghprbPullId"), out pull_request)) { + if (!int.TryParse (Environment.GetEnvironmentVariable ("ghprbPullId"), out pull_request)) MainLog.WriteLine ("The environment variable 'ghprbPullId' was not found, so no pull requests will be checked for test selection."); - return; - } // First check if can auto-select any tests based on which files were modified. // This will only enable additional tests, never disable tests. - SelectTestsByModifiedFiles (pull_request); + if (pull_request > 0) + SelectTestsByModifiedFiles (pull_request); + // Then we check for labels. Labels are manually set, so those override // whatever we did automatically. - SelectTestsByLabel (pull_request); + if (pull_request > 0) + SelectTestsByLabel (pull_request); + + if (!Harness.INCLUDE_IOS) { + MainLog.WriteLine ("The iOS build is diabled, so any iOS tests will be disabled as well."); + IncludeiOS = false; + } + + if (!Harness.INCLUDE_WATCH) { + MainLog.WriteLine ("The watchOS build is disabled, so any watchOS tests will be disabled as well."); + IncludewatchOS = false; + } + + if (!Harness.INCLUDE_TVOS) { + MainLog.WriteLine ("The tvOS build is disabled, so any tvOS tests will be disabled as well."); + IncludetvOS = false; + } + + if (!Harness.INCLUDE_MAC) { + MainLog.WriteLine ("The macOS build is disabled, so any macOS tests will be disabled as well."); + IncludeMac = false; + } } void SelectTestsByModifiedFiles (int pull_request)