예제 #1
0
        private static string GetRepoRevisionLine(string revision)
        {
            string branchText = "master";

            if (!MainWindow.NightlyBuildTrunk.Checked)
            {
                string branchUrl            = MainWindow.NightlyBranchUrl.Text;
                string expectedBranchPrefix = "https://github.com/ProteoWizard/pwiz/tree/";
                if (!branchUrl.StartsWith(expectedBranchPrefix))
                {
                    return(string.Empty);
                }
                branchText = branchUrl.Substring(expectedBranchPrefix.Length);
            }
            var    reader = new StringReader(GitCommand(".", @"ls-remote -h " + TabBuild.GetMasterUrl()));
            string line;

            while ((line = reader.ReadLine()) != null)
            {
                if (line.EndsWith("heads/" + branchText))
                {
                    return(line);
                }
            }
            return(string.Empty);
        }
예제 #2
0
        private string GetRevision(bool nuke)
        {
            // Get current git revision info.
            string revision = String.Empty;

            try
            {
                var buildRoot = MainWindow.GetBuildRoot();
                var target    = (Directory.Exists(buildRoot) && !nuke)
                    ? buildRoot
                    : TabBuild.GetBranchUrl();
                var revisionCount = GitCommand(target, @"rev-list --count head");
                var revisionHash  = GitCommand(target, @"rev-parse --short HEAD");
                revision = revisionCount + " (" + revisionHash + ")";
            }
// ReSharper disable once EmptyGeneralCatchClause
            catch
            {
            }

            return(revision);
        }
예제 #3
0
        private int GetRevision(bool nuke)
        {
            // Get current SVN revision info.
            int revision = 0;

            try
            {
                var buildRoot = MainWindow.GetBuildRoot();
                var target    = (Directory.Exists(buildRoot) && !nuke)
                    ? buildRoot
                    : TabBuild.GetBranchUrl();
                Process svn = new Process
                {
                    StartInfo =
                    {
                        UseShellExecute        = false,
                        RedirectStandardOutput = true,
                        RedirectStandardError  = true,
                        FileName       = MainWindow.Subversion,
                        Arguments      = @"info " + target,
                        CreateNoWindow = true
                    }
                };
                svn.Start();
                string svnOutput = svn.StandardOutput.ReadToEnd();
                svn.WaitForExit();
                var revisionString = Regex.Match(svnOutput, @".*Revision: (\d+)").Groups[1].Value;
                revision = int.Parse(revisionString);
            }
// ReSharper disable once EmptyGeneralCatchClause
            catch
            {
            }

            return(revision);
        }
예제 #4
0
파일: TabNightly.cs 프로젝트: zrolfs/pwiz
        private string GetRevision(bool nuke)
        {
            // Get current git revision info in form of git hash.
            string revision = String.Empty;

            try
            {
                var buildRoot = MainWindow.GetBuildRoot() + "\\pwiz";
                if (Directory.Exists(buildRoot) && !nuke)
                {
                    revision = GitCommand(buildRoot, @"rev-parse HEAD"); // Commit hash for local repo
                }
                else
                {
                    revision = GitCommand(".", @"ls-remote -h " + TabBuild.GetBranchUrl()).Split(' ', '\t')[0]; // Commit hash for github repo
                }
            }
// ReSharper disable once EmptyGeneralCatchClause
            catch
            {
            }

            return(revision);
        }
