Exemplo n.º 1
0
        public void DBEventCountVerification()
        {
            Configuration.Logging.LogExecution = true;

            var fileOne = FileArtifact.CreateOutputFile(Combine(TestDirPath, "foo.txt"));
            var fileTwo = FileArtifact.CreateOutputFile(Combine(TestDirPath, "bar.txt"));
            var dirOne  = Path.Combine(ReadonlyRoot, "baz");

            Directory.CreateDirectory(dirOne);
            File.WriteAllText(Path.Combine(dirOne, "abc.txt"), "text");
            File.WriteAllText(Path.Combine(dirOne, "xyz.txt"), "text12");

            var pipA = CreateAndSchedulePipBuilder(new[]
            {
                Operation.WriteFile(fileOne),
            }).Process;

            var pipB = CreateAndSchedulePipBuilder(new[]
            {
                Operation.WriteFile(fileTwo),
            }).Process;

            var pipC = CreateAndSchedulePipBuilder(new[]
            {
                Operation.ReadFile(fileOne),
                Operation.WriteFile(CreateOutputFileArtifact())
            }).Process;

            var pipD = CreateAndSchedulePipBuilder(new[]
            {
                Operation.EnumerateDir(new DirectoryArtifact(AbsolutePath.Create(Context.PathTable, dirOne), 0, false)),
                Operation.WriteFile(CreateOutputFileArtifact())
            }).Process;

            var buildA      = RunScheduler().AssertSuccess();
            var analyzerRes = RunAnalyzer(buildA).AssertSuccess();

            var dataStore = new XldbDataStore(storeDirectory: OutputDirPath.ToString(Context.PathTable));

            // As per Mike's offline comment, non-zero vs zero event count tests for now until we can rent out some mac machines
            // and figure out the true reason why the windows and mac event log counts differ by so much

            // For these tests, there should be a non-zero number of events logged
            XAssert.AreNotEqual(0, dataStore.GetFileArtifactContentDecidedEvents().Count());
            XAssert.AreNotEqual(0, dataStore.GetPipExecutionPerformanceEvents().Count());
            XAssert.AreNotEqual(0, dataStore.GetDirectoryMembershipHashedEvents().Count());
            XAssert.AreNotEqual(0, dataStore.GetProcessExecutionMonitoringReportedEvents().Count());
            XAssert.AreNotEqual(0, dataStore.GetProcessFingerprintComputationEvents().Count());
            XAssert.AreNotEqual(0, dataStore.GetBuildSessionConfigurationEvents().Count());
            XAssert.AreNotEqual(0, dataStore.GetPipExecutionStepPerformanceReportedEvents().Count());
            XAssert.AreNotEqual(0, dataStore.GetPipCacheMissEvents().Count());
            XAssert.AreNotEqual(0, dataStore.GetStatusReportedEvents().Count());
            XAssert.AreNotEqual(0, dataStore.GetBxlInvocationEvents().Count());

            // For these tests, there should be no events logged
            XAssert.AreEqual(0, dataStore.GetPipExecutionDirectoryOutputsEvents().Count());
            XAssert.AreEqual(0, dataStore.GetWorkerListEvents().Count());
            XAssert.AreEqual(0, dataStore.GetDependencyViolationReportedEvents().Count());
        }
Exemplo n.º 2
0
        public XLGToDBAnalyzerTests(ITestOutputHelper output) : base(output)
        {
            AnalysisMode = AnalysisMode.XlgToDb;

            OutputDirPath = Combine(AbsolutePath.Create(Context.PathTable, TemporaryDirectory), "XlgToDb");
            TestDirPath   = Combine(AbsolutePath.Create(Context.PathTable, TemporaryDirectory), "XlgToDbTest");

            ModeSpecificDefaultArgs = new Option[]
            {
                new Option
                {
                    Name  = "outputDir",
                    Value = OutputDirPath.ToString(Context.PathTable)
                }
            };
        }
Exemplo n.º 3
0
        public XLGToDBAnalyzerTests(ITestOutputHelper output) : base(output)
        {
            AnalysisMode = AnalysisMode.XlgToDb;
            var uniqueDirPath = Guid.NewGuid().ToString();

            OutputDirPath = Combine(AbsolutePath.Create(Context.PathTable, ObjectRoot), "XlgToDb-", uniqueDirPath);
            TestDirPath   = Combine(AbsolutePath.Create(Context.PathTable, SourceRoot), "XlgToDbTest");

            ModeSpecificDefaultArgs = new Option[]
            {
                new Option
                {
                    Name  = "outputDir",
                    Value = OutputDirPath.ToString(Context.PathTable)
                }
            };
        }
Exemplo n.º 4
0
        public void DBCreatedAndPopulated()
        {
            Configuration.Logging.LogExecution = true;

            var file = FileArtifact.CreateOutputFile(Combine(TestDirPath, "blah.txt"));

            var pipA = CreateAndSchedulePipBuilder(new[]
            {
                Operation.WriteFile(file),
            }).Process;

            var pipB = CreateAndSchedulePipBuilder(new[]
            {
                Operation.ReadFile(file),
                Operation.WriteFile(CreateOutputFileArtifact())
            }).Process;

            var buildA = RunScheduler().AssertSuccess();

            var analyzerRes = RunAnalyzer(buildA).AssertSuccess();

            XAssert.AreNotEqual(Directory.GetFiles(OutputDirPath.ToString(Context.PathTable), "*.sst").Length, 0);
        }