Exemplo n.º 1
0
 public Dx12Build()
 {
     ModuleRoot = "\\Dx12\\";
     AddLibSearch(ref LibrarySearchPaths, "", LibBuildConfig.General, false);
     AddLibSearch(ref LibrarySearchPaths, "", LibBuildConfig.General, true);
     DLLs.Add("dxil.dll");
 }
Exemplo n.º 2
0
        private void PopulateDLLs()
        {
            // get executing assembly
            Assembly thisAssembly     = Assembly.GetExecutingAssembly();
            string   thisAssemblyName = thisAssembly.ManifestModule.Name;

            if (_lastLocation == null)
            {
                _lastLocation = Path.GetDirectoryName(thisAssembly.Location);
            }

            string path = SelectFolder("Test dlls location", _lastLocation, LinkedWindow);

            if (String.IsNullOrEmpty(path))
            {
                return;
            }

            _lastLocation = path;

            // Don't inspect some dlls when looking for assemblies to test
            string[] ignoreDlls = new string[]
            {
                thisAssemblyName,
                "nunit.core.dll",
                "nunit.core.interfaces.dll",
                "nunit.framework.dll",
                "nunit.util.dll",
                "RevitAPI_x64_2013.dll",
                "RevitAPIUI_x64_2013.dll",
                "TechTalk.SpecFlow.dll",
                "Moq.dll",
                "GalaSoft.MvvmLight.dll",
                "Castle.DynamicProxy2.dll",
                "Castle.Core.dll",
                "Castle.Windsor.dll",
                "IronPython.dll",
                "IronPython.Modules.dll",
                "IronPython.SQLite.dll",
                "IronPython.Wpf.dll",
                "Microsoft.Dynamic.dll",
                "Microsoft.Scripting.dll",
                "Microsoft.Scripting.Metadata.dll",
                "System.Windows.Interactivity.dll"
            };
            // Get a list of DLL's that potentially contain tests
            foreach (string dll in System.IO.Directory.GetFiles(path, "*" + ".dll"))
            {
                if (!ignoreDlls.Contains(Path.GetFileName(dll)))
                {
                    TestableDll testableDll = new TestableDll(dll);
                    testableDll.Tests = GetTestsFromDll(dll);
                    DLLs.Add(testableDll);
                }
            }
        }
Exemplo n.º 3
0
 public PixBuild()
 {
     ModuleRoot = "\\Pix\\";
     AddLibSearch(ref LibrarySearchPaths, "", LibBuildConfig.General, false);
     AddLibSearch(ref LibrarySearchPaths, "", LibBuildConfig.General, true);
     DLLs.Add("WinPixEventRuntime.dll");
     LibDirs.Add("../source/ThirdParty/Pix/");
     StaticLibraries.Add(new LibDependency("WinPixEventRuntime.lib", "win64"));
     UnsupportedPlatforms.Add("X*");
     IncludeDir = "\\Pix\\Include\\WinPixEventRuntime\\";
 }
Exemplo n.º 4
0
 public assimpBuild()
 {
     ModuleRoot = "\\assimp\\";
     AddLibSearch(ref LibrarySearchPaths, "", LibBuildConfig.General, false);
     AddLibSearch(ref LibrarySearchPaths, "", LibBuildConfig.General, true);
     StaticLibraries.Add(new LibDependency("assimp.lib", "win64"));
     DLLs.Add("assimp-vc140-mt.dll");
     UnsupportedPlatforms.Add("X*");
     Defines.Add("BUILD_ASSIMP");
     LibDirs.Add("../source/ThirdParty/assimp/");
 }
Exemplo n.º 5
0
 public OpenVRBuild()
 {
     ModuleRoot = "\\OpenVR\\";
     AddLibSearch(ref LibrarySearchPaths, "", LibBuildConfig.General, false);
     AddLibSearch(ref LibrarySearchPaths, "", LibBuildConfig.General, true);
     DLLs.Add("openvr_api.dll");
     UnsupportedPlatforms.Add("X*");
     Defines.Add("SUPPORT_OPENVR");
     StaticLibraries.Add(new LibDependency("openvr_api.lib", "win64"));
     LibDirs.Add("../source/ThirdParty/OpenVR/");
 }
