public static ShellUtilities.ProcessOutput InstrumentAssembly(string options, string path) { string[] commandLine = BuildCommandLine(options, path); return(System.Diagnostics.Debugger.IsAttached ? ShellUtilities.shellm(InstrumentationUtilityPath, commandLine) : ShellUtilities.shell(InstrumentationUtilityPath, commandLine)); }
protected override void CheckInstrumentationOutput(ShellUtilities.ProcessOutput output) { base.CheckInstrumentationOutput(output); Assert.AreEqual( "WARNING: Predicate 'System.Boolean ByUpperNameUnoptimizable::Match(Item)' could not be optimized. Unsupported expression: candidate.get_Name().ToUpper", output.StdErr.Trim()); Assert.AreEqual("", output.StdOut); }
public static string EmitAssemblyFromResource(string resourceName, Action <string> sourceHandler, Assembly[] references) { string assemblyFileName = Path.Combine(ShellUtilities.GetTempPath(), resourceName + (Debug.Value ? ".Debug.dll" : ".dll")); string sourceFileName = Path.Combine(ShellUtilities.GetTempPath(), resourceName); File.WriteAllText(sourceFileName, ResourceServices.GetResourceAsString(resourceName)); DeleteAssemblyAndPdb(assemblyFileName); EmitAssembly(assemblyFileName, references, sourceFileName); sourceHandler(sourceFileName); return(assemblyFileName); }
void VerifyAssembly() { ShellUtilities.ProcessOutput output = ShellUtilities.shell("peverify.exe", "/nologo", _assemblyPath); string stdout = output.ToString(); if (output.ExitCode != 0) { Console.WriteLine("Db4oTool.Tests.Core.VerifyAssemblyTest _assemblyPath: " + _assemblyPath); Console.WriteLine("Db4oTool.Tests.Core.VerifyAssemblyTest stdout: " + stdout); Console.WriteLine("Db4oTool.Tests.Core.VerifyAssemblyTest output.ExitCode: " + output.ExitCode); } if (stdout.Contains("1.1.4322.573")) { return; // ignore older peverify version errors } if (output.ExitCode == 0 && !stdout.ToUpper().Contains("WARNING")) { return; } Assert.Fail(stdout); }
public static string CopyToTemp(string fname) { return(ShellUtilities.CopyFileToFolder(fname, GetTempPath())); }
protected virtual void CheckInstrumentationOutput(ShellUtilities.ProcessOutput output) { if (output.ExitCode == 0) return; Assert.Fail(output.ToString()); }
private static void DeleteAssemblyAndPdb(string path) { ShellUtilities.DeleteFile(Path.ChangeExtension(path, ".pdb")); ShellUtilities.DeleteFile(path); }