コード例 #1
0
def SanityCheckGit():
  """Does a sanity check that git is available and the current working directory
  is in a git repository (exits with an error message on failure)."""

  try:
    Git("status")
  except OSError:
    FatalError("failed to run git -- is it in your PATH?")
  except subprocess.CalledProcessError:
    FatalError("\"git status\" failed -- is %s in a git repository?" %
        os.getcwd())
コード例 #2
0
ファイル: helper.py プロジェクト: pombredanne/xud-docker
    def push_manifest_list(self, tag):
        os.environ["DOCKER_CLI_EXPERIMENTAL"] = "enabled"

        if tag.endswith("x86_64"):
            t0 = tag.replace("__x86_64", "")
            t1 = tag
            t2 = tag.replace("x86_64", "aarch64")
        else:
            t0 = tag.replace("__aarch64", "")
            t1 = tag
            t2 = tag.replace("aarch64", "x86_64")

        try:
            check_output(
                f"docker manifest create {t0} --amend {t1} --amend {t2}",
                shell=True,
                stderr=PIPE)
        except:
            try:
                check_output(f"docker manifest create {t0} --amend {t1}",
                             shell=True,
                             stderr=PIPE)
            except Exception as e:
                raise FatalError(
                    f"Failed to create manifest: {t0}, {t1}, {t2}") from e

        try:
            check_output(f"docker manifest push {t0}", shell=True, stderr=PIPE)
        except Exception as e:
            raise RuntimeError(f"Failed to push manifest: {t0}") from e
コード例 #3
0
ファイル: binary.py プロジェクト: VishalSharma0309/gap_sdk
 def __init__(self, flashType, *args, **kargs):
     if flashType == 'hyper':
         romBlockSize = 1024
     elif flashType == 'spi':
         romBlockSize = 4096
     else:
         raise FatalError(
             'Flash type %s not suported. ROM boot loader supports hyper and spi flash type' % flashType)
     
     super().__init__(romBlockSize, *args, **kargs)
コード例 #4
0
 def get_manifest(self, repo, tag):
     url = f"{self.registry_url}/v2/{repo}/manifests/{tag}"
     request = Request(url)
     request.add_header("Authorization", "Bearer " + self.get_token(repo))
     request.add_header("Accept", "application/vnd.docker.distribution.manifest.list.v2+json")
     try:
         for i in range(3):
             try:
                 r = urlopen(request)
                 payload = json.loads(r.read().decode())
                 return payload
             except http.client.IncompleteRead:
                 pass
             except HTTPError as e:
                 if e.code == 404:
                     return None
                 else:
                     raise
             time.sleep(1)
         raise FatalError("Failed to get manifest: {}:{} (tried 3 times)".format(repo, tag))
     except Exception as e:
         raise FatalError("Failed to get manifest: {}:{}".format(repo, tag)) from e
コード例 #5
0
 def __init__(self, sectorSize, flashType):
     
     self.sectorSize = sectorSize
     if flashType not in ('hyper', 'spi'):
         raise FatalError(
             'Flash type %s not suported. ROM boot loader supports hyper and spi flash type' % flashType)
     self.flashType = flashType
     
     self.image = bytearray()
     
     # Partition
     self.partitionTable = None
     self.partitionTableOffset = None
     # Partition 0 : Flash header + Second Stage BootLoader or unic APP
     self.ssbl = None
コード例 #6
0
    def __init__(self, flashType, encrypt = False, aesKey = None, aesIv = None, *args, **kargs):

        if flashType == 'hyper':
            romBlockSize = 1024
            self.xip_dev = 0
        elif flashType == 'spi':
            if os.environ.get('TARGET_CHIP_FAMILY') in ['PULP', 'GAP8']:
                romBlockSize = 4096
            else:
                romBlockSize = 1024
            self.xip_dev = 1
        elif flashType == 'mram':
            romBlockSize = 1024
            self.xip_dev = 2
        else:
            raise FatalError(
                'Flash type %s not suported. ROM boot loader supports hyper and spi flash type' % flashType)

        self.encrypt = encrypt
        self.aesKey = aesKey
        self.aesIv = aesIv
       
        super().__init__(romBlockSize, encrypt=encrypt, aesKey=aesKey, aesIv=aesIv, *args, **kargs)
