Ejemplo n.º 1
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();
        }