|
1 | 1 | //----------------------------------------------------------------------- |
2 | 2 | // <copyright file="AbstractTestingEngine.cs"> |
3 | 3 | // Copyright (c) Microsoft Corporation. All rights reserved. |
4 | | -// |
| 4 | +// |
5 | 5 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, |
6 | 6 | // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF |
7 | 7 | // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. |
|
19 | 19 | using System.Reflection; |
20 | 20 | using System.Threading; |
21 | 21 | using System.Threading.Tasks; |
| 22 | +using System.Configuration; |
22 | 23 |
|
23 | 24 | using Microsoft.PSharp.IO; |
24 | 25 | using Microsoft.PSharp.TestingServices.Scheduling; |
@@ -197,6 +198,31 @@ protected AbstractTestingEngine(Configuration configuration) |
197 | 198 | Error.ReportAndExit(ex.Message); |
198 | 199 | } |
199 | 200 |
|
| 201 | +#if NET46 || NET45 |
| 202 | + // Load config file and absorb its settings. |
| 203 | + try |
| 204 | + { |
| 205 | + var configFile = ConfigurationManager.OpenExeConfiguration(configuration.AssemblyToBeAnalyzed); |
| 206 | + |
| 207 | + var settings = configFile.AppSettings.Settings; |
| 208 | + foreach (var key in settings.AllKeys) |
| 209 | + { |
| 210 | + if (ConfigurationManager.AppSettings.Get(key) == null) |
| 211 | + { |
| 212 | + ConfigurationManager.AppSettings.Set(key, settings[key].Value); |
| 213 | + } |
| 214 | + else |
| 215 | + { |
| 216 | + ConfigurationManager.AppSettings.Add(key, settings[key].Value); |
| 217 | + } |
| 218 | + } |
| 219 | + } |
| 220 | + catch (ConfigurationErrorsException ex) |
| 221 | + { |
| 222 | + Error.Report(ex.Message); |
| 223 | + } |
| 224 | +#endif |
| 225 | + |
200 | 226 | if (configuration.TestingRuntimeAssembly != "") |
201 | 227 | { |
202 | 228 | try |
@@ -324,7 +350,7 @@ private void Initialize() |
324 | 350 | else if (this.Configuration.SchedulingStrategy == SchedulingStrategy.RDPOR) |
325 | 351 | { |
326 | 352 | this.Strategy = new DPORStrategy( |
327 | | - new ContractAsserter(), |
| 353 | + new ContractAsserter(), |
328 | 354 | this.RandomNumberGenerator, |
329 | 355 | -1, |
330 | 356 | this.Configuration.MaxFairSchedulingSteps); |
|
0 commit comments