Beispiel #1
0
 private void status()
 {
     while (!m_evtStatusCancel.WaitOne(1000))
     {
         m_dfProgress = TestingProgressGet.GetProgress();
     }
 }
Beispiel #2
0
        public void UpdateStatus()
        {
            int          nProgressCount = 0;
            MethodInfoEx miLast         = null;

            foreach (ListViewItem lvi in lstTests.Items)
            {
                KeyValuePair <TestClass, MethodInfoEx> kvTc = (KeyValuePair <TestClass, MethodInfoEx>)lvi.Tag;
                MethodInfoEx mi = kvTc.Value;

                if (lvi.ImageIndex != (int)mi.Status)
                {
                    lvi.SubItems[1].Text = mi.Status.ToString();
                    lvi.ImageIndex       = (int)mi.Status;

                    if (mi.Status == MethodInfoEx.STATUS.Passed)
                    {
                        lvi.Checked = false;
                        mi.Enabled  = false;
                    }

                    if (mi.Status == MethodInfoEx.STATUS.Running)
                    {
                        lvi.EnsureVisible();
                    }
                }

                double?dfProgress = mi.Progress;
                if (!dfProgress.HasValue)
                {
                    dfProgress = m_progress.GetProgress();
                }

                if (dfProgress.HasValue)
                {
                    nProgressCount++;
                    tsItemProgress.Visible = true;
                    pbItemProgress.Visible = true;
                    tsItemProgress.Text    = dfProgress.Value.ToString("P");
                    pbItemProgress.Value   = (int)(dfProgress.Value * 100.0);
                }

                if (mi.ErrorInfo.Error != null && lvi.SubItems[4].Text.Length == 0)
                {
                    lvi.SubItems[4].Text = mi.ErrorInfo.ShortErrorString;
                    lvi.SubItems[4].Tag  = mi.ErrorInfo;
                }

                miLast = mi;
            }

            if (nProgressCount == 0)
            {
                tsItemProgress.Visible = false;
                pbItemProgress.Visible = false;
            }
        }
Beispiel #3
0
        private void status()
        {
            TestingProgressGet progress = new TestingProgressGet();

            while (!m_evtStatusCancel.WaitOne(1000))
            {
                m_dfProgress = progress.GetProgress();
            }
        }
Beispiel #4
0
        private void m_bw_DoWork(object sender, DoWorkEventArgs e)
        {
            BackgroundWorker     bw       = sender as BackgroundWorker;
            AutoTestParams       param    = e.Argument as AutoTestParams;
            AutoTestProgressInfo pi       = new AutoTestProgressInfo();
            TestClassCollection  colTests = new TestClassCollection();

            colTests.OnRunCompleted += colTests_OnRunCompleted;
            colTests.Load(param.TestDllFile);

            if (param.ResetAllTests)
            {
                colTests.ResetAllTests();
            }
            else
            {
                colTests.LoadFromDatabase();
            }

            try
            {
                colTests.Run(m_evtCancel, false, true, param.GpuId, param.ImageDbVersion, param.CudaPath);

                TestingProgressGet progress = new TestingProgressGet();

                string strLast = null;
                while (!bw.CancellationPending && colTests.IsRunning)
                {
                    Thread.Sleep(1000);
                    string strCurrent = colTests.CurrentTest;
                    double?dfProgress = progress.GetProgress();

                    if (strCurrent.Length > 0)
                    {
                        strCurrent = " [" + strCurrent + "]";
                    }

                    if (dfProgress.HasValue)
                    {
                        strCurrent += " (" + dfProgress.Value.ToString("P") + " of current item)";
                    }

                    pi.Set(colTests.PercentComplete, colTests.TotalTestTimingString + " completed " + colTests.TotalTestRunCount.ToString("N0") + " of " + colTests.TotalTestCount.ToString("N0") + " (" + colTests.TotalTestFailureCount.ToString("N0") + " failed)." + strCurrent);
                    bw.ReportProgress((int)(pi.Progress * 100), pi);

                    strLast = strCurrent;
                }
            }
            catch (Exception excpt)
            {
                pi.Set(excpt);
                bw.ReportProgress((int)(pi.Progress * 100), pi);
            }

            colTests.SaveToDatabase();
        }