Ejemplo n.º 1
0
    def _download_run_file(self, cmdname):
        count = 0

        while count < 3:
            url = 'http://172.16.120.166/media_resource/MFLD_Android/LibVA-API_Test/'
            if self.platform is not None and self.platform.lower().strip(
            ) == 'ctp':
                url += 'CTP_PR1/'
            else:
                url += 'mfld_pr3/'
            url += cmdname
            download_url = 'wget --no-proxy ' + url
            execute_command_on_server(download_url, False)
            cmd = 'test -f ' + str(
                './' +
                cmdname) + " && echo 'File exists' || echo 'File not found'"
            stdout, stderr = execute_command_on_server(cmd, False)
            if stdout.strip() == 'File exists':
                self.cli.upload(cmdname, LIBVA_FILE_PATH)
                cmd = 'test -f ' + str(
                    LIBVA_FILE_PATH + cmdname
                ) + " && echo 'File exists' || echo 'File not found'"
                stdout, stderr = self.cli.execute(cmd)
                if stdout.strip() == 'File exists':
                    cmd = 'chmod 777 ' + str(LIBVA_FILE_PATH + cmdname)
                    stdout, stderr = self.cli.execute(cmd)
                    os.system("rm -rf " + cmdname)
                    break
                else:
                    raise TestException("Error: can't push libva file to DUT")
            else:
                count += 1
        if count == 3:
            raise TestException("Error: can't download libva file with url: " +
                                url)
Ejemplo n.º 2
0
 def _download_run_file(self, cmdname):
     count = 0
     
     while count < 3:
         url = 'http://172.16.120.166/media_resource/MFLD_Android/LibVA-API_Test/'
         if self.platform is not None and self.platform.lower().strip() == 'ctp':
             url += 'CTP_PR1/'
         else:
             url += 'mfld_pr3/'
         url += cmdname
         download_url = 'wget --no-proxy ' + url
         execute_command_on_server(download_url, False)
         cmd = 'test -f ' + str('./' + cmdname) + " && echo 'File exists' || echo 'File not found'"
         stdout, stderr = execute_command_on_server(cmd, False)
         if stdout.strip() == 'File exists':
             self.cli.upload(cmdname, LIBVA_FILE_PATH)
             cmd = 'test -f ' + str(LIBVA_FILE_PATH + cmdname) + " && echo 'File exists' || echo 'File not found'"
             stdout, stderr = self.cli.execute(cmd)
             if stdout.strip() == 'File exists':
                 cmd = 'chmod 777 ' + str(LIBVA_FILE_PATH + cmdname) 
                 stdout, stderr = self.cli.execute(cmd)
                 os.system("rm -rf " + cmdname)
                 break
             else:
                 raise TestException("Error: can't push libva file to DUT")
         else:
             count += 1
     if count == 3:
         raise TestException("Error: can't download libva file with url: " + url)
Ejemplo n.º 3
0
def download_clip(address):
    input_file = address.split('/')[-1]
    print '\nDownloading %s ......' %input_file
    cmd = "wget  --no-proxy " + address + " -O " + input_file
    execute_command_on_server(cmd, False)
    cmd = 'test -f ' + str('./' + input_file) + " && echo 'File exists' || echo 'File not found'"
    stdout, stderr = execute_command_on_server(cmd, False)
    if stdout.strip() == 'File exists':
        return 'pass'
    elif stdout.strip() == 'File not found':
        return 'fail'