Exemplo n.º 6
0
 private static void RecurseDirectories(string path)
 {
     if (Directory.Exists(path))
     {
         var dir = new DirectoryInfo(path);
         DLLs.AddRange(dir.GetFiles(App.IsDocker ? "*.so" : "*.dll").Select(a => a.FullName).ToArray());
         foreach (var sub in dir.GetDirectories())
         {
             RecurseDirectories(sub.FullName);
         }
     }
 }
Exemplo n.º 7
0
        private void OnRunAllTests()
        {
            LinkedWindow.Close();

            List <string> copiedAssemblies = new List <string>();

            foreach (TestableDll dll in DLLs)
            {
                // Shadow copy to temp folder
                string tempFile = Path.GetTempFileName();
                tempFile = tempFile.Replace(Path.GetExtension(tempFile), Path.GetExtension(dll.FullPath));
                File.Copy(dll.FullPath, tempFile, true);

                //Copy the PDB to get stack trace
                string destPdbFile = tempFile.Replace(Path.GetExtension(tempFile), ".pdb");
                string srcPdb      = dll.FullPath.Replace(Path.GetExtension(dll.FullPath), ".pdb");
                File.Copy(srcPdb, destPdbFile, true);

                copiedAssemblies.Add(tempFile);
            }

            // Copy Moq.dll and dependencies to temp folder
            CopyRequiredLibsToTemp(DLLs.First().FullPath);

            TestResult testResult = RunTestsInAssemblies(copiedAssemblies, TestFilter.Empty);

            // Save the result to xml file:
            string          resultFile   = Path.GetDirectoryName(DLLs.First().FullPath) + @"\TestResult.xml";
            XmlResultWriter resultWriter = new XmlResultWriter(resultFile);

            resultWriter.SaveTestResult(testResult);

            // show results dialog
            string extraMsg = "Result file can be found at " + resultFile;
            TestResultViewerViewModel vm     = new TestResultViewerViewModel(testResult, extraMsg);
            TestResultViewer          viewer = new TestResultViewer(vm);

            //viewer.Owner = LinkedWindow;
            GeneralHelper.SetRevitAsWindowOwner(viewer);
            viewer.ShowDialog();

            // cleanup
            foreach (string dll in copiedAssemblies)
            {
                File.Delete(dll);
                File.Delete(Path.ChangeExtension(dll, ".pdb"));
            }
        }
Exemplo n.º 8
0
        private void OnRunTest(string testDll)
        {
            string originalDllName = testDll;

            LinkedWindow.Close();
            // Shadow copy to temp folder
            string tempFile = Path.GetTempFileName();

            tempFile = tempFile.Replace(Path.GetExtension(tempFile), Path.GetExtension(testDll));
            File.Copy(testDll, tempFile, true);

            //Copy the PDB to get stack trace
            string destPdbFile = tempFile.Replace(Path.GetExtension(tempFile), ".pdb");
            string srcPdb      = testDll.Replace(Path.GetExtension(testDll), ".pdb");

            File.Copy(srcPdb, destPdbFile, true);

            testDll = tempFile;

            // Copy Moq.dll and dependencies to temp folder
            CopyRequiredLibsToTemp(tempFile);

            SimpleTestFilter filter     = new SimpleTestFilter(DLLs.FirstOrDefault(d => d.FullPath == originalDllName).Tests);
            TestResult       testResult = RunTestsInAssemblies(new List <string>()
            {
                testDll
            }, filter);

            // Save the result to xml file:
            string          resultFile   = Path.GetDirectoryName(testDll) + @"\TestResult.xml";
            XmlResultWriter resultWriter = new XmlResultWriter(resultFile);

            resultWriter.SaveTestResult(testResult);

            // show results dialog
            string extraMsg = "Result file can be found at " + resultFile;
            TestResultViewerViewModel vm     = new TestResultViewerViewModel(testResult, extraMsg);
            TestResultViewer          viewer = new TestResultViewer(vm);

            //viewer.Owner = LinkedWindow;
            GeneralHelper.SetRevitAsWindowOwner(viewer);
            viewer.ShowDialog();

            // cleanup
            File.Delete(tempFile);
            File.Delete(destPdbFile);
        }
