コード例 #1
0
        private static async Task <int> RunCore(Options options, CancellationToken cancellationToken)
        {
            if (!CheckAssemblyList(options))
            {
                return(ExitFailure);
            }

            var testExecutor     = CreateTestExecutor(options);
            var testRunner       = new TestRunner(options, testExecutor);
            var start            = DateTime.Now;
            var assemblyInfoList = GetAssemblyList(options);

            ConsoleUtil.WriteLine($"Proc dump location: {options.ProcDumpDirectory}");
            ConsoleUtil.WriteLine($"Running {options.Assemblies.Count} test assemblies in {assemblyInfoList.Count} partitions");

            var result = await testRunner.RunAllAsync(assemblyInfoList, cancellationToken).ConfigureAwait(true);

            var elapsed = DateTime.Now - start;

            ConsoleUtil.WriteLine($"Test execution time: {elapsed}");

            LogProcessResultDetails(result.ProcessResults);
            WriteLogFile(options);
            DisplayResults(options.Display, result.TestResults);

            if (!result.Succeeded)
            {
                ConsoleUtil.WriteLine(ConsoleColor.Red, $"Test failures encountered");
                return(ExitFailure);
            }

            ConsoleUtil.WriteLine($"All tests passed");
            return(ExitSuccess);
        }
コード例 #2
0
        private static async Task <int> RunCore(Options options, CancellationToken cancellationToken)
        {
            var testExecutor = CreateTestExecutor(options);
            var testRunner   = new TestRunner(options, testExecutor);
            var start        = DateTime.Now;

            Console.WriteLine($"Data Storage: {testExecutor.DataStorage.Name}");
            Console.WriteLine($"Running {options.Assemblies.Count()} test assemblies");

            var orderedList = OrderAssemblyList(options.Assemblies);
            var result      = await testRunner.RunAllAsync(orderedList, cancellationToken).ConfigureAwait(true);

            var ellapsed = DateTime.Now - start;

            foreach (var assemblyPath in options.MissingAssemblies)
            {
                ConsoleUtil.WriteLine(ConsoleColor.Red, $"The file '{assemblyPath}' does not exist, is an invalid file name, or you do not have sufficient permissions to read the specified file.");
            }

            Logger.Finish();

            if (CanUseWebStorage())
            {
                await SendRunStats(options, testExecutor.DataStorage, ellapsed, result, cancellationToken).ConfigureAwait(true);
            }

            if (!result.Succeeded)
            {
                ConsoleUtil.WriteLine(ConsoleColor.Red, $"Test failures encountered: {ellapsed}");
                return(1);
            }

            Console.WriteLine($"All tests passed: {ellapsed}");
            return(options.MissingAssemblies.Any() ? 1 : 0);
        }
コード例 #3
0
        internal static int Main(string[] args)
        {
            if (args.Length < 2)
            {
                PrintUsage();
                return(1);
            }

            var xunitPath = args[0];
            var index     = 1;
            var test64    = false;
            var useHtml   = true;

            ParseArgs(args, ref index, ref test64, ref useHtml);

            var list = new List <string>(args.Skip(index));

            if (list.Count == 0)
            {
                PrintUsage();
                return(1);
            }

            var xunit = test64
                ? Path.Combine(xunitPath, "xunit.console.exe")
                : Path.Combine(xunitPath, "xunit.console.x86.exe");

            // Setup cancellation for ctrl-c key presses
            var cts = new CancellationTokenSource();

            Console.CancelKeyPress += delegate
            {
                cts.Cancel();
            };

            var testRunner = new TestRunner(xunit, useHtml);
            var start      = DateTime.Now;

            Console.WriteLine("Running {0} test assemblies", list.Count);

            var orderedList = OrderAssemblyList(list);
            var result      = testRunner.RunAllAsync(orderedList, cts.Token).Result;
            var span        = DateTime.Now - start;

            if (!result)
            {
                ConsoleUtil.WriteLine(ConsoleColor.Red, "Test failures encountered: {0}", span);
                return(1);
            }

            Console.WriteLine("All tests passed: {0}", span);
            return(0);
        }