Ejemplo n.º 4
0
def kill_command_on_device(case_profile, dev_dict):
    if case_profile.find('run.xml') == -1:
        case_profile += '/run.xml'
    tree = ET.parse(case_profile)
    root = tree.getroot()
    steps = root.findall('Step')
    for step in steps:
        function = step.get('function')
        command_list = []
        if function.find('va') != -1 and function.find('decode') != -1:
            format = root.find('Step').find('Parameter').find(
                'Format').text.strip()
            if not cmp(format, 'H263'):
                vld = 'mpeg4vld'
            else:
                vld = format.lower() + 'vld'
            command_list.append(vld)
        elif function.find('va') != -1 and function.find('decode') != -1:
            command_list.append('va_encode')
        elif function.find('media') != -1 and function.find('decode') != -1:
            command_list.append('mediaplayer')
        elif function.find('media') != -1 and function.find('encode') != -1:
            command_list.append('mediarecorder')
        elif function.find('app') != -1:
            cmd = 'adb -s ' + dev_dict[
                'serialNumber'] + ' shell input keyevent 4'
            execute_command_on_server(cmd, False)
    monitors = root.findall('Monitor')
    for monitor in monitors:
        if monitor.get('name').strip() == 'kernel_log':
            command_list.append('/proc/kmsg')
        elif monitor.get('name').strip() == 'logcat':
            command_list.append('logcat')
        elif monitor.get('name').strip() == 'matrix':
            command_list.append('matrix')
    status, output = commands.getstatusoutput("adb -s " +
                                              dev_dict['serialNumber'] +
                                              " shell ps -ef")
    process_list = output.split('\n')
    for process in process_list:
        for command in command_list:
            if process.find(command) != -1:
                pid = ''
                for item in process.split(' '):
                    if item.isdigit():
                        pid = item
                        break
                if pid:
                    cmd = 'kill -9 ' + str(pid)
                    commands.getstatusoutput("adb -s " +
                                             dev_dict['serialNumber'] +
                                             " shell " + cmd)
Ejemplo n.º 5
0
 def check_connection(self, ip):
     cmd = 'ping ' + ip + ' -w 3'
     stdout, stderr = execute_command_on_server(cmd, False)
     if stdout.find('bytes from ' + ip.strip()) != -1:
         return True
     else:
         return False
Ejemplo n.º 6
0
 def check_connection(self, ip):
     cmd = 'ping ' + ip + ' -w 3'
     stdout, stderr = execute_command_on_server(cmd, False)
     if stdout.find('bytes from ' + ip.strip()) != - 1:
         return True
     else:
         return False
Ejemplo n.º 7
0
def kill_command_on_device(case_profile, dev_dict):
        if case_profile.find('run.xml') == -1:
            case_profile += '/run.xml'
        tree = ET.parse(case_profile)
        root = tree.getroot()
        steps = root.findall('Step')
        for step in steps:
            function = step.get('function')
            command_list = []
            if function.find('va') != -1 and function.find('decode') != -1:
                format = root.find('Step').find('Parameter').find('Format').text.strip()
                if not cmp(format, 'H263'):
                    vld = 'mpeg4vld'
                else:
                    vld = format.lower() + 'vld'
                command_list.append(vld)
            elif function.find('va') != -1 and function.find('decode') != -1:
                command_list.append('va_encode')
            elif function.find('media') != -1 and function.find('decode') != -1:
                command_list.append('mediaplayer')
            elif function.find('media') != -1 and function.find('encode') != -1:
                command_list.append('mediarecorder')
            elif function.find('app') != -1 :
                cmd = 'adb -s ' + dev_dict['serialNumber'] + ' shell input keyevent 4'
                execute_command_on_server(cmd, False)
        monitors = root.findall('Monitor')
        for monitor in monitors:
            if monitor.get('name').strip() == 'kernel_log':
                command_list.append('/proc/kmsg')
            elif monitor.get('name').strip() == 'logcat':
                command_list.append('logcat')
            elif monitor.get('name').strip() == 'matrix':
                command_list.append('matrix')
        status, output = commands.getstatusoutput("adb -s " + dev_dict['serialNumber'] + " shell ps -ef")
        process_list = output.split('\n')
        for process in process_list:
            for command in command_list:
                if process.find(command) != -1:
                    pid = ''
                    for item in process.split(' '):
                        if item.isdigit():
                            pid = item
                            break
                    if pid:
                        cmd = 'kill -9 ' + str(pid)
                        commands.getstatusoutput("adb -s " + dev_dict['serialNumber'] + " shell " + cmd)
Ejemplo n.º 8
0
def check_file_size(path):
    cmd = 'du ' + path + ' -sh'
    stdout, stderr = execute_command_on_server(cmd, False)
    file_size = stdout.split()[0]
    if str(file_size).strip() == '0':
        os.remove(path)
        return 'fail'
    else:
        return 'pass'
