1 # Copyright (c) 2013 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.client.common_lib import error 6 from autotest_lib.client.common_lib.cros.network import ap_constants 7 from autotest_lib.server import test 8 9 class network_WiFi_ChaosConfigFailure(test.test): 10 """ Test to grab debugging info about chaos configuration falures. """ 11 12 version = 1 13 14 15 def run_once(self, ap, error_string): 16 """ Main entry function for autotest. 17 18 There are three pieces of information we want to grab: 19 1.) Screenshot at the point of failure 20 2.) Screenshots of all pages 21 3.) Stack trace of failure 22 23 @param ap: an APConfigurator object 24 @param error_string: String with the Configurator error description 25 26 """ 27 if ap_constants.AP_CONFIG_FAIL in error_string: 28 ap.debug_last_failure(self.outputdir) 29 30 ap.debug_full_state(self.outputdir) 31 32 if ap_constants.AP_PDU_DOWN in error_string: 33 raise error.TestError('The AP was not configured because the PDU ' 34 'is down. See the ERROR log for more details.' 35 '\n%s', ap.name) 36 37 if ap_constants.AP_CONFIG_FAIL in error_string: 38 raise error.TestError('The AP was not configured correctly. Please ' 39 'see the ERROR log for more details.\n%s', 40 ap.name) 41 elif ap_constants.AP_SECURITY_MISMATCH in error_string: 42 raise error.TestError('The AP was not configured with correct ' 43 'security. Please check screenshots to ' 44 'debug.\n%s', ap.name) 45 elif ap_constants.WORK_CLI_CONNECT_FAIL in error_string: 46 raise error.TestError('Work client was not able to connect to ' 47 'the AP. Please check screenshots to ' 48 'debug.\n%s', ap.name) 49 else: 50 raise error.TestError('The SSID %s was not found in the scan. ' 51 'Check the screenshots to debug.\n%s', 52 ap.ssid, ap.name) 53