in utils/WasmTestRunner/Program.cs [48:117]
public static int Main(string[] args)
{
var p = new OptionSet
{
{ "d|driver=", "the path to the ChromeDriver executable. Default is use the local version.", v => ChromeDriverPath = v },
{ "o|output=", "the path to the test results file. Default is the current directory.", v => OutputPath = v },
{ "t|timeout=", "the number of seconds to wait before timing out. Default is 30.", (int v) => Timeout = v },
{ "no-headless", "do not use a headless browser.", v => UseHeadless = false },
{ "v|verbose", "show verbose error messages.", v => Verbose= true },
{ "h|help", "show this message and exit.", v => ShowHelp = true },
};
List<string> extra;
try
{
extra = p.Parse(args);
if (extra.Count > 1)
throw new OptionException("To many extras provided.", "extras");
Url = extra.FirstOrDefault() ?? DefaultUrl;
if (string.IsNullOrEmpty(OutputPath))
OutputPath = Directory.GetCurrentDirectory();
OutputPath = Path.Combine(OutputPath, ResultsFileName);
var dir = Path.GetDirectoryName(OutputPath);
if (!string.IsNullOrEmpty(dir))
Directory.CreateDirectory(dir);
}
catch (OptionException ex)
{
Console.Error.Write("wasm-test: ");
Console.Error.WriteLine(ex.Message);
Console.Error.WriteLine("Try `wasm-test --help' for more information.");
if (Verbose)
Console.Error.WriteLine(ex);
return 1;
}
if (ShowHelp)
{
Console.WriteLine("Usage: wasm-test [OPTIONS]+ URL");
Console.WriteLine("Run WASM tests in the browser.");
Console.WriteLine();
Console.WriteLine("Options:");
p.WriteOptionDescriptions(Console.Out);
return 0;
}
try
{
RunTests();
var xdoc = XDocument.Load(OutputPath);
var failed = xdoc.Root.Element("assembly").Attribute("failed").Value;
if (failed != "0")
throw new Exception($"There were test failures: {failed}");
}
catch (Exception ex)
{
Console.Error.WriteLine($"There was an error running the tests: {ex.Message}");
if (Verbose)
Console.Error.WriteLine(ex);
return 1;
}
return 0;
}