def install_android_sdk(device_profile):
    xmlparser_2 = XMLParser.XMLParser(device_profile)
    dev_dict = xmlparser_2.ClientParser()
    cmd = 'tar -zxf ./resource/android-sdk_r18-linux.tgz'   
    execute_command_on_server(cmd, False)
    cmd = 'which adb'
    stdout, stderr = execute_command_on_server(cmd, False)
    cmd = 'ln -s ' + stdout + ' ./android-sdk-linux/tools/adb'
    execute_command_on_server(cmd, False)
    cmd = 'pwd'
    execute_command_on_server(cmd, False)
    stdout, stderr = execute_command_on_server(cmd, False)
    monkeryrunner_env = '#!/usr/bin/env ' + stdout.strip() + '/android-sdk-linux/tools/monkeyrunner'
    # modify monkey_plackback.py
    source_file = open('./resource/monkeyrunner/scripts/monkey_playback.py')
    str = ''
    for line in source_file:
        if line.find('#!/usr/bin/env') != -1:
            continue
        else:
            if line.find('device = MonkeyRunner.waitForConnection') != -1:
                space_str = line[:line.find('device = MonkeyRunner.waitForConnection')]
                line = space_str + 'device = MonkeyRunner.waitForConnection(60, ' + '"' + dev_dict['serialNumber'] + '")\n'
            str += line
    target_file = open('./resource/monkeyrunner/scripts/monkey_playback.py', 'w')
    target_file.write(monkeryrunner_env + '\n' + str)
    # modify monkey_recorder.py
    source_file = open('./resource/monkeyrunner/scripts/monkey_recorder.py')
    str = ''
    for line in source_file:
        if line.find('#!/usr/bin/env') != -1:
            continue
        else:
            if line.find('device = mr.waitForConnection') != -1:
                space_str = line[:line.find('device = mr.waitForConnection')]
                line = space_str + 'device = mr.waitForConnection(60, ' + '"' + dev_dict['serialNumber'] + '")\n'
            str += line
    target_file = open('./resource/monkeyrunner/scripts/monkey_recorder.py', 'w')
    target_file.write(monkeryrunner_env + '\n' + str)
    result = check_android_sdk()
    if result:
        return True
    else:
        return False
