Exemple #1
0
        public void Test_LoadingAssembly(ICirData cirData, string assemblyToLoad, bool verify, bool verbose)
        {
            AssemblyDefinition assemblyDefinition = CecilUtils.getAssembly(assemblyToLoad);

            if (assemblyDefinition == null)
            {
                return;
            }

            var loadTimer = new O2Timer("Assembly " + Path.GetFileName(assemblyToLoad) + " Loaded in");

            if (verbose)
            {
                loadTimer.start();
            }
            cirFactory.processAssemblyDefinition(cirData, assemblyDefinition, assemblyToLoad);
            if (verbose)
            {
                loadTimer.stop();
            }
            if (verify)
            {
                var checkTimer = new O2Timer("       functions checked in  ");
                if (verbose)
                {
                    checkTimer.start();
                }
                checkThatAllFunctionsMatch(cirData, assemblyDefinition);
                if (verbose)
                {
                    checkTimer.stop();
                }
            }
        }
Exemple #2
0
        public void createCirDataObject()
        {
            var      cirFactory = new CirFactory();
            ICirData cirData    = new CirData();

            DI.log.info("using assembly:{0} and O2_Kernel.dll", Assembly.GetExecutingAssembly().Location);
            cirFactory.processAssemblyDefinition(cirData, Assembly.GetExecutingAssembly().Location);
            cirFactory.processAssemblyDefinition(cirData, DI.config.ExecutingAssembly);
            Assert.That(cirData.dClasses_bySignature.Count > 0, "There were no classes in cirData object");
            Assert.That(cirData.dFunctions_bySignature.Count > 0, "There were no function in cirData object");
            O2Messages.setCirData(cirData);
            //CirFactoryUtils.showCirDataStats();
        }
        public void test_SaveCirDataFile()
        {
            ICirData cirData = new CirData();

            cirFactory.processAssemblyDefinition(cirData, DI.config.ExecutingAssembly);
            var savedCirDataFile = DI.config.getTempFileInTempDirectory("CirData");

            Assert.That(false == File.Exists(savedCirDataFile), "savedCirDataFile shouldn't exist here");
            CirDataUtils.saveSerializedO2CirDataObjectToFile(cirData, savedCirDataFile);
            Assert.That(File.Exists(savedCirDataFile), "savedCirDataFile exist here");
            File.Delete(savedCirDataFile);
            Assert.That(false == File.Exists(savedCirDataFile), "savedCirDataFile Should be deleted");
            DI.log.info("all done");
        }
Exemple #4
0
        public void createCirDataObject()
        {
            cirData = new CirData();
            DI.log.info("using assembly:{0} and O2_Kernel.dll", Assembly.GetExecutingAssembly().Location);
            cirFactory.processAssemblyDefinition(cirData, Assembly.GetExecutingAssembly().Location);
            cirFactory.processAssemblyDefinition(cirData, DI.config.ExecutingAssembly);

            /* // this will load all dlls in the O2 dir
             * foreach(var file in Files.getFilesFromDir_returnFullPath(DI.hardCodedO2DeploymentDir,"*.dll"))
             *  cirFactory.processAssemblyDefinition(cirData, CecilUtils.getAssembly(file));*/

            Assert.That(cirData.dClasses_bySignature.Count > 0, "There were no classes in cirData object");
            Assert.That(cirData.dFunctions_bySignature.Count > 0, "There were no function in cirData object");
            CirFactoryUtils.showCirDataStats(cirData);
        }