From ca9e9d7c2177b5d232381831f106dec5fe6e9c9d Mon Sep 17 00:00:00 2001 From: Rolf Bjarne Kvinge Date: Fri, 29 Nov 2019 12:07:28 +0100 Subject: [PATCH 01/38] [sample-tester] Collect app size and build duration statistics. --- tests/sampletester/ProcessHelper.cs | 109 ++++++++++++++++++++++- tools/devops/build-samples.yml | 3 + tools/devops/publish-performance-data.sh | 21 +++++ 3 files changed, 131 insertions(+), 2 deletions(-) create mode 100755 tools/devops/publish-performance-data.sh diff --git a/tests/sampletester/ProcessHelper.cs b/tests/sampletester/ProcessHelper.cs index 2022b2c1a1f0..3476057ba28e 100644 --- a/tests/sampletester/ProcessHelper.cs +++ b/tests/sampletester/ProcessHelper.cs @@ -6,6 +6,7 @@ using System.Threading; using System.Text; using System.Text.RegularExpressions; +using System.Xml; using NUnit.Framework; @@ -79,8 +80,8 @@ public static void BuildSolution (string solution, string platform, string confi nuget_args.Add ("sln"); // replaced later nuget_args.Add ("-Verbosity"); nuget_args.Add ("detailed"); + var slndir = Path.GetDirectoryName (solution); if (!solution.EndsWith (".sln", StringComparison.Ordinal)) { - var slndir = Path.GetDirectoryName (solution); while ((solutions = Directory.GetFiles (slndir, "*.sln", SearchOption.TopDirectoryOnly)).Length == 0 && slndir.Length > 1) slndir = Path.GetDirectoryName (slndir); nuget_args.Add ("-SolutionDir"); @@ -102,6 +103,110 @@ public static void BuildSolution (string solution, string platform, string confi sb.Add (solution); if (!string.IsNullOrEmpty (target)) sb.Add ($"/t:{target}"); - AssertRunProcess ("msbuild", sb.ToArray (), TimeSpan.FromMinutes (5), Configuration.SampleRootDirectory, environment_variables, "build"); + + var watch = Stopwatch.StartNew (); + var failed = false; + try { + AssertRunProcess ("msbuild", sb.ToArray (), TimeSpan.FromMinutes (5), Configuration.SampleRootDirectory, environment_variables, "build"); + } catch { + failed = true; + throw; + } finally { + watch.Stop (); + } + + // Write performance data to disk + var subdirs = Directory.GetDirectories (slndir, "*", SearchOption.AllDirectories); + var apps = subdirs.Where ((v) => { + var names = v.Split (Path.DirectorySeparatorChar); + if (names.Length < 2) + return false; + var bin_idx = Array.IndexOf (names, "bin"); + var conf_idx = Array.IndexOf (names, configuration); + if (bin_idx < 0 || conf_idx < 0) + return false; + if (bin_idx > conf_idx) + return false; + if (platform.Length > 0) { + var platform_idx = Array.IndexOf (names, platform); + if (platform_idx < 0) + return false; + if (bin_idx > platform_idx) + return false; + } + var app_idx = Array.FindIndex (names, (v2) => v2.EndsWith (".app", StringComparison.Ordinal)); + if (!names [names.Length - 1].EndsWith (".app", StringComparison.Ordinal)) + return false; + return true; + }).ToArray (); + + if (apps.Length > 1) { + apps = apps.Where ((v) => { + // If one .app is a subdirectory of another .app, we don't care about the former. + if (apps.Any ((v2) => v2.Length < v.Length && v.StartsWith (v2, StringComparison.Ordinal))) + return false; + + // If one .app is contained within another .app, we don't care about the former. + var vname = Path.GetFileName (v); + var otherApps = apps.Where ((v2) => v != v2); + if (otherApps.Any ((v2) => { + var otherSubdirs = subdirs.Where ((v3) => v3.StartsWith (v2, StringComparison.Ordinal)); + return otherSubdirs.Any ((v3) => Path.GetFileName (v3) == vname); + })) + return false; + + return true; + }).ToArray (); + } + + if (apps.Length > 1) { + Assert.Fail ($"More than one app directory????\n\t{string.Join ("\n\t", apps)}"); + } else if (apps.Length == 0) { + Assert.Fail ($"No app directory????\n\t{string.Join ("\n\t", subdirs)}"); + } else { + var logfile = Path.Combine (LogDirectory, $"{Path.GetFileNameWithoutExtension (solution)}-perfdata-{Interlocked.Increment (ref counter)}.xml"); + + var xmlSettings = new XmlWriterSettings { + Indent = true, + }; + var xml = XmlWriter.Create (logfile, xmlSettings); + xml.WriteStartDocument (true); + xml.WriteStartElement ("perf-data"); + + foreach (var app in apps) { + xml.WriteStartElement ("test"); + xml.WriteAttributeString ("name", TestContext.CurrentContext.Test.FullName); + xml.WriteAttributeString ("result", failed ? "failed" : "success"); + if (platform.Length > 0) + xml.WriteAttributeString ("platform", platform); + xml.WriteAttributeString ("configuration", configuration); + if (!failed) { + xml.WriteAttributeString ("duration", watch.ElapsedTicks.ToString ()); + xml.WriteAttributeString ("duration-formatted", watch.Elapsed.ToString ()); + + var files = Directory.GetFiles (app, "*", SearchOption.AllDirectories).OrderBy ((v) => v).ToArray (); + var lengths = files.Select ((v) => new FileInfo (v).Length).ToArray (); + var total_size = lengths.Sum (); + + xml.WriteAttributeString ("total-size", total_size.ToString ()); + var appstart = Path.GetDirectoryName (app).Length; + for (var i = 0; i < files.Length; i++) { + xml.WriteStartElement ("file"); + xml.WriteAttributeString ("name", files [i].Substring (appstart + 1)); + xml.WriteAttributeString ("size", lengths [i].ToString ()); + xml.WriteEndElement (); + } + } + + xml.WriteEndElement (); + } + + xml.WriteEndElement (); + xml.WriteEndDocument (); + xml.Dispose (); + + TestContext.AddTestAttachment (logfile, $"Performance data"); + Console.WriteLine ("Performance data: {0}:\n\t{1}", logfile, string.Join ("\n\t", File.ReadAllLines (logfile))); + } } } diff --git a/tools/devops/build-samples.yml b/tools/devops/build-samples.yml index ebb27f094b9c..062ecbea16ef 100644 --- a/tools/devops/build-samples.yml +++ b/tools/devops/build-samples.yml @@ -111,6 +111,9 @@ jobs: publishRunAttachments: true mergeTestResults: true + - bash: ./tools/devops/publish-performance-data.sh + displayName: Publish performance data + - bash: echo "##vso[task.setvariable variable=JobStatus;isOutput=true]$AGENT_JOBSTATUS" name: ExportedVariables displayName: Export status diff --git a/tools/devops/publish-performance-data.sh b/tools/devops/publish-performance-data.sh new file mode 100755 index 000000000000..27a5350cbc5f --- /dev/null +++ b/tools/devops/publish-performance-data.sh @@ -0,0 +1,21 @@ +#!/bin/bash -ex + +# git clone https://github.com/xamarin/xamarin-macios-performance-data +mkdir xamarin-macios-performance-data +( cd xamarin-macios-performance-data && git init . ) + +DIR=xamarin-macios-performance-data/$BUILD_SOURCEBRANCHNAME/$BUILD_SOURCEVERSION/$SYSTEM_JOBID +mkdir -p "$DIR" + +cp -c tests/sampletester/bin/Debug/tmp-test-dir/execution-logs/*.xml "$DIR/" +cd "$DIR" +git add . +git commit -m "Add performance data for $BUILD_SOURCEBRANCHNAME/$BUILD_SOURCEVERSION from the $SYSTEM_JOBNAME job." + +# Try to push 5 times, just in case someone else pushed first. +COUNTER=5 +while [[ $COUNTER -gt 0 ]]; do + if git push; then break; fi + git pull + (( COUNTER-- )) +done From 8aabf275af04aaddf5d26ab2c0ee49e8e63662ad Mon Sep 17 00:00:00 2001 From: Rolf Bjarne Kvinge Date: Fri, 29 Nov 2019 14:53:58 +0100 Subject: [PATCH 02/38] Always publish performance data. --- tools/devops/build-samples.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/tools/devops/build-samples.yml b/tools/devops/build-samples.yml index 062ecbea16ef..e7a685fe61de 100644 --- a/tools/devops/build-samples.yml +++ b/tools/devops/build-samples.yml @@ -113,6 +113,7 @@ jobs: - bash: ./tools/devops/publish-performance-data.sh displayName: Publish performance data + condition: always() - bash: echo "##vso[task.setvariable variable=JobStatus;isOutput=true]$AGENT_JOBSTATUS" name: ExportedVariables From fdef0277b4ecbb1a5aad81ef58865bbf96ab0b17 Mon Sep 17 00:00:00 2001 From: Rolf Bjarne Kvinge Date: Fri, 29 Nov 2019 15:00:49 +0100 Subject: [PATCH 03/38] [mmp] Add support for MMP_ENV_OPTIONS to mirror mtouch's MTOUCH_ENV_OPTIONS. --- tools/mmp/driver.cs | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/tools/mmp/driver.cs b/tools/mmp/driver.cs index 4409a8592769..75b708a5aec3 100644 --- a/tools/mmp/driver.cs +++ b/tools/mmp/driver.cs @@ -358,6 +358,13 @@ static void Main2 (string [] args) AddSharedOptions (App, os); + var extra_args = Environment.GetEnvironmentVariable ("MMP_ENV_OPTIONS"); + if (!string.IsNullOrEmpty (extra_args)) { + var l = new List (args); + l.AddRange (extra_args.Split (new char [] { ' ' }, StringSplitOptions.RemoveEmptyEntries)); + args = l.ToArray (); + } + try { App.RootAssemblies.AddRange (os.Parse (args)); } From d447c5dc3f78aced8ffa91d00f302c68ccc7d92c Mon Sep 17 00:00:00 2001 From: Rolf Bjarne Kvinge Date: Fri, 29 Nov 2019 20:14:32 +0100 Subject: [PATCH 04/38] [sample-tester] Make mmp/mtouch show timing information, and get the diagnostic msbuild log. --- tests/sampletester/ProcessHelper.cs | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/tests/sampletester/ProcessHelper.cs b/tests/sampletester/ProcessHelper.cs index 3476057ba28e..a77243c0ed8e 100644 --- a/tests/sampletester/ProcessHelper.cs +++ b/tests/sampletester/ProcessHelper.cs @@ -104,6 +104,10 @@ public static void BuildSolution (string solution, string platform, string confi if (!string.IsNullOrEmpty (target)) sb.Add ($"/t:{target}"); + sb.Add ($"/verbosity:diag"); + environment_variables ["MTOUCH_ENV_OPTIONS"] = "--time --time --time --time -qqqq"; + environment_variables ["MMP_ENV_OPTIONS"] = "--time --time --time --time -qqqq"; + var watch = Stopwatch.StartNew (); var failed = false; try { From 866a020d1648483cf1b97228e24b44bcadbd41c2 Mon Sep 17 00:00:00 2001 From: Rolf Bjarne Kvinge Date: Fri, 29 Nov 2019 20:37:55 +0100 Subject: [PATCH 05/38] Collect task and target info. --- tests/sampletester/ProcessHelper.cs | 68 ++++++++++++++++++++++++----- 1 file changed, 56 insertions(+), 12 deletions(-) diff --git a/tests/sampletester/ProcessHelper.cs b/tests/sampletester/ProcessHelper.cs index a77243c0ed8e..dad9dd3ca635 100644 --- a/tests/sampletester/ProcessHelper.cs +++ b/tests/sampletester/ProcessHelper.cs @@ -14,8 +14,7 @@ using Xamarin.Tests; using Xamarin.Utils; -public static class ProcessHelper -{ +public static class ProcessHelper { static int counter; static string log_directory; @@ -28,7 +27,12 @@ static string LogDirectory { } - public static void AssertRunProcess (string filename, string[] arguments, TimeSpan timeout, string workingDirectory, Dictionary environment_variables, string message) + public static void AssertRunProcess (string filename, string [] arguments, TimeSpan timeout, string workingDirectory, Dictionary environment_variables, string message) + { + AssertRunProcess (filename, arguments, timeout, workingDirectory, environment_variables, message, out _); + } + + public static void AssertRunProcess (string filename, string [] arguments, TimeSpan timeout, string workingDirectory, Dictionary environment_variables, string message, out string logfile) { var exitCode = 0; var output = new List (); @@ -50,7 +54,7 @@ public static void AssertRunProcess (string filename, string[] arguments, TimeSp output_callback ($"Exit code: {exitCode} Timed out: {timed_out} Total duration: {watch.Elapsed.ToString ()}"); // Write execution log to disk (and print the path) - var logfile = Path.Combine (LogDirectory, $"{filename}-{Interlocked.Increment (ref counter)}.log"); + logfile = Path.Combine (LogDirectory, $"{filename}-{Interlocked.Increment (ref counter)}.log"); File.WriteAllLines (logfile, output); TestContext.AddTestAttachment (logfile, $"Execution log for {filename}"); Console.WriteLine ("Execution log for {0}: {1}", filename, logfile); @@ -110,8 +114,9 @@ public static void BuildSolution (string solution, string platform, string confi var watch = Stopwatch.StartNew (); var failed = false; + string msbuild_logfile; try { - AssertRunProcess ("msbuild", sb.ToArray (), TimeSpan.FromMinutes (5), Configuration.SampleRootDirectory, environment_variables, "build"); + AssertRunProcess ("msbuild", sb.ToArray (), TimeSpan.FromMinutes (5), Configuration.SampleRootDirectory, environment_variables, "build", out msbuild_logfile); } catch { failed = true; throw; @@ -200,17 +205,56 @@ public static void BuildSolution (string solution, string platform, string confi xml.WriteAttributeString ("size", lengths [i].ToString ()); xml.WriteEndElement (); } + + if (File.Exists (msbuild_logfile)) { + var lines = File.ReadAllLines (msbuild_logfile); + var target_perf_summary = new List (); + var task_perf_summary = new List (); + for (var i = lines.Length - 1; i >= 0; i--) { + if (lines [i].EndsWith ("Target Performance Summary:", StringComparison.Ordinal)) { + for (var k = i + 1; k < lines.Length && lines [k].EndsWith ("calls", StringComparison.Ordinal); k++) { + target_perf_summary.Add (lines [k].Substring (18).Trim ()); + } + } else if (lines [i].EndsWith ("Task Performance Summary:", StringComparison.Ordinal)) { + for (var k = i + 1; k < lines.Length && lines [k].EndsWith ("calls", StringComparison.Ordinal); k++) { + task_perf_summary.Add (lines [k].Substring (18).Trim ()); + } + } + if (target_perf_summary.Count > 0 && task_perf_summary.Count > 0) + break; + } + if (target_perf_summary != null) { + foreach (var tps in target_perf_summary) { + var split = tps.Split (new char [] { ' ' }, StringSplitOptions.RemoveEmptyEntries); + xml.WriteStartElement ("target"); + xml.WriteAttributeString ("name", split [2]); + xml.WriteAttributeString ("ms", split [0]); + xml.WriteAttributeString ("calls", split [3]); + xml.WriteEndElement (); + } + } + if (task_perf_summary != null) { + foreach (var tps in task_perf_summary) { + var split = tps.Split (new char [] { ' ' }, StringSplitOptions.RemoveEmptyEntries); + xml.WriteStartElement ("task"); + xml.WriteAttributeString ("name", split [2]); + xml.WriteAttributeString ("ms", split [0]); + xml.WriteAttributeString ("calls", split [3]); + xml.WriteEndElement (); + } + } + } + + xml.WriteEndElement (); } xml.WriteEndElement (); - } + xml.WriteEndDocument (); + xml.Dispose (); - xml.WriteEndElement (); - xml.WriteEndDocument (); - xml.Dispose (); - - TestContext.AddTestAttachment (logfile, $"Performance data"); - Console.WriteLine ("Performance data: {0}:\n\t{1}", logfile, string.Join ("\n\t", File.ReadAllLines (logfile))); + TestContext.AddTestAttachment (logfile, $"Performance data"); + Console.WriteLine ("Performance data: {0}:\n\t{1}", logfile, string.Join ("\n\t", File.ReadAllLines (logfile))); + } } } } From 1e99f427b325b65ffe77bbadafee19175b47dbd0 Mon Sep 17 00:00:00 2001 From: Rolf Bjarne Kvinge Date: Mon, 2 Dec 2019 13:56:50 +0100 Subject: [PATCH 06/38] Add more perf data and a baseline test. --- .../sampletester/BaselineTest/AppDelegate.cs | 28 +++++++ .../BaselineTest/BaselineTest.csproj | 72 +++++++++++++++++ tests/sampletester/BaselineTest/Info.plist | 48 +++++++++++ .../BaselineTest/LaunchScreen.storyboard | 27 +++++++ tests/sampletester/Configuration.cs | 80 +++++++++++++++++++ tests/sampletester/ProcessHelper.cs | 73 +++++++++++------ tests/sampletester/SampleTester.cs | 13 +++ tests/sampletester/sampletester.sln | 26 ++++++ 8 files changed, 344 insertions(+), 23 deletions(-) create mode 100644 tests/sampletester/BaselineTest/AppDelegate.cs create mode 100644 tests/sampletester/BaselineTest/BaselineTest.csproj create mode 100644 tests/sampletester/BaselineTest/Info.plist create mode 100644 tests/sampletester/BaselineTest/LaunchScreen.storyboard diff --git a/tests/sampletester/BaselineTest/AppDelegate.cs b/tests/sampletester/BaselineTest/AppDelegate.cs new file mode 100644 index 000000000000..25802298148d --- /dev/null +++ b/tests/sampletester/BaselineTest/AppDelegate.cs @@ -0,0 +1,28 @@ +using Foundation; +using UIKit; + +namespace BaselineTest { + [Register ("AppDelegate")] + public class AppDelegate : UIResponder, IUIApplicationDelegate { + UIWindow window; + UIViewController vc; + + [Export ("application:didFinishLaunchingWithOptions:")] + public bool FinishedLaunching (UIApplication application, NSDictionary launchOptions) + { + window = new UIWindow (UIScreen.MainScreen.Bounds); + vc = new UIViewController (); + vc.View.BackgroundColor = UIColor.Green; + window.RootViewController = vc; + window.MakeKeyAndVisible (); + + return true; + } + + static void Main (string [] args) + { + UIApplication.Main (args, null, typeof (AppDelegate)); + } + } +} + diff --git a/tests/sampletester/BaselineTest/BaselineTest.csproj b/tests/sampletester/BaselineTest/BaselineTest.csproj new file mode 100644 index 000000000000..699748ec15ab --- /dev/null +++ b/tests/sampletester/BaselineTest/BaselineTest.csproj @@ -0,0 +1,72 @@ + + + + Debug + iPhoneSimulator + {E7E76A89-6DB7-4CF6-953C-6D9ADC656C6F} + {FEACFBD2-3405-455C-9665-78FE426C6842};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} + {edc1b0fa-90cd-4038-8fad-98fe74adb368} + Exe + BaselineTest + BaselineTest + Resources + true + NSUrlSessionHandler + PackageReference + + + true + full + false + bin\iPhoneSimulator\Debug + DEBUG + prompt + 4 + x86_64 + None + true + + + none + true + bin\iPhoneSimulator\Release + prompt + 4 + None + x86_64 + + + true + full + false + bin\iPhone\Debug + DEBUG + prompt + 4 + ARM64 + iPhone Developer + true + + + none + true + bin\iPhone\Release + prompt + 4 + ARM64 + iPhone Developer + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/tests/sampletester/BaselineTest/Info.plist b/tests/sampletester/BaselineTest/Info.plist new file mode 100644 index 000000000000..bba9b4ffd48a --- /dev/null +++ b/tests/sampletester/BaselineTest/Info.plist @@ -0,0 +1,48 @@ + + + + + CFBundleDisplayName + BaselineTest + CFBundleIdentifier + com.xamarin.BaselineTest + CFBundleShortVersionString + 1.0 + CFBundleVersion + 1.0 + LSRequiresIPhoneOS + + MinimumOSVersion + 8.0 + UIDeviceFamily + + 1 + 2 + + UILaunchStoryboardName + LaunchScreen + UIMainStoryboardFile~ipad + Main + UIRequiredDeviceCapabilities + + armv7 + + UISupportedInterfaceOrientations + + UIInterfaceOrientationPortrait + UIInterfaceOrientationLandscapeLeft + UIInterfaceOrientationLandscapeRight + + UISupportedInterfaceOrientations~ipad + + UIInterfaceOrientationPortrait + UIInterfaceOrientationPortraitUpsideDown + UIInterfaceOrientationLandscapeLeft + UIInterfaceOrientationLandscapeRight + + XSAppIconAssets + Assets.xcassets/AppIcon.appiconset + CFBundleName + BaselineTest + + diff --git a/tests/sampletester/BaselineTest/LaunchScreen.storyboard b/tests/sampletester/BaselineTest/LaunchScreen.storyboard new file mode 100644 index 000000000000..f18534b49b24 --- /dev/null +++ b/tests/sampletester/BaselineTest/LaunchScreen.storyboard @@ -0,0 +1,27 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/tests/sampletester/Configuration.cs b/tests/sampletester/Configuration.cs index a209f1422160..883d316d9019 100644 --- a/tests/sampletester/Configuration.cs +++ b/tests/sampletester/Configuration.cs @@ -52,5 +52,85 @@ static void CreateGlobalConfig (string root) } "); } + + static string tested_hash; + public static string TestedHash { + get { + lock (lock_obj) { + if (tested_hash != null) + return tested_hash; + + tested_hash = GetCurrentHash (Environment.CurrentDirectory); + return tested_hash; + } + } + } + + public static string GetCurrentHash (string directory) + { + using (var p = System.Diagnostics.Process.Start ("git", "log -1 --pretty=%H")) { + p.StartInfo.WorkingDirectory = directory; + p.StartInfo.RedirectStandardOutput = true; + p.StartInfo.UseShellExecute = false; + p.Start (); + var hash = p.StandardOutput.ReadToEnd ().Trim (); + p.WaitForExit (); + return hash; + } + } + + public static string GetCurrentRemoteUrl (string directory) + { + using (var p = System.Diagnostics.Process.Start ("git", "remote get-url origin")) { + p.StartInfo.WorkingDirectory = directory; + p.StartInfo.RedirectStandardOutput = true; + p.StartInfo.UseShellExecute = false; + p.Start (); + var url = p.StandardOutput.ReadToEnd ().Trim (); + p.WaitForExit (); + return url; + } + } + + static string mono_version; + public static string MonoVersion { + get { + lock (lock_obj) { + if (mono_version != null) + return mono_version; + + using (var p = System.Diagnostics.Process.Start ("mono", "--version")) { + p.StartInfo.RedirectStandardOutput = true; + p.StartInfo.UseShellExecute = false; + p.Start (); + mono_version = p.StandardOutput.ReadLine ().Trim (); // We only care about the first line + p.StandardOutput.ReadToEnd (); + p.WaitForExit (); + } + } + + return mono_version; + } + } + + static string sw_version; + public static string OSVersion { + get { + lock (lock_obj) { + if (sw_version != null) + return sw_version; + + using (var p = System.Diagnostics.Process.Start ("sw_vers")) { + p.StartInfo.RedirectStandardOutput = true; + p.StartInfo.UseShellExecute = false; + p.Start (); + sw_version = p.StandardOutput.ReadToEnd ().Replace ('\n', ';').Replace ((char) 9, ' '); + p.WaitForExit (); + } + } + + return sw_version; + } + } } } diff --git a/tests/sampletester/ProcessHelper.cs b/tests/sampletester/ProcessHelper.cs index dad9dd3ca635..978218ce8cf2 100644 --- a/tests/sampletester/ProcessHelper.cs +++ b/tests/sampletester/ProcessHelper.cs @@ -130,27 +130,35 @@ public static void BuildSolution (string solution, string platform, string confi var names = v.Split (Path.DirectorySeparatorChar); if (names.Length < 2) return false; + + if (names.Any ((v2) => v2 == "copySceneKitAssets")) + return false; + var bin_idx = Array.IndexOf (names, "bin"); var conf_idx = Array.IndexOf (names, configuration); if (bin_idx < 0 || conf_idx < 0) return false; + if (bin_idx > conf_idx) return false; + if (platform.Length > 0) { var platform_idx = Array.IndexOf (names, platform); if (platform_idx < 0) return false; + if (bin_idx > platform_idx) return false; } var app_idx = Array.FindIndex (names, (v2) => v2.EndsWith (".app", StringComparison.Ordinal)); if (!names [names.Length - 1].EndsWith (".app", StringComparison.Ordinal)) return false; + return true; }).ToArray (); if (apps.Length > 1) { - apps = apps.Where ((v) => { + var filtered_apps = apps.Where ((v) => { // If one .app is a subdirectory of another .app, we don't care about the former. if (apps.Any ((v2) => v2.Length < v.Length && v.StartsWith (v2, StringComparison.Ordinal))) return false; @@ -166,12 +174,15 @@ public static void BuildSolution (string solution, string platform, string confi return true; }).ToArray (); + if (apps.Length == 0) + Assert.Fail ($"Filtered away all the .apps, from:\n\t{string.Join ("\n\t", apps)}"); + apps = filtered_apps; } if (apps.Length > 1) { Assert.Fail ($"More than one app directory????\n\t{string.Join ("\n\t", apps)}"); } else if (apps.Length == 0) { - Assert.Fail ($"No app directory????\n\t{string.Join ("\n\t", subdirs)}"); + Assert.Fail ($"No app directory???? platform: {platform} configuration: {configuration} target: {target} \n\t{string.Join ("\n\t", subdirs)}"); } else { var logfile = Path.Combine (LogDirectory, $"{Path.GetFileNameWithoutExtension (solution)}-perfdata-{Interlocked.Increment (ref counter)}.xml"); @@ -181,7 +192,11 @@ public static void BuildSolution (string solution, string platform, string confi var xml = XmlWriter.Create (logfile, xmlSettings); xml.WriteStartDocument (true); xml.WriteStartElement ("perf-data"); - + xml.WriteAttributeString ("mono-version", Configuration.MonoVersion); + xml.WriteAttributeString ("os-version", Configuration.OSVersion); + xml.WriteAttributeString ("xamarin-macios-hash", Configuration.TestedHash); + xml.WriteAttributeString ("sample-repository", Configuration.GetCurrentRemoteUrl (slndir)); + xml.WriteAttributeString ("sample-hash", Configuration.GetCurrentHash (slndir)); foreach (var app in apps) { xml.WriteStartElement ("test"); xml.WriteAttributeString ("name", TestContext.CurrentContext.Test.FullName); @@ -210,6 +225,7 @@ public static void BuildSolution (string solution, string platform, string confi var lines = File.ReadAllLines (msbuild_logfile); var target_perf_summary = new List (); var task_perf_summary = new List (); + var timestamps = new List (); for (var i = lines.Length - 1; i >= 0; i--) { if (lines [i].EndsWith ("Target Performance Summary:", StringComparison.Ordinal)) { for (var k = i + 1; k < lines.Length && lines [k].EndsWith ("calls", StringComparison.Ordinal); k++) { @@ -219,29 +235,40 @@ public static void BuildSolution (string solution, string platform, string confi for (var k = i + 1; k < lines.Length && lines [k].EndsWith ("calls", StringComparison.Ordinal); k++) { task_perf_summary.Add (lines [k].Substring (18).Trim ()); } + } else if (lines [i].Contains ("!Timestamp")) { + timestamps.Add (lines [i]); } - if (target_perf_summary.Count > 0 && task_perf_summary.Count > 0) - break; } - if (target_perf_summary != null) { - foreach (var tps in target_perf_summary) { - var split = tps.Split (new char [] { ' ' }, StringSplitOptions.RemoveEmptyEntries); - xml.WriteStartElement ("target"); - xml.WriteAttributeString ("name", split [2]); - xml.WriteAttributeString ("ms", split [0]); - xml.WriteAttributeString ("calls", split [3]); - xml.WriteEndElement (); - } + foreach (var tps in target_perf_summary) { + var split = tps.Split (new char [] { ' ' }, StringSplitOptions.RemoveEmptyEntries); + xml.WriteStartElement ("target"); + xml.WriteAttributeString ("name", split [2]); + xml.WriteAttributeString ("ms", split [0]); + xml.WriteAttributeString ("calls", split [3]); + xml.WriteEndElement (); } - if (task_perf_summary != null) { - foreach (var tps in task_perf_summary) { - var split = tps.Split (new char [] { ' ' }, StringSplitOptions.RemoveEmptyEntries); - xml.WriteStartElement ("task"); - xml.WriteAttributeString ("name", split [2]); - xml.WriteAttributeString ("ms", split [0]); - xml.WriteAttributeString ("calls", split [3]); - xml.WriteEndElement (); - } + foreach (var tps in task_perf_summary) { + var split = tps.Split (new char [] { ' ' }, StringSplitOptions.RemoveEmptyEntries); + xml.WriteStartElement ("task"); + xml.WriteAttributeString ("name", split [2]); + xml.WriteAttributeString ("ms", split [0]); + xml.WriteAttributeString ("calls", split [3]); + xml.WriteEndElement (); + } + foreach (var ts in timestamps) { + // Sample line: + // 15:04:50.4609520: !Timestamp Setup: 28 ms (TaskId:137) + var splitFirst = ts.Split (new char [] { ':' }, StringSplitOptions.RemoveEmptyEntries); + var splitSecondA = splitFirst [3].Split (new char [] { ' ' }, StringSplitOptions.RemoveEmptyEntries); + var splitSecondB = splitFirst [4].Split (new char [] { ' ' }, StringSplitOptions.RemoveEmptyEntries); + var name = string.Join (" ", splitSecondA.Skip (1)); + var level = splitSecondA [0].Count ((v) => v == '!').ToString (); + var ms = splitSecondB [0]; + xml.WriteStartElement ("timestamp"); + xml.WriteAttributeString ("name", name); + xml.WriteAttributeString ("level", level); + xml.WriteAttributeString ("ms", ms); + xml.WriteEndElement (); } } diff --git a/tests/sampletester/SampleTester.cs b/tests/sampletester/SampleTester.cs index 2bdbd28cc9a1..505235aa4e1b 100644 --- a/tests/sampletester/SampleTester.cs +++ b/tests/sampletester/SampleTester.cs @@ -240,6 +240,19 @@ IEnumerable filter (string name, string proj, IEnumerable input, string } } } + + var baseline_test = new SampleTest (); + baseline_test.BuildSolution = false; + baseline_test.Solution = Path.Combine (Configuration.SourceRoot, "tests", "sampletester", "sampletester.sln"); + baseline_test.Project = new ProjectInfo { + FullPath = Path.Combine (Configuration.SourceRoot, "tests", "sampletester", "BaselineTest", "BaselineTest.csproj"), + IsExecutable = true, + RelativePath = "../../../../BaselineTest/BaselineTest.csproj", + Title = "BaselineTest", + Platform = TestPlatform.iOS, + }; + GitHub.CleanRepository (Path.GetDirectoryName (baseline_test.Project.FullPath), false); + yield return new SampleTestData { SampleTest = baseline_test, Configuration = "Debug", Platform = "iPhone" }; } string CloneRepo () diff --git a/tests/sampletester/sampletester.sln b/tests/sampletester/sampletester.sln index 6a85f8fa7094..7e6795b66a65 100644 --- a/tests/sampletester/sampletester.sln +++ b/tests/sampletester/sampletester.sln @@ -3,15 +3,41 @@ Microsoft Visual Studio Solution File, Format Version 12.00 # Visual Studio 15 Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "sampletester", "sampletester.csproj", "{7340A1C6-61A5-42D2-9DBC-6688D2E70F62}" EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "BaselineTest", "BaselineTest\BaselineTest.csproj", "{E7E76A89-6DB7-4CF6-953C-6D9ADC656C6F}" +EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Any CPU = Debug|Any CPU Release|Any CPU = Release|Any CPU + Debug|iPhoneSimulator = Debug|iPhoneSimulator + Release|iPhoneSimulator = Release|iPhoneSimulator + Debug|iPhone = Debug|iPhone + Release|iPhone = Release|iPhone EndGlobalSection GlobalSection(ProjectConfigurationPlatforms) = postSolution {7340A1C6-61A5-42D2-9DBC-6688D2E70F62}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {7340A1C6-61A5-42D2-9DBC-6688D2E70F62}.Debug|Any CPU.Build.0 = Debug|Any CPU {7340A1C6-61A5-42D2-9DBC-6688D2E70F62}.Release|Any CPU.ActiveCfg = Release|Any CPU {7340A1C6-61A5-42D2-9DBC-6688D2E70F62}.Release|Any CPU.Build.0 = Release|Any CPU + {7340A1C6-61A5-42D2-9DBC-6688D2E70F62}.Debug|iPhoneSimulator.ActiveCfg = Debug|Any CPU + {7340A1C6-61A5-42D2-9DBC-6688D2E70F62}.Debug|iPhoneSimulator.Build.0 = Debug|Any CPU + {7340A1C6-61A5-42D2-9DBC-6688D2E70F62}.Release|iPhoneSimulator.ActiveCfg = Release|Any CPU + {7340A1C6-61A5-42D2-9DBC-6688D2E70F62}.Release|iPhoneSimulator.Build.0 = Release|Any CPU + {7340A1C6-61A5-42D2-9DBC-6688D2E70F62}.Debug|iPhone.ActiveCfg = Debug|Any CPU + {7340A1C6-61A5-42D2-9DBC-6688D2E70F62}.Debug|iPhone.Build.0 = Debug|Any CPU + {7340A1C6-61A5-42D2-9DBC-6688D2E70F62}.Release|iPhone.ActiveCfg = Release|Any CPU + {7340A1C6-61A5-42D2-9DBC-6688D2E70F62}.Release|iPhone.Build.0 = Release|Any CPU + {E7E76A89-6DB7-4CF6-953C-6D9ADC656C6F}.Debug|Any CPU.ActiveCfg = Debug|iPhoneSimulator + {E7E76A89-6DB7-4CF6-953C-6D9ADC656C6F}.Debug|Any CPU.Build.0 = Debug|iPhoneSimulator + {E7E76A89-6DB7-4CF6-953C-6D9ADC656C6F}.Release|Any CPU.ActiveCfg = Release|iPhoneSimulator + {E7E76A89-6DB7-4CF6-953C-6D9ADC656C6F}.Release|Any CPU.Build.0 = Release|iPhoneSimulator + {E7E76A89-6DB7-4CF6-953C-6D9ADC656C6F}.Debug|iPhoneSimulator.ActiveCfg = Debug|iPhoneSimulator + {E7E76A89-6DB7-4CF6-953C-6D9ADC656C6F}.Debug|iPhoneSimulator.Build.0 = Debug|iPhoneSimulator + {E7E76A89-6DB7-4CF6-953C-6D9ADC656C6F}.Release|iPhoneSimulator.ActiveCfg = Release|iPhoneSimulator + {E7E76A89-6DB7-4CF6-953C-6D9ADC656C6F}.Release|iPhoneSimulator.Build.0 = Release|iPhoneSimulator + {E7E76A89-6DB7-4CF6-953C-6D9ADC656C6F}.Debug|iPhone.ActiveCfg = Debug|iPhone + {E7E76A89-6DB7-4CF6-953C-6D9ADC656C6F}.Debug|iPhone.Build.0 = Debug|iPhone + {E7E76A89-6DB7-4CF6-953C-6D9ADC656C6F}.Release|iPhone.ActiveCfg = Release|iPhone + {E7E76A89-6DB7-4CF6-953C-6D9ADC656C6F}.Release|iPhone.Build.0 = Release|iPhone EndGlobalSection EndGlobal From 28724af598514566a3dab42f1f9b814b792edb22 Mon Sep 17 00:00:00 2001 From: Rolf Bjarne Kvinge Date: Mon, 2 Dec 2019 19:25:52 +0100 Subject: [PATCH 07/38] Redo the base test a bit. --- tests/sampletester/SampleTester.cs | 21 ++++++++------------- 1 file changed, 8 insertions(+), 13 deletions(-) diff --git a/tests/sampletester/SampleTester.cs b/tests/sampletester/SampleTester.cs index 505235aa4e1b..b5c4943cfa0b 100644 --- a/tests/sampletester/SampleTester.cs +++ b/tests/sampletester/SampleTester.cs @@ -240,24 +240,19 @@ IEnumerable filter (string name, string proj, IEnumerable input, string } } } - - var baseline_test = new SampleTest (); - baseline_test.BuildSolution = false; - baseline_test.Solution = Path.Combine (Configuration.SourceRoot, "tests", "sampletester", "sampletester.sln"); - baseline_test.Project = new ProjectInfo { - FullPath = Path.Combine (Configuration.SourceRoot, "tests", "sampletester", "BaselineTest", "BaselineTest.csproj"), - IsExecutable = true, - RelativePath = "../../../../BaselineTest/BaselineTest.csproj", - Title = "BaselineTest", - Platform = TestPlatform.iOS, - }; - GitHub.CleanRepository (Path.GetDirectoryName (baseline_test.Project.FullPath), false); - yield return new SampleTestData { SampleTest = baseline_test, Configuration = "Debug", Platform = "iPhone" }; } string CloneRepo () { return GitHub.CloneRepository (Org, Repository, Hash); } + + [Test] + public void BuildBaselineTest () + { + var csproj = Path.Combine (Configuration.SourceRoot, "tests", "sampletester", "BaselineTest", "BaselineTest.csproj"); + GitHub.CleanRepository (Path.GetDirectoryName (csproj)); + ProcessHelper.BuildSolution (csproj, "iPhone", "Debug", new Dictionary ()); + } } } From 2578bf7c992c77752cd364d18674cee29d8f845c Mon Sep 17 00:00:00 2001 From: Rolf Bjarne Kvinge Date: Mon, 2 Dec 2019 22:31:32 +0100 Subject: [PATCH 08/38] More tweaks. --- mk/xamarin.mk | 4 +- .../BaselineTest/BaselineTest.sln | 23 ++++++++++ tests/sampletester/ProcessHelper.cs | 8 ++-- tests/sampletester/SampleTester.cs | 12 ++++-- tests/sampletester/Samples.cs | 2 +- tests/sampletester/sampletester.sln | 18 -------- tools/devops/build-samples.csx | 19 +++++++- tools/devops/build-samples.sh | 2 + tools/devops/build-samples.yml | 43 +++++++++++++++---- tools/devops/fetch-maccore.sh | 9 +++- tools/devops/publish-performance-data.sh | 13 +++--- tools/devops/system-info.sh | 4 +- 12 files changed, 111 insertions(+), 46 deletions(-) create mode 100644 tests/sampletester/BaselineTest/BaselineTest.sln diff --git a/mk/xamarin.mk b/mk/xamarin.mk index ec21f5cec9f9..3eb97c989a76 100644 --- a/mk/xamarin.mk +++ b/mk/xamarin.mk @@ -7,8 +7,8 @@ MONO_BRANCH := $(shell cd $(MONO_PATH) 2> /dev/null && git symbolic-ref --sho endif ifdef ENABLE_XAMARIN -NEEDED_MACCORE_VERSION := 92433b7757c57de089b3edb0e7060d90363273f9 -NEEDED_MACCORE_BRANCH := master +NEEDED_MACCORE_VERSION := c8f72155c8849082295015d6bee28d2034ae92c9 +NEEDED_MACCORE_BRANCH := provisioning-skip-fetch MACCORE_DIRECTORY := maccore MACCORE_MODULE := git@github.com:xamarin/maccore.git diff --git a/tests/sampletester/BaselineTest/BaselineTest.sln b/tests/sampletester/BaselineTest/BaselineTest.sln new file mode 100644 index 000000000000..b2b66729db02 --- /dev/null +++ b/tests/sampletester/BaselineTest/BaselineTest.sln @@ -0,0 +1,23 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio 15 +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "BaselineTest", "BaselineTest.csproj", "{E7E76A89-6DB7-4CF6-953C-6D9ADC656C6F}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|iPhoneSimulator = Debug|iPhoneSimulator + Release|iPhoneSimulator = Release|iPhoneSimulator + Debug|iPhone = Debug|iPhone + Release|iPhone = Release|iPhone + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {E7E76A89-6DB7-4CF6-953C-6D9ADC656C6F}.Debug|iPhoneSimulator.ActiveCfg = Debug|iPhoneSimulator + {E7E76A89-6DB7-4CF6-953C-6D9ADC656C6F}.Debug|iPhoneSimulator.Build.0 = Debug|iPhoneSimulator + {E7E76A89-6DB7-4CF6-953C-6D9ADC656C6F}.Release|iPhoneSimulator.ActiveCfg = Release|iPhoneSimulator + {E7E76A89-6DB7-4CF6-953C-6D9ADC656C6F}.Release|iPhoneSimulator.Build.0 = Release|iPhoneSimulator + {E7E76A89-6DB7-4CF6-953C-6D9ADC656C6F}.Debug|iPhone.ActiveCfg = Debug|iPhone + {E7E76A89-6DB7-4CF6-953C-6D9ADC656C6F}.Debug|iPhone.Build.0 = Debug|iPhone + {E7E76A89-6DB7-4CF6-953C-6D9ADC656C6F}.Release|iPhone.ActiveCfg = Release|iPhone + {E7E76A89-6DB7-4CF6-953C-6D9ADC656C6F}.Release|iPhone.Build.0 = Release|iPhone + EndGlobalSection +EndGlobal diff --git a/tests/sampletester/ProcessHelper.cs b/tests/sampletester/ProcessHelper.cs index 978218ce8cf2..e55d6cfa7b06 100644 --- a/tests/sampletester/ProcessHelper.cs +++ b/tests/sampletester/ProcessHelper.cs @@ -127,10 +127,13 @@ public static void BuildSolution (string solution, string platform, string confi // Write performance data to disk var subdirs = Directory.GetDirectories (slndir, "*", SearchOption.AllDirectories); var apps = subdirs.Where ((v) => { - var names = v.Split (Path.DirectorySeparatorChar); + var names = v.Substring (slndir.Length).Split (Path.DirectorySeparatorChar); if (names.Length < 2) return false; + if (!names [names.Length - 1].EndsWith (".app", StringComparison.Ordinal)) + return false; + if (names.Any ((v2) => v2 == "copySceneKitAssets")) return false; @@ -150,9 +153,6 @@ public static void BuildSolution (string solution, string platform, string confi if (bin_idx > platform_idx) return false; } - var app_idx = Array.FindIndex (names, (v2) => v2.EndsWith (".app", StringComparison.Ordinal)); - if (!names [names.Length - 1].EndsWith (".app", StringComparison.Ordinal)) - return false; return true; }).ToArray (); diff --git a/tests/sampletester/SampleTester.cs b/tests/sampletester/SampleTester.cs index b5c4943cfa0b..6c83f706e179 100644 --- a/tests/sampletester/SampleTester.cs +++ b/tests/sampletester/SampleTester.cs @@ -246,13 +246,17 @@ string CloneRepo () { return GitHub.CloneRepository (Org, Repository, Hash); } + } + [TestFixture] + public class BaselineTester { [Test] - public void BuildBaselineTest () + public void DeviceDebug () { - var csproj = Path.Combine (Configuration.SourceRoot, "tests", "sampletester", "BaselineTest", "BaselineTest.csproj"); - GitHub.CleanRepository (Path.GetDirectoryName (csproj)); - ProcessHelper.BuildSolution (csproj, "iPhone", "Debug", new Dictionary ()); + var sln = Path.Combine (Configuration.SourceRoot, "tests", "sampletester", "BaselineTest", "BaselineTest.sln"); + GitHub.CleanRepository (Path.GetDirectoryName (sln)); + ProcessHelper.BuildSolution (sln, "iPhone", "Debug", new Dictionary ()); } + } } diff --git a/tests/sampletester/Samples.cs b/tests/sampletester/Samples.cs index 6ec67817268a..f74342a1c1d9 100644 --- a/tests/sampletester/Samples.cs +++ b/tests/sampletester/Samples.cs @@ -8,7 +8,7 @@ public class IosSampleTester : SampleTester { const string ORG = "xamarin"; const string REPO = "ios-samples"; // monotouch-samples redirects to ios-samples const string CATEGORY = "iossamples"; // categories can't contain dashes - const string HASH = "bffa511ecb8f74b2d4a42418a130d0c83c9723cf"; + const string HASH = "150f0e6167e2133182924114a3b36e8384f632f1"; static Dictionary test_data = new Dictionary { // Build solution instead of csproj diff --git a/tests/sampletester/sampletester.sln b/tests/sampletester/sampletester.sln index 7e6795b66a65..42f569df45cc 100644 --- a/tests/sampletester/sampletester.sln +++ b/tests/sampletester/sampletester.sln @@ -3,16 +3,10 @@ Microsoft Visual Studio Solution File, Format Version 12.00 # Visual Studio 15 Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "sampletester", "sampletester.csproj", "{7340A1C6-61A5-42D2-9DBC-6688D2E70F62}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "BaselineTest", "BaselineTest\BaselineTest.csproj", "{E7E76A89-6DB7-4CF6-953C-6D9ADC656C6F}" -EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Any CPU = Debug|Any CPU Release|Any CPU = Release|Any CPU - Debug|iPhoneSimulator = Debug|iPhoneSimulator - Release|iPhoneSimulator = Release|iPhoneSimulator - Debug|iPhone = Debug|iPhone - Release|iPhone = Release|iPhone EndGlobalSection GlobalSection(ProjectConfigurationPlatforms) = postSolution {7340A1C6-61A5-42D2-9DBC-6688D2E70F62}.Debug|Any CPU.ActiveCfg = Debug|Any CPU @@ -27,17 +21,5 @@ Global {7340A1C6-61A5-42D2-9DBC-6688D2E70F62}.Debug|iPhone.Build.0 = Debug|Any CPU {7340A1C6-61A5-42D2-9DBC-6688D2E70F62}.Release|iPhone.ActiveCfg = Release|Any CPU {7340A1C6-61A5-42D2-9DBC-6688D2E70F62}.Release|iPhone.Build.0 = Release|Any CPU - {E7E76A89-6DB7-4CF6-953C-6D9ADC656C6F}.Debug|Any CPU.ActiveCfg = Debug|iPhoneSimulator - {E7E76A89-6DB7-4CF6-953C-6D9ADC656C6F}.Debug|Any CPU.Build.0 = Debug|iPhoneSimulator - {E7E76A89-6DB7-4CF6-953C-6D9ADC656C6F}.Release|Any CPU.ActiveCfg = Release|iPhoneSimulator - {E7E76A89-6DB7-4CF6-953C-6D9ADC656C6F}.Release|Any CPU.Build.0 = Release|iPhoneSimulator - {E7E76A89-6DB7-4CF6-953C-6D9ADC656C6F}.Debug|iPhoneSimulator.ActiveCfg = Debug|iPhoneSimulator - {E7E76A89-6DB7-4CF6-953C-6D9ADC656C6F}.Debug|iPhoneSimulator.Build.0 = Debug|iPhoneSimulator - {E7E76A89-6DB7-4CF6-953C-6D9ADC656C6F}.Release|iPhoneSimulator.ActiveCfg = Release|iPhoneSimulator - {E7E76A89-6DB7-4CF6-953C-6D9ADC656C6F}.Release|iPhoneSimulator.Build.0 = Release|iPhoneSimulator - {E7E76A89-6DB7-4CF6-953C-6D9ADC656C6F}.Debug|iPhone.ActiveCfg = Debug|iPhone - {E7E76A89-6DB7-4CF6-953C-6D9ADC656C6F}.Debug|iPhone.Build.0 = Debug|iPhone - {E7E76A89-6DB7-4CF6-953C-6D9ADC656C6F}.Release|iPhone.ActiveCfg = Release|iPhone - {E7E76A89-6DB7-4CF6-953C-6D9ADC656C6F}.Release|iPhone.Build.0 = Release|iPhone EndGlobalSection EndGlobal diff --git a/tools/devops/build-samples.csx b/tools/devops/build-samples.csx index f123ff969405..082cb394213c 100644 --- a/tools/devops/build-samples.csx +++ b/tools/devops/build-samples.csx @@ -59,7 +59,24 @@ InstallPackage ("Objective-Sharpie", FindVariable ("MIN_SHARPIE_URL")); // Provisioning profiles Console.WriteLine ("Provisioning provisioning profiles..."); -Exec ($"../../../maccore/tools/install-qa-provisioning-profiles.sh"); + +void Execute (string cmd, params string[] args) +{ + new Exec ( + ProcessArguments.FromCommandAndArguments (cmd, args), + ExecFlags.None, (ConsoleRedirection) null) + .RunAsync () + .GetAwaiter () + .GetResult (); +} + +Execute ("pwd"); +Environment.SetEnvironmentVariable ("PROVISION_DONT_FETCH_UPDATED_CERTS", "1"); +try { + Execute ($"../../../maccore/tools/install-qa-provisioning-profiles.sh", "-v"); +} catch (Exception e) { + Console.WriteLine ("Failed to provision provisioning profiles: {0}", e); +} // .NET core // The version number here must match the one in Xamarin.Tests.Configuration:CreateGlobalConfig (tests/sampletester/Configuration.cs). diff --git a/tools/devops/build-samples.sh b/tools/devops/build-samples.sh index e678483fc9e1..ac609ea819b8 100755 --- a/tools/devops/build-samples.sh +++ b/tools/devops/build-samples.sh @@ -1,5 +1,7 @@ #!/bin/bash -eux +cd "$(dirname "${BASH_SOURCE[0]}")/../.." + # we want verbose output from mtouch and mlaunch echo 123456789 > ~/.mtouch-verbosity echo 123456789 > ~/.mlaunch-verbosity diff --git a/tools/devops/build-samples.yml b/tools/devops/build-samples.yml index e7a685fe61de..ab540a5624c5 100644 --- a/tools/devops/build-samples.yml +++ b/tools/devops/build-samples.yml @@ -13,12 +13,29 @@ variables: name_filter_gr: '^[G-Rg-r].*$' name_filter_rest: '^[^A-Ra-r].*$' +resources: + repositories: + - repository: xamarin-macios-data + type: github + name: xamarin/xamarin-macios-data + ref: refs/heads/master + endpoint: xamarin + - repository: maccore + type: github + name: xamarin/maccore + ref: refs/heads/master + endpoint: xamarin + jobs: - job: ReportStartToGitHub displayName: Set pending GitHub status pool: name: '$(macOSVersion)' steps: + + - bash: pwd && ls -la + displayName: Where am I + - bash: ./jenkins/add-commit-status.sh "--token=$(github-pat)" "--hash=$BUILD_SOURCEVERSION" "--state=pending" --target-url="$AZURE_BUILD_URL" --description="$BUILD_DEFINITIONNAME" --context="$BUILD_DEFINITIONNAME" displayName: Set pending GitHub status @@ -73,32 +90,40 @@ jobs: steps: - checkout: self - persistCredentials: true + - checkout: xamarin-macios-data + - checkout: maccore - - bash: ./tools/devops/system-info.sh + - bash: ./xamarin-macios/tools/devops/system-info.sh displayName: System Info - - bash: ./tools/devops/fetch-maccore.sh - displayName: Fetch maccore + - bash: | + set -x + cd maccore + git remote rename origin xamarin + cd .. + cd xamarin-macios + ./configure --enable-xamarin + V=1 make reset-maccore V=1 + displayName: Fetch correct maccore hash - task: provisionator@2 displayName: Xcode inputs: provisionator_uri: '$(provisionator-uri)' github_token: '$(github-pat)' - provisioning_script: $(System.DefaultWorkingDirectory)/tools/devops/provision-xcode.csx + provisioning_script: $(System.DefaultWorkingDirectory)/xamarin-macios/tools/devops/provision-xcode.csx - task: provisionator@2 displayName: Provision XI/XM/Mono/Objective-Sharpie inputs: provisionator_uri: '$(provisionator-uri)' github_token: '$(github-pat)' - provisioning_script: $(System.DefaultWorkingDirectory)/tools/devops/build-samples.csx + provisioning_script: $(System.DefaultWorkingDirectory)/xamarin-macios/tools/devops/build-samples.csx - - bash: ./tools/devops/system-info.sh + - bash: ./xamarin-macios/tools/devops/system-info.sh displayName: System Info post provisioning - - bash: ./tools/devops/build-samples.sh + - bash: ./xamarin-macios/tools/devops/build-samples.sh displayName: Run tests - task: PublishTestResults@2 @@ -111,7 +136,7 @@ jobs: publishRunAttachments: true mergeTestResults: true - - bash: ./tools/devops/publish-performance-data.sh + - bash: ./xamarin-macios/tools/devops/publish-performance-data.sh displayName: Publish performance data condition: always() diff --git a/tools/devops/fetch-maccore.sh b/tools/devops/fetch-maccore.sh index cdfae75a8212..7b993b0f0659 100755 --- a/tools/devops/fetch-maccore.sh +++ b/tools/devops/fetch-maccore.sh @@ -3,9 +3,16 @@ # Make sure we've enabled our xamarin bits ./configure --enable-xamarin -# grab Azure Devop's authorization token from the current repo, and use add it to the global git configuration +# grab Azure Devop's authorization token from the current repo, and add it to the global git configuration AUTH=$(git config -l | grep AUTHORIZATION | sed 's/.*AUTHORIZATION: //') +AUTH_MD5=$(echo "$AUTH" | md5) git config --global http.extraheader "AUTHORIZATION: $AUTH" +echo "AUTH_MD5=$AUTH_MD5" + +# Debug spew, checking if the authorization token is correct +git ls-remote https://github.com/xamarin/maccore || true +git ls-remote https://github.com/xamarin/xamarin-macios-data || true + # fetch maccore # the github auth we use only works with https, so change maccore's url to be https:// instead of git@ diff --git a/tools/devops/publish-performance-data.sh b/tools/devops/publish-performance-data.sh index 27a5350cbc5f..04b5a8596bcd 100755 --- a/tools/devops/publish-performance-data.sh +++ b/tools/devops/publish-performance-data.sh @@ -1,13 +1,16 @@ #!/bin/bash -ex -# git clone https://github.com/xamarin/xamarin-macios-performance-data -mkdir xamarin-macios-performance-data -( cd xamarin-macios-performance-data && git init . ) +DATA_REPO_NAME=xamarin-macios-data -DIR=xamarin-macios-performance-data/$BUILD_SOURCEBRANCHNAME/$BUILD_SOURCEVERSION/$SYSTEM_JOBID +DIR=$DATA_REPO_NAME/perf-data/samples/$BUILD_SOURCEBRANCHNAME/$BUILD_SOURCEVERSION/$SYSTEM_JOBID mkdir -p "$DIR" -cp -c tests/sampletester/bin/Debug/tmp-test-dir/execution-logs/*.xml "$DIR/" +XMLS=(xamarin-macios/tests/sampletester/bin/Debug/tmp-test-dir/execution-logs/*.xml) +if ! test -f "${XMLS[0]}"; then + echo "##vso[task.logissue type=warning]Could not find any performance data to publish" + exit 0 +fi +cp -c xamarin-macios/tests/sampletester/bin/Debug/tmp-test-dir/execution-logs/*.xml "$DIR/" cd "$DIR" git add . git commit -m "Add performance data for $BUILD_SOURCEBRANCHNAME/$BUILD_SOURCEVERSION from the $SYSTEM_JOBNAME job." diff --git a/tools/devops/system-info.sh b/tools/devops/system-info.sh index a753fb8412cf..455544f3f0dd 100755 --- a/tools/devops/system-info.sh +++ b/tools/devops/system-info.sh @@ -10,5 +10,7 @@ ls -lad /Applications/Xcode* xcode-select -p mono --version env | sort +uptime +ps aux -exit 0 \ No newline at end of file +exit 0 From 1d1e2c477bd49864396f99ccf6567445664ec086 Mon Sep 17 00:00:00 2001 From: Rolf Bjarne Kvinge Date: Mon, 16 Dec 2019 19:23:17 +0100 Subject: [PATCH 09/38] More tweaks. --- mk/xamarin.mk | 4 ++-- tools/devops/build-samples.yml | 2 ++ 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/mk/xamarin.mk b/mk/xamarin.mk index 3eb97c989a76..147cc4dc5239 100644 --- a/mk/xamarin.mk +++ b/mk/xamarin.mk @@ -7,8 +7,8 @@ MONO_BRANCH := $(shell cd $(MONO_PATH) 2> /dev/null && git symbolic-ref --sho endif ifdef ENABLE_XAMARIN -NEEDED_MACCORE_VERSION := c8f72155c8849082295015d6bee28d2034ae92c9 -NEEDED_MACCORE_BRANCH := provisioning-skip-fetch +NEEDED_MACCORE_VERSION := 4f039a05f6781ffd0b1e6937e0294e08b5e3a81e +NEEDED_MACCORE_BRANCH := master MACCORE_DIRECTORY := maccore MACCORE_MODULE := git@github.com:xamarin/maccore.git diff --git a/tools/devops/build-samples.yml b/tools/devops/build-samples.yml index ab540a5624c5..522978c3959d 100644 --- a/tools/devops/build-samples.yml +++ b/tools/devops/build-samples.yml @@ -91,7 +91,9 @@ jobs: steps: - checkout: self - checkout: xamarin-macios-data + persistCredentials: true - checkout: maccore + persistCredentials: true - bash: ./xamarin-macios/tools/devops/system-info.sh displayName: System Info From a3ba23a215e271b71a95c7e84bd50b20595dbee5 Mon Sep 17 00:00:00 2001 From: Rolf Bjarne Kvinge Date: Mon, 16 Dec 2019 22:40:40 +0100 Subject: [PATCH 10/38] Huh? --- tools/devops/publish-performance-data.sh | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/tools/devops/publish-performance-data.sh b/tools/devops/publish-performance-data.sh index 04b5a8596bcd..cae6ed10ec87 100755 --- a/tools/devops/publish-performance-data.sh +++ b/tools/devops/publish-performance-data.sh @@ -12,6 +12,13 @@ if ! test -f "${XMLS[0]}"; then fi cp -c xamarin-macios/tests/sampletester/bin/Debug/tmp-test-dir/execution-logs/*.xml "$DIR/" cd "$DIR" + +git branch || true +pwd +git status || true +git log || true +git checkout master || true + git add . git commit -m "Add performance data for $BUILD_SOURCEBRANCHNAME/$BUILD_SOURCEVERSION from the $SYSTEM_JOBNAME job." From c3617a47140fb80209cb641eba407ae78b777717 Mon Sep 17 00:00:00 2001 From: Rolf Bjarne Kvinge Date: Tue, 17 Dec 2019 07:29:17 +0100 Subject: [PATCH 11/38] Debug stuff. --- tools/devops/build-samples.csx | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/tools/devops/build-samples.csx b/tools/devops/build-samples.csx index 082cb394213c..637d13e33b4c 100644 --- a/tools/devops/build-samples.csx +++ b/tools/devops/build-samples.csx @@ -72,6 +72,11 @@ void Execute (string cmd, params string[] args) Execute ("pwd"); Environment.SetEnvironmentVariable ("PROVISION_DONT_FETCH_UPDATED_CERTS", "1"); +try { + Execute ($"../../../maccore/tools/provisioning-profiles/fetch-updated-certificates-and-profiles.sh", "-v"); +} catch (Exception e) { + Console.WriteLine ("Failed to fetch provisioning profiles: {0}", e); +} try { Execute ($"../../../maccore/tools/install-qa-provisioning-profiles.sh", "-v"); } catch (Exception e) { From 2839202abf3478de965344be0e8c2ebecf101442 Mon Sep 17 00:00:00 2001 From: Rolf Bjarne Kvinge Date: Tue, 17 Dec 2019 09:04:05 +0100 Subject: [PATCH 12/38] diagnostics. --- tools/devops/build-samples.csx | 28 ++++++++++++---------------- tools/devops/diagnostics.sh | 15 +++++++++++++++ 2 files changed, 27 insertions(+), 16 deletions(-) create mode 100755 tools/devops/diagnostics.sh diff --git a/tools/devops/build-samples.csx b/tools/devops/build-samples.csx index 637d13e33b4c..2addfdb80693 100644 --- a/tools/devops/build-samples.csx +++ b/tools/devops/build-samples.csx @@ -62,26 +62,22 @@ Console.WriteLine ("Provisioning provisioning profiles..."); void Execute (string cmd, params string[] args) { - new Exec ( - ProcessArguments.FromCommandAndArguments (cmd, args), - ExecFlags.None, (ConsoleRedirection) null) - .RunAsync () - .GetAwaiter () - .GetResult (); + try { + new Exec ( + ProcessArguments.FromCommandAndArguments (cmd, args), + ExecFlags.None, (ConsoleRedirection) null) + .RunAsync () + .GetAwaiter () + .GetResult (); + } catch (Exception e) { + Console.WriteLine ("Failed to execute {1}: {0}", e, cmd); + } } Execute ("pwd"); Environment.SetEnvironmentVariable ("PROVISION_DONT_FETCH_UPDATED_CERTS", "1"); -try { - Execute ($"../../../maccore/tools/provisioning-profiles/fetch-updated-certificates-and-profiles.sh", "-v"); -} catch (Exception e) { - Console.WriteLine ("Failed to fetch provisioning profiles: {0}", e); -} -try { - Execute ($"../../../maccore/tools/install-qa-provisioning-profiles.sh", "-v"); -} catch (Exception e) { - Console.WriteLine ("Failed to provision provisioning profiles: {0}", e); -} +Execute ($"./diagnostics.sh", "-v"); +Execute ($"../../../maccore/tools/install-qa-provisioning-profiles.sh", "-v"); // .NET core // The version number here must match the one in Xamarin.Tests.Configuration:CreateGlobalConfig (tests/sampletester/Configuration.cs). diff --git a/tools/devops/diagnostics.sh b/tools/devops/diagnostics.sh new file mode 100755 index 000000000000..ad21d6074d89 --- /dev/null +++ b/tools/devops/diagnostics.sh @@ -0,0 +1,15 @@ +#!/bin/bash -x + +cd "$(dirname "${BASH_SOURCE[0]}")/../.." || exit + +cd ../../../maccore +git remote -v +git show +git branch +git status +git config -l + +./tools/provisioning-profiles/fetch-updated-certificates-and-profiles.sh -v +../../../maccore/tools/install-qa-provisioning-profiles.sh -v + +exit 0 From e06f7273d15d2ff5e9e8c013cc780f9bcc3d61e2 Mon Sep 17 00:00:00 2001 From: Rolf Bjarne Kvinge Date: Tue, 17 Dec 2019 09:05:39 +0100 Subject: [PATCH 13/38] Better diagnostics. --- tools/devops/diagnostics.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/devops/diagnostics.sh b/tools/devops/diagnostics.sh index ad21d6074d89..c288f6527b30 100755 --- a/tools/devops/diagnostics.sh +++ b/tools/devops/diagnostics.sh @@ -1,6 +1,6 @@ #!/bin/bash -x -cd "$(dirname "${BASH_SOURCE[0]}")/../.." || exit +cd "$(dirname "${BASH_SOURCE[0]}")" cd ../../../maccore git remote -v From 007d0db20a5e7a1fd3afc32a16fcb8a5a3ca2daa Mon Sep 17 00:00:00 2001 From: Rolf Bjarne Kvinge Date: Tue, 17 Dec 2019 09:40:04 +0100 Subject: [PATCH 14/38] cleanup --- tools/devops/build-samples.yml | 2 +- tools/devops/diagnostics.sh | 4 +++- tools/devops/fetch-maccore.sh | 5 ----- 3 files changed, 4 insertions(+), 7 deletions(-) diff --git a/tools/devops/build-samples.yml b/tools/devops/build-samples.yml index 522978c3959d..e66e5d6ab543 100644 --- a/tools/devops/build-samples.yml +++ b/tools/devops/build-samples.yml @@ -101,7 +101,7 @@ jobs: - bash: | set -x cd maccore - git remote rename origin xamarin + #git remote rename origin xamarin cd .. cd xamarin-macios ./configure --enable-xamarin diff --git a/tools/devops/diagnostics.sh b/tools/devops/diagnostics.sh index c288f6527b30..a67fdbcc4e22 100755 --- a/tools/devops/diagnostics.sh +++ b/tools/devops/diagnostics.sh @@ -9,7 +9,9 @@ git branch git status git config -l +#git remote rename xamarin origin + ./tools/provisioning-profiles/fetch-updated-certificates-and-profiles.sh -v -../../../maccore/tools/install-qa-provisioning-profiles.sh -v +./tools/install-qa-provisioning-profiles.sh -v exit 0 diff --git a/tools/devops/fetch-maccore.sh b/tools/devops/fetch-maccore.sh index 7b993b0f0659..5b024f7a1634 100755 --- a/tools/devops/fetch-maccore.sh +++ b/tools/devops/fetch-maccore.sh @@ -9,11 +9,6 @@ AUTH_MD5=$(echo "$AUTH" | md5) git config --global http.extraheader "AUTHORIZATION: $AUTH" echo "AUTH_MD5=$AUTH_MD5" -# Debug spew, checking if the authorization token is correct -git ls-remote https://github.com/xamarin/maccore || true -git ls-remote https://github.com/xamarin/xamarin-macios-data || true - - # fetch maccore # the github auth we use only works with https, so change maccore's url to be https:// instead of git@ make reset-maccore MACCORE_MODULE="$(grep ^MACCORE_MODULE mk/xamarin.mk | sed -e 's/.*:= //' -e 's_git@github.com:_https://github.com/_' -e 's/[.]git//')" V=1 From 944c6ed442c77709e5906ed508e494187c4f01a5 Mon Sep 17 00:00:00 2001 From: Rolf Bjarne Kvinge Date: Tue, 17 Dec 2019 10:18:35 +0100 Subject: [PATCH 15/38] tmp --- .../AppIcon.appiconset/Contents.json~ | 202 ------------------ tools/devops/build-samples.yml | 2 +- 2 files changed, 1 insertion(+), 203 deletions(-) delete mode 100644 msbuild/tests/Bug60536/Assets.xcassets/AppIcon.appiconset/Contents.json~ diff --git a/msbuild/tests/Bug60536/Assets.xcassets/AppIcon.appiconset/Contents.json~ b/msbuild/tests/Bug60536/Assets.xcassets/AppIcon.appiconset/Contents.json~ deleted file mode 100644 index 64d0e3ddf877..000000000000 --- a/msbuild/tests/Bug60536/Assets.xcassets/AppIcon.appiconset/Contents.json~ +++ /dev/null @@ -1,202 +0,0 @@ -{ - "images" : [ - { - "idiom" : "iphone", - "size" : "20x20", - "scale" : "2x" - }, - { - "idiom" : "iphone", - "size" : "20x20", - "scale" : "3x" - }, - { - "idiom" : "iphone", - "size" : "29x29", - "scale" : "2x" - }, - { - "idiom" : "iphone", - "size" : "29x29", - "scale" : "3x" - }, - { - "idiom" : "iphone", - "size" : "40x40", - "scale" : "2x" - }, - { - "idiom" : "iphone", - "size" : "40x40", - "scale" : "3x" - }, - { - "idiom" : "iphone", - "size" : "60x60", - "scale" : "2x" - }, - { - "idiom" : "iphone", - "size" : "60x60", - "scale" : "3x" - }, - { - "idiom" : "ipad", - "size" : "20x20", - "scale" : "1x" - }, - { - "idiom" : "ipad", - "size" : "20x20", - "scale" : "2x" - }, - { - "idiom" : "ipad", - "size" : "29x29", - "scale" : "1x" - }, - { - "idiom" : "ipad", - "size" : "29x29", - "scale" : "2x" - }, - { - "idiom" : "ipad", - "size" : "40x40", - "scale" : "1x" - }, - { - "idiom" : "ipad", - "size" : "40x40", - "scale" : "2x" - }, - { - "idiom" : "ipad", - "size" : "76x76", - "scale" : "1x" - }, - { - "idiom" : "ipad", - "size" : "76x76", - "scale" : "2x" - }, - { - "idiom" : "ipad", - "size" : "83.5x83.5", - "scale" : "2x" - }, - { - "idiom" : "ios-marketing", - "size" : "1024x1024", - "scale" : "1x" - }, - { - "size" : "24x24", - "idiom" : "watch", - "scale" : "2x", - "role" : "notificationCenter", - "subtype" : "38mm" - }, - { - "size" : "27.5x27.5", - "idiom" : "watch", - "scale" : "2x", - "role" : "notificationCenter", - "subtype" : "42mm" - }, - { - "size" : "29x29", - "idiom" : "watch", - "role" : "companionSettings", - "scale" : "2x" - }, - { - "size" : "29x29", - "idiom" : "watch", - "role" : "companionSettings", - "scale" : "3x" - }, - { - "size" : "40x40", - "idiom" : "watch", - "scale" : "2x", - "role" : "appLauncher", - "subtype" : "38mm" - }, - { - "size" : "44x44", - "idiom" : "watch", - "scale" : "2x", - "role" : "longLook", - "subtype" : "42mm" - }, - { - "size" : "86x86", - "idiom" : "watch", - "scale" : "2x", - "role" : "quickLook", - "subtype" : "38mm" - }, - { - "size" : "98x98", - "idiom" : "watch", - "scale" : "2x", - "role" : "quickLook", - "subtype" : "42mm" - }, - { - "idiom" : "mac", - "size" : "16x16", - "scale" : "1x" - }, - { - "idiom" : "mac", - "size" : "16x16", - "scale" : "2x" - }, - { - "idiom" : "mac", - "size" : "32x32", - "scale" : "1x" - }, - { - "idiom" : "mac", - "size" : "32x32", - "scale" : "2x" - }, - { - "idiom" : "mac", - "size" : "128x128", - "scale" : "1x" - }, - { - "idiom" : "mac", - "size" : "128x128", - "scale" : "2x" - }, - { - "idiom" : "mac", - "size" : "256x256", - "scale" : "1x" - }, - { - "idiom" : "mac", - "size" : "256x256", - "scale" : "2x" - }, - { - "idiom" : "mac", - "size" : "512x512", - "scale" : "1x" - }, - { - "idiom" : "mac", - "size" : "512x512", - "scale" : "2x" - } - ], - "info" : { - "version" : 1, - "author" : "xcode" - } -} diff --git a/tools/devops/build-samples.yml b/tools/devops/build-samples.yml index e66e5d6ab543..29396d5dd93b 100644 --- a/tools/devops/build-samples.yml +++ b/tools/devops/build-samples.yml @@ -101,7 +101,7 @@ jobs: - bash: | set -x cd maccore - #git remote rename origin xamarin + git remote add -f xamarin https://github.com/xamarin/maccore cd .. cd xamarin-macios ./configure --enable-xamarin From 999aeeada2342f8df2950b1d2888f0ad80f71df8 Mon Sep 17 00:00:00 2001 From: Rolf Bjarne Kvinge Date: Tue, 17 Dec 2019 19:15:03 +0100 Subject: [PATCH 16/38] Use a separate stage to push data. --- tools/devops/build-samples.yml | 50 ++++++++++++++++++++++++++++++++-- 1 file changed, 48 insertions(+), 2 deletions(-) diff --git a/tools/devops/build-samples.yml b/tools/devops/build-samples.yml index 29396d5dd93b..dd8635be976f 100644 --- a/tools/devops/build-samples.yml +++ b/tools/devops/build-samples.yml @@ -138,15 +138,61 @@ jobs: publishRunAttachments: true mergeTestResults: true - - bash: ./xamarin-macios/tools/devops/publish-performance-data.sh - displayName: Publish performance data + # - bash: ./xamarin-macios/tools/devops/publish-performance-data.sh + # displayName: Publish performance data + # condition: always() + + - bash: | + set -e + set -x + mkdir -p logs + zip -9r logs/execution-logs-$SYSTEM_JOBID.zip xamarin-macios/tests/sampletester/bin/Debug/tmp-test-dir/execution-logs + displayName: Compress execution logs + condition: always() + + - task: PublishBuildArtifacts@1 + displayName: 'Upload perf data' condition: always() + inputs: + PathtoPublish: 'logs' + ArtifactName: 'logs' + publishLocation: 'Container' - bash: echo "##vso[task.setvariable variable=JobStatus;isOutput=true]$AGENT_JOBSTATUS" name: ExportedVariables displayName: Export status condition: always() +- job: PublishPerformanceData + condition: always() + dependsOn: macOS + pool: + name: '$(macOSVersion)' + steps: + - checkout: self + - checkout: xamarin-macios-data + persistCredentials: true + + - task: DownloadPipelineArtifact@2 + inputs: + source: current + artifact: logs + path: logs + + - bash: | + set -x + set -e + cp -cr logs/ xamarin-macios-data/ + cd xamarin-macios-data && git add . && git commit -m "Add performance data for $BUILD_SOURCEBRANCHNAME/$BUILD_SOURCEVERSION." + # Try to push 5 times, just in case someone else pushed first. + COUNTER=5 + while [[ $COUNTER -gt 0 ]]; do + if git push; then break; fi + git pull + (( COUNTER-- )) + done + displayName: Publish perf data + - job: ReportResultsToGitHub displayName: Report status/results to GitHub dependsOn: macOS From fa1d2f25a32844fc7b3897eccb0c1abe933bba0e Mon Sep 17 00:00:00 2001 From: Rolf Bjarne Kvinge Date: Tue, 17 Dec 2019 22:56:53 +0100 Subject: [PATCH 17/38] Next attempt. --- tools/devops/build-samples.yml | 25 +++++++++++++------------ 1 file changed, 13 insertions(+), 12 deletions(-) diff --git a/tools/devops/build-samples.yml b/tools/devops/build-samples.yml index dd8635be976f..ac58a384a410 100644 --- a/tools/devops/build-samples.yml +++ b/tools/devops/build-samples.yml @@ -125,8 +125,15 @@ jobs: - bash: ./xamarin-macios/tools/devops/system-info.sh displayName: System Info post provisioning - - bash: ./xamarin-macios/tools/devops/build-samples.sh - displayName: Run tests + # - bash: ./xamarin-macios/tools/devops/build-samples.sh + # displayName: Run tests + + - bash: | + set -e + set -x + mkdir -p xamarin-macios/tests/sampletester/bin/Debug/tmp-test-dir/execution-logs + echo "Test results" > xamarin-macios/tests/sampletester/bin/Debug/tmp-test-dir/execution-logs/results.xml + displayName: Fake test run - task: PublishTestResults@2 displayName: Publish test results @@ -150,13 +157,10 @@ jobs: displayName: Compress execution logs condition: always() - - task: PublishBuildArtifacts@1 + - publish: logs displayName: 'Upload perf data' condition: always() - inputs: - PathtoPublish: 'logs' - ArtifactName: 'logs' - publishLocation: 'Container' + artifact: logs - bash: echo "##vso[task.setvariable variable=JobStatus;isOutput=true]$AGENT_JOBSTATUS" name: ExportedVariables @@ -173,11 +177,8 @@ jobs: - checkout: xamarin-macios-data persistCredentials: true - - task: DownloadPipelineArtifact@2 - inputs: - source: current - artifact: logs - path: logs + - download: current + artifact: logs - bash: | set -x From 23d4a3970e16f3551b7b29f4c09da6bacdb1bd96 Mon Sep 17 00:00:00 2001 From: Rolf Bjarne Kvinge Date: Tue, 17 Dec 2019 23:42:20 +0100 Subject: [PATCH 18/38] Unique artifact names. --- tools/devops/build-samples.yml | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/tools/devops/build-samples.yml b/tools/devops/build-samples.yml index ac58a384a410..3e176f4e6487 100644 --- a/tools/devops/build-samples.yml +++ b/tools/devops/build-samples.yml @@ -157,7 +157,7 @@ jobs: displayName: Compress execution logs condition: always() - - publish: logs + - publish: logs-$(System.JobId) displayName: 'Upload perf data' condition: always() artifact: logs @@ -167,6 +167,8 @@ jobs: displayName: Export status condition: always() +### Upload performance data to xamarin-macios-data + - job: PublishPerformanceData condition: always() dependsOn: macOS @@ -177,8 +179,10 @@ jobs: - checkout: xamarin-macios-data persistCredentials: true - - download: current - artifact: logs + - task: DownloadPipelineArtifact@2 + inputs: + source: current + path: logs - bash: | set -x @@ -194,6 +198,8 @@ jobs: done displayName: Publish perf data +### Report final results to GitHub + - job: ReportResultsToGitHub displayName: Report status/results to GitHub dependsOn: macOS From d208ce65801e3b417e9f63d23149ec8b4be15309 Mon Sep 17 00:00:00 2001 From: Rolf Bjarne Kvinge Date: Wed, 18 Dec 2019 00:24:09 +0100 Subject: [PATCH 19/38] Make the right name unique. --- tools/devops/build-samples.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tools/devops/build-samples.yml b/tools/devops/build-samples.yml index 3e176f4e6487..a9202203a397 100644 --- a/tools/devops/build-samples.yml +++ b/tools/devops/build-samples.yml @@ -157,10 +157,10 @@ jobs: displayName: Compress execution logs condition: always() - - publish: logs-$(System.JobId) + - publish: logs displayName: 'Upload perf data' condition: always() - artifact: logs + artifact: logs-$(System.JobId) - bash: echo "##vso[task.setvariable variable=JobStatus;isOutput=true]$AGENT_JOBSTATUS" name: ExportedVariables From 165eb98c815c32f6cf11e29ad0791da449fd0252 Mon Sep 17 00:00:00 2001 From: Rolf Bjarne Kvinge Date: Wed, 18 Dec 2019 07:06:16 +0100 Subject: [PATCH 20/38] More progress --- tools/devops/build-samples.yml | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/tools/devops/build-samples.yml b/tools/devops/build-samples.yml index a9202203a397..aaa07c38dbcf 100644 --- a/tools/devops/build-samples.yml +++ b/tools/devops/build-samples.yml @@ -150,8 +150,7 @@ jobs: # condition: always() - bash: | - set -e - set -x + set -ex mkdir -p logs zip -9r logs/execution-logs-$SYSTEM_JOBID.zip xamarin-macios/tests/sampletester/bin/Debug/tmp-test-dir/execution-logs displayName: Compress execution logs @@ -185,10 +184,12 @@ jobs: path: logs - bash: | - set -x - set -e - cp -cr logs/ xamarin-macios-data/ - cd xamarin-macios-data && git add . && git commit -m "Add performance data for $BUILD_SOURCEBRANCHNAME/$BUILD_SOURCEVERSION." + set -ex + cd xamarin-macios-data + git checkout master + cp -cr ../logs/ ./ + git add . + git commit -m "Add performance data for $BUILD_SOURCEBRANCHNAME/$BUILD_SOURCEVERSION." # Try to push 5 times, just in case someone else pushed first. COUNTER=5 while [[ $COUNTER -gt 0 ]]; do @@ -196,6 +197,7 @@ jobs: git pull (( COUNTER-- )) done + for i in *.zip; do unzip -l $i; done || true displayName: Publish perf data ### Report final results to GitHub From c71a27daab4e2492a00268904352f0abca416ab5 Mon Sep 17 00:00:00 2001 From: Rolf Bjarne Kvinge Date: Wed, 18 Dec 2019 10:42:48 +0100 Subject: [PATCH 21/38] Improvements --- tools/devops/build-samples.yml | 55 ++++++++++-------------- tools/devops/fetch-maccore.sh | 20 +++++---- tools/devops/prepare-performance-data.sh | 14 ++++++ tools/devops/publish-performance-data.sh | 31 ------------- tools/devops/push-performance-data.sh | 20 +++++++++ 5 files changed, 67 insertions(+), 73 deletions(-) create mode 100755 tools/devops/prepare-performance-data.sh delete mode 100755 tools/devops/publish-performance-data.sh create mode 100755 tools/devops/push-performance-data.sh diff --git a/tools/devops/build-samples.yml b/tools/devops/build-samples.yml index aaa07c38dbcf..fee6f749318a 100644 --- a/tools/devops/build-samples.yml +++ b/tools/devops/build-samples.yml @@ -26,6 +26,10 @@ resources: ref: refs/heads/master endpoint: xamarin +### +### Tell GitHub we're starting on this commit +### + jobs: - job: ReportStartToGitHub displayName: Set pending GitHub status @@ -39,6 +43,13 @@ jobs: - bash: ./jenkins/add-commit-status.sh "--token=$(github-pat)" "--hash=$BUILD_SOURCEVERSION" "--state=pending" --target-url="$AZURE_BUILD_URL" --description="$BUILD_DEFINITIONNAME" --context="$BUILD_DEFINITIONNAME" displayName: Set pending GitHub status +### +### Run the sample tests. +### +### They're split over multiple bots to make them run faster (and not hit the +### max job time duration for a single job). +### + - job: macOS dependsOn: ReportStartToGitHub displayName: Build samples @@ -98,14 +109,7 @@ jobs: - bash: ./xamarin-macios/tools/devops/system-info.sh displayName: System Info - - bash: | - set -x - cd maccore - git remote add -f xamarin https://github.com/xamarin/maccore - cd .. - cd xamarin-macios - ./configure --enable-xamarin - V=1 make reset-maccore V=1 + - bash: ./xamarin-macios/tools/devops/fetch-maccore.sh displayName: Fetch correct maccore hash - task: provisionator@2 @@ -145,15 +149,8 @@ jobs: publishRunAttachments: true mergeTestResults: true - # - bash: ./xamarin-macios/tools/devops/publish-performance-data.sh - # displayName: Publish performance data - # condition: always() - - - bash: | - set -ex - mkdir -p logs - zip -9r logs/execution-logs-$SYSTEM_JOBID.zip xamarin-macios/tests/sampletester/bin/Debug/tmp-test-dir/execution-logs - displayName: Compress execution logs + - bash: ./xamarin-macios/tools/devops/prepare-performance-data.sh + displayName: Prepare performance data condition: always() - publish: logs @@ -166,9 +163,12 @@ jobs: displayName: Export status condition: always() -### Upload performance data to xamarin-macios-data +### +### Push performance data to the xamarin-macios-data repository +### - job: PublishPerformanceData + displayName: Publish Performance Data condition: always() dependsOn: macOS pool: @@ -179,28 +179,17 @@ jobs: persistCredentials: true - task: DownloadPipelineArtifact@2 + displayName: Download performance data inputs: source: current path: logs - - bash: | - set -ex - cd xamarin-macios-data - git checkout master - cp -cr ../logs/ ./ - git add . - git commit -m "Add performance data for $BUILD_SOURCEBRANCHNAME/$BUILD_SOURCEVERSION." - # Try to push 5 times, just in case someone else pushed first. - COUNTER=5 - while [[ $COUNTER -gt 0 ]]; do - if git push; then break; fi - git pull - (( COUNTER-- )) - done - for i in *.zip; do unzip -l $i; done || true + - bash: ./xamarin-macios/tools/devops/push-performance-data.sh displayName: Publish perf data +### ### Report final results to GitHub +### - job: ReportResultsToGitHub displayName: Report status/results to GitHub diff --git a/tools/devops/fetch-maccore.sh b/tools/devops/fetch-maccore.sh index 5b024f7a1634..10966fa8fb8b 100755 --- a/tools/devops/fetch-maccore.sh +++ b/tools/devops/fetch-maccore.sh @@ -1,14 +1,16 @@ #!/bin/bash -eux +# maccore is already checked out, but our script does a different remote +# ('xamarin' vs 'origin'), so add the different remote, and at the same time +# use https for the repository (instead of git@), since GitHub auth on Azure +# Devops only works with https. + +cd "cd $(git rev-parse --show-toplevel)/../maccore" +git remote add -f xamarin https://github.com/xamarin/maccore +cd ../xamarin-macios + # Make sure we've enabled our xamarin bits ./configure --enable-xamarin -# grab Azure Devop's authorization token from the current repo, and add it to the global git configuration -AUTH=$(git config -l | grep AUTHORIZATION | sed 's/.*AUTHORIZATION: //') -AUTH_MD5=$(echo "$AUTH" | md5) -git config --global http.extraheader "AUTHORIZATION: $AUTH" -echo "AUTH_MD5=$AUTH_MD5" - -# fetch maccore -# the github auth we use only works with https, so change maccore's url to be https:// instead of git@ -make reset-maccore MACCORE_MODULE="$(grep ^MACCORE_MODULE mk/xamarin.mk | sed -e 's/.*:= //' -e 's_git@github.com:_https://github.com/_' -e 's/[.]git//')" V=1 +# fetch the hash we want +make reset-maccore V=1 diff --git a/tools/devops/prepare-performance-data.sh b/tools/devops/prepare-performance-data.sh new file mode 100755 index 000000000000..7d3764d38140 --- /dev/null +++ b/tools/devops/prepare-performance-data.sh @@ -0,0 +1,14 @@ +#!/bin/bash -ex + +DIR=perf-data/samples/$BUILD_SOURCEBRANCHNAME/$BUILD_SOURCEVERSION/$SYSTEM_JOBID +mkdir -p "$DIR" + +XMLS=(xamarin-macios/tests/sampletester/bin/Debug/tmp-test-dir/execution-logs/*.xml) +if ! test -f "${XMLS[0]}"; then + echo "##vso[task.logissue type=warning]Could not find any performance data to publish" + exit 0 +fi +cp -c xamarin-macios/tests/sampletester/bin/Debug/tmp-test-dir/execution-logs/*.xml "$DIR/" + +mkdir -p logs +zip -9r "logs/execution-logs-$SYSTEM_JOBID.zip" perf-data diff --git a/tools/devops/publish-performance-data.sh b/tools/devops/publish-performance-data.sh deleted file mode 100755 index cae6ed10ec87..000000000000 --- a/tools/devops/publish-performance-data.sh +++ /dev/null @@ -1,31 +0,0 @@ -#!/bin/bash -ex - -DATA_REPO_NAME=xamarin-macios-data - -DIR=$DATA_REPO_NAME/perf-data/samples/$BUILD_SOURCEBRANCHNAME/$BUILD_SOURCEVERSION/$SYSTEM_JOBID -mkdir -p "$DIR" - -XMLS=(xamarin-macios/tests/sampletester/bin/Debug/tmp-test-dir/execution-logs/*.xml) -if ! test -f "${XMLS[0]}"; then - echo "##vso[task.logissue type=warning]Could not find any performance data to publish" - exit 0 -fi -cp -c xamarin-macios/tests/sampletester/bin/Debug/tmp-test-dir/execution-logs/*.xml "$DIR/" -cd "$DIR" - -git branch || true -pwd -git status || true -git log || true -git checkout master || true - -git add . -git commit -m "Add performance data for $BUILD_SOURCEBRANCHNAME/$BUILD_SOURCEVERSION from the $SYSTEM_JOBNAME job." - -# Try to push 5 times, just in case someone else pushed first. -COUNTER=5 -while [[ $COUNTER -gt 0 ]]; do - if git push; then break; fi - git pull - (( COUNTER-- )) -done diff --git a/tools/devops/push-performance-data.sh b/tools/devops/push-performance-data.sh new file mode 100755 index 000000000000..38948eb5da54 --- /dev/null +++ b/tools/devops/push-performance-data.sh @@ -0,0 +1,20 @@ +#!/bin/bash -ex + +cd xamarin-macios-data +git checkout master +cp -cr ../logs/ ./ + +mv ./*/*.zip . +unzip ./*.zip +rm -f ./*.zip + +git add . +git commit -m "Add performance data for $BUILD_SOURCEBRANCHNAME/$BUILD_SOURCEVERSION." + +# Try to push 5 times, just in case someone else pushed first. +COUNTER=5 +while [[ $COUNTER -gt 0 ]]; do + if git push; then break; fi + git pull + (( COUNTER-- )) +done From c66da8ccd2632491dd7b4857efcdf0f2f09e8774 Mon Sep 17 00:00:00 2001 From: Rolf Bjarne Kvinge Date: Wed, 18 Dec 2019 10:48:27 +0100 Subject: [PATCH 22/38] Don't need new maccore. --- mk/xamarin.mk | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mk/xamarin.mk b/mk/xamarin.mk index 147cc4dc5239..ec21f5cec9f9 100644 --- a/mk/xamarin.mk +++ b/mk/xamarin.mk @@ -7,7 +7,7 @@ MONO_BRANCH := $(shell cd $(MONO_PATH) 2> /dev/null && git symbolic-ref --sho endif ifdef ENABLE_XAMARIN -NEEDED_MACCORE_VERSION := 4f039a05f6781ffd0b1e6937e0294e08b5e3a81e +NEEDED_MACCORE_VERSION := 92433b7757c57de089b3edb0e7060d90363273f9 NEEDED_MACCORE_BRANCH := master MACCORE_DIRECTORY := maccore From cb0c22d09736f25c760444d9fb7e768501d21a57 Mon Sep 17 00:00:00 2001 From: Rolf Bjarne Kvinge Date: Wed, 18 Dec 2019 10:53:06 +0100 Subject: [PATCH 23/38] cleanup --- tools/devops/build-samples.csx | 20 +------------------- tools/devops/diagnostics.sh | 17 ----------------- 2 files changed, 1 insertion(+), 36 deletions(-) delete mode 100755 tools/devops/diagnostics.sh diff --git a/tools/devops/build-samples.csx b/tools/devops/build-samples.csx index 2addfdb80693..f123ff969405 100644 --- a/tools/devops/build-samples.csx +++ b/tools/devops/build-samples.csx @@ -59,25 +59,7 @@ InstallPackage ("Objective-Sharpie", FindVariable ("MIN_SHARPIE_URL")); // Provisioning profiles Console.WriteLine ("Provisioning provisioning profiles..."); - -void Execute (string cmd, params string[] args) -{ - try { - new Exec ( - ProcessArguments.FromCommandAndArguments (cmd, args), - ExecFlags.None, (ConsoleRedirection) null) - .RunAsync () - .GetAwaiter () - .GetResult (); - } catch (Exception e) { - Console.WriteLine ("Failed to execute {1}: {0}", e, cmd); - } -} - -Execute ("pwd"); -Environment.SetEnvironmentVariable ("PROVISION_DONT_FETCH_UPDATED_CERTS", "1"); -Execute ($"./diagnostics.sh", "-v"); -Execute ($"../../../maccore/tools/install-qa-provisioning-profiles.sh", "-v"); +Exec ($"../../../maccore/tools/install-qa-provisioning-profiles.sh"); // .NET core // The version number here must match the one in Xamarin.Tests.Configuration:CreateGlobalConfig (tests/sampletester/Configuration.cs). diff --git a/tools/devops/diagnostics.sh b/tools/devops/diagnostics.sh deleted file mode 100755 index a67fdbcc4e22..000000000000 --- a/tools/devops/diagnostics.sh +++ /dev/null @@ -1,17 +0,0 @@ -#!/bin/bash -x - -cd "$(dirname "${BASH_SOURCE[0]}")" - -cd ../../../maccore -git remote -v -git show -git branch -git status -git config -l - -#git remote rename xamarin origin - -./tools/provisioning-profiles/fetch-updated-certificates-and-profiles.sh -v -./tools/install-qa-provisioning-profiles.sh -v - -exit 0 From f9116aaee147fd7bc0e0f289247bdc35baf68af6 Mon Sep 17 00:00:00 2001 From: Rolf Bjarne Kvinge Date: Wed, 18 Dec 2019 10:53:59 +0100 Subject: [PATCH 24/38] Remove debug spew. --- tools/devops/build-samples.yml | 3 --- 1 file changed, 3 deletions(-) diff --git a/tools/devops/build-samples.yml b/tools/devops/build-samples.yml index fee6f749318a..1ac6fdf2a572 100644 --- a/tools/devops/build-samples.yml +++ b/tools/devops/build-samples.yml @@ -37,9 +37,6 @@ jobs: name: '$(macOSVersion)' steps: - - bash: pwd && ls -la - displayName: Where am I - - bash: ./jenkins/add-commit-status.sh "--token=$(github-pat)" "--hash=$BUILD_SOURCEVERSION" "--state=pending" --target-url="$AZURE_BUILD_URL" --description="$BUILD_DEFINITIONNAME" --context="$BUILD_DEFINITIONNAME" displayName: Set pending GitHub status From d68e5061065bab9f54ee198fe347ed9251d3dc8b Mon Sep 17 00:00:00 2001 From: Rolf Bjarne Kvinge Date: Wed, 18 Dec 2019 10:55:58 +0100 Subject: [PATCH 25/38] Realign stuff. --- tests/sampletester/ProcessHelper.cs | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/tests/sampletester/ProcessHelper.cs b/tests/sampletester/ProcessHelper.cs index e55d6cfa7b06..625b4353da26 100644 --- a/tests/sampletester/ProcessHelper.cs +++ b/tests/sampletester/ProcessHelper.cs @@ -14,7 +14,8 @@ using Xamarin.Tests; using Xamarin.Utils; -public static class ProcessHelper { +public static class ProcessHelper +{ static int counter; static string log_directory; @@ -27,12 +28,12 @@ static string LogDirectory { } - public static void AssertRunProcess (string filename, string [] arguments, TimeSpan timeout, string workingDirectory, Dictionary environment_variables, string message) + public static void AssertRunProcess (string filename, string[] arguments, TimeSpan timeout, string workingDirectory, Dictionary environment_variables, string message) { AssertRunProcess (filename, arguments, timeout, workingDirectory, environment_variables, message, out _); } - public static void AssertRunProcess (string filename, string [] arguments, TimeSpan timeout, string workingDirectory, Dictionary environment_variables, string message, out string logfile) + public static void AssertRunProcess (string filename, string[] arguments, TimeSpan timeout, string workingDirectory, Dictionary environment_variables, string message, out string logfile) { var exitCode = 0; var output = new List (); From 5783e35c36bedd947fc11577ec72b39041ef9d75 Mon Sep 17 00:00:00 2001 From: Rolf Bjarne Kvinge Date: Wed, 18 Dec 2019 12:33:38 +0100 Subject: [PATCH 26/38] duh --- tools/devops/fetch-maccore.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/devops/fetch-maccore.sh b/tools/devops/fetch-maccore.sh index 10966fa8fb8b..bf7032bc6d27 100755 --- a/tools/devops/fetch-maccore.sh +++ b/tools/devops/fetch-maccore.sh @@ -5,7 +5,7 @@ # use https for the repository (instead of git@), since GitHub auth on Azure # Devops only works with https. -cd "cd $(git rev-parse --show-toplevel)/../maccore" +cd "$(git rev-parse --show-toplevel)/../maccore" git remote add -f xamarin https://github.com/xamarin/maccore cd ../xamarin-macios From 6bb18873f14a8cbd03fcd84de192ad5312019c63 Mon Sep 17 00:00:00 2001 From: Rolf Bjarne Kvinge Date: Wed, 18 Dec 2019 12:34:35 +0100 Subject: [PATCH 27/38] More path fixes. --- tools/devops/fetch-maccore.sh | 1 + 1 file changed, 1 insertion(+) diff --git a/tools/devops/fetch-maccore.sh b/tools/devops/fetch-maccore.sh index bf7032bc6d27..cecdb7c19eec 100755 --- a/tools/devops/fetch-maccore.sh +++ b/tools/devops/fetch-maccore.sh @@ -5,6 +5,7 @@ # use https for the repository (instead of git@), since GitHub auth on Azure # Devops only works with https. +cd "$(dirname "${BASH_SOURCE[0]}")" cd "$(git rev-parse --show-toplevel)/../maccore" git remote add -f xamarin https://github.com/xamarin/maccore cd ../xamarin-macios From 9de71970501cbcf880544b4689a7b8c324e08353 Mon Sep 17 00:00:00 2001 From: Rolf Bjarne Kvinge Date: Wed, 18 Dec 2019 13:21:11 +0100 Subject: [PATCH 28/38] zippity zip. --- tools/devops/push-performance-data.sh | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/tools/devops/push-performance-data.sh b/tools/devops/push-performance-data.sh index 38948eb5da54..77609ae51d65 100755 --- a/tools/devops/push-performance-data.sh +++ b/tools/devops/push-performance-data.sh @@ -5,7 +5,9 @@ git checkout master cp -cr ../logs/ ./ mv ./*/*.zip . -unzip ./*.zip +for zip in ./*.zip; do + unzip "$zip" +done rm -f ./*.zip git add . From c01ee8e2715cf9860324d34368a8222354e08516 Mon Sep 17 00:00:00 2001 From: Rolf Bjarne Kvinge Date: Wed, 18 Dec 2019 14:11:15 +0100 Subject: [PATCH 29/38] Show publishing errors. --- tools/devops/build-samples.yml | 11 +++++++++-- tools/devops/push-performance-data.sh | 1 + 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/tools/devops/build-samples.yml b/tools/devops/build-samples.yml index 1ac6fdf2a572..eaf0753e6f66 100644 --- a/tools/devops/build-samples.yml +++ b/tools/devops/build-samples.yml @@ -184,13 +184,18 @@ jobs: - bash: ./xamarin-macios/tools/devops/push-performance-data.sh displayName: Publish perf data + - bash: echo "##vso[task.setvariable variable=JobStatus;isOutput=true]$AGENT_JOBSTATUS" + name: ExportedVariables + displayName: Export status + condition: always() + ### ### Report final results to GitHub ### - job: ReportResultsToGitHub displayName: Report status/results to GitHub - dependsOn: macOS + dependsOn: PublishPerformanceData condition: always() pool: name: '$(macOSVersion)' @@ -205,6 +210,7 @@ jobs: jobResultReleaseiPhoneSimulator: $[ dependencies.macOS.outputs['Release_iPhoneSimulator.ExportedVariables.JobStatus'] ] jobResultDebugMac: $[ dependencies.macOS.outputs['Debug_Mac.ExportedVariables.JobStatus'] ] jobResultReleaseMac: $[ dependencies.macOS.outputs['Release_Mac.ExportedVariables.JobStatus'] ] + jobResultPublishPerformanceData: $[ dependencies.PublishPerformanceData.outputs['ExportedVariables.JobStatus'] ] steps: - bash: | ./tools/devops/build-samples-report-to-github.sh "$(github-pat)" \ @@ -213,6 +219,7 @@ jobs: "Release_iPhone_AF" "Release_iPhone_GR" "Release_iPhone_SZ" \ "Release_iPhoneSimulator" \ "Debug_Mac" \ - "Release_Mac" + "Release_Mac" \ + "PublishPerformanceData" displayName: Report results to GitHub as comment / status condition: always() diff --git a/tools/devops/push-performance-data.sh b/tools/devops/push-performance-data.sh index 77609ae51d65..ceeb98645f37 100755 --- a/tools/devops/push-performance-data.sh +++ b/tools/devops/push-performance-data.sh @@ -1,4 +1,5 @@ #!/bin/bash -ex +exit 1 cd xamarin-macios-data git checkout master From 6067093e9572bb707cfd2447d532be07237fd355 Mon Sep 17 00:00:00 2001 From: Rolf Bjarne Kvinge Date: Wed, 18 Dec 2019 19:16:12 +0100 Subject: [PATCH 30/38] dependencies --- tools/devops/build-samples.yml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/tools/devops/build-samples.yml b/tools/devops/build-samples.yml index eaf0753e6f66..7a34548eaa8d 100644 --- a/tools/devops/build-samples.yml +++ b/tools/devops/build-samples.yml @@ -195,7 +195,9 @@ jobs: - job: ReportResultsToGitHub displayName: Report status/results to GitHub - dependsOn: PublishPerformanceData + dependsOn: + - PublishPerformanceData + - macOS condition: always() pool: name: '$(macOSVersion)' From 21381ed358e0f378a55d167aa5fffb518b87cae2 Mon Sep 17 00:00:00 2001 From: Rolf Bjarne Kvinge Date: Thu, 19 Dec 2019 00:29:25 +0100 Subject: [PATCH 31/38] Not fake results anymore. --- tools/devops/build-samples.yml | 13 +++---------- tools/devops/push-performance-data.sh | 1 - 2 files changed, 3 insertions(+), 11 deletions(-) diff --git a/tools/devops/build-samples.yml b/tools/devops/build-samples.yml index 7a34548eaa8d..4266029b3cff 100644 --- a/tools/devops/build-samples.yml +++ b/tools/devops/build-samples.yml @@ -27,7 +27,7 @@ resources: endpoint: xamarin ### -### Tell GitHub we're starting on this commit +### Tell GitHub we're starting working on this commit ### jobs: @@ -126,15 +126,8 @@ jobs: - bash: ./xamarin-macios/tools/devops/system-info.sh displayName: System Info post provisioning - # - bash: ./xamarin-macios/tools/devops/build-samples.sh - # displayName: Run tests - - - bash: | - set -e - set -x - mkdir -p xamarin-macios/tests/sampletester/bin/Debug/tmp-test-dir/execution-logs - echo "Test results" > xamarin-macios/tests/sampletester/bin/Debug/tmp-test-dir/execution-logs/results.xml - displayName: Fake test run + - bash: ./xamarin-macios/tools/devops/build-samples.sh + displayName: Run tests - task: PublishTestResults@2 displayName: Publish test results diff --git a/tools/devops/push-performance-data.sh b/tools/devops/push-performance-data.sh index ceeb98645f37..77609ae51d65 100755 --- a/tools/devops/push-performance-data.sh +++ b/tools/devops/push-performance-data.sh @@ -1,5 +1,4 @@ #!/bin/bash -ex -exit 1 cd xamarin-macios-data git checkout master From 788556b966b37d81a3ccab45fb3f24131c195e5f Mon Sep 17 00:00:00 2001 From: Rolf Bjarne Kvinge Date: Thu, 19 Dec 2019 00:43:24 +0100 Subject: [PATCH 32/38] Tweaks --- tests/sampletester/Configuration.cs | 38 +----- tests/sampletester/ProcessHelper.cs | 203 +++++++++++++++------------- 2 files changed, 115 insertions(+), 126 deletions(-) diff --git a/tests/sampletester/Configuration.cs b/tests/sampletester/Configuration.cs index 883d316d9019..acbc4915a5dc 100644 --- a/tests/sampletester/Configuration.cs +++ b/tests/sampletester/Configuration.cs @@ -68,28 +68,12 @@ public static string TestedHash { public static string GetCurrentHash (string directory) { - using (var p = System.Diagnostics.Process.Start ("git", "log -1 --pretty=%H")) { - p.StartInfo.WorkingDirectory = directory; - p.StartInfo.RedirectStandardOutput = true; - p.StartInfo.UseShellExecute = false; - p.Start (); - var hash = p.StandardOutput.ReadToEnd ().Trim (); - p.WaitForExit (); - return hash; - } + return ProcessHelper.RunProcess ("git", "log -1 --pretty=%H").Trim (); } public static string GetCurrentRemoteUrl (string directory) { - using (var p = System.Diagnostics.Process.Start ("git", "remote get-url origin")) { - p.StartInfo.WorkingDirectory = directory; - p.StartInfo.RedirectStandardOutput = true; - p.StartInfo.UseShellExecute = false; - p.Start (); - var url = p.StandardOutput.ReadToEnd ().Trim (); - p.WaitForExit (); - return url; - } + return ProcessHelper.RunProcess ("git", "remote get-url origin").Trim (); } static string mono_version; @@ -99,14 +83,8 @@ public static string MonoVersion { if (mono_version != null) return mono_version; - using (var p = System.Diagnostics.Process.Start ("mono", "--version")) { - p.StartInfo.RedirectStandardOutput = true; - p.StartInfo.UseShellExecute = false; - p.Start (); - mono_version = p.StandardOutput.ReadLine ().Trim (); // We only care about the first line - p.StandardOutput.ReadToEnd (); - p.WaitForExit (); - } + // We only care about the first line + mono_version = ProcessHelper.RunProcess ("mono", "--version").Split (new char [] { '\n' }, StringSplitOptions.RemoveEmptyEntries) [0].Trim (); } return mono_version; @@ -120,13 +98,7 @@ public static string OSVersion { if (sw_version != null) return sw_version; - using (var p = System.Diagnostics.Process.Start ("sw_vers")) { - p.StartInfo.RedirectStandardOutput = true; - p.StartInfo.UseShellExecute = false; - p.Start (); - sw_version = p.StandardOutput.ReadToEnd ().Replace ('\n', ';').Replace ((char) 9, ' '); - p.WaitForExit (); - } + sw_version = ProcessHelper.RunProcess ("sw_vers").Replace ('\n', ';').Replace ((char) 9, ' '); } return sw_version; diff --git a/tests/sampletester/ProcessHelper.cs b/tests/sampletester/ProcessHelper.cs index 625b4353da26..f3371cd2c9f1 100644 --- a/tests/sampletester/ProcessHelper.cs +++ b/tests/sampletester/ProcessHelper.cs @@ -127,6 +127,8 @@ public static void BuildSolution (string solution, string platform, string confi // Write performance data to disk var subdirs = Directory.GetDirectories (slndir, "*", SearchOption.AllDirectories); + + // First figure out which .app subdirectory is the actual .app. This is a bit more complicated than it would seem... var apps = subdirs.Where ((v) => { var names = v.Substring (slndir.Length).Split (Path.DirectorySeparatorChar); if (names.Length < 2) @@ -159,6 +161,7 @@ public static void BuildSolution (string solution, string platform, string confi }).ToArray (); if (apps.Length > 1) { + // Found more than one .app subdirectory, use additional logic to choose between them. var filtered_apps = apps.Where ((v) => { // If one .app is a subdirectory of another .app, we don't care about the former. if (apps.Any ((v2) => v2.Length < v.Length && v.StartsWith (v2, StringComparison.Ordinal))) @@ -181,108 +184,122 @@ public static void BuildSolution (string solution, string platform, string confi } if (apps.Length > 1) { - Assert.Fail ($"More than one app directory????\n\t{string.Join ("\n\t", apps)}"); + Assert.Fail ($"Found more than one .app directory:\n\t{string.Join ("\n\t", apps)}"); } else if (apps.Length == 0) { - Assert.Fail ($"No app directory???? platform: {platform} configuration: {configuration} target: {target} \n\t{string.Join ("\n\t", subdirs)}"); - } else { - var logfile = Path.Combine (LogDirectory, $"{Path.GetFileNameWithoutExtension (solution)}-perfdata-{Interlocked.Increment (ref counter)}.xml"); - - var xmlSettings = new XmlWriterSettings { - Indent = true, - }; - var xml = XmlWriter.Create (logfile, xmlSettings); - xml.WriteStartDocument (true); - xml.WriteStartElement ("perf-data"); - xml.WriteAttributeString ("mono-version", Configuration.MonoVersion); - xml.WriteAttributeString ("os-version", Configuration.OSVersion); - xml.WriteAttributeString ("xamarin-macios-hash", Configuration.TestedHash); - xml.WriteAttributeString ("sample-repository", Configuration.GetCurrentRemoteUrl (slndir)); - xml.WriteAttributeString ("sample-hash", Configuration.GetCurrentHash (slndir)); - foreach (var app in apps) { - xml.WriteStartElement ("test"); - xml.WriteAttributeString ("name", TestContext.CurrentContext.Test.FullName); - xml.WriteAttributeString ("result", failed ? "failed" : "success"); - if (platform.Length > 0) - xml.WriteAttributeString ("platform", platform); - xml.WriteAttributeString ("configuration", configuration); - if (!failed) { - xml.WriteAttributeString ("duration", watch.ElapsedTicks.ToString ()); - xml.WriteAttributeString ("duration-formatted", watch.Elapsed.ToString ()); - - var files = Directory.GetFiles (app, "*", SearchOption.AllDirectories).OrderBy ((v) => v).ToArray (); - var lengths = files.Select ((v) => new FileInfo (v).Length).ToArray (); - var total_size = lengths.Sum (); - - xml.WriteAttributeString ("total-size", total_size.ToString ()); - var appstart = Path.GetDirectoryName (app).Length; - for (var i = 0; i < files.Length; i++) { - xml.WriteStartElement ("file"); - xml.WriteAttributeString ("name", files [i].Substring (appstart + 1)); - xml.WriteAttributeString ("size", lengths [i].ToString ()); - xml.WriteEndElement (); - } + Assert.Fail ($"Found no .app directories for platform: {platform} configuration: {configuration} target: {target}. All directories:\n\t{string.Join ("\n\t", subdirs)}"); + } + + var logfile = Path.Combine (LogDirectory, $"{Path.GetFileNameWithoutExtension (solution)}-perfdata-{Interlocked.Increment (ref counter)}.xml"); + + var xmlSettings = new XmlWriterSettings { + Indent = true, + }; + var xml = XmlWriter.Create (logfile, xmlSettings); + xml.WriteStartDocument (true); + xml.WriteStartElement ("performance"); + xml.WriteStartElement ("sample-build"); + xml.WriteAttributeString ("mono-version", Configuration.MonoVersion); + xml.WriteAttributeString ("os-version", Configuration.OSVersion); + xml.WriteAttributeString ("xamarin-macios-hash", Configuration.TestedHash); + xml.WriteAttributeString ("sample-repository", Configuration.GetCurrentRemoteUrl (slndir)); + xml.WriteAttributeString ("sample-hash", Configuration.GetCurrentHash (slndir)); + foreach (var app in apps) { + xml.WriteStartElement ("test"); + xml.WriteAttributeString ("name", TestContext.CurrentContext.Test.FullName); + xml.WriteAttributeString ("result", failed ? "failed" : "success"); + if (platform.Length > 0) + xml.WriteAttributeString ("platform", platform); + xml.WriteAttributeString ("configuration", configuration); + if (!failed) { + xml.WriteAttributeString ("duration", watch.ElapsedTicks.ToString ()); + xml.WriteAttributeString ("duration-formatted", watch.Elapsed.ToString ()); + + var files = Directory.GetFiles (app, "*", SearchOption.AllDirectories).OrderBy ((v) => v).ToArray (); + var lengths = files.Select ((v) => new FileInfo (v).Length).ToArray (); + var total_size = lengths.Sum (); + + xml.WriteAttributeString ("total-size", total_size.ToString ()); + var appstart = Path.GetDirectoryName (app).Length; + for (var i = 0; i < files.Length; i++) { + xml.WriteStartElement ("file"); + xml.WriteAttributeString ("name", files [i].Substring (appstart + 1)); + xml.WriteAttributeString ("size", lengths [i].ToString ()); + xml.WriteEndElement (); + } - if (File.Exists (msbuild_logfile)) { - var lines = File.ReadAllLines (msbuild_logfile); - var target_perf_summary = new List (); - var task_perf_summary = new List (); - var timestamps = new List (); - for (var i = lines.Length - 1; i >= 0; i--) { - if (lines [i].EndsWith ("Target Performance Summary:", StringComparison.Ordinal)) { - for (var k = i + 1; k < lines.Length && lines [k].EndsWith ("calls", StringComparison.Ordinal); k++) { - target_perf_summary.Add (lines [k].Substring (18).Trim ()); - } - } else if (lines [i].EndsWith ("Task Performance Summary:", StringComparison.Ordinal)) { - for (var k = i + 1; k < lines.Length && lines [k].EndsWith ("calls", StringComparison.Ordinal); k++) { - task_perf_summary.Add (lines [k].Substring (18).Trim ()); - } - } else if (lines [i].Contains ("!Timestamp")) { - timestamps.Add (lines [i]); + if (File.Exists (msbuild_logfile)) { + var lines = File.ReadAllLines (msbuild_logfile); + var target_perf_summary = new List (); + var task_perf_summary = new List (); + var timestamps = new List (); + for (var i = lines.Length - 1; i >= 0; i--) { + if (lines [i].EndsWith ("Target Performance Summary:", StringComparison.Ordinal)) { + for (var k = i + 1; k < lines.Length && lines [k].EndsWith ("calls", StringComparison.Ordinal); k++) { + target_perf_summary.Add (lines [k].Substring (18).Trim ()); } - } - foreach (var tps in target_perf_summary) { - var split = tps.Split (new char [] { ' ' }, StringSplitOptions.RemoveEmptyEntries); - xml.WriteStartElement ("target"); - xml.WriteAttributeString ("name", split [2]); - xml.WriteAttributeString ("ms", split [0]); - xml.WriteAttributeString ("calls", split [3]); - xml.WriteEndElement (); - } - foreach (var tps in task_perf_summary) { - var split = tps.Split (new char [] { ' ' }, StringSplitOptions.RemoveEmptyEntries); - xml.WriteStartElement ("task"); - xml.WriteAttributeString ("name", split [2]); - xml.WriteAttributeString ("ms", split [0]); - xml.WriteAttributeString ("calls", split [3]); - xml.WriteEndElement (); - } - foreach (var ts in timestamps) { - // Sample line: - // 15:04:50.4609520: !Timestamp Setup: 28 ms (TaskId:137) - var splitFirst = ts.Split (new char [] { ':' }, StringSplitOptions.RemoveEmptyEntries); - var splitSecondA = splitFirst [3].Split (new char [] { ' ' }, StringSplitOptions.RemoveEmptyEntries); - var splitSecondB = splitFirst [4].Split (new char [] { ' ' }, StringSplitOptions.RemoveEmptyEntries); - var name = string.Join (" ", splitSecondA.Skip (1)); - var level = splitSecondA [0].Count ((v) => v == '!').ToString (); - var ms = splitSecondB [0]; - xml.WriteStartElement ("timestamp"); - xml.WriteAttributeString ("name", name); - xml.WriteAttributeString ("level", level); - xml.WriteAttributeString ("ms", ms); - xml.WriteEndElement (); + } else if (lines [i].EndsWith ("Task Performance Summary:", StringComparison.Ordinal)) { + for (var k = i + 1; k < lines.Length && lines [k].EndsWith ("calls", StringComparison.Ordinal); k++) { + task_perf_summary.Add (lines [k].Substring (18).Trim ()); + } + } else if (lines [i].Contains ("!Timestamp")) { + timestamps.Add (lines [i]); } } - - xml.WriteEndElement (); + foreach (var tps in target_perf_summary) { + var split = tps.Split (new char [] { ' ' }, StringSplitOptions.RemoveEmptyEntries); + xml.WriteStartElement ("target"); + xml.WriteAttributeString ("name", split [2]); + xml.WriteAttributeString ("ms", split [0]); + xml.WriteAttributeString ("calls", split [3]); + xml.WriteEndElement (); + } + foreach (var tps in task_perf_summary) { + var split = tps.Split (new char [] { ' ' }, StringSplitOptions.RemoveEmptyEntries); + xml.WriteStartElement ("task"); + xml.WriteAttributeString ("name", split [2]); + xml.WriteAttributeString ("ms", split [0]); + xml.WriteAttributeString ("calls", split [3]); + xml.WriteEndElement (); + } + foreach (var ts in timestamps) { + // Sample line: + // 15:04:50.4609520: !Timestamp Setup: 28 ms (TaskId:137) + var splitFirst = ts.Split (new char [] { ':' }, StringSplitOptions.RemoveEmptyEntries); + var splitSecondA = splitFirst [3].Split (new char [] { ' ' }, StringSplitOptions.RemoveEmptyEntries); + var splitSecondB = splitFirst [4].Split (new char [] { ' ' }, StringSplitOptions.RemoveEmptyEntries); + var name = string.Join (" ", splitSecondA.Skip (1)); + var level = splitSecondA [0].Count ((v) => v == '!').ToString (); + var ms = splitSecondB [0]; + xml.WriteStartElement ("timestamp"); + xml.WriteAttributeString ("name", name); + xml.WriteAttributeString ("level", level); + xml.WriteAttributeString ("ms", ms); + xml.WriteEndElement (); + } } xml.WriteEndElement (); - xml.WriteEndDocument (); - xml.Dispose (); - - TestContext.AddTestAttachment (logfile, $"Performance data"); - Console.WriteLine ("Performance data: {0}:\n\t{1}", logfile, string.Join ("\n\t", File.ReadAllLines (logfile))); } + + xml.WriteEndElement (); // sample-build + xml.WriteEndElement (); // performance + xml.WriteEndDocument (); + xml.Dispose (); + + TestContext.AddTestAttachment (logfile, $"Performance data"); + // Console.WriteLine ("Performance data: {0}:\n\t{1}", logfile, string.Join ("\n\t", File.ReadAllLines (logfile))); + } + } + + internal static string RunProcess (string filename, string arguments = "") + { + using (var p = Process.Start (filename, arguments)) { + p.StartInfo.RedirectStandardOutput = true; + p.StartInfo.UseShellExecute = false; + p.Start (); + var output = p.StandardOutput.ReadToEnd (); + p.WaitForExit (); + return output; } } } From 1b847a12bb3bf3c005db18236dd423d461c20e55 Mon Sep 17 00:00:00 2001 From: Rolf Bjarne Kvinge Date: Thu, 19 Dec 2019 08:13:15 +0100 Subject: [PATCH 33/38] Merge xml files --- tools/devops/push-performance-data.sh | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/tools/devops/push-performance-data.sh b/tools/devops/push-performance-data.sh index 77609ae51d65..8a927165ee7d 100755 --- a/tools/devops/push-performance-data.sh +++ b/tools/devops/push-performance-data.sh @@ -8,11 +8,22 @@ mv ./*/*.zip . for zip in ./*.zip; do unzip "$zip" done -rm -f ./*.zip -git add . +# Merge each individual xml file into one big xml file +DIR=perf-data/samples/$BUILD_SOURCEBRANCHNAME/$BUILD_SOURCEVERSION +cd "$DIR" +{ + echo '' + echo '' + find . -name '*perfdata*.xml' -print0 | xargs -0 -n 1 tail -n +2 | grep -F -v -e '' -e '' + echo '' +} > data.xml + +# Add the big xml file to git +git add data.xml git commit -m "Add performance data for $BUILD_SOURCEBRANCHNAME/$BUILD_SOURCEVERSION." +# Push! # Try to push 5 times, just in case someone else pushed first. COUNTER=5 while [[ $COUNTER -gt 0 ]]; do From b9c03c55e8ebd311982469f5a50fb577960ad8db Mon Sep 17 00:00:00 2001 From: Rolf Bjarne Kvinge Date: Thu, 19 Dec 2019 11:47:13 +0100 Subject: [PATCH 34/38] [sampletester] Bump nuget timeout to 5 minutes. The TodoREST.iOS test seems to use a lot of packages, and it can apparently take a while to restore them, so give a few more minutes. --- tests/sampletester/ProcessHelper.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/sampletester/ProcessHelper.cs b/tests/sampletester/ProcessHelper.cs index f3371cd2c9f1..8372a3a2c8fc 100644 --- a/tests/sampletester/ProcessHelper.cs +++ b/tests/sampletester/ProcessHelper.cs @@ -95,7 +95,7 @@ public static void BuildSolution (string solution, string platform, string confi foreach (var sln in solutions) { nuget_args [1] = sln; // replacing here - AssertRunProcess ("nuget", nuget_args.ToArray (), TimeSpan.FromMinutes (2), Configuration.SampleRootDirectory, environment_variables, "nuget restore"); + AssertRunProcess ("nuget", nuget_args.ToArray (), TimeSpan.FromMinutes (5), Configuration.SampleRootDirectory, environment_variables, "nuget restore"); } // msbuild From be8f77b042d0b23d1c1c80397b144d76b0f39603 Mon Sep 17 00:00:00 2001 From: Rolf Bjarne Kvinge Date: Thu, 19 Dec 2019 12:32:57 +0100 Subject: [PATCH 35/38] Improvements. --- tests/sampletester/ProcessHelper.cs | 3 ++- tools/devops/push-performance-data.sh | 16 +++++++++++----- 2 files changed, 13 insertions(+), 6 deletions(-) diff --git a/tests/sampletester/ProcessHelper.cs b/tests/sampletester/ProcessHelper.cs index 8372a3a2c8fc..310422e8b234 100644 --- a/tests/sampletester/ProcessHelper.cs +++ b/tests/sampletester/ProcessHelper.cs @@ -203,6 +203,8 @@ public static void BuildSolution (string solution, string platform, string confi xml.WriteAttributeString ("xamarin-macios-hash", Configuration.TestedHash); xml.WriteAttributeString ("sample-repository", Configuration.GetCurrentRemoteUrl (slndir)); xml.WriteAttributeString ("sample-hash", Configuration.GetCurrentHash (slndir)); + xml.WriteAttributeString ("agent-machinename", Environment.GetEnvironmentVariable ("AGENT_MACHINENAME")); + xml.WriteAttributeString ("agent-name", Environment.GetEnvironmentVariable ("AGENT_NAME")); foreach (var app in apps) { xml.WriteStartElement ("test"); xml.WriteAttributeString ("name", TestContext.CurrentContext.Test.FullName); @@ -287,7 +289,6 @@ public static void BuildSolution (string solution, string platform, string confi xml.Dispose (); TestContext.AddTestAttachment (logfile, $"Performance data"); - // Console.WriteLine ("Performance data: {0}:\n\t{1}", logfile, string.Join ("\n\t", File.ReadAllLines (logfile))); } } diff --git a/tools/devops/push-performance-data.sh b/tools/devops/push-performance-data.sh index 8a927165ee7d..75f1fb3f4bb8 100755 --- a/tools/devops/push-performance-data.sh +++ b/tools/devops/push-performance-data.sh @@ -12,15 +12,21 @@ done # Merge each individual xml file into one big xml file DIR=perf-data/samples/$BUILD_SOURCEBRANCHNAME/$BUILD_SOURCEVERSION cd "$DIR" +# Merge the xml files from each bot into a big per-bot xml file. Don't merge +# the xml from all the bots together into a single enormous xml file, because +# it'll be close to GitHub's size limit per file (limit is 100mb, the enormous +# xml file would be ~80mb now), and might very well pass that one day. +for job in ./*-*-*-*-*; do { echo '' - echo '' - find . -name '*perfdata*.xml' -print0 | xargs -0 -n 1 tail -n +2 | grep -F -v -e '' -e '' + echo '' + find "$job" -name '*perfdata*.xml' -print0 | xargs -0 -n 1 tail -n +2 | grep -F -v -e '' -e '' echo '' -} > data.xml +} > "data-$job.xml" +done -# Add the big xml file to git -git add data.xml +# Add the big xml files to git +git add data-*.xml git commit -m "Add performance data for $BUILD_SOURCEBRANCHNAME/$BUILD_SOURCEVERSION." # Push! From 96425187f851d9b0b2321d6b84f6ede18713f874 Mon Sep 17 00:00:00 2001 From: Rolf Bjarne Kvinge Date: Thu, 19 Dec 2019 16:26:06 +0100 Subject: [PATCH 36/38] Fix glob. --- tools/devops/push-performance-data.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/devops/push-performance-data.sh b/tools/devops/push-performance-data.sh index 75f1fb3f4bb8..801f3341e06c 100755 --- a/tools/devops/push-performance-data.sh +++ b/tools/devops/push-performance-data.sh @@ -16,7 +16,7 @@ cd "$DIR" # the xml from all the bots together into a single enormous xml file, because # it'll be close to GitHub's size limit per file (limit is 100mb, the enormous # xml file would be ~80mb now), and might very well pass that one day. -for job in ./*-*-*-*-*; do +for job in *-*-*-*-*; do { echo '' echo '' From 328b7f6ef4490060eef293c84569b8ea3bdc946d Mon Sep 17 00:00:00 2001 From: Rolf Bjarne Kvinge Date: Fri, 20 Dec 2019 08:45:03 +0100 Subject: [PATCH 37/38] [sampletester] Fix fetching of sample repository and hash. --- tests/sampletester/Configuration.cs | 4 ++-- tests/sampletester/ProcessHelper.cs | 4 +++- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/tests/sampletester/Configuration.cs b/tests/sampletester/Configuration.cs index acbc4915a5dc..dd2ca8c24a65 100644 --- a/tests/sampletester/Configuration.cs +++ b/tests/sampletester/Configuration.cs @@ -68,12 +68,12 @@ public static string TestedHash { public static string GetCurrentHash (string directory) { - return ProcessHelper.RunProcess ("git", "log -1 --pretty=%H").Trim (); + return ProcessHelper.RunProcess ("git", "log -1 --pretty=%H", directory).Trim (); } public static string GetCurrentRemoteUrl (string directory) { - return ProcessHelper.RunProcess ("git", "remote get-url origin").Trim (); + return ProcessHelper.RunProcess ("git", "remote get-url origin", directory).Trim (); } static string mono_version; diff --git a/tests/sampletester/ProcessHelper.cs b/tests/sampletester/ProcessHelper.cs index 310422e8b234..482e6f7805c2 100644 --- a/tests/sampletester/ProcessHelper.cs +++ b/tests/sampletester/ProcessHelper.cs @@ -292,11 +292,13 @@ public static void BuildSolution (string solution, string platform, string confi } } - internal static string RunProcess (string filename, string arguments = "") + internal static string RunProcess (string filename, string arguments = "", string working_directory = null) { using (var p = Process.Start (filename, arguments)) { p.StartInfo.RedirectStandardOutput = true; p.StartInfo.UseShellExecute = false; + if (!string.IsNullOrEmpty (working_directory)) + p.StartInfo.WorkingDirectory = working_directory; p.Start (); var output = p.StandardOutput.ReadToEnd (); p.WaitForExit (); From 7096bee643af6fbe55cc7abf2b89602d0c7df24b Mon Sep 17 00:00:00 2001 From: Rolf Bjarne Kvinge Date: Fri, 20 Dec 2019 08:46:43 +0100 Subject: [PATCH 38/38] [sampletester] Centralize verbosity for mtouch and mmp. --- tests/sampletester/ProcessHelper.cs | 4 ++-- tools/devops/build-samples.sh | 4 ---- 2 files changed, 2 insertions(+), 6 deletions(-) diff --git a/tests/sampletester/ProcessHelper.cs b/tests/sampletester/ProcessHelper.cs index 482e6f7805c2..5af428be36fd 100644 --- a/tests/sampletester/ProcessHelper.cs +++ b/tests/sampletester/ProcessHelper.cs @@ -110,8 +110,8 @@ public static void BuildSolution (string solution, string platform, string confi sb.Add ($"/t:{target}"); sb.Add ($"/verbosity:diag"); - environment_variables ["MTOUCH_ENV_OPTIONS"] = "--time --time --time --time -qqqq"; - environment_variables ["MMP_ENV_OPTIONS"] = "--time --time --time --time -qqqq"; + environment_variables ["MTOUCH_ENV_OPTIONS"] = "--time --time --time --time -vvvv"; + environment_variables ["MMP_ENV_OPTIONS"] = "--time --time --time --time -vvvv"; var watch = Stopwatch.StartNew (); var failed = false; diff --git a/tools/devops/build-samples.sh b/tools/devops/build-samples.sh index ac609ea819b8..50e3b95b87eb 100755 --- a/tools/devops/build-samples.sh +++ b/tools/devops/build-samples.sh @@ -2,9 +2,5 @@ cd "$(dirname "${BASH_SOURCE[0]}")/../.." -# we want verbose output from mtouch and mlaunch -echo 123456789 > ~/.mtouch-verbosity -echo 123456789 > ~/.mlaunch-verbosity - make -C tests test-system.config make -C tests/sampletester TESTS_USE_SYSTEM=1 \ No newline at end of file