From 9be8fdeb7b3e6a054022d43dfabf98db14e7ad28 Mon Sep 17 00:00:00 2001 From: Rolf Bjarne Kvinge Date: Mon, 17 Jun 2019 19:15:41 +0200 Subject: [PATCH] [xharness] Automatically enable tests on older simulators if we're using a beta Xcode. (#6334) Usually it's when working on beta Xcodes we make mistakes that only show up when running on older simulators (and devices): * Missing/wrong availability attributes. * Tests for new API that don't check the OS if that API is available. So automatically enable the tests on older simulators for PR builds when using a beta Xcode. --- tests/xharness/Harness.cs | 7 +++++++ tests/xharness/Jenkins.cs | 9 ++++++++- 2 files changed, 15 insertions(+), 1 deletion(-) diff --git a/tests/xharness/Harness.cs b/tests/xharness/Harness.cs index e1e78f851e..a016349b17 100644 --- a/tests/xharness/Harness.cs +++ b/tests/xharness/Harness.cs @@ -116,6 +116,13 @@ namespace xharness LaunchTimeout = InWrench ? 3 : 120; } + public bool IsBetaXcode { + get { + // There's no string.Contains (string, StringComparison) overload, so use IndexOf instead. + return XcodeRoot.IndexOf ("beta", StringComparison.OrdinalIgnoreCase) >= 0; + } + } + static string FindXcode (string path) { var p = path; diff --git a/tests/xharness/Jenkins.cs b/tests/xharness/Jenkins.cs index 43c3ba8ec8..5081ace8b3 100644 --- a/tests/xharness/Jenkins.cs +++ b/tests/xharness/Jenkins.cs @@ -764,7 +764,6 @@ namespace xharness SetEnabled (labels, "ios-extensions", ref IncludeiOSExtensions); SetEnabled (labels, "device", ref IncludeDevice); SetEnabled (labels, "xtro", ref IncludeXtro); - SetEnabled (labels, "old-simulator", ref IncludeOldSimulatorTests); SetEnabled (labels, "all", ref IncludeAll); // enabled by default @@ -802,6 +801,14 @@ namespace xharness MainLog.WriteLine ("Disabled 'docs' tests because the Xamarin-specific parts of the build are not enabled."); } } + + // old simulator tests is also a bit special: + // - enabled by default if using a beta Xcode, otherwise disabled by default + changed = SetEnabled (labels, "old-simulator", ref IncludeOldSimulatorTests); + if (!changed && Harness.IsBetaXcode) { + IncludeOldSimulatorTests = true; + MainLog.WriteLine ("Enabled 'old-simulator' tests because we're using a beta Xcode."); + } } // Returns true if the value was changed.