MCPcopy Create free account
hub / github.com/apache/thrift / Execute

Method Execute

test/netstd/Client/TestClient.cs:396–444  ·  view source on GitHub ↗
(List<string> args)

Source from the content-addressed store, hash-verified

394 }
395
396 public static Task<int> Execute(List<string> args)
397 {
398 try
399 {
400 var param = new TestParams();
401
402 try
403 {
404 param.Parse(args);
405 }
406 catch (Exception ex)
407 {
408 Console.WriteLine("*** FAILED ***");
409 Console.WriteLine("Error while parsing arguments");
410 Console.WriteLine("{0} {1}\nStack:\n{2}", ex.GetType().Name, ex.Message, ex.StackTrace);
411 return Task.FromResult(ErrorUnknown);
412 }
413
414 //issue tests on separate threads simultaneously
415 var nThreads = Math.Max(param.numThreads, 1);
416 Console.Write("Starting {0} test thread(s) ", nThreads);
417 var tasks = new Task[nThreads];
418 var start = DateTime.Now;
419 var retcode = 0;
420 for (var i = 0; i < tasks.Length; ++i)
421 {
422 Console.Write('.');
423 tasks[i] = Task.Run(async () =>
424 {
425 var test = new ClientTest(param);
426 await test.Execute();
427 lock (tasks)
428 retcode |= test.ReturnCode;
429 });
430 }
431 Console.WriteLine(" OK");
432 Task.WaitAll(tasks);
433 Console.WriteLine("Total time: " + (DateTime.Now - start));
434 Console.WriteLine();
435 return Task.FromResult(retcode);
436 }
437 catch (Exception outerEx)
438 {
439 Console.WriteLine("*** FAILED ***");
440 Console.WriteLine("Unexpected error");
441 Console.WriteLine(outerEx.Message + "\n" + outerEx.StackTrace);
442 return Task.FromResult(ErrorUnknown);
443 }
444 }
445
446 public static string BytesToHex(byte[] data)
447 {

Callers 1

MainMethod · 0.45

Calls 3

WriteMethod · 0.65
ParseMethod · 0.45
RunMethod · 0.45

Tested by

no test coverage detected