示例#1
0
		/// <exception cref="System.Exception"></exception>
		public static void Main(JsDriver.Arguments arguments)
		{
			JsDriver driver = new JsDriver();
			driver.Run(arguments);
		}
示例#2
0
		/// <exception cref="System.Exception"></exception>
		internal virtual void Run(JsDriver.Arguments arguments)
		{
			if (arguments.Help())
			{
				System.Console.Out.WriteLine("See mozilla/js/tests/README-jsDriver.html; note that some options are not supported.");
				System.Console.Out.WriteLine("Consult the Java source code at testsrc/org/mozilla/javascript/JsDriver.java for details.");
				System.Environment.Exit(0);
			}
			ShellContextFactory factory = new ShellContextFactory();
			factory.SetOptimizationLevel(arguments.GetOptimizationLevel());
			factory.SetStrictMode(arguments.IsStrict());
			FilePath path = arguments.GetTestsPath();
			if (path == null)
			{
				path = new FilePath("../tests");
			}
			if (!path.Exists())
			{
				throw new Exception("JavaScript tests not found at " + path.GetCanonicalPath());
			}
			JsDriver.Tests tests = new JsDriver.Tests(path, arguments.GetTestList(), arguments.GetSkipList());
			JsDriver.Tests.Script[] all = tests.GetFiles();
			arguments.GetConsole().Println("Running " + all.Length + " tests.");
			JsDriver.Results results = new JsDriver.Results(factory, arguments, arguments.Trace());
			results.Start();
			for (int i = 0; i < all.Length; i++)
			{
				results.Run(all[i], new JsDriver.ShellTestParameters(arguments.GetTimeout()));
			}
			results.Finish();
		}
示例#3
0
			internal Results(ShellContextFactory factory, JsDriver.Arguments arguments, bool trace)
			{
				this.factory = factory;
				this.arguments = arguments;
				FilePath output = arguments.GetOutputFile();
				if (output == null)
				{
					output = new FilePath("rhino-test-results." + new SimpleDateFormat("yyyy.MM.dd.HH.mm.ss").Format(new DateTime()) + ".html");
				}
				this.output = output;
				this.trace = trace;
			}
示例#4
0
			internal virtual void Run(JsDriver.Tests.Script script, ShellTest.Parameters parameters)
			{
				string path = script.GetPath();
				FilePath test = script.GetFile();
				JsDriver.ConsoleStatus cStatus = new JsDriver.ConsoleStatus(arguments.GetConsole(), trace);
				JsDriver.HtmlStatus hStatus = new JsDriver.HtmlStatus(arguments.GetLxrUrl(), arguments.GetBugUrl(), path, html, (XmlElement)failureHtml.CloneNode(true));
				JsDriver.XmlStatus xStatus = new JsDriver.XmlStatus(path, this.xml.DocumentElement);
				ShellTest.Status status = ShellTest.Status.Compose(new ShellTest.Status[] { cStatus, hStatus, xStatus });
				try
				{
					ShellTest.Run(factory, test, parameters, status);
				}
				catch (Exception e)
				{
					throw new Exception(e);
				}
				tests++;
				if (hStatus.Failed())
				{
					failures++;
				}
				hStatus.Finish();
			}
示例#5
0
			internal ConsoleStatus(JsDriver.Arguments.Console console, bool trace)
			{
				this.console = console;
				this.trace = trace;
			}