Ejemplo n.º 10
0
 def camera(self):
     result = check_android_sdk()
     if not result:
         raise TestException('Error: please run setup.py to install Android SDK')
     if self.stepType == 0 or self.stepType == 10:
         if self.stepType == 10:
             return "noResult"
     
     if self.stepType == 0 or self.stepType == 20:
         print "\nCase preparation: \n"
         SOURCE_CLIP_PATH = '/sdcard/DCIM/Camera/'
         TARGET_CLIP_PATH = get_result_path() + 'VideoCapture/'
         self.cli.execute("rm -rf " + SOURCE_CLIP_PATH + '*')
         self.cli.execute("mkdir -p " + TARGET_CLIP_PATH)
         
         sensor_flag = self.par_dict.get('Sensor', ' ')
         if sensor_flag is None or sensor_flag.strip() == '' or sensor_flag.strip().lower() not in ['front', 'back']:
             raise TestException('ERROR: No Sensor element found or the value of Sensor element should be Front or Back')
         if sensor_flag.lower() == 'front':
             sensor_resolution = FRONT_SENSOR_RESOLUTION
             script_pre = 'Default_Cam_Front_'
         else:
             sensor_resolution = BACK_SENSOR_RESOLUTION
             script_pre = 'Default_Cam_Back_'
             
         duration = self.par_dict.get('Duration', '')
         try:
             duration = int(duration)
         except (ValueError, TypeError), e:
             raise TestException("Error:  no Duration element found or the value of Duration element  must be a number")
         
         resolution = self.par_dict.get('Resolution', '')
         if resolution.strip() == '1080p_modified':
             self.cli.execute_on_host('root')
             self.cli.execute_on_host('remount')
             self.cli.upload('resource/settings/media_profiles.xml', '/etc/')
             self.cli.execute_on_host('reboot')
             time.sleep(120)
             self.cli.execute('svc power stayon usb')
             execute_command_on_server('./resource/settings/unlock.sh ' + self.dev_dict['serialNumber'], False)
         if resolution is None or resolution.strip() == '' or resolution.strip() not in sensor_resolution:
             raise TestException("Error:  no Resolution element found or the value of Resolution element  must be the value in " + ','.join(sensor_resolution))
         if self.platform is not None and self.platform.lower() == 'mfld_r3':
             cmd = 'am start -n com.android.camera/.Camera'
         elif self.platform is not None and self.platform.lower() == 'mfld_r4':
             cmd = 'am start -n com.android.gallery3d/com.android.camera.CameraLauncher'
         elif self.platform is not None and self.platform.lower() == 'ctp':
             cmd = 'am start -n com.android.gallery3d/com.android.camera.CameraLauncher'
         else:
             raise TestException('Error: please specify platform: ctp or mfld_r3 or mfld_r4')
         self.cli.execute(cmd)
         
         if self.caseFolderName.lower().find('zoom_max') != -1:
             pre_script_directory = 'default_camera_zoom'
             script_name = script_pre + resolution.strip() + '.mr'
         elif self.caseFolderName.lower().find('timelapse') != -1:
             pre_script_directory = 'default_camera_timelapse'
             timelapse = self.par_dict.get('Timelapse', '').strip()
             if timelapse == '':
                 raise TestException("Error: no Timelapse element found.")
             timelapse_dict = {'off': '0s', '1': '1s', '1.5': '1s5', '2': '2s', '2.5': '2s5', 
                               '3': '3s', '5': '5s', '10': '10s'}
             script_name = script_pre + resolution.strip() + '-' + timelapse_dict[timelapse.strip().lower()] + '.mr'
         else:
             pre_script_directory = 'default_camera'
             script_name = script_pre + resolution.strip() + '.mr'
             
         if self.platform.lower().find('mfld') != -1:
             script_folder = 'MFLD'
         elif self.platform.lower() == 'ctp':
             script_folder = 'CTP'
             
         cmd = 'resource/monkeyrunner/scripts/monkey_playback.py ' + ' resource/video_caputure_script/' + script_folder + '/' + pre_script_directory + '/' + script_name
         print cmd
         stdout, stderr = execute_command_on_server(cmd, False)
         # press back key, and exit camera UI
         cmd = 'input keyevent 4'
         self.cli.execute(cmd)
         self.cli.execute(cmd)
         # get the clip name for mediainfo
         stdout, stderr = self.cli.execute("ls -al " + SOURCE_CLIP_PATH + ' | grep ^-')
         dirList = stdout.split('\n')
         outputName = ''
         for eachdir in dirList:
             outputName = outputName + (eachdir.split(' ')[-1])
         outputName = outputName.strip()
         
         #pull the clip to test_repo
         os.system("mkdir -p " + path.resultClip_path + '/' + self.caseFolderName + '/')
         self.cli.execute('mv '+ SOURCE_CLIP_PATH + outputName + ' ' + TARGET_CLIP_PATH)
         self.cli.download(TARGET_CLIP_PATH + outputName + " ", path.resultClip_path + '/' + self.caseFolderName + '/')
         
         #obtain mediainfo result on result clip            
         mediainfo_dict = parseMediaInfo(path.resultClip_path + '/' + self.caseFolderName + '/' + outputName)
         for eachItem in mediainfo_dict:           
             self.rt_dict.setdefault(eachItem, mediainfo_dict[eachItem])
         return self.rt_dict 
