コード例 #1
0
ファイル: Program.cs プロジェクト: rsumner31/corefx2
        public static void TestCase(Assembly assembly,
                                    RunMode mode,
                                    int duration,
                                    int threads,
                                    int?exceptionThreshold    = null,
                                    bool printMethodName      = false,
                                    bool deadlockDetection    = false,
                                    int randomSeed            = 0,
                                    string[] selectedTests    = null,
                                    string[] overrides        = null,
                                    string[] variations       = null,
                                    string filter             = null,
                                    bool monitorEnabled       = false,
                                    string monitorMachineName = "localhost")
        {
            TestMetrics.Reset();
            TestFinder.AssemblyName = assembly.GetName();
            mode = RunMode.RunAll;

            for (int i = 0; overrides != null && i < overrides.Length; i++)
            {
                TestMetrics.Overrides.Add(overrides[i], overrides[++i]);
            }

            for (int i = 0; variations != null && i < variations.Length; i++)
            {
                TestMetrics.Variations.Add(variations[i]);
            }

            for (int i = 0; selectedTests != null && i < selectedTests.Length; i++)
            {
                TestMetrics.SelectedTests.Add(selectedTests[i]);
            }

            TestMetrics.StressDuration     = duration;
            TestMetrics.StressThreads      = threads;
            TestMetrics.ExceptionThreshold = exceptionThreshold;
            TestMetrics.MonitorEnabled     = monitorEnabled;
            TestMetrics.MonitorMachineName = monitorMachineName;
            TestMetrics.RandomSeed         = randomSeed;
            TestMetrics.Filter             = filter;
            TestMetrics.PrintMethodName    = printMethodName;

            if (deadlockDetection)
            {
                DeadlockDetection.Enable();
            }

            // get and load all the tests
            s_tests = TestFinder.GetTests(assembly);

            // instantiate the stress engine
            s_eng = new StressEngine(TestMetrics.StressThreads, TestMetrics.StressDuration, s_tests, TestMetrics.RandomSeed);
        }
コード例 #2
0
ファイル: Program.cs プロジェクト: Corillian/corefx
        public static void Init(string[] args)
        {
            for (int i = 0; i < args.Length; i++)
            {
                switch (args[i])
                {
                    case "-a":
                        string assemblyName = args[++i];
                        TestFinder.AssemblyName = new AssemblyName(assemblyName);
                        break;

                    case "-all":
                        s_mode = RunMode.RunAll;
                        break;

                    case "-override":
                        TestMetrics.Overrides.Add(args[++i], args[++i]);
                        break;

                    case "-variation":
                        TestMetrics.Variations.Add(args[++i]);
                        break;

                    case "-test":
                        TestMetrics.SelectedTests.Add(args[++i]);
                        break;

                    case "-duration":
                        TestMetrics.StressDuration = Int32.Parse(args[++i]);
                        break;

                    case "-threads":
                        TestMetrics.StressThreads = Int32.Parse(args[++i]);
                        break;

                    case "-verify":
                        s_mode = RunMode.RunVerify;
                        break;

                    case "-debug":
                        if (System.Diagnostics.Debugger.IsAttached)
                        {
                            System.Diagnostics.Debugger.Break();
                        }
                        else
                        {
                            Console.WriteLine("Current PID: {0}, attach the debugger and press Enter to continue the execution...", System.Diagnostics.Process.GetCurrentProcess().Id);
                            Console.ReadLine();
                        }
                        break;

                    case "-exceptionThreshold":
                        TestMetrics.ExceptionThreshold = Int32.Parse(args[++i]);
                        break;

                    case "-monitorenabled":
                        TestMetrics.MonitorEnabled = bool.Parse(args[++i]);
                        break;

                    case "-randomSeed":
                        TestMetrics.RandomSeed = Int32.Parse(args[++i]);
                        break;

                    case "-filter":
                        TestMetrics.Filter = args[++i];
                        break;

                    case "-printMethodName":
                        TestMetrics.PrintMethodName = true;
                        break;

                    case "-deadlockdetection":
                        if (bool.Parse(args[++i]))
                        {
                            DeadlockDetection.Enable();
                        }
                        break;

                    default:
                        s_mode = RunMode.Help;
                        break;
                }
            }

            if (TestFinder.AssemblyName != null)
            {
                Console.WriteLine("Assembly Found for the Assembly Name " + TestFinder.AssemblyName);
                
                if (TestFinder.AssemblyName != null)
                {
                    // get and load all the tests
                    s_tests = TestFinder.GetTests(Assembly.Load(TestFinder.AssemblyName));

                    // instantiate the stress engine
                    s_eng = new StressEngine(TestMetrics.StressThreads, TestMetrics.StressDuration, s_tests, TestMetrics.RandomSeed);
                }
                else
                {
                    Program.s_error = string.Format("Assembly {0} cannot be found.", TestFinder.AssemblyName);
                    s_mode = RunMode.ExitWithError;
                }
            }
        }