예제 #5
0
        private void StartNightly()
        {
            _labels.Clear();
            _findTest.Clear();

            if (File.Exists(MainWindow.DefaultLogFile))
            {
                Try.Multi <Exception>(() => File.Delete(MainWindow.DefaultLogFile), 4, false);
            }
            var logsDirectory = MainWindow.GetLogsDir();

            if (!Directory.Exists(logsDirectory))
            {
                Directory.CreateDirectory(logsDirectory);
            }

            MainWindow.SetStatus("Running nightly pass...");
            var architecture = MainWindow.NightlyBuildType.SelectedIndex == 0 ? 32 : 64;

            MainWindow.SelectBuild(architecture == 32 ? SkylineTesterWindow.BuildDirs.nightly32 : SkylineTesterWindow.BuildDirs.nightly64);
            _saveSelectedBuild = MainWindow.SelectedBuild;
            MainWindow.ResetElapsedTime();

            MainWindow.TestsRun       = 0;
            MainWindow.LastTestResult = null;
            MainWindow.NewNightlyRun  = new Summary.Run
            {
                Date = DateTime.Now
            };
            MainWindow.Summary.Runs.Add(MainWindow.NewNightlyRun);
            MainWindow.AddRun(MainWindow.NewNightlyRun, MainWindow.NightlyRunDate);
            MainWindow.NightlyRunDate.SelectedIndex = 0;

            StartLog("Nightly", MainWindow.Summary.GetLogFile(MainWindow.NewNightlyRun));

            var revisionWorker = new BackgroundWorker();

            revisionWorker.DoWork += (s, a) => _revision = GetRevision(true);
            revisionWorker.RunWorkerAsync();

            _updateTimer = new Timer {
                Interval = 300
            };
            _updateTimer.Tick += (s, a) => RunUI(() =>
            {
                try
                {
                    UpdateNightly();
                }
                catch (Exception x)
                {
                    _updateTimer.Stop();

                    MessageBox.Show(string.Format("Unexpected Error: {0}", x));

                    Stop(false);
                }
            });

            _stopTimer = new Timer {
                Interval = (int)MainWindow.NightlyDuration.Value * 60 * 60 * 1000
            };
            _stopTimer.Tick += (s, a) => RunUI(() =>
            {
                _stopTimer.Stop();
                _stopTimer = null;
                MainWindow.Stop();
            });

            _architecture = (MainWindow.NightlyBuildType.SelectedIndex == 0)
                ? 32
                : 64;
            var architectureList = new[] { _architecture };
            var branchUrl        = MainWindow.NightlyBuildTrunk.Checked
                ? @"https://github.com/ProteoWizard/pwiz"
                : MainWindow.NightlyBranchUrl.Text;
            var buildRoot = Path.Combine(MainWindow.GetNightlyBuildRoot(), "pwiz");

            TabBuild.CreateBuildCommands(branchUrl, buildRoot, architectureList, true, false, false); // Just build Skyline.exe without testing it - that's about to happen anyway

            int stressTestLoopCount;

            if (!int.TryParse(MainWindow.NightlyRepeat.Text, out stressTestLoopCount))
            {
                stressTestLoopCount = 0;
            }
            MainWindow.AddTestRunner("offscreen=on quality=on loop=-1 " +
                                     (stressTestLoopCount > 1 || MainWindow.NightlyRunPerfTests.Checked ? "pass0=off pass1=off " : "pass0=on pass1=on ") + // Skip the special passes if we're here to do stresstests or perftests
                                     (MainWindow.NightlyRunPerfTests.Checked ? " perftests=on" : string.Empty) +
                                     (MainWindow.NightlyTestSmallMolecules.Checked ? " testsmallmolecules=on" : string.Empty) +
                                     " runsmallmoleculeversions=on" + // Run any provided tests that convert the document to small molecules (this is different from testsmallmolecules, which just adds the magic test node to every doc in every test)
                                     (MainWindow.NightlyRandomize.Checked ? " random=on" : " random=off") +
                                     (stressTestLoopCount > 1 ? " repeat=" + MainWindow.NightlyRepeat.Text : string.Empty));
            MainWindow.CommandShell.Add("# Nightly finished.");

            MainWindow.RunCommands();

            if (_updateTimer != null)
            {
                _updateTimer.Start();
            }
            if (_stopTimer != null)
            {
                _stopTimer.Start();
            }
        }