コード例 #4
0
        internal static int Main(string[] args)
        {
            var options = Options.Parse(args);

            if (options == null)
            {
                Options.PrintUsage();
                return(1);
            }

            // Setup cancellation for ctrl-c key presses
            var cts = new CancellationTokenSource();

            Console.CancelKeyPress += delegate
            {
                cts.Cancel();
            };

            ITestExecutor testExecutor = new ProcessTestExecutor(options);

            if (options.UseCachedResults)
            {
                testExecutor = new CachingTestExecutor(options, testExecutor, new LocalDataStorage());
            }

            var testRunner = new TestRunner(options, testExecutor);
            var start      = DateTime.Now;

            Console.WriteLine("Running {0} test assemblies", options.Assemblies.Count());

            var orderedList = OrderAssemblyList(options.Assemblies);
            var result      = testRunner.RunAllAsync(orderedList, cts.Token).Result;
            var span        = DateTime.Now - start;

            foreach (var assemblyPath in options.MissingAssemblies)
            {
                ConsoleUtil.WriteLine(ConsoleColor.Red, $"The file '{assemblyPath}' does not exist, is an invalid file name, or you do not have sufficient permissions to read the specified file.");
            }

            Logger.Finish();

            if (!result)
            {
                ConsoleUtil.WriteLine(ConsoleColor.Red, "Test failures encountered: {0}", span);
                return(1);
            }

            Console.WriteLine("All tests passed: {0}", span);
            return(options.MissingAssemblies.Any() ? 1 : 0);
        }
コード例 #5
0
ファイル: Program.cs プロジェクト: nileshjagtap/roslyn
        internal static int Main(string[] args)
        {
            if (args.Length < 2)
            {
                PrintUsage();
                return 1;
            }

            var xunitPath = args[0];
            var index = 1;
            var test64 = false;
            var useHtml = true;
            ParseArgs(args, ref index, ref test64, ref useHtml);

            var list = new List<string>(args.Skip(index));
            if (list.Count == 0)
            {
                PrintUsage();
                return 1;
            }

            var xunit = test64
                ? Path.Combine(xunitPath, "xunit.console.exe")
                : Path.Combine(xunitPath, "xunit.console.x86.exe");

            // Setup cancellation for ctrl-c key presses
            var cts = new CancellationTokenSource();
            Console.CancelKeyPress += delegate
            {
                cts.Cancel();
            };

            var testRunner = new TestRunner(xunit, useHtml);
            var start = DateTime.Now;

            Console.WriteLine("Running {0} test assemblies", list.Count);

            var orderedList = OrderAssemblyList(list);
            var result = testRunner.RunAllAsync(orderedList, cts.Token).Result;
            var span = DateTime.Now - start;
            if (!result)
            {
                ConsoleUtil.WriteLine(ConsoleColor.Red, "Test failures encountered: {0}", span);
                return 1;
            }

            Console.WriteLine("All tests passed: {0}", span);
            return 0;
        }
コード例 #6
0
        internal static int Main(string[] args)
        {
            var options = Options.Parse(args);
            if (options == null)
            {
                Options.PrintUsage();
                return 1;
            }

            // Setup cancellation for ctrl-c key presses
            var cts = new CancellationTokenSource();
            Console.CancelKeyPress += delegate
            {
                cts.Cancel();
            };

            ITestExecutor testExecutor = new ProcessTestExecutor(options);
            if (options.UseCachedResults)
            {
                testExecutor = new CachingTestExecutor(options, testExecutor, new LocalDataStorage());
            }

            var testRunner = new TestRunner(options, testExecutor);
            var start = DateTime.Now;

            Console.WriteLine("Running {0} test assemblies", options.Assemblies.Count());

            var orderedList = OrderAssemblyList(options.Assemblies);
            var result = testRunner.RunAllAsync(orderedList, cts.Token).Result;
            var span = DateTime.Now - start;

            foreach (var assemblyPath in options.MissingAssemblies)
            {
                ConsoleUtil.WriteLine(ConsoleColor.Red, $"The file '{assemblyPath}' does not exist, is an invalid file name, or you do not have sufficient permissions to read the specified file.");
            }

            Logger.Finish();

            if (!result)
            {
                ConsoleUtil.WriteLine(ConsoleColor.Red, "Test failures encountered: {0}", span);
                return 1;
            }

            Console.WriteLine("All tests passed: {0}", span);
            return options.MissingAssemblies.Any() ? 1 : 0;
        }
