blob: 09a9cf2bb35069a77be134204bfecd145ffd5bfb [file] [log] [blame]
Jens Geyeraa0c8b32019-01-28 23:27:45 +01001// Licensed to the Apache Software Foundation(ASF) under one
2// or more contributor license agreements.See the NOTICE file
3// distributed with this work for additional information
4// regarding copyright ownership.The ASF licenses this file
5// to you under the Apache License, Version 2.0 (the
6// "License"); you may not use this file except in compliance
7// with the License. You may obtain a copy of the License at
8//
9// http://www.apache.org/licenses/LICENSE-2.0
10//
11// Unless required by applicable law or agreed to in writing,
12// software distributed under the License is distributed on an
13// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
14// KIND, either express or implied. See the License for the
15// specific language governing permissions and limitations
16// under the License.
17
18using System;
19using System.Collections.Generic;
Jens Geyer56700e42020-02-22 16:51:51 +010020using System.Linq;
Mario Emmenlaueraeb89642021-05-05 10:50:02 +020021using System.Runtime.InteropServices;
Jens Geyer71569402021-11-13 23:51:16 +010022using System.Threading.Tasks;
Jens Geyeraa0c8b32019-01-28 23:27:45 +010023using ThriftTest;
24
25namespace Client
26{
27 public class Program
28 {
Jens Geyer71569402021-11-13 23:51:16 +010029 static async Task<int> Main(string[] args)
Jens Geyeraa0c8b32019-01-28 23:27:45 +010030 {
Mario Emmenlaueraeb89642021-05-05 10:50:02 +020031 if (RuntimeInformation.IsOSPlatform(OSPlatform.Windows))
32 {
Jens Geyer526a1ac2021-02-13 13:58:09 +010033 try
34 {
35 Console.SetBufferSize(Console.BufferWidth, 4096);
36 }
37 catch (Exception)
38 {
39 Console.WriteLine("Failed to grow scroll-back buffer");
40 }
Jens Geyeraa0c8b32019-01-28 23:27:45 +010041 }
42
Jens Geyerb541c6f2019-11-23 18:50:22 +010043 // run whatever mode is choosen, default to test impl
Jens Geyer56700e42020-02-22 16:51:51 +010044 var argslist = new List<string>(args);
45 switch (argslist.FirstOrDefault())
Jens Geyeraa0c8b32019-01-28 23:27:45 +010046 {
Jens Geyer56700e42020-02-22 16:51:51 +010047 case "client": // crosstest wants to pass this, so just emit a hint and ignore
48 Console.WriteLine("Hint: The 'client' argument is no longer required.");
49 argslist.RemoveAt(0);
Jens Geyer71569402021-11-13 23:51:16 +010050 return await TestClient.Execute(argslist);
Jens Geyerffb97e12019-12-06 23:43:08 +010051 case "--performance":
Jens Geyerec439542019-11-01 19:19:44 +010052 case "--performance-test":
Jens Geyer71569402021-11-13 23:51:16 +010053 return await Tests.PerformanceTests.Execute();
Jens Geyeraa0c8b32019-01-28 23:27:45 +010054 case "--help":
55 PrintHelp();
56 return 0;
57 default:
Jens Geyer71569402021-11-13 23:51:16 +010058 return await TestClient.Execute(argslist);
Jens Geyeraa0c8b32019-01-28 23:27:45 +010059 }
60 }
61
62 private static void PrintHelp()
63 {
64 Console.WriteLine("Usage:");
Jens Geyerec439542019-11-01 19:19:44 +010065 Console.WriteLine(" Client [options]");
66 Console.WriteLine(" Client --performance-test");
Jens Geyeraa0c8b32019-01-28 23:27:45 +010067 Console.WriteLine(" Client --help");
68 Console.WriteLine("");
69
70 TestClient.PrintOptionsHelp();
71 }
72 }
73}