Jens Geyer | aa0c8b3 | 2019-01-28 23:27:45 +0100 | [diff] [blame] | 1 | // 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 | |
| 18 | using System; |
| 19 | using System.Collections.Generic; |
Jens Geyer | 56700e4 | 2020-02-22 16:51:51 +0100 | [diff] [blame] | 20 | using System.Linq; |
Jens Geyer | aa0c8b3 | 2019-01-28 23:27:45 +0100 | [diff] [blame] | 21 | using ThriftTest; |
| 22 | |
| 23 | namespace Client |
| 24 | { |
| 25 | public class Program |
| 26 | { |
| 27 | public static int Main(string[] args) |
| 28 | { |
Jens Geyer | 526a1ac | 2021-02-13 13:58:09 +0100 | [diff] [blame^] | 29 | if (OperatingSystem.IsWindows()) |
| 30 | { |
| 31 | try |
| 32 | { |
| 33 | Console.SetBufferSize(Console.BufferWidth, 4096); |
| 34 | } |
| 35 | catch (Exception) |
| 36 | { |
| 37 | Console.WriteLine("Failed to grow scroll-back buffer"); |
| 38 | } |
Jens Geyer | aa0c8b3 | 2019-01-28 23:27:45 +0100 | [diff] [blame] | 39 | } |
| 40 | |
Jens Geyer | b541c6f | 2019-11-23 18:50:22 +0100 | [diff] [blame] | 41 | // run whatever mode is choosen, default to test impl |
Jens Geyer | 56700e4 | 2020-02-22 16:51:51 +0100 | [diff] [blame] | 42 | var argslist = new List<string>(args); |
| 43 | switch (argslist.FirstOrDefault()) |
Jens Geyer | aa0c8b3 | 2019-01-28 23:27:45 +0100 | [diff] [blame] | 44 | { |
Jens Geyer | 56700e4 | 2020-02-22 16:51:51 +0100 | [diff] [blame] | 45 | case "client": // crosstest wants to pass this, so just emit a hint and ignore |
| 46 | Console.WriteLine("Hint: The 'client' argument is no longer required."); |
| 47 | argslist.RemoveAt(0); |
| 48 | return TestClient.Execute(argslist); |
Jens Geyer | ffb97e1 | 2019-12-06 23:43:08 +0100 | [diff] [blame] | 49 | case "--performance": |
Jens Geyer | ec43954 | 2019-11-01 19:19:44 +0100 | [diff] [blame] | 50 | case "--performance-test": |
Jens Geyer | 5a17b13 | 2019-05-26 15:53:37 +0200 | [diff] [blame] | 51 | return Tests.PerformanceTests.Execute(); |
Jens Geyer | aa0c8b3 | 2019-01-28 23:27:45 +0100 | [diff] [blame] | 52 | case "--help": |
| 53 | PrintHelp(); |
| 54 | return 0; |
| 55 | default: |
Jens Geyer | 56700e4 | 2020-02-22 16:51:51 +0100 | [diff] [blame] | 56 | return TestClient.Execute(argslist); |
Jens Geyer | aa0c8b3 | 2019-01-28 23:27:45 +0100 | [diff] [blame] | 57 | } |
| 58 | } |
| 59 | |
| 60 | private static void PrintHelp() |
| 61 | { |
| 62 | Console.WriteLine("Usage:"); |
Jens Geyer | ec43954 | 2019-11-01 19:19:44 +0100 | [diff] [blame] | 63 | Console.WriteLine(" Client [options]"); |
| 64 | Console.WriteLine(" Client --performance-test"); |
Jens Geyer | aa0c8b3 | 2019-01-28 23:27:45 +0100 | [diff] [blame] | 65 | Console.WriteLine(" Client --help"); |
| 66 | Console.WriteLine(""); |
| 67 | |
| 68 | TestClient.PrintOptionsHelp(); |
| 69 | } |
| 70 | } |
| 71 | } |
| 72 | |
| 73 | |