コード例 #7
0
ファイル: Program.cs プロジェクト: togglebrain/roslyn
        private static async Task<int> RunCore(Options options, CancellationToken cancellationToken)
        {
            if (options.MissingAssemblies.Count > 0)
            {
                foreach (var assemblyPath in options.MissingAssemblies)
                {
                    ConsoleUtil.WriteLine(ConsoleColor.Red, $"The file '{assemblyPath}' does not exist, is an invalid file name, or you do not have sufficient permissions to read the specified file.");
                }

                return 1;
            }

            var testExecutor = CreateTestExecutor(options);
            var testRunner = new TestRunner(options, testExecutor);
            var start = DateTime.Now;
            var assemblyInfoList = GetAssemblyList(options);

            Console.WriteLine($"Data Storage: {testExecutor.DataStorage.Name}");
            Console.WriteLine($"Running {options.Assemblies.Count()} test assemblies in {assemblyInfoList.Count} chunks");

            var result = await testRunner.RunAllAsync(assemblyInfoList, cancellationToken).ConfigureAwait(true);
            var ellapsed = DateTime.Now - start;

            Console.WriteLine($"Test execution time: {ellapsed}");

            Logger.Finish(Path.GetDirectoryName(options.Assemblies.FirstOrDefault() ?? ""));

            if (CanUseWebStorage())
            {
                await SendRunStats(options, testExecutor.DataStorage, ellapsed, result, assemblyInfoList.Count, cancellationToken).ConfigureAwait(true);
            }

            if (!result.Succeeded)
            {
                ConsoleUtil.WriteLine(ConsoleColor.Red, $"Test failures encountered");
                return 1;
            }

            Console.WriteLine($"All tests passed");
            return options.MissingAssemblies.Any() ? 1 : 0;
        }
コード例 #8
0
ファイル: Program.cs プロジェクト: lodejard/AllNetCore
        private static async Task <int> RunCore(Options options, CancellationToken cancellationToken)
        {
            if (!CheckAssemblyList(options))
            {
                return(ExitFailure);
            }

            var testExecutor     = CreateTestExecutor(options);
            var testRunner       = new TestRunner(options, testExecutor);
            var start            = DateTime.Now;
            var assemblyInfoList = GetAssemblyList(options);

            Console.WriteLine($"Data Storage: {testExecutor.DataStorage.Name}");
            Console.WriteLine($"Running {options.Assemblies.Count()} test assemblies in {assemblyInfoList.Count} partitions");

            var result = await testRunner.RunAllAsync(assemblyInfoList, cancellationToken).ConfigureAwait(true);

            var elapsed = DateTime.Now - start;

            Console.WriteLine($"Test execution time: {elapsed}");

            Logger.Finish(Path.GetDirectoryName(options.Assemblies.FirstOrDefault() ?? ""));

            DisplayResults(options.Display, result.TestResults);

            if (CanUseWebStorage())
            {
                await SendRunStats(options, testExecutor.DataStorage, elapsed, result, assemblyInfoList.Count, cancellationToken).ConfigureAwait(true);
            }

            if (!result.Succeeded)
            {
                ConsoleUtil.WriteLine(ConsoleColor.Red, $"Test failures encountered");
                return(ExitFailure);
            }

            Console.WriteLine($"All tests passed");
            return(ExitSuccess);
        }
コード例 #9
0
ファイル: Program.cs プロジェクト: rgani/roslyn
        private static async Task<int> RunCore(Options options, CancellationToken cancellationToken)
        {
            if (!CheckAssemblyList(options))
            { 
                return ExitFailure;
            }

            var testExecutor = CreateTestExecutor(options);
            var testRunner = new TestRunner(options, testExecutor);
            var start = DateTime.Now;
            var assemblyInfoList = GetAssemblyList(options);

            Console.WriteLine($"Data Storage: {testExecutor.DataStorage.Name}");
            Console.WriteLine($"Running {options.Assemblies.Count()} test assemblies in {assemblyInfoList.Count} partitions");

            var result = await testRunner.RunAllAsync(assemblyInfoList, cancellationToken).ConfigureAwait(true);
            var elapsed = DateTime.Now - start;

            Console.WriteLine($"Test execution time: {elapsed}");

            Logger.Finish(Path.GetDirectoryName(options.Assemblies.FirstOrDefault() ?? ""));

            DisplayResults(options.Display, result.TestResults);

            if (CanUseWebStorage())
            {
                await SendRunStats(options, testExecutor.DataStorage, elapsed, result, assemblyInfoList.Count, cancellationToken).ConfigureAwait(true);
            }

            if (!result.Succeeded)
            {
                ConsoleUtil.WriteLine(ConsoleColor.Red, $"Test failures encountered");
                return ExitFailure;
            }

            Console.WriteLine($"All tests passed");
            return ExitSuccess;
        }