Esempio n. 1
0
        def setup():
            if p.exists('modelsim.ini'):
                _logger.warning("Modelsim ini found at %s",
                                p.abspath('modelsim.ini'))
                os.remove('modelsim.ini')

            #  hdlcc.HdlCodeCheckerBase.cleanProjectCache(it.PROJECT_FILE)
            cleanProjectCache(it.PROJECT_FILE)

            builder = hdlcc.builders.getBuilderByName(it.BUILDER_NAME)

            if onCI() and it.BUILDER_NAME is not None:
                with it.assertRaises(hdlcc.exceptions.SanityCheckError):
                    builder(it.DUMMY_PROJECT_FILE)

            # Add the builder path to the environment so we can call it
            if it.BUILDER_PATH:
                it.patch = mock.patch.dict('os.environ', {
                    'PATH':
                    os.pathsep.join([it.BUILDER_PATH, os.environ['PATH']])
                })
                it.patch.start()

            try:
                builder(it.DUMMY_PROJECT_FILE)
            except hdlcc.exceptions.SanityCheckError:
                it.fail("Builder creation failed even after configuring "
                        "the builder path")

            _logger.info("Creating project builder object")
            it.project = StandaloneProjectBuilder(it.PROJECT_FILE)
Esempio n. 2
0
        def teardown():
            #  hdlcc.HdlCodeCheckerBase.cleanProjectCache(it.PROJECT_FILE)
            cleanProjectCache(it.PROJECT_FILE)
            if it.BUILDER_PATH:
                it.patch.stop()

            if p.exists(it.project._config.getTargetDir()):
                shutil.rmtree(it.project._config.getTargetDir())
            del it.project
Esempio n. 3
0
 def teardown():
     if not it.BUILDER_NAME:
         return
     #  hdlcc.HdlCodeCheckerBase.cleanProjectCache(it.PROJECT_FILE)
     utils.cleanProjectCache(it.PROJECT_FILE)
     target_dir = hdlcc.config_parser.ConfigParser(it.PROJECT_FILE).getTargetDir()
     if p.exists(target_dir):
         shutil.rmtree(target_dir)
     cache_fname = utils.getDefaultCachePath(it.PROJECT_FILE)
     if p.exists(cache_fname):
         os.remove(cache_fname)
Esempio n. 4
0
 def teardown():
     if not it.BUILDER_NAME:
         return
     #  hdlcc.HdlCodeCheckerBase.cleanProjectCache(it.PROJECT_FILE)
     utils.cleanProjectCache(it.PROJECT_FILE)
     target_dir = hdlcc.config_parser.ConfigParser(
         it.PROJECT_FILE).getTargetDir()
     if p.exists(target_dir):
         shutil.rmtree(target_dir)
     cache_fname = utils.getDefaultCachePath(it.PROJECT_FILE)
     if p.exists(cache_fname):
         os.remove(cache_fname)
Esempio n. 5
0
    def teardown():
        cleanProjectCache(it.PROJECT_FILE)

        _logger.debug("Cleaning up test files")
        for path in (it.DUMMY_PROJECT_FILE, '.fallback', '.hdlcc',
                     'myproject.prj', 'some_file.vhd', 'xvhdl.pb',
                     '.xvhdl.init'):
            if p.exists(path):
                _logger.debug("Removing %s", path)
                if p.isdir(path):
                    shutil.rmtree(path)
                else:
                    os.remove(path)

        it._patch.stop()
Esempio n. 6
0
    def setup():
        it.BUILDER_NAME = os.environ.get('BUILDER_NAME', None)
        it.BUILDER_PATH = os.environ.get('BUILDER_PATH', None)
        if it.BUILDER_NAME:
            it.PROJECT_FILE = p.join(VIM_HDL_EXAMPLES,
                                     it.BUILDER_NAME + '.prj')
        else:
            it.PROJECT_FILE = None

        cleanProjectCache(it.PROJECT_FILE)

        _logger.info("Builder name: %s", it.BUILDER_NAME)
        _logger.info("Builder path: %s", it.BUILDER_PATH)

        it._patch = mock.patch('hdlcc.config_parser.foundVunit', lambda: False)
        it._patch.start()
Esempio n. 7
0
    def setup():
        it.BUILDER_NAME = os.environ.get('BUILDER_NAME', None)
        it.BUILDER_PATH = os.environ.get('BUILDER_PATH', None)
        if not it.BUILDER_NAME:
            return

        it.PROJECT_FILE = p.join(BASE_PATH, it.BUILDER_NAME + '.prj')

        #  StandaloneProjectBuilder.cleanProjectCache(it.PROJECT_FILE)
        utils.cleanProjectCache(it.PROJECT_FILE)

        it.original_env = os.environ.copy()
        it.builder_env = os.environ.copy()

        #  utils.addToPath(it.BUILDER_PATH)
        it.patch = mock.patch.dict(
            'os.environ',
            {'PATH': os.pathsep.join([it.BUILDER_PATH, os.environ['PATH']])})
        it.patch.start()

        _logger.info("Builder name: %s", it.BUILDER_NAME)
        _logger.info("Builder path: %s", it.BUILDER_PATH)
Esempio n. 8
0
    def setup():
        it.BUILDER_NAME = os.environ.get('BUILDER_NAME', None)
        it.BUILDER_PATH = os.environ.get('BUILDER_PATH', None)
        if not it.BUILDER_NAME:
            return

        it.PROJECT_FILE = p.join(BASE_PATH, it.BUILDER_NAME + '.prj')

        #  StandaloneProjectBuilder.cleanProjectCache(it.PROJECT_FILE)
        utils.cleanProjectCache(it.PROJECT_FILE)

        it.original_env = os.environ.copy()
        it.builder_env = os.environ.copy()

        #  utils.addToPath(it.BUILDER_PATH)
        it.patch = mock.patch.dict(
            'os.environ',
            {'PATH' : os.pathsep.join([it.BUILDER_PATH, os.environ['PATH']])})
        it.patch.start()

        _logger.info("Builder name: %s", it.BUILDER_NAME)
        _logger.info("Builder path: %s", it.BUILDER_PATH)
Esempio n. 9
0
 def teardown():
     if not it.BUILDER_NAME:
         return
     utils.cleanProjectCache(it.PROJECT_FILE)
Esempio n. 10
0
 def teardown():
     if not it.BUILDER_NAME:
         return
     utils.cleanProjectCache(it.PROJECT_FILE)