Esempio n. 1
0
        private void DisplayFailure(Test test, TestResult result)
        {
            if (_verbose && !_quiet) {
                Console.WriteLine("Repro:");
                if (test.EnvironmentVariables != null) {
                    foreach (var envVar in test.EnvironmentVariables) {
                        Console.WriteLine("SET {0}={1}", envVar.Name, envVar.Value);
                    }
                }
                Console.WriteLine("CD /D {0}", test.WorkingDirectory);
                Console.WriteLine("{0} {1}", test.Filename, test.Arguments);

                Console.WriteLine();
                Console.WriteLine("Result: ");
                foreach (var line in result.Output) {
                    Console.WriteLine("> {0}", line);
                }
            }
        }
Esempio n. 2
0
		public void HandleFailure (string file, TestResult status, string extra)
		{
			switch (status) {
				case TestResult.Success:
					success++;
					if (know_issues.Contains (file)) {
						LogFileLine (file, "FIXED ISSUE");
						return;
					}
					if (verbose)
						LogFileLine (file, "OK");
					return;

				case TestResult.CompileError:
					if (know_issues.Contains (file)) {
						LogFileLine (file, "KNOWN ISSUE (Compilation error)");
						know_issues.Remove (file);
						return;
					}
					LogFileLine (file, "REGRESSION (SUCCESS -> COMPILATION ERROR)");
					break;

				case TestResult.ExecError:
					if (know_issues.Contains (file)) {
						LogFileLine (file, "KNOWN ISSUE (Execution error)");
						know_issues.Remove (file);
						return;
					}
					LogFileLine (file, "REGRESSION (SUCCESS -> EXECUTION ERROR)");
					break;

				case TestResult.XmlError:
					if (know_issues.Contains (file)) {
						LogFileLine (file, "KNOWN ISSUE (Xml comparision error)");
						know_issues.Remove (file);
						return;
					}
					LogFileLine (file, "REGRESSION (SUCCESS -> DOCUMENTATION ERROR)");
					break;

				case TestResult.LoadError:
					if (extra != null)
						extra = ": " + extra;

					LogFileLine (file, "REGRESSION (SUCCESS -> LOAD ERROR)" + extra);
					extra = null;
					break;

				case TestResult.MethodAttributesError:
				case TestResult.ILError:
					if (!update_verif_file) {
						LogFileLine (file, "IL REGRESSION: " + extra);
					}
					extra = null;
					break;

				case TestResult.DebugError:
					LogFileLine (file, "REGRESSION (SUCCESS -> SYMBOL FILE ERROR)");
					break;
			}

			if (extra != null)
				LogLine ("{0}", extra);

			if (!regression.Contains (file))
				regression.Add (file);
		}
Esempio n. 3
0
        private void RunTestForConsole(Test test) {
            lock (this) {
                if (!_quiet && _verbose) {
                    Console.Write("{0,-100}", test.Category.Name + " " + test.Name);
                }
            }

            TestResult result = null;
            try {
                result = RunTest(test);
            } catch (Exception e) {
                result = new TestResult(test, TestResultStatus.Failed, 0, new List<string> { e.Message });
            }

            lock (this) {
                if (!_quiet) {
                    if (_verbose) {
                        const string resultFormat = "{0,-10}";
                        var originalColor = Console.ForegroundColor;
                        switch (result.Status) {
                            case TestResultStatus.Skipped:
                                Console.ForegroundColor = ConsoleColor.Yellow;
                                Console.Write(resultFormat, "SKIPPED");
                                break;
                            case TestResultStatus.TimedOut:
                                Console.ForegroundColor = ConsoleColor.Red;
                                Console.Write(resultFormat, "TIMEOUT");
                                break;
                            case TestResultStatus.Passed:
                                Console.ForegroundColor = ConsoleColor.Green;
                                Console.Write(resultFormat, "PASSED");
                                break;
                            case TestResultStatus.Failed:
                                Console.ForegroundColor = ConsoleColor.Red;
                                Console.Write(resultFormat, "FAILED");
                                break;
                            case TestResultStatus.Disabled:
                                Console.ForegroundColor = ConsoleColor.Blue;
                                Console.Write(resultFormat, "DISABLED");
                                break;
                        }
                        Console.ForegroundColor = originalColor;
                        Console.WriteLine(result.EllapsedSeconds);
                    } else {
                        if (result.Status == TestResultStatus.Passed) {
                            Console.Write(".");
                        } else {
                            Console.Write(result.Status.ToString()[0]);
                        }
                    }
                }

                if (result.IsFailure) {
                    DisplayFailure(test, result);
                }

                _results.Add(result);
            }
        }