/// <summary> /// Provides a ProcessExecutionContextArgs structure containing the necessary information to launch the test process. /// Aggregates the BoostTestRunnerCommandLineArgs structure with the command-line arguments specified at configuration stage. /// </summary> /// <param name="args">The Boost Test Framework command line arguments</param> /// <param name="settings">The Boost Test Runner settings</param> /// <returns>A valid ProcessExecutionContextArgs structure to launch the test executable</returns> protected override ProcessExecutionContextArgs GetExecutionContextArgs(BoostTestRunnerCommandLineArgs args, BoostTestRunnerSettings settings) { Code.Require(args, "args"); ProcessExecutionContextArgs info = base.GetExecutionContextArgs(args, settings); BoostTestRunnerCommandLineArgs tmpArgs = args.Clone(); tmpArgs.StandardErrorFile = null; tmpArgs.StandardOutFile = null; CommandEvaluator evaluator = BuildEvaluator(this.Source, tmpArgs, settings); CommandEvaluationResult result = evaluator.Evaluate(this.Settings.ExecutionCommandLine.Arguments); string cmdLineArgs = result.Result; if (!result.MappedVariables.Contains(BoostArgsPlaceholder)) { cmdLineArgs = result.Result + (result.Result.EndsWith(" ", StringComparison.Ordinal) ? string.Empty : " ") + args.ToString(); } BoostTestRunnerCommandLineArgs redirection = new BoostTestRunnerCommandLineArgs { StandardOutFile = args.StandardOutFile, StandardErrorFile = args.StandardErrorFile }; cmdLineArgs += redirection.ToString(); info.FilePath = evaluator.Evaluate(this.Settings.ExecutionCommandLine.FileName).Result; info.Arguments = cmdLineArgs; return(info); }
/// <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 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); }
void Init() { cmdEval = new CommandEvaluator(); titleContent = new GUIContent("Unishell"); cmdEval.ClearEval(); cmdEval.InitEval(); cmdEval.LoadScripts(); }
/// <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); }
void Init() { cfg = FindConfig(); cmdEval = new CommandEvaluator(cfg); titleContent = new GUIContent("Unishell Console"); cmdEval.ClearEval(); cmdEval.InitEval(); cmdEval.LoadScripts(); }
void Init() { cfg = FindConfig(); cmdEval = new CommandEvaluator(cfg); title = "Shell"; cmdEval.ClearEval(); cmdEval.InitEval(); cmdEval.LoadScripts(); }
/// <summary> /// Provides a ProcessStartInfo structure containing the necessary information to launch the test process. /// Aggregates the BoostTestRunnerCommandLineArgs structure with the command-line arguments specified at configuration stage. /// </summary> /// <param name="args">The Boost Test Framework command line arguments</param> /// <param name="settings">The Boost Test Runner settings</param> /// <returns>A valid ProcessStartInfo structure to launch the test executable</returns> protected override ProcessStartInfo GetStartInfo(BoostTestRunnerCommandLineArgs args, BoostTestRunnerSettings settings) { ProcessStartInfo info = base.GetStartInfo(args, settings); CommandEvaluator evaluator = BuildEvaluator(this.Source, args, settings); CommandEvaluationResult result = evaluator.Evaluate(this.Settings.ExecutionCommandLine.Arguments); string cmdLineArgs = result.Result; if (!result.MappedVariables.Contains(BoostArgsPlaceholder)) { cmdLineArgs = result.Result + (result.Result.EndsWith(" ", StringComparison.Ordinal) ? string.Empty : " ") + args.ToString(); } info.FileName = this.Settings.ExecutionCommandLine.FileName; info.Arguments = cmdLineArgs; return(info); }
public BuiltinCommands(CommandEvaluator parent) { cmdEval = parent; }
public void SetUp() { CommandEvaluator = new CommandEvaluator(); }