Ejemplo n.º 11
0
 def capture(self):
     
     SOURCE_CLIP_PATH = '/sdcard/DCIM/Camera/'
     TARGET_CLIP_PATH = get_clip_path() + self.par_dict['Format'] + '/'
     self.cli.execute("rm -rf " + SOURCE_CLIP_PATH + '*')
     self.cli.execute("mkdir -p " + TARGET_CLIP_PATH)
     sensor_flag = self.par_dict.get('Sensor', ' ')
     if sensor_flag is None or sensor_flag.strip() == '' or sensor_flag.strip().lower() not in ['front', 'back']:
         raise TestException('ERROR: No Sensor element found or the value of Sensor element should be Front or Back')
     if sensor_flag.lower() == 'front':
         sensor_resolution = FRONT_SENSOR_RESOLUTION
         script_pre = 'Default_Cam_Front_'
     else:
         sensor_resolution = BACK_SENSOR_RESOLUTION
         script_pre = 'Default_Cam_Back_'
     resolution = self.par_dict.get('Resolution', '')
     if resolution.strip() == '1080p_modified':
         self.cli.execute_on_host('root')
         self.cli.execute_on_host('remount')
         self.cli.upload('resource/settings/media_profiles.xml', '/etc/')
         self.cli.execute_on_host('reboot')
         time.sleep(120)
         self.cli.execute('svc power stayon usb')
         execute_command_on_server('./resource/settings/unlock.sh ' + self.dev_dict['serialNumber'], False)
     if resolution is None or resolution.strip() == '' or resolution.strip() not in sensor_resolution:
         raise TestException("Error:  no Resolution element found or the value of Resolution element  must be the value in " + ','.join(sensor_resolution))
     if self.platform is None:
         script_folder = 'MFLD'
     elif self.platform.lower() == 'ctp':
         script_folder = 'CTP'
     cmd = 'am start -n com.android.camera/.Camera'
     self.cli.execute(cmd)
     cmd = 'resource/monkeyrunner/scripts/monkey_playback.py ' + ' resource/video_caputure_script/' + script_folder + '/default_camera/' + script_pre + resolution.strip() + '.mr'
     print cmd
     stdout, stderr = execute_command_on_server(cmd, False)
     # press back key, and exit camera UI
     cmd = 'input keyevent 4'
     self.cli.execute(cmd)
     self.cli.execute(cmd)
     # get the clip name for mediainfo
     stdout, stderr = self.cli.execute("ls -al " + SOURCE_CLIP_PATH + ' | grep ^-')
     dirList = stdout.split('\n')
     outputName = ''
     for eachdir in dirList:
         outputName = outputName + (eachdir.split(' ')[-1])
     outputName = outputName.strip()
     #pull the clip to test_repo
     os.system("mkdir -p " + path.resultClip_path + '/' + self.caseFolderName + '/')
     self.cli.execute('mv '+ SOURCE_CLIP_PATH + outputName + ' ' + TARGET_CLIP_PATH)
     
     #rename clip
     try:
         cmd = 'mv ' + TARGET_CLIP_PATH + '/' + outputName + ' ' + TARGET_CLIP_PATH + '/' + self.par_dict['InputFile'].strip()
     except KeyError:
         raise TestException("Error: no InputFile element found.")
     self.cli.execute(cmd)
     self.cli.download(TARGET_CLIP_PATH +  self.par_dict['InputFile'].strip() + " ", path.resultClip_path + '/' + self.caseFolderName + '/')
     
     #obtain mediainfo result on result clip            
     mediainfo_dict = parseMediaInfo(path.resultClip_path + '/' + self.caseFolderName + '/' +  self.par_dict['InputFile'].strip())
     
     if mediainfo_dict.get('Resolution').strip() != RESOLUTION_DICT.get(resolution).strip():
         raise TestException("Error: recorded clip's resolution" + mediainfo_dict.get('Resolution').strip() + " isn't right with criteria: " + resolution)