예제 #6
0
        private void StartNightly()
        {
            _labels.Clear();
            _findTest.Clear();

            if (File.Exists(MainWindow.DefaultLogFile))
            {
                Try.Multi <Exception>(() => File.Delete(MainWindow.DefaultLogFile), 4, false);
            }
            var logsDirectory = MainWindow.GetLogsDir();

            if (!Directory.Exists(logsDirectory))
            {
                Directory.CreateDirectory(logsDirectory);
            }

            MainWindow.SetStatus("Running nightly pass...");
            var architecture = MainWindow.NightlyBuildType.SelectedIndex == 0 ? 32 : 64;

            MainWindow.SelectBuild(architecture == 32 ? SkylineTesterWindow.BuildDirs.nightly32 : SkylineTesterWindow.BuildDirs.nightly64);
            _saveSelectedBuild = MainWindow.SelectedBuild;
            MainWindow.ResetElapsedTime();

            MainWindow.TestsRun       = 0;
            MainWindow.LastTestResult = null;
            MainWindow.NewNightlyRun  = new Summary.Run
            {
                Date = DateTime.Now
            };
            MainWindow.Summary.Runs.Add(MainWindow.NewNightlyRun);
            MainWindow.AddRun(MainWindow.NewNightlyRun, MainWindow.NightlyRunDate);
            MainWindow.NightlyRunDate.SelectedIndex = 0;

            StartLog("Nightly", MainWindow.Summary.GetLogFile(MainWindow.NewNightlyRun));

            var revisionWorker = new BackgroundWorker();

            revisionWorker.DoWork += (s, a) => _revision = GetRevision(true);
            revisionWorker.RunWorkerAsync();

            _updateTimer = new Timer {
                Interval = 300
            };
            _updateTimer.Tick += (s, a) => RunUI(UpdateNightly);

            _stopTimer = new Timer {
                Interval = (int)MainWindow.NightlyDuration.Value * 60 * 60 * 1000
            };
            _stopTimer.Tick += (s, a) => RunUI(() =>
            {
                _stopTimer.Stop();
                _stopTimer = null;
                MainWindow.Stop();
            });

            _architecture = (MainWindow.NightlyBuildType.SelectedIndex == 0)
                ? 32
                : 64;
            var architectureList = new[] { _architecture };
            var branchUrl        = MainWindow.NightlyBuildTrunk.Checked
                ? @"https://svn.code.sf.net/p/proteowizard/code/trunk/pwiz"
                : MainWindow.NightlyBranchUrl.Text;
            var buildRoot = Path.Combine(MainWindow.GetNightlyBuildRoot(), "pwiz");

            TabBuild.CreateBuildCommands(branchUrl, buildRoot, architectureList, true, false, false); // Just build Skyline.exe without testing it - that's about to happen anyway

            MainWindow.AddTestRunner("offscreen=on quality=on pass0=on pass1=on loop=-1 random=off" + (MainWindow.NightlyRunPerfTests.Checked ? " perftests=on" : "") + (MainWindow.NightlyTestSmallMolecules.Checked ? " testsmallmolecules=on" : ""));
            MainWindow.CommandShell.Add("# Nightly finished.");

            MainWindow.RunCommands();

            if (_updateTimer != null)
            {
                _updateTimer.Start();
            }
            if (_stopTimer != null)
            {
                _stopTimer.Start();
            }
        }
