Ejemplo n.º 1
0
        public static int Main(string[] arguments)
        {
#if FEATURE_PROFILING
            var configuration = ProfileConfiguration.Parse(arguments);
            Console.WriteLine("Running Profiling with the following:");
            Console.WriteLine($"- SdkPath: {SdkPath}");
            Console.WriteLine($"- OutputPath: {OutputPath}");
            Console.WriteLine($"- Classes: [{(configuration.ClassNames.Any() ? string.Join(",", configuration.ClassNames) : "*All*")}]");

            using (var cluster = new ProfilingCluster())
            {
                foreach (var profilingFactory in CreateProfilingFactory(cluster))
                {
                    profilingFactory.Run(configuration);
                    profilingFactory.RunAsync(configuration).Wait();
                }
            }

            return(0);
#else
            Console.ForegroundColor = ConsoleColor.Red;
            Console.WriteLine("Tests.exe is not built with Profiling support");
            Console.ResetColor();
            return(2);
#endif
        }
Ejemplo n.º 2
0
        public static void Main(string[] args)
        {
            if (args.Length == 0)
            {
                Console.WriteLine("Must specify at least one argument: TestAssemblyPath, Profile or Benchmark ");
            }

            var arguments = args.Skip(1).ToArray();

            if (args[0].Equals("Profile", StringComparison.OrdinalIgnoreCase))
            {
#if FEATURE_PROFILING
                var configuration = ProfileConfiguration.Parse(arguments);
                Console.WriteLine("Running Profiling with the following:");
                Console.WriteLine($"- SdkPath: {SdkPath}");
                Console.WriteLine($"- OutputPath: {OutputPath}");
                Console.WriteLine($"- Classes: [{(configuration.ClassNames.Any() ? string.Join(",", configuration.ClassNames) : "*All*")}]");

                using (var cluster = new ProfilingCluster())
                {
                    foreach (var profilingFactory in CreateProfilingFactory(cluster))
                    {
                        profilingFactory.Run(configuration);
                        profilingFactory.RunAsync(configuration).Wait();
                    }
                }
#else
                Console.ForegroundColor = ConsoleColor.Red;
                Console.WriteLine("Tests.exe is not built with Profiling support");
                Console.ResetColor();
                Environment.Exit(9);
#endif
            }
            else if (args[0].Equals("Benchmark", StringComparison.OrdinalIgnoreCase))
            {
                Console.WriteLine("Running Benchmarking.");
                if (args.Count() > 1 && args[1].Equals("non-interactive", StringComparison.OrdinalIgnoreCase))
                {
                    Console.WriteLine("Running in Non-Interactive mode.");
                    foreach (var benchmarkType in GetBenchmarkTypes())
                    {
                        BenchmarkRunner.Run(benchmarkType);
                    }
                    return;
                }

                Console.WriteLine("Running in Interactive mode.");
                var benchmarkSwitcher = new BenchmarkSwitcher(GetBenchmarkTypes());
                benchmarkSwitcher.Run(arguments);
            }
        }
Ejemplo n.º 3
0
        // TODO: Renamed this from Main to TestMain because of a bug with Resharper and running unit tests
        // in Visual Studio with .NET Core: https://youtrack.jetbrains.com/issue/RSRP-464233
        // Once this is fixed, look at renaming back and removing additional packages. See https://github.com/elastic/elasticsearch-net/pull/2793
        public static void TestMain(string[] args)
        {
            if (args.Length == 0)
            {
                Console.WriteLine("Must specify at least one argument: TestAssemblyPath, Profile or Benchmark ");
            }

            var arguments = args.Skip(1).ToArray();

            if (args[0].Equals("Profile", StringComparison.OrdinalIgnoreCase))
            {
#if DOTNETCORE
                Console.Error.WriteLine("DotTrace Profiling is not currently supported on .NET Core");
                return;
#else
                var configuration = ProfileConfiguration.Parse(arguments);
                Console.WriteLine("Running Profiling with the following:");
                Console.WriteLine($"- SdkPath: {SdkPath}");
                Console.WriteLine($"- OutputPath: {OutputPath}");
                Console.WriteLine($"- Classes: [{(configuration.ClassNames.Any() ? string.Join(",", configuration.ClassNames) : "*All*")}]");

                using (var cluster = new ProfilingCluster())
                {
                    foreach (var profilingFactory in CreateProfilingFactory(cluster))
                    {
                        profilingFactory.Run(configuration);
                        profilingFactory.RunAsync(configuration).Wait();
                    }
                }
#endif
            }
            else if (args[0].Equals("Benchmark", StringComparison.OrdinalIgnoreCase))
            {
                var benchmarkSwitcher = new BenchmarkSwitcher(GetBenchmarkTypes());
                benchmarkSwitcher.Run(arguments);
            }
        }