/// <summary> /// Executes the discovery command as specified in the configuration for the requested test source. /// </summary> /// <param name="source">The test source module</param> /// <returns>The test framework describing all tests contained within the test source or null if one cannot be provided.</returns> private TestFramework ExecuteExternalDiscoveryCommand(string source) { // Use a temporary file to host the result of the external discovery process string path = Path.Combine(Path.GetDirectoryName(source), Path.GetFileName(source) + ListFileSuffix); // Perform cleanup to avoid inconsistent listing if (File.Exists(path)) { File.Delete(path); } CommandEvaluator evaluator = new CommandEvaluator(); evaluator.SetVariable("source", "\"" + source + "\""); evaluator.SetVariable("out", "\"" + path + "\""); // Evaluate the discovery command CommandLine commandLine = new CommandLine { FileName = evaluator.Evaluate(Settings.DiscoveryCommandLine.FileName).Result, Arguments = evaluator.Evaluate(Settings.DiscoveryCommandLine.Arguments).Result }; // Execute the discovery command via an external process if (ExecuteCommand(commandLine)) { // Parse the generate TestFramework from the temporary file return(ParseTestFramework(path)); } return(null); }
/// <summary> /// Provides a preset CommandEvaluator instance for evaluating strings containing the source, timeout and boost-args placeholders. /// </summary> /// <param name="source">The source placeholder value</param> /// <param name="args">The boost arguments placeholder value</param> /// <param name="settings">The test runner settings which contains the timeout placeholder value</param> /// <returns>A CommandEvaluator instance for evaluating strings containing the source, timeout and boost-args placeholders.</returns> private static CommandEvaluator BuildEvaluator(string source, BoostTestRunnerCommandLineArgs args, BoostTestRunnerSettings settings) { CommandEvaluator evaluator = BuildEvaluator(source); evaluator.SetVariable(TimeoutPlaceholder, Math.Max(0, settings.Timeout).ToString(CultureInfo.InvariantCulture)); evaluator.SetVariable(BoostArgsPlaceholder, args.ToString()); return(evaluator); }
/// <summary> /// Provides a preset CommandEvaluator instance for evaluating strings containing the source placeholder. /// </summary> /// <param name="source">The source placeholder value</param> /// <returns>A CommandEvaluator instance for evaluating strings containing the source placeholder.</returns> private static CommandEvaluator BuildEvaluator(string source) { CommandEvaluator evaluator = new CommandEvaluator(); evaluator.SetVariable(SourcePlaceholder, "\"" + source + "\""); return(evaluator); }