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; |
Jens Geyer | 56700e4 | 2020-02-22 16:51:51 +0100 | [diff] [blame] | 19 | using System.Linq; |
Jens Geyer | aa0c8b3 | 2019-01-28 23:27:45 +0100 | [diff] [blame] | 20 | using System.Collections.Generic; |
Mario Emmenlauer | aeb8964 | 2021-05-05 10:50:02 +0200 | [diff] [blame] | 21 | using System.Runtime.InteropServices; |
Jens Geyer | aa0c8b3 | 2019-01-28 23:27:45 +0100 | [diff] [blame] | 22 | using ThriftTest; |
Jens Geyer | 7156940 | 2021-11-13 23:51:16 +0100 | [diff] [blame] | 23 | using System.Threading.Tasks; |
Jens Geyer | aa0c8b3 | 2019-01-28 23:27:45 +0100 | [diff] [blame] | 24 | |
| 25 | namespace Server |
| 26 | { |
| 27 | public class Program |
| 28 | { |
Jens Geyer | 7156940 | 2021-11-13 23:51:16 +0100 | [diff] [blame] | 29 | static async Task<int> Main(string[] args) |
Jens Geyer | aa0c8b3 | 2019-01-28 23:27:45 +0100 | [diff] [blame] | 30 | { |
Mario Emmenlauer | aeb8964 | 2021-05-05 10:50:02 +0200 | [diff] [blame] | 31 | if (RuntimeInformation.IsOSPlatform(OSPlatform.Windows)) |
Jens Geyer | aa0c8b3 | 2019-01-28 23:27:45 +0100 | [diff] [blame] | 32 | { |
Jens Geyer | 526a1ac | 2021-02-13 13:58:09 +0100 | [diff] [blame] | 33 | try |
| 34 | { |
| 35 | Console.SetBufferSize(Console.BufferWidth, 4096); |
| 36 | } |
| 37 | catch (Exception) |
| 38 | { |
| 39 | Console.WriteLine("Failed to grow scroll-back buffer"); |
| 40 | } |
Jens Geyer | aa0c8b3 | 2019-01-28 23:27:45 +0100 | [diff] [blame] | 41 | } |
| 42 | |
Jens Geyer | b541c6f | 2019-11-23 18:50:22 +0100 | [diff] [blame] | 43 | // run whatever mode is choosen, default to test impl |
Jens Geyer | 56700e4 | 2020-02-22 16:51:51 +0100 | [diff] [blame] | 44 | var argslist = new List<string>(args); |
| 45 | switch (argslist.FirstOrDefault()) |
Jens Geyer | aa0c8b3 | 2019-01-28 23:27:45 +0100 | [diff] [blame] | 46 | { |
Jens Geyer | 56700e4 | 2020-02-22 16:51:51 +0100 | [diff] [blame] | 47 | case "server": // crosstest wants to pass this, so just emit a hint and ignore |
| 48 | Console.WriteLine("Hint: The 'server' argument is no longer required."); |
| 49 | argslist.RemoveAt(0); |
Jens Geyer | 7156940 | 2021-11-13 23:51:16 +0100 | [diff] [blame] | 50 | return await TestServer.Execute(argslist); |
Jens Geyer | aa0c8b3 | 2019-01-28 23:27:45 +0100 | [diff] [blame] | 51 | case "--help": |
| 52 | PrintHelp(); |
| 53 | return 0; |
| 54 | default: |
Jens Geyer | 7156940 | 2021-11-13 23:51:16 +0100 | [diff] [blame] | 55 | return await TestServer.Execute(argslist); |
Jens Geyer | aa0c8b3 | 2019-01-28 23:27:45 +0100 | [diff] [blame] | 56 | } |
| 57 | } |
| 58 | |
| 59 | private static void PrintHelp() |
| 60 | { |
| 61 | Console.WriteLine("Usage:"); |
Jens Geyer | ec43954 | 2019-11-01 19:19:44 +0100 | [diff] [blame] | 62 | Console.WriteLine(" Server [options]"); |
Jens Geyer | aa0c8b3 | 2019-01-28 23:27:45 +0100 | [diff] [blame] | 63 | Console.WriteLine(" Server --help"); |
| 64 | Console.WriteLine(""); |
| 65 | |
Jens Geyer | adde44b | 2019-02-05 01:00:02 +0100 | [diff] [blame] | 66 | ServerParam.PrintOptionsHelp(); |
Jens Geyer | aa0c8b3 | 2019-01-28 23:27:45 +0100 | [diff] [blame] | 67 | } |
| 68 | } |
| 69 | } |