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
5import logging
6
7from autotest_lib.client.common_lib import error
8from autotest_lib.server import autotest
9from autotest_lib.server import hosts
10from autotest_lib.server import test
11
12
13class bluetooth_RegressionServer(test.test):
14    """Server part of the Bluetooth Semi-Automatic Regression Tests."""
15    version = 1
16
17    def run_once(self, client_ip, device_addrs):
18        """Run Server side of Bluetooth Regression tests.
19
20        @param client_ip: Device under test.
21        @param device_addrs: MAC addresses of Bluetooth devices under test.
22        """
23        if not client_ip:
24            error.TestError('Must provide client\'s IP address to test')
25
26        client = hosts.create_host(client_ip)
27        client_at = autotest.Autotest(client)
28
29        logging.info('Running client side tests')
30        client_at.run_test('bluetooth_RegressionClient',
31                            addrs=device_addrs, close_browser=False,
32                            test_phase='reboot')
33        logging.info('Starting reboot from Server')
34        client.reboot()
35        logging.info('Returning to Client after reboot')
36        client_at.run_test('bluetooth_RegressionClient',
37                           addrs=device_addrs, test_phase='client')
38