Ejemplo n.º 12
0
    def download_suite(self):
        self.download_item_pass_list = []
        self.fail_download_variable_tool_list = []
        self.fail_download_constant_tool_list = []
        platform = self.dev_dict['Platform']
        if platform == 'MFLD':
            file_list = [
                'h264vld', 'libtestsuite_common.so', 'mpeg4vld',
                'penwell_jpegEncode', 'va_encode', 'vc1vld', 'mediarecorder',
                'mediaplayer', 'mediaframeworktest.apk', 'sf-yuv',
                'sf-playback', 'sf-recorder', 'imageencoder'
            ]
        elif platform == 'MRST':
            file_list = [
                'h264vld', 'libtestsuite_common.so', 'mpeg4vld', 'va_encode',
                'vc1vld'
            ]
        #delete old files
        for item in file_list:
            clear_unuseful_file('./' + item)
        ip = self.get_ip()
        if ip:
            result = self.check_connection(ip)
            if result:
                for item in file_list:
                    execute_command_on_server(
                        'wget --no-proxy %s%s -t 1 -T 20' %
                        (self.ftpAddress, item), False)
                    cmd = 'test -f ' + str(
                        './' + item
                    ) + " && echo 'File exists' || echo 'File not found'"
                    stdout, stderr = execute_command_on_server(cmd, False)
                    if stdout.strip().find('File not found') != -1:
                        self.fail_download_variable_tool_list.append(item)
                    elif stdout.strip().find('File exists') != -1:
                        self.download_item_pass_list.append(item)
            else:
                self.fail_download_variable_tool_list.extend(file_list)
        else:
            self.fail_download_variable_tool_list.extend(file_list)
        if self.fail_download_variable_tool_list:
            print inred('##################### Fail to Download tool(s): ' +
                        ', '.join(self.fail_download_variable_tool_list) +
                        inred('  ######################'))
            print inred(
                'Warning: Please check if they exist under ' +
                self.ftpAddress +
                ', you can ignore this error message if these tools are not required for your execution'
            )

        # download tools that doesn't need to be compiled for every build
        tool_list = ['matrix', 'cjpeg', 'djpeg']
        another_tool = 'imagedecoder'
        result = self.check_connection('172.16.123.192')
        if result:
            if self.platform is not None and self.platform.strip().lower(
            ) == 'ctp':
                url = 'http://172.16.123.192/media_resource/rapidrunner_tool/ctp/'
            else:
                url = 'http://172.16.123.192/media_resource/rapidrunner_tool/mfld/'

            for tool in tool_list:
                execute_command_on_server(
                    "wget --no-proxy %s%s -t 1 -T 30 " % (url, tool), False)
                cmd = 'test -f ' + str(
                    './'
                ) + tool + " && echo 'File exists' || echo 'File not found'"
                stdout, stderr = execute_command_on_server(cmd, False)
                if stdout.strip().find('File not found') != -1:
                    self.fail_download_constant_tool_list.append(tool)
                elif stdout.strip().find('File exists') != -1:
                    self.download_item_pass_list.append(tool)

            folder = ''
            build_name = get_build_name()
            if build_name.lower().strip().find('r3') != -1:
                folder = 'ICS/'
            elif build_name.lower().strip().find('r4') != -1:
                folder = 'JB/'
            if folder:
                downloadurl = url + folder + another_tool
                execute_command_on_server(
                    "wget --no-proxy %s -T 30" % downloadurl, False)
                cmd = 'test -f ' + str(
                    './'
                ) + another_tool + " && echo 'File exists' || echo 'File not found'"
                stdout, stderr = execute_command_on_server(cmd, False)
                if stdout.strip().find('File not found') != -1:
                    self.fail_download_constant_tool_list.append(another_tool)
                elif stdout.strip().find('File exists') != -1:
                    self.download_item_pass_list.append(another_tool)
        else:
            self.fail_download_constant_tool_list.extend(tool_list)
            self.fail_download_constant_tool_list.extend(another_tool)
        if self.fail_download_constant_tool_list:
            print inred('##################### Fail to Download tool(s) ' +
                        ','.join(self.fail_download_constant_tool_list) +
                        ' ######################')
            print inred(
                'Warning: Contact developer if you need these tools in execution, or else ignore this error.'
            )
def _install_crypto():
    execute_command_on_server("cd resource/pycrypto-2.3/ ; python setup.py install", False)
    return _check_crypto()
def _install_paramiko():
    stdout, stderr = execute_command_on_server('cd resource/paramiko-1.7.4/ ; python setup.py install', False)
    return _check_paramiko()
def _check_paramiko():
    stdout, stderr = execute_command_on_server('python tools/import_paramiko.py', False)
    if stdout.find('No module named paramiko') != -1 or stderr.find('No module named paramiko') != -1:
        return False
    else:
        return True