예제 #7
0
        private void StartNightly()
        {
            _labels.Clear();
            _findTest.Clear();

            if (File.Exists(MainWindow.DefaultLogFile))
            {
                Try.Multi <Exception>(() => File.Delete(MainWindow.DefaultLogFile), 4, false);
            }
            var logsDirectory = MainWindow.GetLogsDir();

            if (!Directory.Exists(logsDirectory))
            {
                Directory.CreateDirectory(logsDirectory);
            }

            MainWindow.SetStatus("Running nightly pass...");
            var architecture = MainWindow.NightlyBuildType.SelectedIndex == 0 ? 32 : 64;

            MainWindow.SelectBuild(architecture == 32 ? SkylineTesterWindow.BuildDirs.nightly32 : SkylineTesterWindow.BuildDirs.nightly64);
            _saveSelectedBuild = MainWindow.SelectedBuild;
            MainWindow.ResetElapsedTime();

            MainWindow.TestsRun       = 0;
            MainWindow.LastTestResult = null;
            MainWindow.NewNightlyRun  = new Summary.Run
            {
                Date = DateTime.Now
            };
            MainWindow.Summary.Runs.Add(MainWindow.NewNightlyRun);
            MainWindow.AddRun(MainWindow.NewNightlyRun, MainWindow.NightlyRunDate);
            MainWindow.NightlyRunDate.SelectedIndex = 0;

            StartLog("Nightly", MainWindow.Summary.GetLogFile(MainWindow.NewNightlyRun));

            var revisionWorker = new BackgroundWorker();

            revisionWorker.DoWork += (s, a) =>
            {
                var revision = GetRevision(true);
                lock (MainWindow.NewNightlyRun)
                {
                    MainWindow.NewNightlyRun.Revision = _revision = revision;
                    MainWindow.Invoke(new System.Action(() => MainWindow.UpdateRun(MainWindow.NewNightlyRun, MainWindow.NightlyRunDate)));
                }
            };
            revisionWorker.RunWorkerAsync();

            _updateTimer = new Timer {
                Interval = 300
            };
            _updateTimer.Tick += (s, a) => RunUI(() =>
            {
                try
                {
                    UpdateNightly();
                }
                catch (Exception x)
                {
                    _updateTimer.Stop();

                    MessageBox.Show(string.Format("Unexpected Error: {0}", x));

                    Stop(false);
                }
            });

            _stopTimer = new Timer {
                Interval = (int)MainWindow.NightlyDuration.Value * MINUTES_PER_INCREMENT * 60 * 1000
            };                                                                                                          // Interval in milliseconds
            _stopTimer.Tick += (s, a) => RunUI(() =>
            {
                if (_stopTimer != null)
                {
                    _stopTimer.Stop();
                    _stopTimer = null;
                }
                MainWindow.StopByTimer();
            });

            _architecture = (MainWindow.NightlyBuildType.SelectedIndex == 0)
                ? 32
                : 64;
            var architectureList = new[] { _architecture };
            var branchUrl        = MainWindow.NightlyBuildTrunk.Checked
                ? @"https://github.com/ProteoWizard/pwiz"
                : MainWindow.NightlyBranchUrl.Text;
            var buildRoot = Path.Combine(MainWindow.GetNightlyBuildRoot(), "pwiz");

            // Build Skyline.exe without testing during the build
            if (!TabBuild.CreateBuildCommands(branchUrl, buildRoot, architectureList, true, false, false))
            {
                MainWindow.CommandShell.Add("# Nightly cancelled.");
            }
            else
            {
                // Then add the testing command
                int stressTestLoopCount;
                if (!int.TryParse(MainWindow.NightlyRepeat.Text, out stressTestLoopCount))
                {
                    stressTestLoopCount = 0;
                }
                MainWindow.AddTestRunner("offscreen=on quality=on loop=-1 " +
                                         (stressTestLoopCount > 1 || MainWindow.NightlyRunPerfTests.Checked ? "pass0=off pass1=off " : "pass0=on pass1=on ") + // Skip the special passes if we're here to do stresstests or perftests
                                         (MainWindow.NightlyRunPerfTests.Checked ? " perftests=on" : string.Empty) +
                                         " runsmallmoleculeversions=on" +                                                                                      // Run any provided tests that convert the document to small molecules
                                         " retrydatadownloads=on" +                                                                                            // In case of test failure, re-download test data in case staleness was the issue
                                         (MainWindow.NightlyRandomize.Checked ? " random=on" : " random=off") +
                                         (stressTestLoopCount > 1 ? " repeat=" + MainWindow.NightlyRepeat.Text : string.Empty)
                                         + " dmpdir=" + MainWindow.GetMinidumpDir());
                MainWindow.CommandShell.Add("# Nightly finished.");
            }
            MainWindow.CommandShell.IsUnattended = MainWindow.NightlyExit.Checked;

            MainWindow.RunCommands();

            if (_updateTimer != null)
            {
                _updateTimer.Start();
            }
            if (_stopTimer != null)
            {
                _stopTimer.Start();
            }

            _nightlyListener = new NightlyListener(_stopTimer);
        }
