public virtual void Finish()
        {
            if (Exe == null || Exe.EndsWith("maml", StringComparison.OrdinalIgnoreCase) ||
                Exe.EndsWith("maml.exe", StringComparison.OrdinalIgnoreCase))
            {
                string currentDirectory = Path.GetDirectoryName(typeof(ExeConfigRunnerBase).Module.FullyQualifiedName);

                using (var ch = Host.Start("Finish"))
                    using (AssemblyLoadingUtils.CreateAssemblyRegistrar(Host, currentDirectory))
                    {
                        var runs = RunNums.ToArray();
                        var args = Utils.BuildArray(RunNums.Count + 2,
                                                    i =>
                        {
                            if (i == RunNums.Count)
                            {
                                return(string.Format(@"o={{{0}\{1}.summary.txt}}", OutputFolder, Prefix));
                            }
                            if (i == RunNums.Count + 1)
                            {
                                return(string.Format("calledFromUnitTestSuite{0}", _calledFromUnitTestSuite ? "+" : "-"));
                            }
                            return(string.Format("{{{0}}}", GetFilePath(runs[i], "out")));
                        });

                        ResultProcessorInternal.ResultProcessor.Main(args);

                        ch.Info(@"The summary of the run results has been saved to the file {0}\{1}.summary.txt", OutputFolder, Prefix);
                    }
            }
        }
Example #2
0
        private static int MainWithProgress(string args)
        {
            string currentDirectory = Path.GetDirectoryName(typeof(Maml).Module.FullyQualifiedName);

            ConsoleEnvironment env = CreateEnvironment();

#pragma warning disable CS0618 // This is the command line project, so the usage here is OK.
            using (AssemblyLoadingUtils.CreateAssemblyRegistrar(env, currentDirectory))
                                                                                         #pragma warning restore CS0618
                using (var progressCancel = new CancellationTokenSource())
                {
                    var progressTrackerTask = Task.Run(() => TrackProgress(env, progressCancel.Token));
                    try
                    {
                        return(MainCore(env, args, ShouldAlwaysPrintStacktrace()));
                    }
                    finally
                    {
                        progressCancel.Cancel();
                        progressTrackerTask.Wait();
                        // If the run completed so quickly that the progress task was cancelled before it even got a chance to start,
                        // we need to gather the checkpoints.
                        env.PrintProgress();
                    }
                }
        }