internal static int AppMain(TestsToRun testsToRun) { // Run test cases where the child processes don't output to the console if ((testsToRun & TestsToRun.ProcessNoOutput) != 0) { TestProcessCreation.RunWithNoChildOutput(); } // Run test cases where the child processes output to the console if ((testsToRun & TestsToRun.ProcessWithOutput) != 0) { TestProcessCreation.RunWithChildOutput(); } // Run test cases where the child processes don't output to the console if ((testsToRun & TestsToRun.ProcessNoOutputLoop) != 0) { for (int i = 0; ; i++) { Console.Write(i); Console.Write('.'); TestProcessCreation.RunWithNoChildOutput(); Thread.Sleep(1000); } } return(0); }
private static void Main(string[] args) { GVFSPlatformLoader.Initialize(); string enlistmentRootPath = @"M:\OS"; if (args.Length > 0 && !string.IsNullOrWhiteSpace(args[0])) { enlistmentRootPath = args[0]; } TestsToRun testsToRun = TestsToRun.All; if (args.Length > 1) { int tests; if (int.TryParse(args[1], out tests)) { testsToRun = (TestsToRun)tests; } } ProfilingEnvironment environment = new ProfilingEnvironment(enlistmentRootPath); Dictionary <TestsToRun, Action> allTests = new Dictionary <TestsToRun, Action> { { TestsToRun.ValidateIndex, () => GitIndexProjection.ReadIndex(environment.Context.Tracer, Path.Combine(environment.Enlistment.WorkingDirectoryRoot, GVFSConstants.DotGit.Index)) }, { TestsToRun.RebuildProjection, () => environment.FileSystemCallbacks.GitIndexProjectionProfiler.ForceRebuildProjection() }, { TestsToRun.ValidateModifiedPaths, () => environment.FileSystemCallbacks.GitIndexProjectionProfiler.ForceAddMissingModifiedPaths(environment.Context.Tracer) }, }; long before = GetMemoryUsage(); foreach (KeyValuePair <TestsToRun, Action> test in allTests) { if (IsOn(testsToRun, test.Key)) { TimeIt(test.Key.ToString(), test.Value); } } long after = GetMemoryUsage(); Console.WriteLine($"Memory Usage: {FormatByteCount(after - before)}"); Console.WriteLine(); Console.WriteLine("Press Enter to exit"); Console.Read(); }
private static bool IsOn(TestsToRun value, TestsToRun flag) { return(flag == (value & flag)); }