예제 #8
0
        private void SkylineTesterWindow_Load(object sender, EventArgs e)
        {
            if (!Program.IsRunning)
                return; // design mode

            // Register file/exe/icon associations.
            var checkRegistry = Registry.GetValue(
                @"HKEY_CURRENT_USER\Software\Classes\SkylineTester\shell\open\command", null, null);
            Registry.SetValue(@"HKEY_CURRENT_USER\Software\Classes\SkylineTester\shell\open\command", null,
                Assembly.GetExecutingAssembly().Location.Quote() + @" ""%1""");
            Registry.SetValue(@"HKEY_CURRENT_USER\Software\Classes\.skyt", null, "SkylineTester");
            Registry.SetValue(@"HKEY_CURRENT_USER\Software\Classes\.skytr", null, "SkylineTester");

            // Refresh shell if association changed.
            if (checkRegistry == null)
                SHChangeNotify(0x08000000, 0x0000, IntPtr.Zero, IntPtr.Zero);

            _runButtons = new[]
            {
                runForms, runTutorials, runTests, runBuild, runQuality, runNightly
            };

            GetBuildPrerequisites();
            FindBuilds();

            commandShell.StopButton = buttonStop;
            commandShell.AddColorPattern("# ", Color.DarkGreen);
            commandShell.AddColorPattern("> ", Color.FromArgb(120, 120, 120));
            commandShell.AddColorPattern("...skipped ", Color.Orange);
            commandShell.AddColorPattern("...failed ", Color.Red);
            commandShell.AddColorPattern("!!!", Color.Red);
            commandShell.AddColorPatternEx("   at ", ":line ", Color.Blue);

            commandShell.ColorLine = line =>
            {
                if (line.StartsWith("...skipped ") ||
                    line.StartsWith("...failed ") ||
                    line.StartsWith("!!! "))
                {
                    _tabOutput.ProcessError(line);
                }
            };

            commandShell.FilterFunc = line =>
            {
                if (line == null)
                    return false;

                if (line.StartsWith("[MLRAW:"))
                    return false;

                // Filter out false error from Waters DLL (it's looking .ind, ultimately finds and uses .idx)
                if (line.StartsWith("Error opening index file") && line.EndsWith(".ind"))
                    return false;

                if (line.StartsWith("#@ "))
                {
                    // Update status.
                    RunUI(() =>
                    {
                        RunningTestName = line.Remove(0, "#@ Running ".Length).TrimEnd('.');
                        statusLabel.Text = line.Substring(3);
                    });
                    return false;
                }

                if (line.StartsWith("...skipped ") ||
                    line.StartsWith("...failed ") ||
                    line.StartsWith("!!! "))
                {
                    RunUI(() => _tabOutput.ProcessError(line));
                }

                if (NewNightlyRun != null)
                {
                    if (line.StartsWith("!!! "))
                    {
                        var parts = line.Split(' ');
                        if (parts[2] == "LEAKED" || parts[2] == "CRT-LEAKED")
                            NewNightlyRun.Leaks++;
                    }
                    else if (line.Length > 6 && line[0] == '[' && line[6] == ']' && line.Contains(" failures, "))
                    {
                        lock (NewNightlyRun)
                        {
                            LastTestResult = line;
                            TestsRun++;
                        }
                    }
                }

                return true;
            };

            if (_openFile != null)
                LoadSettingsFromFile(_openFile);

            TabBase.MainWindow = this;
            _tabForms = new TabForms();
            _tabTutorials = new TabTutorials();
            _tabTests = new TabTests();
            _tabBuild = new TabBuild();
            _tabQuality = new TabQuality();
            _tabNightly = new TabNightly();
            _tabOutput = new TabOutput();
            _tabRunStats = new TabRunStats();

            _tabs = new TabBase[]
            {
                _tabForms,
                _tabTutorials,
                _tabTests,
                _tabBuild,
                _tabQuality,
                _tabNightly,
                _tabOutput,
                _tabRunStats
            };
            NightlyTabIndex = Array.IndexOf(_tabs, _tabNightly);

            InitQuality();
            _previousTab = tabs.SelectedIndex;
            _tabs[_previousTab].Enter();
            statusLabel.Text = "";

            var loader = new BackgroundWorker();
            loader.DoWork += BackgroundLoad;
            loader.RunWorkerAsync();
        }