Exemplo n.º 9
0
        public static string[] LoadDLLs()
        {
            //search Vendor folder for DLL files
            if (Directory.Exists(App.MapPath("/Vendors")))
            {
                RecurseDirectories(App.MapPath("/Vendors"));
                DLLs = DLLs.OrderBy(a => a).ToList();
            }

            //load assemblies from DLL files
            foreach (var file in DLLs)
            {
                var          context      = new Assemblies.AssemblyLoader(file);
                AssemblyName assemblyName = new AssemblyName(Path.GetFileNameWithoutExtension(file));
                var          assembly     = context.LoadFromAssemblyName(assemblyName);
                Assemblies.Add(new KeyValuePair <string, Assembly>(file, assembly));
            }

            return(DLLs.ToArray());
        }
Exemplo n.º 10
0
        public void ParseArgs(IEnumerable <string> args, List <string> respFiles = null)
        {
            var helpStrings = new string[] { "/?", "-?", "/h", "-h" };

            foreach (var a in args)
            {
                var arg = a.Trim();
                if (arg.StartsWith("#", StringComparison.Ordinal))
                {
                    continue;
                }

                if (arg.StartsWith("/main:", StringComparison.Ordinal))
                {
                    MainName = Main = arg.Substring(6).Trim('"');
                    // only override the target kind if its currently a DLL
                    if (Target == PEFileKinds.Dll)
                    {
                        Target = PEFileKinds.ConsoleApplication;
                    }
                }
                else if (arg.StartsWith("/out:", StringComparison.Ordinal))
                {
                    Output = arg.Substring(5).Trim('"');
                }
                else if (arg.StartsWith("/target:", StringComparison.Ordinal))
                {
                    string tgt = arg.Substring(8).Trim('"');
                    switch (tgt)
                    {
                    case "exe":
                        Target = PEFileKinds.ConsoleApplication;
                        break;

                    case "winexe":
                        Target = PEFileKinds.WindowApplication;
                        break;

                    default:
                        Target = PEFileKinds.Dll;
                        break;
                    }
                }
                else if (arg.StartsWith("/platform:", StringComparison.Ordinal))
                {
                    string plat = arg.Substring(10).Trim('"');
                    switch (plat)
                    {
                    case "x86":
                        Platform = IKVM.Reflection.PortableExecutableKinds.ILOnly | IKVM.Reflection.PortableExecutableKinds.Required32Bit;
                        Machine  = IKVM.Reflection.ImageFileMachine.I386;
                        break;

                    case "x64":
                        Platform = IKVM.Reflection.PortableExecutableKinds.ILOnly | IKVM.Reflection.PortableExecutableKinds.PE32Plus;
                        Machine  = IKVM.Reflection.ImageFileMachine.AMD64;
                        break;

                    default:
                        Platform = IKVM.Reflection.PortableExecutableKinds.ILOnly;
                        Machine  = IKVM.Reflection.ImageFileMachine.AMD64;
                        break;
                    }
                }
                else if (arg.StartsWith("/win32icon:", StringComparison.Ordinal))
                {
                    Win32Icon = arg.Substring(11).Trim('"');
                }
                else if (arg.StartsWith("/fileversion:", StringComparison.Ordinal))
                {
                    FileVersion = arg.Substring(13).Trim('"');
                }
                else if (arg.StartsWith("/productversion:", StringComparison.Ordinal))
                {
                    ProductVersion = arg.Substring(16).Trim('"');
                }
                else if (arg.StartsWith("/productname:", StringComparison.Ordinal))
                {
                    ProductName = arg.Substring(13).Trim('"');
                }
                else if (arg.StartsWith("/copyright:", StringComparison.Ordinal))
                {
                    Copyright = arg.Substring(11).Trim('"');
                }
                else if (arg.StartsWith("/errfmt:", StringComparison.Ordinal))
                {
                    ErrorMessageFormat = arg.Substring(8);
                }
                else if (arg.Equals("/embed", StringComparison.Ordinal))
                {
                    Embed = true;
                }
                else if (arg.Equals("/standalone", StringComparison.Ordinal))
                {
                    Standalone = true;
                }
                else if (arg.Equals("/mta", StringComparison.Ordinal))
                {
                    UseMta = true;
                }
                else if (arg.Equals("/sta", StringComparison.Ordinal))
                {
                    UseSta = true;
                }
                else if (arg.StartsWith("/recurse:", StringComparison.Ordinal))
                {
                    string pattern = arg.Substring(9);
                    if (string.IsNullOrWhiteSpace(pattern))
                    {
                        ConsoleOps.Error(true, "Missing pattern for /recurse option");
                    }
                    foreach (var f in Directory.EnumerateFiles(Environment.CurrentDirectory, pattern))
                    {
                        Files.Add(Path.GetFullPath(f));
                    }
                }
                else if (Array.IndexOf(helpStrings, arg) >= 0)
                {
                    ConsoleOps.Usage(true);
                }
                else if (arg.StartsWith("/py:", StringComparison.Ordinal))
                {
                    // if you add a parameter that takes a different type then
                    // ScriptingRuntimeHelpers.True/False or int
                    // you need ot also modify Program.cs for standalone generation.
                    string[] pyargs = arg.Substring(4).Trim('"').Split(new char[] { ' ' }, StringSplitOptions.RemoveEmptyEntries);
                    switch (pyargs[0])
                    {
                    case "-X:Frames":
                        PythonOptions["Frames"] = ScriptingRuntimeHelpers.True;
                        break;

                    case "-X:FullFrames":
                        PythonOptions["Frames"] = PythonOptions["FullFrames"] = ScriptingRuntimeHelpers.True;
                        break;

                    case "-X:Tracing":
                        PythonOptions["Tracing"] = ScriptingRuntimeHelpers.True;
                        break;

                    case "-X:GCStress":
                        int gcStress;
                        if (!int.TryParse(pyargs[1], out gcStress) || (gcStress <0 || gcStress> GC.MaxGeneration))
                        {
                            ConsoleOps.Error(true, $"The argument for the {pyargs[1]} option must be between 0 and {GC.MaxGeneration}.");
                        }

                        PythonOptions["GCStress"] = gcStress;
                        break;

                    case "-X:MaxRecursion":
                        // we need about 6 frames for starting up, so 10 is a nice round number.
                        int limit;
                        if (!int.TryParse(pyargs[1], out limit) || limit < 10)
                        {
                            ConsoleOps.Error(true, $"The argument for the {pyargs[1]} option must be an integer >= 10.");
                        }

                        PythonOptions["RecursionLimit"] = limit;
                        break;

                    case "-X:EnableProfiler":
                        PythonOptions["EnableProfiler"] = ScriptingRuntimeHelpers.True;
                        break;

                    case "-X:LightweightScopes":
                        PythonOptions["LightweightScopes"] = ScriptingRuntimeHelpers.True;
                        break;

                    case "-X:Debug":
                        PythonOptions["Debug"] = ScriptingRuntimeHelpers.True;
                        break;
                    }
                }
                else
                {
                    if (arg.StartsWith("@", StringComparison.Ordinal))
                    {
                        var respFile = Path.GetFullPath(arg.Substring(1));
                        if (respFiles == null)
                        {
                            respFiles = new List <string>();
                        }

                        if (!respFiles.Contains(respFile))
                        {
                            respFiles.Add(respFile);
                            ParseArgs(File.ReadAllLines(respFile), respFiles);
                        }
                        else
                        {
                            ConsoleOps.Warning($"Already parsed response file '{arg.Substring(1)}'");
                        }
                    }
                    else
                    {
                        if (arg.ToLower().EndsWith(".dll", StringComparison.Ordinal))
                        {
                            DLLs.Add(arg);
                        }
                        else
                        {
                            Files.Add(arg);
                        }
                    }
                }
            }
        }