Ejemplo n.º 16
0
 def download_suite(self):
     self.download_item_pass_list = []
     self.fail_download_variable_tool_list = []
     self.fail_download_constant_tool_list = []
     platform = self.dev_dict['Platform']
     if platform == 'MFLD': 
         file_list = ['h264vld', 'libtestsuite_common.so', 'mpeg4vld', 'penwell_jpegEncode',  'va_encode', 'vc1vld', 'mediarecorder', 'mediaplayer', 'mediaframeworktest.apk','sf-yuv' ,'sf-playback','sf-recorder', 'imageencoder']
     elif platform == 'MRST': 
         file_list = ['h264vld', 'libtestsuite_common.so', 'mpeg4vld', 'va_encode', 'vc1vld']
     #delete old files 
     for item in file_list:
         clear_unuseful_file('./' + item)
     ip = self.get_ip()
     if ip:
         result = self.check_connection(ip)
         if result:
             for item in file_list:
                 execute_command_on_server('wget --no-proxy %s%s -t 1 -T 20' %(self.ftpAddress, item), False)
                 cmd = 'test -f ' + str('./' + item) + " && echo 'File exists' || echo 'File not found'"
                 stdout, stderr = execute_command_on_server(cmd, False)
                 if stdout.strip().find('File not found') != -1:
                     self.fail_download_variable_tool_list.append(item)
                 elif stdout.strip().find('File exists') != -1:
                     self.download_item_pass_list.append(item)
         else:
             self.fail_download_variable_tool_list.extend(file_list)
     else:
         self.fail_download_variable_tool_list.extend(file_list)
     if self.fail_download_variable_tool_list:
         print inred('##################### Fail to Download tool(s): ' + ', '.join(self.fail_download_variable_tool_list) + inred('  ######################'))
         print inred('Warning: Please check if they exist under ' + self.ftpAddress + ', you can ignore this error message if these tools are not required for your execution')
     
     # download tools that doesn't need to be compiled for every build
     tool_list = ['matrix', 'cjpeg', 'djpeg']
     another_tool = 'imagedecoder'
     result = self.check_connection('172.16.123.192')
     if result:
         if self.platform is not None and self.platform.strip().lower() == 'ctp':
             url = 'http://172.16.123.192/media_resource/rapidrunner_tool/ctp/'
         else:
             url = 'http://172.16.123.192/media_resource/rapidrunner_tool/mfld/' 
         
         for tool in tool_list:
             execute_command_on_server("wget --no-proxy %s%s -t 1 -T 30 " %(url, tool), False)
             cmd = 'test -f ' + str('./') + tool + " && echo 'File exists' || echo 'File not found'"
             stdout, stderr = execute_command_on_server(cmd, False)
             if stdout.strip().find('File not found') != -1:
                 self.fail_download_constant_tool_list.append(tool)
             elif stdout.strip().find('File exists') != -1:
                 self.download_item_pass_list.append(tool)
         
         folder = ''
         build_name = get_build_name()
         if build_name.lower().strip().find('r3') != -1:
             folder = 'ICS/'
         elif build_name.lower().strip().find('r4') != -1:
             folder = 'JB/'
         if folder:
             downloadurl = url + folder + another_tool
             execute_command_on_server("wget --no-proxy %s -T 30" %downloadurl, False)
             cmd = 'test -f ' + str('./') + another_tool + " && echo 'File exists' || echo 'File not found'"
             stdout, stderr = execute_command_on_server(cmd, False)
             if stdout.strip().find('File not found') != -1:
                 self.fail_download_constant_tool_list.append(another_tool)
             elif stdout.strip().find('File exists') != -1:
                 self.download_item_pass_list.append(another_tool)
     else:
         self.fail_download_constant_tool_list.extend(tool_list)
         self.fail_download_constant_tool_list.extend(another_tool)
     if self.fail_download_constant_tool_list:
         print inred('##################### Fail to Download tool(s) ' + ','.join(self.fail_download_constant_tool_list) +' ######################')
         print inred('Warning: Contact developer if you need these tools in execution, or else ignore this error.')
Ejemplo n.º 17
0
def get_device_list():
    stdout, stderr = execute_command_on_server('adb devices', False)
    line_list = stdout.split(os.linesep)[1:]
    device_list = [line.split('\t')[0] for line in line_list if line]
    return device_list
Ejemplo n.º 18
0
def get_device_list():
    stdout, stderr = execute_command_on_server('adb devices', False)
    line_list = stdout.split(os.linesep)[1:]
    device_list = [line.split('\t')[0] for line in line_list if line]
    return device_list