當前位置: 首頁>>代碼示例>>C#>>正文


C# Options.GetFullExecutablePath方法代碼示例

本文整理匯總了C#中Tests.Options.GetFullExecutablePath方法的典型用法代碼示例。如果您正苦於以下問題:C# Options.GetFullExecutablePath方法的具體用法?C# Options.GetFullExecutablePath怎麽用?C# Options.GetFullExecutablePath使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在Tests.Options的用法示例。


在下文中一共展示了Options.GetFullExecutablePath方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C#代碼示例。

示例1: Rewrite

    internal static object Rewrite(string absoluteSourceDir, string absoluteBinary, Options options, bool alwaysCapture = false)
    {
      string referencedir;
      if (Path.IsPathRooted(options.ReferencesFramework))
      {
        referencedir = options.ReferencesFramework;
      }
      else
      {
        referencedir = options.MakeAbsolute(Path.Combine(ReferenceDirRoot, options.ReferencesFramework));
      }
      var contractreferencedir = options.MakeAbsolute(Path.Combine(ContractReferenceDirRoot, options.ContractFramework));
      var absoluteSourcedir = Path.GetDirectoryName(absoluteBinary);
      var absoluteSource = absoluteBinary;
      var libPathsString = FormLibPaths(absoluteSourceDir, contractreferencedir, options);

      var targetName = options.TestName + ".rw" + Path.GetExtension(absoluteBinary);
      var binDir = options.UseBinDir ? Path.Combine(Path.Combine(absoluteSourcedir, "bin"), options.BuildFramework) : absoluteSourcedir;
      var targetfile = Path.Combine(binDir, targetName);
      Console.WriteLine("Rewriting '{0}' to '{1}'", absoluteBinary, targetfile);
      if (!Directory.Exists(binDir))
      {
        Directory.CreateDirectory(binDir);
      }
      var optionString = String.Format("/out:{0} -nobox -libpaths:{3} {4} {1} {2}", targetfile, options.FoxtrotOptions, absoluteSource, referencedir, libPathsString);
      if (absoluteBinary.EndsWith("mscorlib.dll"))
        optionString = String.Format("/platform:{0} {1}", absoluteBinary, optionString);
      var capture = RunProcessAndCapture(binDir, options.GetFullExecutablePath(FoxtrotExe), optionString, options.TestName);
      if (capture.ExitCode != 0)
      {
        if (options.MustSucceed)
        {
          Assert.AreEqual(0, capture.ExitCode, "{0} returned an errorcode of {1}.", FoxtrotExe, capture.ExitCode);
        }
        return capture;
      }
      else
      {
        if (alwaysCapture) return capture;

        if (options.UseBinDir)
        {
          var fileName = Path.Combine(absoluteSourcedir, targetName);
          if (File.Exists(fileName))
          {
            try
            {
              File.SetAttributes(fileName, FileAttributes.Normal);
            }
            catch { }
          }
          File.Copy(targetfile, fileName, true);
          return fileName;
        }
      }
      return targetfile;
    }
開發者ID:gitter-badger,項目名稱:CodeContracts,代碼行數:57,代碼來源:TestDriver.cs

示例2: Clousot1Slicing

 internal static void Clousot1Slicing(string absoluteSourceDir, string absoluteBinary, Options options, Output output)
 {
     var referencedir = options.MakeAbsolute(Path.Combine(ReferenceDirRoot, options.BuildFramework));
     var contractreferencedir = options.MakeAbsolute(Path.Combine(ContractReferenceDirRoot, options.ContractFramework));
     var absoluteBinaryDir = Path.GetDirectoryName(absoluteBinary);
     var absoluteSource = absoluteBinary;
     var libPathsString = FormLibPaths(contractreferencedir, options) + " /libpaths:.";
     var args = String.Format("{0} -cci1 /regression /define:cci1only;clousot1 -framework:{4} -libpaths:{2} {3} {1}", options.ClousotOptions, absoluteSource, referencedir, libPathsString, options.Framework);
     if (options.Fast || System.Diagnostics.Debugger.IsAttached)
     {
         output.WriteLine("Calling NewCCI2Driver.Main with: {0}", args);
         // Use output to avoid Clousot from closing the Console
         Assert.AreEqual(0, Microsoft.Research.CodeAnalysis.NewCCI2Driver.Main(args.Split(' '), output));
     }
     else
         RunProcess(absoluteBinaryDir, options.GetFullExecutablePath(Clousot2SlicingExe), args, output);
 }
開發者ID:GitTorre,項目名稱:CodeContracts,代碼行數:17,代碼來源:TestDriver.cs

示例3: Clousot

        internal static void Clousot(string absoluteSourceDir, string absoluteBinary, Options options, string testName, int testindex, Output output)
        {
            var referencedir = options.MakeAbsolute(Path.Combine(ReferenceDirRoot, options.BuildFramework));
            var contractreferencedir = options.MakeAbsolute(Path.Combine(ContractReferenceDirRoot, options.ContractFramework));
            var absoluteBinaryDir = Path.GetDirectoryName(absoluteBinary);
            var absoluteSource = absoluteBinary;
            var libPathsString = FormLibPaths(contractreferencedir, options);
            var args = string.Format("{0} /regression /define:cci1only;clousot1 -framework:{4} -libpaths:{2} {3} {1}", options.ClousotOptions, absoluteSource, referencedir, libPathsString, options.Framework);

            WriteRSPFile(absoluteBinaryDir, testName, args);
            
            if (options.Fast || Debugger.IsAttached)
            {
                output.WriteLine("Calling CCI1Driver.Main with: {0}", args);
                // Use output to avoid Clousot from closing the Console
                Assert.Equal(0, Microsoft.Research.CodeAnalysis.CCI1Driver.Main(args.Split(' '), output));
            }
            else
            {
                RunProcess(absoluteBinaryDir, options.GetFullExecutablePath(ClousotExe), args, output, testName);
            }
        }
開發者ID:asvishnyakov,項目名稱:CodeContracts,代碼行數:22,代碼來源:TestDriver.cs


注:本文中的Tests.Options.GetFullExecutablePath方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。