コード例 #1
0
ファイル: AwsFpgaTestBase.py プロジェクト: zeta1999/aws-fpga
    def setup_class(cls, derived_cls, filename_of_test_class):
        AwsFpgaTestBase.s3_bucket = 'aws-fpga-jenkins-testing'
        AwsFpgaTestBase.__ec2_client = None
        AwsFpgaTestBase.__s3_client = None
        AwsFpgaTestBase.test_dir = dirname(realpath(filename_of_test_class))

        # SDAccel locations
        # Need to move to either a config file somewhere or a subclass
        AwsFpgaTestBase.xilinx_sdaccel_examples_prefix_path = "SDAccel/examples/xilinx"
        AwsFpgaTestBase.xilinx_sdaccel_examples_dir = AwsFpgaTestBase.git_repo_dir + "/" + AwsFpgaTestBase.xilinx_sdaccel_examples_prefix_path
        AwsFpgaTestBase.xilinx_sdaccel_examples_list_file = AwsFpgaTestBase.WORKSPACE + "/sdaccel_examples_list.json"

        # Vitis locations
        # Need to move to either a config file somewhere or a subclass
        AwsFpgaTestBase.xilinx_vitis_examples_prefix_path = "Vitis/examples/xilinx"
        AwsFpgaTestBase.xilinx_vitis_examples_dir = AwsFpgaTestBase.git_repo_dir + "/" + AwsFpgaTestBase.xilinx_vitis_examples_prefix_path
        AwsFpgaTestBase.xilinx_vitis_examples_list_file = AwsFpgaTestBase.WORKSPACE + "/vitis_examples_list.json"

        if 'WORKSPACE' in os.environ:
            assert os.environ[
                'WORKSPACE'] == AwsFpgaTestBase.git_repo_dir, "WORKSPACE incorrect"
        else:
            os.environ['WORKSPACE'] = AwsFpgaTestBase.WORKSPACE
        if 'BUILD_TAG' not in os.environ:
            os.environ['BUILD_TAG'] = 'test'
            logger.info('Set BUILD_TAG to {}'.format(os.environ['BUILD_TAG']))
        AwsFpgaTestBase.instance_type = aws_fpga_test_utils.get_instance_type()
        AwsFpgaTestBase.num_slots = aws_fpga_test_utils.get_num_fpga_slots(
            AwsFpgaTestBase.instance_type)
        return
コード例 #2
0
    def setup_class(cls):
        '''
        Do any setup required for tests.
        '''
        AwsFpgaTestBase.setup_class(cls, __file__)

        AwsFpgaTestBase.assert_sdk_setup()

        assert AwsFpgaTestBase.running_on_f1_instance(
        ), 'This test must be run on an F1 instance. Instance type={}'.format(
            aws_fpga_test_utils.get_instance_type())
        return
コード例 #3
0
    def setup_class(cls):
        '''
        Do any setup required for tests.
        '''
        AwsFpgaTestBase.setup_class(cls, __file__)

        AwsFpgaTestBase.assert_sdk_setup()

        assert AwsFpgaTestBase.running_on_f1_instance(
        ), "This test must be run on an F1 instance. Running on {}".format(
            aws_fpga_test_utils.get_instance_type())

        (cls.cl_hello_world_agfi,
         cl_hello_world_afi) = cls.get_agfi_from_readme('cl_hello_world')
        return
コード例 #4
0
    def setup_class(cls):
        '''
        Do any setup required for tests.
        '''
        AwsFpgaTestBase.setup_class(cls, __file__)

        AwsFpgaTestBase.assert_sdk_setup()

        assert AwsFpgaTestBase.running_on_f1_instance(
        ), "This test must be run on an F1 instance. Running on {}".format(
            aws_fpga_test_utils.get_instance_type())

        (cls.cl_dram_dma_agfi,
         cl_dram_dma_afi) = cls.get_agfi_from_readme('cl_dram_dma')

        for slot in range(AwsFpgaTestBase.num_slots):
            AwsFpgaTestBase.load_msix_workaround(slot)

        cls.get_fio_dma_tools()
        return
コード例 #5
0
    def setup_class(cls, derived_cls, filename_of_test_class):
        AwsFpgaTestBase.s3_bucket = 'aws-fpga-jenkins-testing'
        AwsFpgaTestBase.__ec2_client = None
        AwsFpgaTestBase.__s3_client = None
        AwsFpgaTestBase.test_dir = dirname(realpath(filename_of_test_class))
        AwsFpgaTestBase.git_repo_dir = get_git_repo_root(dirname(filename_of_test_class))
        AwsFpgaTestBase.WORKSPACE = AwsFpgaTestBase.git_repo_dir

        # SDAccel locations
        # Need to move to either a config file somewhere or a subclass
        AwsFpgaTestBase.xilinx_sdaccel_examples_dir = AwsFpgaTestBase.git_repo_dir + "/SDAccel/examples/xilinx"
        AwsFpgaTestBase.xilinx_sdaccel_examples_list_file = AwsFpgaTestBase.WORKSPACE + "/sdaccel_examples_list.json"

        if 'WORKSPACE' in os.environ:
            assert os.environ['WORKSPACE'] == AwsFpgaTestBase.git_repo_dir, "WORKSPACE incorrect"
        else:
            os.environ['WORKSPACE'] = AwsFpgaTestBase.WORKSPACE
        AwsFpgaTestBase.instance_type = aws_fpga_test_utils.get_instance_type()
        AwsFpgaTestBase.num_slots = aws_fpga_test_utils.get_num_fpga_slots(AwsFpgaTestBase.instance_type)
        return
コード例 #6
0
ファイル: base_sdk.py プロジェクト: zwl1671/aws-fpga
    def setup_class(cls):
        '''
        Do any setup required for tests.
        '''
        AwsFpgaTestBase.setup_class(cls, __file__)

        AwsFpgaTestBase.assert_sdk_setup()

        assert AwsFpgaTestBase.running_on_f1_instance(
        ), 'This test must be run on an F1 instance. Instance type={}'.format(
            aws_fpga_test_utils.get_instance_type())

        cls.load_mgmt_so()
        cls.load_mgmt_test_so()

        (cls.cl_hello_world_agfi,
         cls.cl_dram_dma_afi) = cls.get_agfi_from_readme('cl_hello_world')
        (cls.cl_dram_dma_agfi,
         cls.cl_dram_dma_afi) = cls.get_agfi_from_readme('cl_dram_dma')

        cls.shell_version = cls.get_shell_version()

        # Need to preload an AFI or else may be the wrong shell version because of MSIX fix which is run
        # when the instance is created.
        logger.info("Initializing all slots with cl_hello_world AFI")
        for slot in range(cls.num_slots):
            cls.fpga_load_local_image(cls.cl_hello_world_agfi, slot)
        logger.info("PCI devices:\n{}".format("\n".join(
            cls.list_pci_devices())))

        # Rescanning PCI for each slot
        logger.info("Rescanning each slot to see if PCI devices change")
        for slot in range(cls.num_slots):
            (rc, stdout, stderr) = cls.run_cmd(
                "sudo fpga-describe-local-image -R -S {}".format(slot))
        logger.info("PCI devices:\n{}".format("\n".join(
            cls.list_pci_devices())))

        cls.set_slot_to_device_mapping()
        return
コード例 #7
0
 def running_on_f1_instance():
     '''
     Check to see if running on an F1 instance
     '''
     instance_type = aws_fpga_test_utils.get_instance_type()
     return re.match(r'f1\.', instance_type)