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 5from autotest_lib.server import utils 6 7AUTHOR = "mzhuo@chromium.org" 8NAME = "enterprise_CFM_Test.atrus" 9TIME = "LONG" 10TEST_CATEGORY = "Functional" 11TEST_CLASS = "enterprise" 12TEST_TYPE = "server" 13DEPENDENCIES = "" 14JOB_RETRIES = 1 15 16DOC = """ 17This test verifies peripherals for Bluestreak. 18Tests and verifications can be selected in control file. 19action_list defines the list of all available tests, which are keys for dict 20action_list, value for the key defines how many times this test will be run 21in one loop. 22 23verification_list defineds the list of all available verifications, 24which are keys for dict verification_list. True means this verification specified 25by this key will be performed. 26 27Testing flow can be set in control file. 28test_flow_control defines: 291. 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. 342. 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. 383. abort_on_failure: if True, test is aborted if test fails or verification fails, 39 else, test continutes. 404. random_mode: if True, sequence of multiple test in one loop is randomized everytime. 41 else, sequence is same for all loops. 425. recovery_on_fatal_failure: if True, reboot CfM when fatal failure occurs, 43 else, no reboot. 446. 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. 487. 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. 538. report: If True, after each loop script prints out summary for test and verification. 54 55Dict error_key_words provides the list of error logs which script checks and verify. 56If script finds any of them in the log, script claims test failure. This list can be 57updated on the fly. Dict has keys, the value for each key is the list which contains 58the list of error log script looks for when scanning log files. 59 60How to run it: 611. Run cros_sdk 622. Go to ~/chromiumos/src/third_party/autotest/files/server/site_tests/enterprise_CFM_Test 633. Edit control file. Replace meeting_code working for CfM to be tested. 644. Update test_config, action_config, verification_config, test_flow_control ane etc properly. 655. Issue command line to kickstart autotest: 66test_that --autotest_dir ~/trunk/src/third_party/autotest/files/ --board=guado 67100.123.174.2 enterprise_CFM_Test.demo 68 69""" 70 71args_dict = utils.args_to_dict(args) 72 73error_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. 152test_config = { 153 'gpio_list': ['218','219', '209'], 154 'gpiopause': 8, 155 'puts': "18d1:8001", 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. 177action_config = { 178 'meeting_test': 1, 179 'mute_unmute_camera_test': 0, 180 'mute_unmute_mic_test': 3, 181 'speaker_volume_test': 3, 182 'gpio_test': 1, 183 'reboot_test': 1, 184 'reset_usb_test': 0, 185 'flap_monitor_test': 0 186} 187 188 189verification_config = { 190 'check_usb_enumeration':True, 191 'check_usb_inf_init': True, 192 'check_v4l2_interface': False, 193 'check_audio_card': True, 194 'check_cras_speaker': True, 195 'check_cras_mic': True, 196 'check_cras_pspeaker': True, 197 'check_cras_pmic': True, 198 'check_cras_speaker_vol': True, 199 'check_cras_mic_mute': True, 200 'check_prefer_camera': False, 201 'check_camera_mute': False, 202 'check_audio_stream': True, 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': True, 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 225test_flow_control = { 226 'reboot_before_start' : False, 227 'runtestonly': True, 228 'setupcleanup': True, 229 'abort_on_failure': True, 230 'random_mode': True, 231 'recovery_on_fatal_failure': False, 232 'skip_cfm_check': True, 233 'debug': True, 234 'report': True 235} 236 237 238def run_test(machine): 239 host = hosts.create_host(machine) 240 run_test_only = test_flow_control['runtestonly'] 241 job.run_test('enterprise_CFM_Test', host=host, 242 run_test_only=run_test_only, 243 test_config=test_config, action_config=action_config, 244 verification_config=verification_config, 245 error_key_words=error_key_words, 246 test_flow_control=test_flow_control, 247 tag='atrus') 248 249 250parallel_simple(run_test, machines) 251