diff --git a/Jamroot.jam b/Jamroot.jam index 04caed504d..ab0643b033 100644 --- a/Jamroot.jam +++ b/Jamroot.jam @@ -362,6 +362,8 @@ project pwiz msvc:/wd4456 # warning: declaration of 'type' hides previous local declaration msvc:/wd4459 # warning: declaration of 'type' hides global declaration msvc:/wd4458 # warning: declaration of 'type' hides class member + #msvc,on:-fsanitize=address # address sanitizer + #msvc,on:/bigobj # address sanitizer makes for big object files: "fatal error C1128: number of sections exceeded object file format limit" msvc,off:"/OPT:REF,ICF" msvc,12.0:_HAS_TR1 msvc,14.0:_HAS_TR1 diff --git a/pwiz_tools/Skyline/Model/DiaUmpireDdaConverter.cs b/pwiz_tools/Skyline/Model/DiaUmpireDdaConverter.cs index 5073008ad5..dcd1547bd7 100644 --- a/pwiz_tools/Skyline/Model/DiaUmpireDdaConverter.cs +++ b/pwiz_tools/Skyline/Model/DiaUmpireDdaConverter.cs @@ -111,6 +111,7 @@ public override bool Run(IProgressMonitor progressMonitor, IProgressStatus statu // CONSIDER: read the file description to see what settings were used to generate the file; // if the same settings were used, we can re-use the file, else regenerate +/* TODO(bspratt) temp removal - is this the trouble spot causing memory errors? TODO restore this? if (MsDataFileImpl.IsValidFile(outputFilepath)) { var outputFileConfig = DiaUmpire.Config.GetConfigFromDiaUmpireOutput(outputFilepath); @@ -139,7 +140,8 @@ public override bool Run(IProgressMonitor progressMonitor, IProgressStatus statu } } } - +end temp removal */ + if (File.Exists(outputFilepath)) FileEx.SafeDelete(outputFilepath); diff --git a/pwiz_tools/Skyline/Program.cs b/pwiz_tools/Skyline/Program.cs index 14c0b342d6..55bf4b422d 100644 --- a/pwiz_tools/Skyline/Program.cs +++ b/pwiz_tools/Skyline/Program.cs @@ -95,6 +95,7 @@ public static bool SkylineOffscreen } // Set true to move Skyline windows offscreen. public static bool DemoMode { get; set; } // Set to true in demo mode (main window is full screen and pauses at screenshots) + public static bool ReportTutorialTestProgress { get; set; } // When True, write PauseForScreenshot messages to console even if offscreen and even if not pausing for screenshots public static bool NoVendorReaders { get; set; } // Set true to avoid calling vendor readers. public static bool UseOriginalURLs { get; set; } // Set true to use original URLs for downloading tools instead of our S3 copies public static bool IsPassZero { get { return NoVendorReaders; } } // Currently the only time NoVendorReaders gets set is pass0 diff --git a/pwiz_tools/Skyline/SkylineTester/SkylineTesterWindow.Designer.cs b/pwiz_tools/Skyline/SkylineTester/SkylineTesterWindow.Designer.cs index 1630f58ce6..ab57065f23 100644 --- a/pwiz_tools/Skyline/SkylineTester/SkylineTesterWindow.Designer.cs +++ b/pwiz_tools/Skyline/SkylineTester/SkylineTesterWindow.Designer.cs @@ -276,11 +276,15 @@ private void InitializeComponent() this.label1 = new System.Windows.Forms.Label(); this.dataGridRunStats = new SkylineTester.SafeDataGridView(); this.TestName = new System.Windows.Forms.DataGridViewTextBoxColumn(); + this.FirstAppearance = new System.Windows.Forms.DataGridViewTextBoxColumn(); this.Iterations = new System.Windows.Forms.DataGridViewTextBoxColumn(); this.Duration = new System.Windows.Forms.DataGridViewTextBoxColumn(); this.AverageDuration = new System.Windows.Forms.DataGridViewTextBoxColumn(); this.RelDuration = new System.Windows.Forms.DataGridViewTextBoxColumn(); this.DeltaTotalDuration = new System.Windows.Forms.DataGridViewTextBoxColumn(); + this.DeltaHeap = new System.Windows.Forms.DataGridViewTextBoxColumn(); + this.DeltaManaged = new System.Windows.Forms.DataGridViewTextBoxColumn(); + this.DeltaMemory = new System.Windows.Forms.DataGridViewTextBoxColumn(); this.menuStrip1 = new System.Windows.Forms.MenuStrip(); this.fileToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.openToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); @@ -2972,6 +2976,10 @@ private void InitializeComponent() this.dataGridRunStats.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize; this.dataGridRunStats.Columns.AddRange(new System.Windows.Forms.DataGridViewColumn[] { this.TestName, + this.FirstAppearance, + this.DeltaHeap, + this.DeltaManaged, + this.DeltaMemory, this.Iterations, this.Duration, this.AverageDuration, @@ -2992,6 +3000,12 @@ private void InitializeComponent() this.TestName.Name = "TestName"; this.TestName.ReadOnly = true; // + // FirstAppearance + // + this.FirstAppearance.HeaderText = "First Appearance"; + this.FirstAppearance.Name = "FirstAppearance"; + this.FirstAppearance.ReadOnly = true; + // // Iterations // this.Iterations.HeaderText = "Iterations"; @@ -3022,6 +3036,24 @@ private void InitializeComponent() this.DeltaTotalDuration.Name = "DeltaTotalDuration"; this.DeltaTotalDuration.ReadOnly = true; // + // DeltaHeap + // + this.DeltaHeap.HeaderText = "Delta Heap"; + this.DeltaHeap.Name = "DeltaHeap"; + this.DeltaHeap.ReadOnly = true; + // + // DeltaManaged + // + this.DeltaManaged.HeaderText = "Delta Managed"; + this.DeltaManaged.Name = "DeltaManaged"; + this.DeltaManaged.ReadOnly = true; + // + // DeltaMemory + // + this.DeltaMemory.HeaderText = "Delta Memory"; + this.DeltaMemory.Name = "DeltaMemory"; + this.DeltaMemory.ReadOnly = true; + // // menuStrip1 // this.menuStrip1.Items.AddRange(new System.Windows.Forms.ToolStripItem[] { @@ -3597,11 +3629,15 @@ private void InitializeComponent() private Label label1; private ComboBox comboBoxRunStats; private DataGridViewTextBoxColumn TestName; + private DataGridViewTextBoxColumn FirstAppearance; private DataGridViewTextBoxColumn Iterations; private DataGridViewTextBoxColumn Duration; private DataGridViewTextBoxColumn AverageDuration; private DataGridViewTextBoxColumn RelDuration; private DataGridViewTextBoxColumn DeltaTotalDuration; + private DataGridViewTextBoxColumn DeltaHeap; + private DataGridViewTextBoxColumn DeltaManaged; + private DataGridViewTextBoxColumn DeltaMemory; private Label label6; private Label label3; private CheckBox randomize; diff --git a/pwiz_tools/Skyline/SkylineTester/SkylineTesterWindow.resx b/pwiz_tools/Skyline/SkylineTester/SkylineTesterWindow.resx index 396c728421..f3f65189de 100644 --- a/pwiz_tools/Skyline/SkylineTester/SkylineTesterWindow.resx +++ b/pwiz_tools/Skyline/SkylineTester/SkylineTesterWindow.resx @@ -154,6 +154,9 @@ True + + True + True @@ -172,6 +175,9 @@ 17, 17 + + True + 25 diff --git a/pwiz_tools/Skyline/SkylineTester/TabBuild.cs b/pwiz_tools/Skyline/SkylineTester/TabBuild.cs index 82a2aa7a23..9fd2b08273 100644 --- a/pwiz_tools/Skyline/SkylineTester/TabBuild.cs +++ b/pwiz_tools/Skyline/SkylineTester/TabBuild.cs @@ -196,15 +196,17 @@ public static bool CreateBuildCommands( commandShell.Add("#@ Checking out {0} source files...\n", branchName); commandShell.Add("# Checking out {0} source files...", branchName); + // Add the --progress flag for richer logging - git leaves out most progress info when it isn't writing to an actual terminal + // Add the "-c http.postBuffer=524288000" argument to help with clone on unstable networks if (branchName.Contains("master")) { - commandShell.AddWithRetry("{0} clone {1} --recurse-submodules --progress {2}", git.Quote(), branchUrl.Quote(), buildRoot.Quote()); + commandShell.AddWithRetry("{0} -c http.postBuffer=524288000 clone {1} --recurse-submodules --progress {2}", git.Quote(), branchUrl.Quote(), buildRoot.Quote()); } else { var branch = branchUrl.Split(new[] {"tree/"}, StringSplitOptions.None)[1]; - commandShell.AddWithRetry("{0} clone {1} --recurse-submodules --progress -b {2} {3}", git.Quote(), GetMasterUrl().Quote(), branch.Quote(), buildRoot.Quote()); + commandShell.AddWithRetry("{0} -c http.postBuffer=524288000 clone {1} --recurse-submodules --progress -b {2} {3}", git.Quote(), GetMasterUrl().Quote(), branch.Quote(), buildRoot.Quote()); } } @@ -214,7 +216,7 @@ public static bool CreateBuildCommands( foreach (int architecture in architectures) { commandShell.Add("#@ Building Skyline {0} bit...\n", architecture); - commandShell.Add("{0} {1} {2} --i-agree-to-the-vendor-licenses {3} nolog", + commandShell.Add("{0} {1} {2} --i-agree-to-the-vendor-licenses {3} debug-symbols=on nolog", Path.Combine(buildRoot, @"pwiz_tools\build-apps.bat").Quote(), architecture, runBuildTests ? "pwiz_tools/Skyline" : "pwiz_tools/Skyline//Skyline.exe", diff --git a/pwiz_tools/Skyline/SkylineTester/TabRunStats.cs b/pwiz_tools/Skyline/SkylineTester/TabRunStats.cs index b8ba8b5839..a7f27761f8 100644 --- a/pwiz_tools/Skyline/SkylineTester/TabRunStats.cs +++ b/pwiz_tools/Skyline/SkylineTester/TabRunStats.cs @@ -19,6 +19,7 @@ using System.Collections.Generic; +using System.Globalization; using System.IO; using System.Linq; using System.Text.RegularExpressions; @@ -48,6 +49,10 @@ public override void Enter() private class TestData { public int Iterations => _durations.Count; + public int AppearanceOrder => _firstAppearance; + public string DeltaHeap => _deltaHeapBytes ?? string.Empty; + public string DeltaManaged => _deltaManagedBytes ?? string.Empty; + public string DeltaMemory => _deltaMemoryBytes ?? string.Empty; public int TotalDuration => _durations.Sum(); public int MinDuration => _durations.Min(); public int MaxDuration => _durations.Max(); @@ -74,10 +79,18 @@ public int MedianDuration { } } public List _durations; + public int _firstAppearance; // Order of first appearance (sorting aid) + public string _deltaManagedBytes; + public string _deltaHeapBytes; + public string _deltaMemoryBytes; public TestData() { _durations = new List(); + _firstAppearance = -1; + _deltaManagedBytes = null; + _deltaHeapBytes = null; + _deltaMemoryBytes = null; } } @@ -104,6 +117,22 @@ private void AddColumnPair(int? valA, int? valB, List columns) columns.Add(valA.HasValue && valB.HasValue ? (valA - valB).ToString() : string.Empty); } + private void AddColumnPair(string valA, string valB, List columns) + { + columns.Add(valA ?? string.Empty); + columns.Add(valB ?? string.Empty); + var leakA = string.IsNullOrEmpty(valA) ? 0 : double.Parse(valA.Split(' ')[0]); + var leakB = string.IsNullOrEmpty(valB) ? 0 : double.Parse(valB.Split(' ')[0]); + columns.Add((leakA - leakB).ToString(CultureInfo.InvariantCulture)); + } + + private string FormatDelta(string delta) + { + var result = (string.IsNullOrEmpty(delta) ? string.Empty : delta).Trim().Replace(" ", string.Empty); + return result.StartsWith("-") ? string.Empty : result; + } + + private void AddColumns(Dictionary tests, Dictionary testsCompare, string testName, List columns) { if (!tests.TryGetValue(testName, out var testData)) @@ -113,6 +142,10 @@ private void AddColumns(Dictionary tests, Dictionary tests, Dictionary() { $@"Test ({Path.GetFileNameWithoutExtension(TestLog)}{compared})" }; var paired = !string.IsNullOrEmpty(compared); + AddHeaderPair(paired, header, $@"AppearanceOrder"); + AddHeaderPair(paired, header, $@"HeapDelta"); + AddHeaderPair(paired, header, $@"ManagedDelta"); + AddHeaderPair(paired, header, $@"MemoryDelta"); AddHeaderPair(paired, header, $@"Iterations"); AddHeaderPair(paired, header, $@"TotalTime"); AddHeaderPair(paired, header, $@"MinTime"); @@ -204,7 +245,7 @@ public void Process(string logFile, string logFileCompare) if (TestSummariesCompare == null) { var value = TestSummaries[key]; - MainWindow.DataGridRunStats.Rows.Add(key, value.Iterations, value.TotalDuration, value.TotalDuration / value.Iterations, "N/A"); + MainWindow.DataGridRunStats.Rows.Add(key, value.AppearanceOrder, FormatDelta(value.DeltaHeap), FormatDelta(value.DeltaManaged), FormatDelta(value.DeltaMemory), value.Iterations, value.TotalDuration, value.TotalDuration / value.Iterations, "N/A"); } else { @@ -218,13 +259,30 @@ public void Process(string logFile, string logFileCompare) var durRightTotal = valRight == null ? 0 : valRight.TotalDuration; var durLeftD = valLeft == null ? 0 : valLeft.TotalDuration / (double)valLeft.Iterations; var durRightD = valRight == null ? 0 : valRight.TotalDuration / (double)valRight.Iterations; + var heapDeltas = FormatDeltas(valLeft?.DeltaHeap, valRight?.DeltaHeap); + var managedDeltas = FormatDeltas(valLeft?.DeltaManaged, valRight?.DeltaManaged); + var memoryDeltas = FormatDeltas(valLeft?.DeltaMemory, valRight?.DeltaMemory); MainWindow.DataGridRunStats.Rows.Add(key, + string.Format("{0}/{1}", valLeft?.AppearanceOrder,valRight?.AppearanceOrder), + heapDeltas, + managedDeltas, + memoryDeltas, string.Format("{0}/{1}", valLeft == null ? 0 : valLeft.Iterations, valRight == null ? 0 : valRight.Iterations), string.Format("{0}/{1}", valLeft == null ? 0 : valLeft.TotalDuration, valRight == null ? 0 : valRight.TotalDuration), string.Format("{0}/{1}", durLeftI, durRightI), (valRight == null || valLeft == null) ? "N/A" : string.Format("{0:0.00}", (durRightD == 0 ? 1 : durLeftD / durRightD)), string.Format("{0}", durLeftTotal - durRightTotal)); } + + string FormatDeltas(string valLeft, string valRight) + { + var deltaLeft = FormatDelta(valLeft); + var deltaRight = FormatDelta(valRight); + var deltas = (string.IsNullOrEmpty(deltaLeft) && string.IsNullOrEmpty(deltaRight)) + ? string.Empty + : string.Format("{0}/{1}", string.IsNullOrEmpty(deltaLeft) ? "N/A" : deltaLeft, string.IsNullOrEmpty(deltaRight) ? "N/A" : deltaRight); + return deltas; + } } } @@ -237,23 +295,36 @@ private Dictionary GetStatsFromLog(string logFile) var log = File.ReadAllText(logFile); var testDictionary = new Dictionary(); - var startTest = new Regex(@"\r\n\[\d\d:\d\d\] +(\d+).(\d+) +(\S+) +\((\w\w)\) ", RegexOptions.Compiled); + var startTest = new Regex(@"\r\n\[(\d\d):(\d\d)\] +(\d+).(\d+) +(\S+) +\((\w\w)\) |\!\!\! +(\S+) LEAKED .*\n.* managed = (.*), heap = (.*), memory = (.*), user", RegexOptions.Compiled); var endTest = new Regex(@" \d+ failures, .* (\d+) sec\.\r\n", RegexOptions.Compiled); for (var startMatch = startTest.Match(log); startMatch.Success; startMatch = startMatch.NextMatch()) { - var name = startMatch.Groups[3].Value; + var testTime = int.TryParse(startMatch.Groups[1].Value, out var minutes) && + int.TryParse(startMatch.Groups[2].Value, out var seconds) + ? (minutes * 60 + seconds) : (int?)null; + if (testTime.HasValue) + { + var name = startMatch.Groups[5].Value; var endMatch = endTest.Match(log, startMatch.Index); var duration = endMatch.Groups[1].Value; - - TestData testData; - if (!testDictionary.TryGetValue(name, out testData)) + if (!testDictionary.TryGetValue(name, out var testData)) { testData = new TestData(); + testData._firstAppearance = testDictionary.Count + 1; testDictionary.Add(name, testData); } int.TryParse(duration, out var durationSeconds); testData._durations.Add(durationSeconds); + } + else + { + var name = startMatch.Groups[7].Value; + var testData = testDictionary[name]; + testData._deltaManagedBytes = startMatch.Groups[8].Value.Trim(); + testData._deltaHeapBytes = startMatch.Groups[9].Value.Trim(); + testData._deltaMemoryBytes = startMatch.Groups[10].Value.Trim(); + } } return testDictionary; } diff --git a/pwiz_tools/Skyline/TestFunctional/AgilentCeOptimizationTest.cs b/pwiz_tools/Skyline/TestFunctional/AgilentCeOptimizationTest.cs index f6833198fe..5724eab38e 100644 --- a/pwiz_tools/Skyline/TestFunctional/AgilentCeOptimizationTest.cs +++ b/pwiz_tools/Skyline/TestFunctional/AgilentCeOptimizationTest.cs @@ -27,7 +27,7 @@ namespace pwiz.SkylineTestFunctional { [TestClass] - public class AgilentCeOptimizationTest : AbstractFunctionalTest + public class AgilentCeOptimizationTest : AbstractFunctionalTestEx { [TestMethod] public void TestAgilentCeOptimization() @@ -38,10 +38,7 @@ public void TestAgilentCeOptimization() protected override void DoTest() { - RunUI(() => - { - SkylineWindow.OpenFile(TestFilesDir.GetTestPath("AgilentCeTest.sky")); - }); + OpenDocument(TestFilesDir.GetTestPath("AgilentCeTest.sky")); RunDlg(SkylineWindow.ImportResults, importResults=>{ importResults.OptimizationName = ExportOptimize.CE; importResults.NamedPathSets = new[] diff --git a/pwiz_tools/Skyline/TestFunctional/DdaSearchTest.cs b/pwiz_tools/Skyline/TestFunctional/DdaSearchTest.cs index 9d2e835e51..86fdc54d23 100644 --- a/pwiz_tools/Skyline/TestFunctional/DdaSearchTest.cs +++ b/pwiz_tools/Skyline/TestFunctional/DdaSearchTest.cs @@ -245,6 +245,12 @@ private string[] SearchFilesSameName protected override void DoTest() { +if (TestSettings.SearchEngine == SearchSettingsControl.SearchEngine.MSAmanda) +{ +Console.Write("skipping MSAmanda runs, to see if that's the memory corruption issue"); +return; +} + TestSearch(); } diff --git a/pwiz_tools/Skyline/TestFunctional/DiaSearchTest.cs b/pwiz_tools/Skyline/TestFunctional/DiaSearchTest.cs index 99c2931e79..0294bfbf20 100644 --- a/pwiz_tools/Skyline/TestFunctional/DiaSearchTest.cs +++ b/pwiz_tools/Skyline/TestFunctional/DiaSearchTest.cs @@ -252,6 +252,11 @@ private string GetTestPath(string path) protected override void DoTest() { +if (_testDetails.SearchEngine == SearchSettingsControl.SearchEngine.MSAmanda) +{ + Console.Write("skipping MSAmanda runs, to see if that's the memory corruption issue"); + return; +} _testDetails.TestAction(); } diff --git a/pwiz_tools/Skyline/TestFunctional/PermuteIsotopeModificationsTest.cs b/pwiz_tools/Skyline/TestFunctional/PermuteIsotopeModificationsTest.cs index 4040d1eb90..a63ab3beaa 100644 --- a/pwiz_tools/Skyline/TestFunctional/PermuteIsotopeModificationsTest.cs +++ b/pwiz_tools/Skyline/TestFunctional/PermuteIsotopeModificationsTest.cs @@ -32,7 +32,7 @@ namespace pwiz.SkylineTestFunctional /// https://skyline.ms/announcements/home/support/thread.view?rowId=52220 /// [TestClass] - public class PermuteIsotopeModificationsTest : AbstractFunctionalTest + public class PermuteIsotopeModificationsTest : AbstractFunctionalTestEx { [TestMethod] public void TestPermuteIsotopeModifications() @@ -43,7 +43,7 @@ public void TestPermuteIsotopeModifications() protected override void DoTest() { - RunUI(()=>SkylineWindow.OpenFile(TestFilesDir.GetTestPath("PermuteIsotopeModificationsTest.sky"))); + OpenDocument(TestFilesDir.GetTestPath("PermuteIsotopeModificationsTest.sky")); // This document contains two peptides Assert.AreEqual(2, SkylineWindow.Document.MoleculeCount); Assert.AreEqual(2, SkylineWindow.Document.MoleculeTransitionGroupCount); diff --git a/pwiz_tools/Skyline/TestRunner/Program.cs b/pwiz_tools/Skyline/TestRunner/Program.cs index 05768625e7..fd87352fa1 100644 --- a/pwiz_tools/Skyline/TestRunner/Program.cs +++ b/pwiz_tools/Skyline/TestRunner/Program.cs @@ -1483,6 +1483,26 @@ private static bool RunTestPasses( runTests.Log("\r\n"); } + if (asNightly) + { + // Run procdump if installed + var process = new Process(); + process.StartInfo.FileName = "procdump.exe"; + var dmpDirQuote = string.IsNullOrEmpty(dmpDir) ? string.Empty : $@" ""{dmpDir}"""; + process.StartInfo.Arguments = $@"-accepteula -ma -mk -h -64 TestRunner{dmpDirQuote}"; + runTests.Log($@"# Attempting to launch 'procdump.exe {process.StartInfo.Arguments}', to try to diagnose hangs in TestRunner\r\n"); + try + { + + process.Start(); + } + catch (Exception) + { + // ignored, presumably ProcDump is not installed + runTests.Log("# ProcDump did not launch. You may wish to install SysInternals ProcDump to try to diagnose hangs in TestRunner. It will be launched automatically if available.\r\n"); + } + } + if (commandLineArgs.ArgAsBool("clipboardcheck")) { runTests.TestContext.Properties["ClipboardCheck"] = "TestRunner clipboard check"; diff --git a/pwiz_tools/Skyline/TestTutorial/MethodEditTutorialTest.cs b/pwiz_tools/Skyline/TestTutorial/MethodEditTutorialTest.cs index 160b87f173..0995d324f0 100644 --- a/pwiz_tools/Skyline/TestTutorial/MethodEditTutorialTest.cs +++ b/pwiz_tools/Skyline/TestTutorial/MethodEditTutorialTest.cs @@ -54,6 +54,7 @@ public class MethodEditTutorialTest : AbstractFunctionalTestEx [TestMethod] public void TestMethodEditTutorial() { +Program.ReportTutorialTestProgress = true; // Write screenshot info to console, trying to figure out where this hangs // Set true to look at tutorial screenshots. // IsPauseForScreenShots = true; // IsPauseForAuditLog = true; diff --git a/pwiz_tools/Skyline/TestTutorial/Ms1FullScanFilteringTutorial.cs b/pwiz_tools/Skyline/TestTutorial/Ms1FullScanFilteringTutorial.cs index b65f421100..2686c817de 100644 --- a/pwiz_tools/Skyline/TestTutorial/Ms1FullScanFilteringTutorial.cs +++ b/pwiz_tools/Skyline/TestTutorial/Ms1FullScanFilteringTutorial.cs @@ -23,6 +23,7 @@ using System.Globalization; using System.IO; using System.Linq; +using System.Runtime.CompilerServices; using System.Windows.Forms; using Microsoft.VisualStudio.TestTools.UnitTesting; using pwiz.Common.SystemUtil; @@ -46,6 +47,7 @@ using pwiz.Skyline.Util; using pwiz.Skyline.Util.Extensions; using ZedGraph; +using pwiz.Skyline; namespace pwiz.SkylineTestTutorial { @@ -58,6 +60,7 @@ public class Ms1FullScanFilteringTutorial : AbstractFunctionalTestEx [TestMethod, MinidumpLeakThreshold(15)] public void TestMs1Tutorial() { +Program.ReportTutorialTestProgress = true; // Write screenshot info to console, trying to figure out where this hangs // Set true to look at tutorial screenshots. // IsPauseForScreenShots = true; // IsCoverShotMode = true; @@ -129,6 +132,14 @@ private string PathsMessage(string message, IEnumerable paths) return TextUtil.LineSeparate(message, TextUtil.LineSeparate(paths)); } + // TODO revert this debug stuff if this ever merges to master +static void MFSTLog(string message, + [CallerFilePath] string file = null, + [CallerLineNumber] int line = 0) +{ + Console.WriteLine(@"at {0} ({1}): {2}", Path.GetFileName(file), line, message); +} + protected override void DoTest() { // Clean-up before running the test @@ -570,6 +581,7 @@ protected override void DoTest() if (PreferWiff) { + MFSTLog("PreferWiff"); RunUI(() => { int pointCount = GetTotalPointCount(SkylineWindow.GraphFullScan.ZedGraphControl.GraphPane); @@ -588,6 +600,7 @@ protected override void DoTest() TestFullScanProperties(); RunUI(() => SkylineWindow.HideFullScanGraph()); + MFSTLog("ArrangeGraphs"); RunUI(() => { @@ -1014,6 +1027,7 @@ private string GetFileNameWithoutExtension(string searchFile) private void TestFullScanProperties() { + MFSTLog("TestFullScanProperties begin"); var expectedPropertiesDict = new Dictionary { {"FileName",PreferWiff ? "100803_0005b_MCF7_TiTip3.wiff" : "100803_0005b_MCF7_TiTip3.mzML"}, {"ReplicateName","5b_MCF7_TiTip3"}, @@ -1050,13 +1064,17 @@ private void TestFullScanProperties() var propertiesButton = SkylineWindow.GraphFullScan.PropertyButton; Assert.IsFalse(propertiesButton.Checked); - RunUI(() => +MFSTLog("TestFullScanProperties"); + + RunUI(() => { propertiesButton.PerformClick(); }); WaitForConditionUI(() => msGraph.PropertiesVisible); + MFSTLog("TestFullScanProperties"); WaitForGraphs(); + MFSTLog("TestFullScanProperties"); FullScanProperties currentProperties = null; RunUI(() => { @@ -1065,30 +1083,40 @@ private void TestFullScanProperties() Assert.IsNotNull(currentProperties); // To write new json string for the expected property values into the output stream uncomment the next line //Trace.Write(currentProperties.Serialize()); + MFSTLog("TestFullScanProperties"); Assert.IsTrue(expectedProperties.IsSameAs(currentProperties)); Assert.IsTrue(propertiesButton.Checked); + MFSTLog("TestFullScanProperties about to SkylineWindow.GraphFullScan.LeftButton?.PerformClick()"); // make sure the properties are updated when the spectrum changes RunUI(() => { SkylineWindow.GraphFullScan.LeftButton?.PerformClick(); }); + MFSTLog("TestFullScanProperties about to wait for graphs"); WaitForGraphs(); + MFSTLog("TestFullScanProperties"); WaitForConditionUI(() => SkylineWindow.GraphFullScan.IsLoaded); + MFSTLog("TestFullScanProperties"); RunUI(() => { currentProperties = msGraph.PropertiesSheet.SelectedObject as FullScanProperties; }); Assert.IsFalse(currentProperties.IsSameAs(expectedProperties)); + MFSTLog("TestFullScanProperties about to propertiesButton.PerformClick()"); RunUI(() => { propertiesButton.PerformClick(); }); + MFSTLog("TestFullScanProperties"); WaitForConditionUI(() => !msGraph.PropertiesVisible); + MFSTLog("TestFullScanProperties"); WaitForGraphs(); + MFSTLog("TestFullScanProperties"); Assert.IsFalse(propertiesButton.Checked); + MFSTLog("TestFullScanProperties done"); } } } diff --git a/pwiz_tools/Skyline/TestUtil/TestFunctional.cs b/pwiz_tools/Skyline/TestUtil/TestFunctional.cs index 6d88057fe9..b2334469fa 100644 --- a/pwiz_tools/Skyline/TestUtil/TestFunctional.cs +++ b/pwiz_tools/Skyline/TestUtil/TestFunctional.cs @@ -1824,6 +1824,12 @@ private void PauseForScreenShotInternal(string description, Type formType = null var form = !fullScreen ? TryWaitForOpenForm(formType) : SkylineWindow; Assert.IsNotNull(form); } + + if (Program.ReportTutorialTestProgress) + { + Console.WriteLine($@"# tutorial test progress: {description}"); + } + if (Program.SkylineOffscreen) return; diff --git a/pwiz_tools/Skyline/Util/Statistics.cs b/pwiz_tools/Skyline/Util/Statistics.cs index 4e809e5333..6eb91a3027 100644 --- a/pwiz_tools/Skyline/Util/Statistics.cs +++ b/pwiz_tools/Skyline/Util/Statistics.cs @@ -1342,24 +1342,34 @@ public static double QNthItem(IList list, int elementIndex) private static void Split(IList list, double value, ref int left, ref int right) { - // Left and right scan until the pointers cross - do + try { - while (list[left] < value) - left++; - while (value < list[right]) - right--; - if (left <= right) + // Left and right scan until the pointers cross + do { - double temp = list[left]; - list[left] = list[right]; - list[right] = temp; + while (list[left] < value) + left++; + while (value < list[right]) + right--; - left++; - right--; - } - } while (left <= right); + if (left <= right) + { + double temp = list[left]; + list[left] = list[right]; + list[right] = temp; + + left++; + right--; + } + } while (left <= right); + } + catch (Exception e) + { + Console.WriteLine(e); + Console.WriteLine($@"left={left} right={right} size={list.Count}"); + throw; + } } /// diff --git a/pwiz_tools/build-apps.bat b/pwiz_tools/build-apps.bat index 4735550ed6..b5314f5947 100644 --- a/pwiz_tools/build-apps.bat +++ b/pwiz_tools/build-apps.bat @@ -10,41 +10,37 @@ set REGISTER= set OPTIMIZATION=optimization=speed set NOLOG= -set ALL_ARGS= %* +REM that trailing space matters for argument parsing - keeps "debug-symbols" from matching "debug" +set ALL_ARGS= %* -if "%ALL_ARGS: 32=%" neq "%ALL_ARGS%" ( +if "%ALL_ARGS: 32 =%" neq "%ALL_ARGS%" ( set TARGETPLATFORM=32 - set ALL_ARGS=%ALL_ARGS: 32=% + set ALL_ARGS=%ALL_ARGS: 32 =% ) -if "%ALL_ARGS: 64=%" neq "%ALL_ARGS%" ( +if "%ALL_ARGS: 64 =%" neq "%ALL_ARGS%" ( set TARGETPLATFORM=64 - set ALL_ARGS=%ALL_ARGS: 64=% + set ALL_ARGS=%ALL_ARGS: 64 =% ) if "%ALL_ARGS: register=%" neq "%ALL_ARGS%" ( set REGISTER=1 - set ALL_ARGS=%ALL_ARGS: register=% + set ALL_ARGS=%ALL_ARGS: register =% ) if "%ALL_ARGS: REGISTER=%" neq "%ALL_ARGS%" ( set REGISTER=1 - set ALL_ARGS=%ALL_ARGS: REGISTER=% + set ALL_ARGS=%ALL_ARGS: REGISTER =% ) -if "%ALL_ARGS: debug=%" neq "%ALL_ARGS%" ( +if "%ALL_ARGS: debug =%" neq "%ALL_ARGS%" ( set OPTIMIZATION=debug - if "%ALL_ARGS: debug-symbols=%" == "%ALL_ARGS%" ( - set ALL_ARGS=%ALL_ARGS: debug=% - ) + ) -if "%ALL_ARGS: DEBUG=%" neq "%ALL_ARGS%" ( +if "%ALL_ARGS: DEBUG =%" neq "%ALL_ARGS%" ( set OPTIMIZATION=debug - if "%ALL_ARGS: DEBUG-SYMBOLS=%" == "%ALL_ARGS%" ( - set ALL_ARGS=%ALL_ARGS: DEBUG=% - ) ) -if "%ALL_ARGS: nolog=%" neq "%ALL_ARGS%" ( +if "%ALL_ARGS: nolog =%" neq "%ALL_ARGS%" ( set NOLOG=1 set ALL_ARGS=%ALL_ARGS: nolog=% ) -if "%ALL_ARGS: NOLOG=%" neq "%ALL_ARGS%" ( +if "%ALL_ARGS: NOLOG =%" neq "%ALL_ARGS%" ( set NOLOG=1 set ALL_ARGS=%ALL_ARGS: NOLOG=% )