コード例 #7
0
    def __init__(self, args, config):
        super(Runner, self).__init__(args, config)

        self.__process_args()

        try:
            gv.gvsoc.process_args(args, config)
        except:
            pass

        self.areas = []
        self.cmd_args = self.config.get('rtl/args').get_dict()

        self.plt_args = []
        self.env = {}
        self.platform_path = None
        self.platform_tool = self.config.get_str('rtl/simulator')

        if os.environ.get('GAPY_RTL_SIMULATOR') is not None:
            self.platform_tool = os.environ.get('GAPY_RTL_SIMULATOR')

        self.plt_config = self.config.get('rtl/' + self.platform_tool)
        self.plt_profile_config = self.plt_config.get('profiles/rtl')

        if self.config.get('**/runner/peripherals') is not None:
            self.set_arg('-gCONFIG_FILE=rtl_config.json')

            if os.environ.get('INSTALL_DIR') is not None:
                dpi_path = '%s/lib/libpulpdpi' % (
                    os.environ.get('INSTALL_DIR'))
                if not os.path.exists(dpi_path + '.so'):
                    raise FatalError('Did no find DPI models: ' + dpi_path +
                                     '.so')

                self.set_arg('-sv_lib %s' % dpi_path)

        #
        # Co-simulation with GVSOC
        #
        if self.config.get_bool('**/runner/gvsoc_dpi/enabled'):
            dpi_path = '%s/lib/libgvsocdpi' % (os.environ.get('INSTALL_DIR'))

            if not os.path.exists(dpi_path + '.so'):
                raise FatalError('Did no find DPI models: ' + dpi_path + '.so')

            if self.platform_tool == 'vsim':
                self.set_arg('-sv_lib %s' % dpi_path)
            else:
                self.set_cmd_arg('-sv_lib %s' % dpi_path)

            full_config, gvsoc_config_path = gv.gvsoc.gen_config(
                args, self.config)
            gv.gvsoc.prepare_exec(self.config, full_config)
            gv.gvsoc.dump_config(full_config, gvsoc_config_path)

            if self.platform_tool == 'vsim':
                self.set_arg('+DPI_CONFIG_FILE=%s' % gvsoc_config_path)
            else:
                self.set_cmd_arg('+DPI_CONFIG_FILE=%s' % gvsoc_config_path)

        else:
            if os.environ.get('TARGET_CHIP') == 'GAP9_V2':
                dpi_path = os.path.join(self.__get_platform_path(),
                                        'ips_inputs/dpi/libchipwrapper')

                if self.platform_tool == 'vsim':
                    self.set_arg('-sv_lib %s' % dpi_path)
                else:
                    self.set_cmd_arg('-sv_lib %s' % dpi_path)

        if self.args.cov or os.environ.get('GAPY_RTL_COVERAGE') is not None:
            test_name = os.environ.get('PLPTEST_NAME')
            if test_name is None:
                test_name = 'test'
            test_name = test_name.replace(':', '.').replace('/', '.')

            self.set_cmd_arg(
                '-covoverwrite -covworkdir %s/cov_work -covtest %s' %
                (os.environ.get('XCSIM_PATH'), test_name))

        self.full_config = js.import_config(self.config.get_dict(),
                                            interpret=True,
                                            gen=True)
コード例 #8
0
    def __init__(self, args, config):
        super(Runner, self).__init__(args, config)

        self.__process_args()

        try:
            gv.gvsoc.process_args(args, config)
        except:
            pass

        self.cmd_args = []
        self.plt_args = []
        self.env = {}
        self.platform_path = None
        self.platform_tool = self.config.get_str('rtl/simulator')

        if os.environ.get('GAPY_RTL_SIMULATOR') is not None:
            self.platform_tool = os.environ.get('GAPY_RTL_SIMULATOR')

        self.plt_config = self.config.get('rtl/' + self.platform_tool)
        self.plt_profile_config = self.plt_config.get('profiles/rtl')

        if self.config.get('**/runner/peripherals') is not None:
            self.set_arg('-gCONFIG_FILE=rtl_config.json')

            if os.environ.get('INSTALL_DIR') is not None:
                dpi_path = '%s/lib/libpulpdpi' % (
                    os.environ.get('INSTALL_DIR'))
                if not os.path.exists(dpi_path + '.so'):
                    raise FatalError('Did no find DPI models: ' + dpi_path +
                                     '.so')

                self.set_arg('-sv_lib %s' % dpi_path)

        #
        # Co-simulation with GVSOC
        #
        if self.config.get_bool('**/runner/gvsoc_dpi/enabled'):
            dpi_path = '%s/lib/libgvsocdpi' % (os.environ.get('INSTALL_DIR'))

            if not os.path.exists(dpi_path + '.so'):
                raise FatalError('Did no find DPI models: ' + dpi_path + '.so')

            if self.platform_tool == 'vsim':
                self.set_arg('-sv_lib %s' % dpi_path)
            else:
                self.set_cmd_arg('-sv_lib %s' % dpi_path)

            full_config, gvsoc_config_path = gv.gvsoc.gen_config(
                args, self.config)
            gv.gvsoc.prepare_exec(self.config, full_config)
            gv.gvsoc.dump_config(full_config, gvsoc_config_path)

            if self.platform_tool == 'vsim':
                self.set_arg('+DPI_CONFIG_FILE=%s' % gvsoc_config_path)
            else:
                self.set_cmd_arg('+DPI_CONFIG_FILE=%s' % gvsoc_config_path)

        else:
            if self.platform_tool == 'vsim':
                self.set_arg('-sv_lib %s/%s' %
                             (self.__get_platform_path(),
                              'ips_inputs/dpi/libchipwrapper'))
            else:
                self.set_cmd_arg('-sv_lib %s/%s' %
                                 (self.__get_platform_path(),
                                  'ips_inputs/dpi/libchipwrapper'))

        self.full_config = js.import_config(self.config.get_dict(),
                                            interpret=True,
                                            gen=True)