blob: 2d50ee18bcc7c8af404329af18915bf20f58d0d2 [file] [log] [blame]
# Copyright (c) 2013 The Chromium OS Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
import traceback
from import ap_constants
from autotest_lib.server import utils
AUTHOR = 'krisr, wiley, jabele'
NAME = 'network_WiFi_ChaosConfigFailure'
TEST_TYPE = 'server'
DOC = """
This test is run when a chaos APConfigurator fails to successfully configure
an AP. It will grab screenshots and print stack traces of the failure.
This control file is only run directly to simulate APConfigurator failures for
test purposes.
from autotest_lib.server.cros.chaos_ap_configurators \
import ap_configurator_factory
from autotest_lib.server.cros.chaos_ap_configurators import ap_spec
def run_chaos_config_failure(machine):
args_dict = utils.args_to_dict(args)
host = hosts.create_host(machine)
debug_aps = ['chromeos3-row2-rack1-host3',]
tested_ap_spec = ap_spec.APSpec(hostnames=debug_aps)
factory = ap_configurator_factory.APConfiguratorFactory()
ap = factory.get_ap_configurators_by_spec(tested_ap_spec)[0]
## Simulate test failure by forcing state and gathering artifacts
raise RuntimeError("Simulated APConfigurator Error")
except Exception:
trace = ''.join(traceback.format_exc())
job.run_test('network_WiFi_ChaosConfigFailure', ap=ap,
error_string=ap_constants.AP_CONFIG_FAIL, tag=ap.ssid)
parallel_simple(run_chaos_config_failure, machines)