Exemplo n.º 1
0
 public void TestScrubbingCommandLine()
 {
     XAssert.AreEqual($"{Branding.ProductExecutableName} /first [...] /tenth", BuildXLApp.ScrubCommandLine($"{Branding.ProductExecutableName} /first /second /third /fourth /fifth /sixth /seventh /eight /ninth /tenth", 20, 10));
     XAssert.AreEqual($"{Branding.ProductExecutableName} /first [...]nth", BuildXLApp.ScrubCommandLine($"{Branding.ProductExecutableName} /first /second /tenth", 20, 3));
     XAssert.AreEqual("bxl.[...]nth", BuildXLApp.ScrubCommandLine($"{Branding.ProductExecutableName} /first /second /tenth", 4, 3));
     XAssert.AreEqual($"{Branding.ProductExecutableName} /first /second /tenth", BuildXLApp.ScrubCommandLine($"{Branding.ProductExecutableName} /first /second /tenth", 4, 332));
     XAssert.AreEqual($"{Branding.ProductExecutableName} /first /second /tenth", BuildXLApp.ScrubCommandLine($"{Branding.ProductExecutableName} /first /second /tenth", 432, 2));
     XAssert.AreEqual("[...]", BuildXLApp.ScrubCommandLine($"{Branding.ProductExecutableName} /first /second /tenth", 0, 0));
     XAssert.AreEqual("", BuildXLApp.ScrubCommandLine("", 1, 1));
 }
Exemplo n.º 2
0
        public void DistributedBuildConnectivityIssueTrumpsOtherErrors()
        {
            var loggingContext = XunitBuildXLTest.CreateLoggingContextForTest();

            using (var listener = new TrackingEventListener(Events.Log))
            {
                listener.RegisterEventSource(global::BuildXL.Engine.ETWLogger.Log);
                listener.RegisterEventSource(global::BuildXL.Scheduler.ETWLogger.Log);
                global::BuildXL.Scheduler.Tracing.Logger.Log.PipMaterializeDependenciesFromCacheFailure(loggingContext, "ArbitraryPip", "ArbitraryMessage");
                global::BuildXL.Engine.Tracing.Logger.Log.DistributionExecutePipFailedNetworkFailure(loggingContext, "ArbitraryPip", "ArbitraryWorker", "ArbitraryMessage", "ArbitraryStep", "ArbitraryCaller");
                global::BuildXL.Scheduler.Tracing.Logger.Log.PipMaterializeDependenciesFromCacheFailure(loggingContext, "ArbitraryPip", "ArbitraryMessage");

                var infrastructureErrorClassification = BuildXLApp.ClassifyFailureFromLoggedEvents(listener);
                XAssert.AreEqual(ExitKind.InfrastructureError, infrastructureErrorClassification.ExitKind);
                XAssert.AreEqual(global::BuildXL.Engine.Tracing.LogEventId.DistributionExecutePipFailedNetworkFailure.ToString(), infrastructureErrorClassification.ErrorBucket);
            }
        }
Exemplo n.º 3
0
        private static ExitKind RunSingleInstance(IReadOnlyCollection <string> rawArgs, ServerModeStatusAndPerf?serverModeStatusAndPerf = null)
        {
            using (var args = new Args())
            {
                var pathTable = new PathTable();

                ICommandLineConfiguration configuration;
                ContentHashingUtilities.SetContentHasherIdlePoolSize(10);
                if (!args.TryParse(rawArgs.ToArray(), pathTable, out configuration))
                {
                    return(ExitKind.InvalidCommandLine);
                }

                string clientPath     = AssemblyHelper.GetThisProgramExeLocation();
                var    rawArgsWithExe = new List <string>(rawArgs.Count + 1)
                {
                    clientPath
                };
                rawArgsWithExe.AddRange(rawArgs);

                using (var app = new BuildXLApp(
                           new SingleInstanceHost(),
                           null,

                           // BuildXLApp will create a standard console.
                           configuration,
                           pathTable,
                           rawArgsWithExe,
                           null,
                           serverModeStatusAndPerf))
                {
                    Console.CancelKeyPress +=
                        (sender, eventArgs) =>
                    {
                        eventArgs.Cancel = !app.OnConsoleCancelEvent(isTermination: eventArgs.SpecialKey == ConsoleSpecialKey.ControlBreak);
                    };

                    return(app.Run().ExitKind);
                }
            }
        }
Exemplo n.º 4
0
        public void ErrorPrecedence()
        {
            using (var listener = new TrackingEventListener(Events.Log))
            {
                Events.Log.UserErrorEvent("1");
                var userErrorClassification = BuildXLApp.ClassifyFailureFromLoggedEvents(listener);
                XAssert.AreEqual(ExitKind.UserError, userErrorClassification.ExitKind);
                XAssert.AreEqual("UserErrorEvent", userErrorClassification.ErrorBucket);

                // Now add an infrasctructure error. This should take prescedence
                Events.Log.InfrastructureErrorEvent("1");
                var infrastructureErrorClassification = BuildXLApp.ClassifyFailureFromLoggedEvents(listener);
                XAssert.AreEqual(ExitKind.InfrastructureError, infrastructureErrorClassification.ExitKind);
                XAssert.AreEqual("InfrastructureErrorEvent", infrastructureErrorClassification.ErrorBucket);

                // Finally add an internal error. Again, this takes highest prescedence
                Events.Log.ErrorEvent("1");
                var internalErrorClassification = BuildXLApp.ClassifyFailureFromLoggedEvents(listener);
                XAssert.AreEqual(ExitKind.InternalError, internalErrorClassification.ExitKind);
                XAssert.AreEqual("ErrorEvent", internalErrorClassification.ErrorBucket);
            }
        }