Exemplo n.º 1
0
        public void TestCrashCollectorMacOSConstruction()
        {
            var date           = DateTime.Now;
            var crashCollector = new CrashCollectorMacOS(m_systemCrashReportFolder, m_userCrashReportFolder, new[] { CrashType.Kernel, CrashType.SandboxExec });

            CreateCrashReports(m_userCrashReportFolder, CrashType.SandboxExec, 4, date.AddHours(1), "Some sandbox exec crash report");
            CreateCrashReports(m_systemCrashReportFolder, CrashType.Kernel, 8, date.AddHours(1), SystemCrashReportFilter);
            CreateCrashReports(m_userCrashReportFolder, CrashType.BuildXL, 2, date.AddHours(1), "Some user crash report");

            var systemReports = crashCollector.GetCrashReports(CrashType.Kernel);

            XAssert.IsTrue(systemReports.Count == 8);

            var userReports = crashCollector.GetCrashReports(CrashType.BuildXL);

            XAssert.IsTrue(userReports.Count == 0);

            var sandboxReports = crashCollector.GetCrashReports(CrashType.SandboxExec);

            XAssert.IsTrue(sandboxReports.Count == 4);
        }
Exemplo n.º 2
0
        public void TestGetUserCrashReportsSinceDateTime()
        {
            var date = DateTime.Now;

            // Create some crash reports that are two days old
            CreateCrashReports(m_userCrashReportFolder, CrashType.BuildXL, 10, date.AddDays(-2), "Some data");

            // Get all crash reports
            var reports = m_crashCollector.GetCrashReports(CrashType.BuildXL);

            XAssert.IsTrue(reports.Count == 10);
            reports = m_crashCollector.GetCrashReports(CrashType.BuildXL, from: date.AddDays(-3));
            XAssert.IsTrue(reports.Count == 10);
            reports = m_crashCollector.GetCrashReports(CrashType.BuildXL, to: date);
            XAssert.IsTrue(reports.Count == 10);
            reports = m_crashCollector.GetCrashReports(CrashType.BuildXL, from: date.AddDays(-3), to: date);
            XAssert.IsTrue(reports.Count == 10);

            // Create some crash reports that are about a day old
            var queryDate = date.AddDays(-1);

            CreateCrashReports(m_userCrashReportFolder, CrashType.BuildXL, 5, queryDate, "Some more data");

            // First query with the current time as a time stamp, should not yield any results
            reports = m_crashCollector.GetCrashReports(CrashType.BuildXL, from: date);
            XAssert.IsTrue(reports.Count == 0);

            CreateCrashReports(m_userCrashReportFolder, CrashType.BuildXL, 1, date, "Even more data");

            // This should only yield the all the crash reports newer or as old as the query date
            reports = m_crashCollector.GetCrashReports(CrashType.BuildXL, from: queryDate, to: date);
            XAssert.IsTrue(reports.Count == 6);
        }