Home | History | Annotate | Download | only in enterprise_CFM_Test
      1 # Copyright 2016 The Chromium OS Authors. All rights reserved.
      2 # Use of this source code is governed by a BSD-style license that can be
      3 # found in the LICENSE file.
      4 
      5 from autotest_lib.server import utils
      6 
      7 AUTHOR = "mzhuo (a] chromium.org"
      8 NAME = "enterprise_CFM_Test.mimo"
      9 TIME = "LONG"
     10 TEST_CATEGORY = "Functional"
     11 TEST_CLASS = "enterprise"
     12 TEST_TYPE = "server"
     13 DEPENDENCIES = ""
     14 JOB_RETRIES = 1
     15 
     16 DOC = """
     17 This test verifies peripherals for Bluestreak.
     18 Tests and verifications can be selected in control file.
     19 action_list defines the list of all available tests, which are keys for dict
     20 action_list, value for the key defines how many times this test will be run
     21 in one loop.
     22 
     23 verification_list defineds the list of all available verifications,
     24 which are keys for dict verification_list. True means this verification specified
     25 by this key will be performed.
     26 
     27 Testing flow can be set in control file.
     28 test_flow_control defines:
     29 1. runtestonly, if True, no cleartmp and enrollment are done before test,
     30                 and no cleartpm is done after test.  Before running test on CfM
     31                 we assume the CfM is enrolled,
     32                 else, cleartpm and enrollment will be done before test,
     33                 and cleartmp is done afterwards.
     34 2. setupcleanup, (TODO)if True, before exit from test cleanup is done,
     35                  else, no cleanup before exit.
     36                  This provides way to keep setup stays in original status when test
     37                  is aborted.
     38 3. abort_on_failure: if True, test is aborted if test fails or verification fails,
     39                      else, test continutes.
     40 4. random_mode: if True, sequence of multiple test in one loop is randomized everytime.
     41                 else, sequence is same for all loops.
     42 5. recovery_on_fatal_failure: if True, reboot CfM when fatal failure occurs,
     43                               else, no reboot.
     44 6. skip_cfm_check: All working CfM should have speaker, camera connected.
     45              For Bluestreak in addition to speaker/camera, Mimo should be connected.
     46              If True script checks the above statement before starting test,
     47              else, no check will be done before test starts.
     48 7. debug: If True, script prints more informations, for example, cli output, name of
     49           test and verification. This is intend to give user more output for information
     50           purpose. This is different from logging.debug which is turned on by "--debug"
     51           when  kickstarting script,
     52           else, less output.
     53 8. report: If True, after each loop script prints out summary for test and verification.
     54 
     55 Dict error_key_words provides the list of error logs which script checks and verify.
     56 If script finds any of them in the log, script claims test failure. This list can be
     57 updated on the fly. Dict has keys, the value for each key is the list which contains
     58 the list of error log script looks for when scanning log files.
     59 
     60 How to run it:
     61 1. Run cros_sdk
     62 2. Go to ~/chromiumos/src/third_party/autotest/files/server/site_tests/enterprise_CFM_Test
     63 3. Edit control file. Replace meeting_code working for CfM to be tested.
     64 4. Update test_config, action_config, verification_config, test_flow_control ane etc properly.
     65 5. Issue command line to kickstart autotest:
     66 test_that --autotest_dir ~/trunk/src/third_party/autotest/files/ --board=guado
     67 100.123.174.2 enterprise_CFM_Test.demo
     68 
     69 """
     70 
     71 args_dict = utils.args_to_dict(args)
     72 
     73 error_key_words = {'usb': [
     74                    'Setup ERROR: setup context command',
     75                    'URB transfer length is wrong',
     76                    'device descriptor read',
     77                    'unable to enumerate USB device',
     78                    'hub_port_status failed',
     79                    'cannot reset port',
     80                    'nonzero write bulk status received',
     81                    'Device not responding to setup address',
     82                    'device not accepting address',
     83                    'Set SEL for device-initiated U2 failed',
     84                    'Set SEL for device-initiated U1 failed',
     85                    'Disable of device-initiated U1 failed',
     86                    'Disable of device-initiated U2 failed',
     87                    'usb_set_interface failed',
     88                    'MIMO has wedged; issuing hub reset'
     89                   ],
     90                    'kernel': [
     91                    'ERROR Transfer event TRB DMA ptr',
     92                    'crashes with segfault',
     93                    'segfault at',
     94                    'cut here',
     95                    'end trace',
     96                    'Failed to resubmit video URB',
     97                    'go2001_watchdog:',
     98                    'go2001_ctx_error_locked:'
     99                   ],
    100                    'video': [
    101                    'uvcvideo: Failed to query',
    102                    'VIDIOC_DQBUF failed',
    103                    'uvcvideo: Non-zero status'
    104                    'uvcvideo: Failed to set UVC commit control',
    105                    'uvcvideo: UVC non compliance',
    106                    'Failed to resubmit video URB',
    107                    'No streaming interface found',
    108                    'Dequeued v4l2 buffer contains corrupted data'
    109                   ],
    110                    'audio': [
    111                    'hw_params: Input/output error: rate:',
    112                    'Init device retry failed',
    113                    'Init Hangouts Meet speakermic: USB Audio',
    114                    'usb_set_interface failed',
    115                    'hw_params: Input/output error: rate:',
    116                    'Init device retry failed',
    117                   ],
    118                    'chrome': [
    119                    '#No match for getting seqNum',
    120                    'Cannot get RenderProcess',
    121                    'segfault at',
    122                    'ERR crash_reporter',
    123                    'Watchdog resetting firmware',
    124                    'Failed to create scanout buffer',
    125                    'Failed to enable controller',
    126                    'Failed to configure: device',
    127                    'Failed to export buffer to dma_buf',
    128                    'Failed to take control of the display',
    129                    'WARNING: texture bound to texture unit 0 is not renderable',
    130                    'Failed to modeset controller'
    131                   ],
    132                    'atrus': [
    133                    '#Internal TrueVoice parameters',
    134                    'write: Connection timed out',
    135                    'Error: report failed',
    136                    'write: Broken pipe',
    137                    'protocol error'
    138                   ],
    139                    'usb_stability': [
    140                    '#autotest',
    141                    'USB disconnect',
    142                    'New USB device found',
    143                   ]
    144 }
    145 
    146 
    147 # !!! Please change meeting code working for CfM.
    148 # !!! If meeting_code for different domain is used, meeting might be timeout.
    149 # vol_change_mode: if set to 1, make one call to set voluem to target volume,
    150 #                  else, make multiple calls to update volume until volume
    151 #                  equals to target volume.
    152 test_config = {
    153                'gpio_list': ['218','219', '209'],
    154                'gpiopause': 8,
    155                'puts': "17e9:016b,266e:0110",
    156                'is_meeting': 1,
    157                'meeting_code': 'otg-dkps-ovj', # this works for crosprq4.com
    158                'repeat': 200,
    159                'reboot_timeout': 30,
    160                'loop_timeout': 60,
    161                'action_timeout': 10,
    162                'min_timeout': 5,
    163                'debug_timeout': 9999,
    164                'vol_change_step': 6,
    165                'vol_change_mode': 1,
    166                'reboot_after_min_meets': 5,
    167                'gpio_after_min_meets': 10
    168 }
    169 
    170 #action_config['meeting_test'] should be 0, 1.
    171 #  0: no meeting test to be done
    172 #  1: In each loop first CfM joins meeting, after all tests are done,
    173 #     CfM leaves meeting.
    174 #the value of 'mute_unmute_camera_test', 'mute_unmute_mic_test' and
    175 #'speaker_volume_test" and etc is number of test for each key to be done in
    176 #one meeting.
    177 action_config = {
    178                  'meeting_test': 1,
    179                  'mute_unmute_camera_test': 0,
    180                  'mute_unmute_mic_test': 0,
    181                  'speaker_volume_test': 0,
    182                  'gpio_test': 1,
    183                  'reboot_test': 1,
    184                  'reset_usb_test': 0,
    185                  'flap_monitor_test': 0
    186 }
    187 
    188 
    189 verification_config = {
    190                       'check_usb_enumeration':True,
    191                       'check_usb_inf_init': True,
    192                       'check_v4l2_interface': True,
    193                       'check_audio_card':  True,
    194                       'check_cras_speaker': False,
    195                       'check_cras_mic': False,
    196                       'check_cras_pspeaker': False,
    197                       'check_cras_pmic': False,
    198                       'check_cras_speaker_vol': False,
    199                       'check_cras_mic_mute': False,
    200                       'check_prefer_camera': False,
    201                       'check_camera_mute': False,
    202                       'check_audio_stream': False,
    203                       'check_video_stream': False,
    204                       'check_hotrod_speaker': False,
    205                       'check_hotrod_mic': False,
    206                       'check_hotrod_camera': False,
    207                       'check_hotrod_pspeaker': False,
    208                       'check_hotrod_pmic': False,
    209                       'check_hotrod_pcamera': False,
    210                       'check_hotrod_speaker_vol': False,
    211                       'check_hotrod_mic_state': False,
    212                       'check_hotrod_camera_state': False,
    213                       'check_usb_errorlog': True,
    214                       'check_kernel_errorlog': True,
    215                       'check_video_errorlog': False,
    216                       'check_audio_errorlog': True,
    217                       'check_chrome_errorlog': True,
    218                       'check_atrus_errorlog': True,
    219                       'check_usb_stability': True,
    220                       'check_process_crash': False,
    221                       'check_kernel_panic': False
    222 }
    223 
    224 
    225 test_flow_control = {
    226                      'runtestonly': True,
    227                      'setupcleanup': True,
    228                      'abort_on_failure': True,
    229                      'random_mode': True,
    230                      'recovery_on_fatal_failure': False,
    231                      'skip_cfm_check': True,
    232                      'debug': True,
    233                      'report': True
    234 }
    235 
    236 
    237 def run_test(machine):
    238     host = hosts.create_host(machine)
    239     run_test_only = test_flow_control['runtestonly']
    240     job.run_test('enterprise_CFM_Test', host=host,
    241                   run_test_only=run_test_only,
    242                   test_config=test_config, action_config=action_config,
    243                   verification_config=verification_config,
    244                   error_key_words=error_key_words,
    245                   test_flow_control=test_flow_control,
    246                   tag='mimo')
    247 
    248 
    249 parallel_simple(run_test, machines)
    250