Пример #1
0
def get_interface_version(mount_point):
    """ Function returns interface version from the target mounted on the specified mount point
    
        mount_point can be acquired via the following:
            muts = get_autodetected_MUTS_list()
            for mut in muts.values():
                mount_point = mut['disk']
                    
        @param mount_point Name of disk where platform is connected to host machine.
    """
    if get_module_avail('mbed_lstools'):
        try :
            mbeds = mbed_lstools.create()
            details_txt = mbeds.get_details_txt(mount_point)
            
            if 'Interface Version' in details_txt:
                return details_txt['Interface Version']
            
            elif 'Version' in details_txt:
                return details_txt['Version']
            
        except :
            return 'unknown'
        
    return 'unknown'
Пример #2
0
    def init_serial(self, serial_baud=None, serial_timeout=None):
        """ Initialize serial port.
            Function will return error is port can't be opened or initialized
        """
        # Overload serial port configuration from default to parameters' values if they are specified
        serial_baud = serial_baud if serial_baud is not None else self.serial_baud
        serial_timeout = serial_timeout if serial_timeout is not None else self.serial_timeout

        if get_module_avail('mbed_lstools') and self.options.auto_detect:
            # Ensure serial port is up-to-date (try to find it 60 times)
            found = False

            for i in range(0, 60):
                print('Looking for %s with MBEDLS' % self.options.micro)
                muts_list = get_autodetected_MUTS_list(
                    platform_name_filter=[self.options.micro])

                if 1 in muts_list:
                    mut = muts_list[1]
                    self.port = mut['port']
                    found = True
                    break
                else:
                    sleep(3)

            if not found:
                return False

        # Clear serial port
        if self.serial:
            self.serial.close()
            self.serial = None

        # We will pool for serial to be re-mounted if it was unmounted after device reset
        result = self.pool_for_serial_init(serial_baud,
                                           serial_timeout)  # Blocking

        # Port can be opened
        if result:
            self.flush()
        return result
Пример #3
0
    def init_serial(self, serial_baud=None, serial_timeout=None):
        """ Initialize serial port.
            Function will return error is port can't be opened or initialized
        """
        # Overload serial port configuration from default to parameters' values if they are specified
        serial_baud = serial_baud if serial_baud is not None else self.serial_baud
        serial_timeout = serial_timeout if serial_timeout is not None else self.serial_timeout

        if get_module_avail('mbed_lstools') and self.options.auto_detect:
            # Ensure serial port is up-to-date (try to find it 60 times)
            found = False

            for i in range(0, 60):
                print('Looking for %s with MBEDLS' % self.options.micro)
                muts_list = get_autodetected_MUTS_list(platform_name_filter=[self.options.micro])

                if 1 in muts_list:
                    mut = muts_list[1]
                    self.port = mut['port']
                    found = True
                    break
                else:
                    sleep(3)

            if not found:
                return False

        # Clear serial port
        if self.serial:
            self.serial.close()
            self.serial = None

        # We will pool for serial to be re-mounted if it was unmounted after device reset
        result = self.pool_for_serial_init(serial_baud, serial_timeout) # Blocking

        # Port can be opened
        if result:
            self.flush()
        return result
def get_interface_version(mount_point):
    """ Function returns interface version from the target mounted on the specified mount point
    
        mount_point can be acquired via the following:
            muts = get_autodetected_MUTS_list()
            for mut in muts.values():
                mount_point = mut['disk']
                    
        @param mount_point Name of disk where platform is connected to host machine.
    """
    if get_module_avail('mbed_lstools'):
        try:
            mbedls = mbed_lstools.create()
            mbeds = mbedls.list_mbeds(unique_names=True, read_details_txt=True)

            for mbed in mbeds:
                if mbed['mount_point'] == mount_point:

                    if 'daplink_version' in mbed:
                        return mbed['daplink_version']
        except:
            return 'unknown'

    return 'unknown'
Пример #5
0
def get_interface_version(mount_point):
    """ Function returns interface version from the target mounted on the specified mount point
    
        mount_point can be acquired via the following:
            muts = get_autodetected_MUTS_list()
            for mut in muts.values():
                mount_point = mut['disk']
                    
        @param mount_point Name of disk where platform is connected to host machine.
    """
    if get_module_avail('mbed_lstools'):
        try :
            mbedls = mbed_lstools.create()
            mbeds = mbedls.list_mbeds(unique_names=True, read_details_txt=True)
            
            for mbed in mbeds:
                if mbed['mount_point'] == mount_point:
            
                    if 'daplink_version' in mbed:
                        return mbed['daplink_version']           
        except :
            return 'unknown'
        
    return 'unknown'
Пример #6
0
            exit(-1)

    if opts.verbose_test_configuration_only:
        print "MUTs configuration in %s:" % (
            'auto-detected' if opts.auto_detect else opts.muts_spec_filename)
        if MUTs:
            print print_muts_configuration_from_json(
                MUTs, platform_filter=opts.general_filter_regex)
        print
        print "Test specification in %s:" % (
            'auto-detected' if opts.auto_detect else opts.test_spec_filename)
        if test_spec:
            print print_test_configuration_from_json(test_spec)
        exit(0)

    if get_module_avail('mbed_lstools'):
        if opts.operability_checks:
            # Check if test scope is valid and run tests
            test_scope = get_available_oper_test_scopes()
            if opts.operability_checks in test_scope:
                tests = IOperTestRunner(scope=opts.operability_checks)
                test_results = tests.run()

                # Export results in form of JUnit XML report to separate file
                if opts.report_junit_file_name:
                    report_exporter = ReportExporter(
                        ResultExporterType.JUNIT_OPER)
                    report_exporter.report_to_file(test_results,
                                                   opts.report_junit_file_name)
            else:
                print "Unknown interoperability test scope name: '%s'" % (
Пример #7
0
        if MUTs is None:
            if not opts.muts_spec_filename:
                parser.print_help()
            exit(-1)

    if opts.verbose_test_configuration_only:
        print "MUTs configuration in %s:" % ('auto-detected' if opts.auto_detect else opts.muts_spec_filename)
        if MUTs:
            print print_muts_configuration_from_json(MUTs, platform_filter=opts.general_filter_regex)
        print
        print "Test specification in %s:" % ('auto-detected' if opts.auto_detect else opts.test_spec_filename)
        if test_spec:
            print print_test_configuration_from_json(test_spec)
        exit(0)

    if get_module_avail('mbed_lstools'):
        if opts.operability_checks:
            # Check if test scope is valid and run tests
            test_scope = get_available_oper_test_scopes()
            if opts.operability_checks in test_scope:
                tests = IOperTestRunner(scope=opts.operability_checks)
                test_results = tests.run()

                # Export results in form of JUnit XML report to separate file
                if opts.report_junit_file_name:
                    report_exporter = ReportExporter(ResultExporterType.JUNIT_OPER)
                    report_exporter.report_to_file(test_results, opts.report_junit_file_name)
            else:
                print "Unknown interoperability test scope name: '%s'" % (opts.operability_checks)
                print "Available test scopes: %s" % (','.join(["'%s'" % n for n in test_scope]))