From 85d1ebe26a40bd172ddb4b29d8864159b6e7ca2f Mon Sep 17 00:00:00 2001 From: wforums Date: Sun, 5 Jul 2015 04:17:08 +0200 Subject: [PATCH] Added option to customise the time out - --- CCExtractorTester/Analyzers/Tester.cs | 8 +++++++- CCExtractorTester/Program.cs | 5 +++++ 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/CCExtractorTester/Analyzers/Tester.cs b/CCExtractorTester/Analyzers/Tester.cs index 9909dfc..615e1e4 100644 --- a/CCExtractorTester/Analyzers/Tester.cs +++ b/CCExtractorTester/Analyzers/Tester.cs @@ -437,7 +437,13 @@ public void Process(object state){ string command = te.Command + String.Format(@" --no_progress_bar -o ""{0}"" ""{1}"" ",producedFile,sampleFile); - RunData rd = runner.Run (command,processError,processOutput); + int timeout = 180; + try { + timeout = int.Parse (config.GetAppSetting ("timeout")); + } catch(FormatException){ + } + + RunData rd = runner.Run (command,processError,processOutput,timeout); try { comparer.CompareAndAddToResult ( diff --git a/CCExtractorTester/Program.cs b/CCExtractorTester/Program.cs index dce62c8..b6b7fc0 100644 --- a/CCExtractorTester/Program.cs +++ b/CCExtractorTester/Program.cs @@ -37,6 +37,8 @@ class Options { public string ResultFolder { get; set; } [Option('h',"comparer",HelpText="The type of comparer to use (overrides the config file)")] public string Comparer { get; set; } + [Option('o',"timeout",DefaultValue=180,HelpText="The timeout value (in seconds). A test will be aborted if CCExtractor is still running after this point. Must be bigger than 60.")] + public int TimeOut { get; set; } [ParserState] public IParserState LastParserState { get; set; } @@ -113,6 +115,9 @@ public static void Main (string[] args) return; } } + if (options.TimeOut > 60) { + config.SetAppSetting ("timeout", options.TimeOut.ToString()); + } if (!String.IsNullOrEmpty (options.Comparer)) { config.SetAppSetting ("Comparer", options.Comparer); Logger.Info ("Overriding Comparer with: " + options.Comparer);