• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1# Copyright (c) 2014 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 = "Harpreet Grewal <harpreet@chromium.org>"
8NAME = "cellular_StaleModemReboot"
9PURPOSE = "Verify modem is available for testing."
10CRITERIA = """
11This test will fail if either there is no response to modem status command or
12modem is in a non testable state after two or more tries.
13"""
14TIME = "SHORT"
15TEST_CATEGORY = "Functional"
16TEST_CLASS = "network"
17TEST_TYPE = "server"
18ATTRIBUTES = "suite:cellular_modem_repair"
19SUITE = "cellular_modem_repair"
20DEPENDENCIES = "servo"
21
22DOC = """
23  Tests that a cellular modem is available for testing.
24
25  The test attempts to detect the modem state by running the modem status
26  command on the DUT and strips the state from its output. The test saves the
27  original modem state and reboots the DUT regardless of what state the modem
28  is in. After the reboot, it tries to get the modem state again and if the
29  modem does not respond or the state is one of the following as listed below,
30  it tries to reboot the DUT for a maximum of two tries by default. User can
31  override the number of tries by passing a tries flag with a desired value.
32
33  REBOOT STATES (If modem is in any of these states, DUT is cold rebooted using
34  the servo.):
35  MODEM STATE FAILED = -1
36  MODEM STATE UNKNOWN = 0
37  MODEM STATE DISABLED = 3
38  MODEM STATE DISABLING = 4
39  MODEM STATE DISCONNECTING = 9
40  GOBI MODEM STATE UNKNOWN = 0
41  GOBI MODEM STATE DISABLED = 10
42  GOBI MODEM STATE DISABLING = 20
43  GOBI MODEM STATE DISCONNECTING = 70
44
45  WAIT DELAY STATES (Waits for a maximum of 120 seconds for the modem to get
46  into a testable state. If the modem is still not in a stable state after the
47  first try, DUT will be rebooted.):
48  MODEM STATE INITIALIZING = 1
49  MODEM STATE ENABLING = 5
50  MODEM STATE ENABLED = 6
51  MODEM STATE SEARCHING = 7
52  GOBI MODEM STATE ENABLING = 30
53  GOBI MODEM STATE ENABLED = 40
54  GOBI MODEM STATE SEARCHING = 50
55
56  STABLE STATES (Test does nothing.):
57  MODEM STATE REGISTERED = 8
58  MODEM STATE CONNECTING = 10
59  MODEM STATE CONNECTED = 11
60  GOBI MODEM STATE REGISTERED = 60
61  GOBI MODEM STATE CONNECTING = 80
62  GOBI MODEM STATE CONNECTED = 90
63
64  LOCKED STATE (Test fails, the device should never be in this state unless
65  the SIM is locked):
66  MODEM STATE LOCKED = 2
67
68"""
69
70args_dict = utils.args_to_dict(args)
71servo_args = hosts.CrosHost.get_servo_arguments(args_dict)
72
73def run_StaleModemReboot(machine):
74    host = hosts.create_host(machine, servo_args=servo_args)
75    tries = int(args_dict.get('tries', 2))
76    job.run_test('cellular_StaleModemReboot', host=host, tries=tries)
77
78parallel_simple(run_StaleModemReboot, machines)
79