blob: 8f1f36d77fdce21c8e754438501bcefda7738da5 [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;
Jens Geyer56700e42020-02-22 16:51:51 +010019using System.Linq;
Jens Geyeraa0c8b32019-01-28 23:27:45 +010020using System.Collections.Generic;
Mario Emmenlaueraeb89642021-05-05 10:50:02 +020021using System.Runtime.InteropServices;
Jens Geyeraa0c8b32019-01-28 23:27:45 +010022using ThriftTest;
23
24namespace Server
25{
26 public class Program
27 {
28 public static int Main(string[] args)
29 {
Mario Emmenlaueraeb89642021-05-05 10:50:02 +020030 if (RuntimeInformation.IsOSPlatform(OSPlatform.Windows))
Jens Geyeraa0c8b32019-01-28 23:27:45 +010031 {
Jens Geyer526a1ac2021-02-13 13:58:09 +010032 try
33 {
34 Console.SetBufferSize(Console.BufferWidth, 4096);
35 }
36 catch (Exception)
37 {
38 Console.WriteLine("Failed to grow scroll-back buffer");
39 }
Jens Geyeraa0c8b32019-01-28 23:27:45 +010040 }
41
Jens Geyerb541c6f2019-11-23 18:50:22 +010042 // run whatever mode is choosen, default to test impl
Jens Geyer56700e42020-02-22 16:51:51 +010043 var argslist = new List<string>(args);
44 switch (argslist.FirstOrDefault())
Jens Geyeraa0c8b32019-01-28 23:27:45 +010045 {
Jens Geyer56700e42020-02-22 16:51:51 +010046 case "server": // crosstest wants to pass this, so just emit a hint and ignore
47 Console.WriteLine("Hint: The 'server' argument is no longer required.");
48 argslist.RemoveAt(0);
49 return TestServer.Execute(argslist);
Jens Geyeraa0c8b32019-01-28 23:27:45 +010050 case "--help":
51 PrintHelp();
52 return 0;
53 default:
Jens Geyer56700e42020-02-22 16:51:51 +010054 return TestServer.Execute(argslist);
Jens Geyeraa0c8b32019-01-28 23:27:45 +010055 }
56 }
57
58 private static void PrintHelp()
59 {
60 Console.WriteLine("Usage:");
Jens Geyerec439542019-11-01 19:19:44 +010061 Console.WriteLine(" Server [options]");
Jens Geyeraa0c8b32019-01-28 23:27:45 +010062 Console.WriteLine(" Server --help");
63 Console.WriteLine("");
64
Jens Geyeradde44b2019-02-05 01:00:02 +010065 ServerParam.PrintOptionsHelp();
Jens Geyeraa0c8b32019-01-28 23:27:45 +010066 }
67 }
68}