コード例 #3
0
ファイル: Program.cs プロジェクト: Corillian/corefx
        public static void TestCase(Assembly assembly,
                                    RunMode mode,
                                    int duration,
                                    int threads,
                                    int? exceptionThreshold = null,
                                    bool printMethodName = false,
                                    bool deadlockDetection = false,
                                    int randomSeed = 0,
                                    string[] selectedTests = null,
                                    string[] overrides = null,
                                    string[] variations = null,
                                    string filter = null,
                                    bool monitorEnabled = false,
                                    string monitorMachineName = "localhost")
        {
            TestMetrics.Reset();
            TestFinder.AssemblyName = assembly.GetName();
            mode = RunMode.RunAll;

            for (int i = 0; overrides != null && i < overrides.Length; i++)
            {
                TestMetrics.Overrides.Add(overrides[i], overrides[++i]);
            }

            for (int i = 0; variations != null && i < variations.Length; i++)
            {
                TestMetrics.Variations.Add(variations[i]);
            }

            for (int i = 0; selectedTests != null && i < selectedTests.Length; i++)
            {
                TestMetrics.SelectedTests.Add(selectedTests[i]);
            }

            TestMetrics.StressDuration = duration;
            TestMetrics.StressThreads = threads;
            TestMetrics.ExceptionThreshold = exceptionThreshold;
            TestMetrics.MonitorEnabled = monitorEnabled;
            TestMetrics.MonitorMachineName = monitorMachineName;
            TestMetrics.RandomSeed = randomSeed;
            TestMetrics.Filter = filter;
            TestMetrics.PrintMethodName = printMethodName;

            if (deadlockDetection)
            {
                DeadlockDetection.Enable();
            }

            // get and load all the tests
            s_tests = TestFinder.GetTests(assembly);

            // instantiate the stress engine
            s_eng = new StressEngine(TestMetrics.StressThreads, TestMetrics.StressDuration, s_tests, TestMetrics.RandomSeed);
        }
コード例 #4
0
ファイル: Program.cs プロジェクト: rsumner31/corefx2
        public static void Init(string[] args)
        {
            for (int i = 0; i < args.Length; i++)
            {
                switch (args[i])
                {
                case "-a":
                    string assemblyName = args[++i];
                    TestFinder.AssemblyName = new AssemblyName(assemblyName);
                    break;

                case "-all":
                    s_mode = RunMode.RunAll;
                    break;

                case "-override":
                    TestMetrics.Overrides.Add(args[++i], args[++i]);
                    break;

                case "-variation":
                    TestMetrics.Variations.Add(args[++i]);
                    break;

                case "-test":
                    TestMetrics.SelectedTests.Add(args[++i]);
                    break;

                case "-duration":
                    TestMetrics.StressDuration = Int32.Parse(args[++i]);
                    break;

                case "-threads":
                    TestMetrics.StressThreads = Int32.Parse(args[++i]);
                    break;

                case "-verify":
                    s_mode = RunMode.RunVerify;
                    break;

                case "-debug":
                    if (System.Diagnostics.Debugger.IsAttached)
                    {
                        System.Diagnostics.Debugger.Break();
                    }
                    else
                    {
                        Console.WriteLine("Current PID: {0}, attach the debugger and press Enter to continue the execution...", System.Diagnostics.Process.GetCurrentProcess().Id);
                        Console.ReadLine();
                    }
                    break;

                case "-exceptionThreshold":
                    TestMetrics.ExceptionThreshold = Int32.Parse(args[++i]);
                    break;

                case "-monitorenabled":
                    TestMetrics.MonitorEnabled = bool.Parse(args[++i]);
                    break;

                case "-randomSeed":
                    TestMetrics.RandomSeed = Int32.Parse(args[++i]);
                    break;

                case "-filter":
                    TestMetrics.Filter = args[++i];
                    break;

                case "-printMethodName":
                    TestMetrics.PrintMethodName = true;
                    break;

                case "-deadlockdetection":
                    if (bool.Parse(args[++i]))
                    {
                        DeadlockDetection.Enable();
                    }
                    break;

                default:
                    s_mode = RunMode.Help;
                    break;
                }
            }

            if (TestFinder.AssemblyName != null)
            {
                Console.WriteLine("Assembly Found for the Assembly Name " + TestFinder.AssemblyName);

                if (TestFinder.AssemblyName != null)
                {
                    // get and load all the tests
                    s_tests = TestFinder.GetTests(Assembly.Load(TestFinder.AssemblyName));

                    // instantiate the stress engine
                    s_eng = new StressEngine(TestMetrics.StressThreads, TestMetrics.StressDuration, s_tests, TestMetrics.RandomSeed);
                }
                else
                {
                    Program.s_error = string.Format("Assembly {0} cannot be found.", TestFinder.AssemblyName);
                    s_mode          = RunMode.ExitWithError;
                }
            }
        }