コード例 #1
0
    def run_once(self, pair, udp, bidirectional, time, stream_list):
        print "running on %s and %s\n" % (pair[0], pair[1])

        # Designate a lable for the server side tests.
        server_label = 'net_server'

        tagname = "%s_%s" % (pair[0], pair[1])
        server = hosts.create_host(pair[0])
        client = hosts.create_host(pair[1])

        # Ensure the client doesn't have the server label.
        platform_label = client.get_platform_label()
        if platform_label == server_label:
            (server, client) = (client, server)

        # Disable IPFilters if they are present.
        for m in [client, server]:
            status = m.run('iptables -L')
            if not status.exit_status:
                m.disable_ipfilters()

        server_at = autotest.Autotest(server)
        client_at = autotest.Autotest(client)

        template = ''.join([
            "job.run_test('iperf', server_ip='%s', client_ip=",
            "'%s', role='%s', udp=%s, bidirectional=%s,",
            "test_time=%d, stream_list=%s, tag='%s')"
        ])

        server_control_file = template % (server.ip, client.ip, 'server', udp,
                                          bidirectional, time, stream_list,
                                          tagname)
        client_control_file = template % (server.ip, client.ip, 'client', udp,
                                          bidirectional, time, stream_list,
                                          tagname)

        server_command = subcommand.subcommand(
            server_at.run, [server_control_file, server.hostname])
        client_command = subcommand.subcommand(
            client_at.run, [client_control_file, client.hostname])

        subcommand.parallel([server_command, client_command])

        for m in [client, server]:
            status = m.run('iptables -L')
            if not status.exit_status:
                m.enable_ipfilters()
コード例 #2
0
    def run_once(self, host=None):
        self.client = host
        self.client_at = autotest.Autotest(self.client)
        self.client_test = 'hardware_TPMFirmware'

        self.job.set_state("client_status", None)

        # Set up the client in the unowned state.
        self.reboot_client()
        self.tpm_run("tpmtest_clear", ignore_status=True)

        self.reboot_client()
        self.tpm_run("tpmtest_enable", ignore_status=True)

        self.reboot_client()
        self.tpm_run("tpmtest_readonly")

        self.reboot_client()
        self.tpm_run("tpmtest_globallock")

        self.reboot_client()
        self.tpm_run("takeownership")

        self.reboot_client()
        self.tpm_run("tpmtest_readonly")

        self.reboot_client()
        self.tpm_run("tpmtest_globallock")
コード例 #3
0
    def run_once(self, host, num_iterations=100, exit_condition=None):
        self.host = host

        # Make sure the device is logged in so TPM activity doesn't keep it
        # awake
        self.client_at = autotest.Autotest(self.host)
        self.client_at.run_test('login_LoginSuccess')

        failed_runs = []
        fail_count = 0
        logging.info("Running Cr50 USB stress test for %d iterations",
                     num_iterations)

        for iteration in xrange(num_iterations):
            if iteration:
                time.sleep(self.SLEEP_DELAY)

            i = iteration + 1
            logging.info("Run %d of %d%s", i, num_iterations,
                         " %d failures" % fail_count if fail_count else "")
            try:
                # Run usb_updater command.
                result = self.host.run("usb_updater -f")
            except Exception, e:
                failed_runs.append(str(i))
                fail_count += 1
                logging.debug(e)

                if exit_condition == "immediately":
                    raise error.TestFail("USB failure on run %d of %d" %
                        (i, num_iterations))

                logging.info("USB failure on %d out of %d runs: %s", fail_count,
                    i, ', '.join(failed_runs))
コード例 #4
0
    def run_once(self, host, power_addr, outlet, username, password):
        # check parameters
        if power_addr == None:
            raise error.TestFail('Missing power_addr argument.')
        if outlet == None:
            raise error.TestFail('Missing outlet argument.')
        if username == None:
            raise error.TestFail('Missing user parameter.')
        if password == None:
            raise error.TestFail('Missing pass parameter.')

        outlet = int(outlet)

        at = autotest.Autotest(host)
        boot_id = host.get_boot_id()

        # log in and verify things work
        self.job.set_state('client_fail', True)
        at.run_test('platform_CryptohomeSyncStress',
                    username=username, password=password)
        if self.job.get_state('client_fail'):
            raise error.TestFail('Client test failed')

        # wait for some delay
        delay = random.randint(0, self.max_delay)
        print 'Delaying for %s seconds and then restarting.' % (delay)
        time.sleep(delay)

        # restart client
        power_strip.PowerStrip(power_addr).reboot(outlet)
        host.wait_for_restart(old_boot_id=boot_id)
    def run_once(self, host, client_autotest):
        """This test verify that user should get default brightness
        after rebooting the device with maximum brigntness level.
        """
        if host.has_internal_display() is None:
            raise error.TestNAError('Test can not processed on '
                                    'devices without internal display')
        autotest_client = autotest.Autotest(host)
        host.reboot()
        autotest_client.run_test(client_autotest, exit_without_logout=True)

        initial_bright = self.backlight_control(self.GET_BRIGHTNESS_FLAG, host)

        if initial_bright < 10.0 or initial_bright > 90.0:
            raise error.TestFail('Default brightness level is out '
                                 'of scope(10% - 90%): %f' % (initial_bright))

        self.backlight_control('%s=0' % (self.SET_BRIGHTNESS_FLAG), host)
        if not self.backlight_control(self.GET_BRIGHTNESS_FLAG, host) == 0:
            raise error.TestFail('Not able to change the brightness '
                                 'to minum(0%) level')
        self.backlight_control('%s=100' % (self.SET_BRIGHTNESS_FLAG), host)
        if not self.backlight_control(self.GET_BRIGHTNESS_FLAG, host) == 100:
            raise error.TestFail('Not able to change the brightness '
                                 'to maximum(100%) level')

        host.reboot()
        autotest_client.run_test(client_autotest, exit_without_logout=True)
        bright_after_reboot = self.backlight_control(self.GET_BRIGHTNESS_FLAG,
                                                     host)
        if not initial_bright == bright_after_reboot:
            raise error.TestFail('Not able to reset default brightness\n'
                                 'Previous boot default brightness: %f\n'
                                 'Current boot default brightness: %f' %
                                 (initial_bright, bright_after_reboot))
コード例 #6
0
    def run_once(self, host=None):
        self.client = host
        self.client_test = 'platform_TrackpadStress'

        logging.info('TrackpadStressServer: start client test')
        client_at = autotest.Autotest(self.client)
        if not self._run_client_test(client_at):
            raise error.TestFail('Client test failed precheck state')

        # Configure the client to reboot on a kernel panic
        self.client.run('sysctl kernel.panic|grep "kernel.panic = -1"')
        self.client.run('sysctl kernel.panic_on_oops|'
                        'grep "kernel.panic_on_oops = 1"')

        boot_id = self.client.get_boot_id()

        # Make it rain
        command = 'echo BUG > /sys/kernel/debug/provoke-crash/DIRECT'
        command += '|| echo bug > /proc/breakme'
        logging.info('TrackpadStressServer: executing "%s" on %s', command,
                     self.client.hostname)
        try:
            # Simply writing to the crash interface resets the target
            # immediately, leaving files unsaved to disk and the master ssh
            # connection wedged for a long time. The sequence below borrowed
            # from logging_KernelCrashServer.py makes sure that the test
            # proceeds smoothly.
            self.client.run('sh -c "sync; sleep 1; %s" >/dev/null 2>&1 &' %
                            command)
        except error.AutoservRunError, e:
            # It is expected that this will cause a non-zero exit status.
            pass
コード例 #7
0
 def run_client_side_test(self):
     """Runs a client side test on Cros device in background."""
     self.client_at = autotest.Autotest(self.host)
     logging.info('Start running client side test %s',
                  arc_resource_common.MicrophoneProps.TEST_NAME)
     self.client_at.run_test(arc_resource_common.MicrophoneProps.TEST_NAME,
                             background=True)
コード例 #8
0
    def run_once(self):
        """Set up two APs, run the client side test and then exit.

        @param host: A host object representing the DUT.
        @param test: Test to be run on the client side.

        """
        self.context.router.require_capabilities(
            [site_linux_system.LinuxSystem.CAPABILITY_MULTI_AP])
        self.context.router.deconfig()

        # Configure first AP with channel 5 and mode G and default ssid.
        self._config_ap(5, hostap_config.HostapConfig.MODE_11G)
        self._host = self.context.client.host

        client_at = autotest.Autotest(self._host)
        ssid = self.context.router.get_ssid(instance=0)
        client_at.run_test('network_RoamWifiEndToEnd',
                           tag='connect',
                           ssid=ssid,
                           test=chrome_net_constants.OPEN_CONNECT)
        # Configure second AP with channel 149, mode N and same ssid as before.
        self._config_ap(149, hostap_config.HostapConfig.MODE_11N_PURE, ssid)
        ssid = self.context.router.get_ssid(instance=1)

        # Bring down the AP that the device is connected to.
        self.context.router.deconfig_aps(instance=0)
        client_at.run_test('network_RoamWifiEndToEnd',
                           tag='roam',
                           ssid=ssid,
                           test=chrome_net_constants.OPEN_ROAM)

        self.context.router.deconfig()
コード例 #9
0
    def run_once(self,
                 client_ip,
                 client_tag='',
                 crypto_runtime=CRYPTO_RUNTIME,
                 cq=False):

        # in a cq run, do not execute the test, just output
        # the order that the test would have run in
        if cq:
            self.write_test_keyval({
                'storage_qual_cq':
                ('%f hardware_StorageQualBase_%s' % (time.time(), client_tag))
            })
            return

        client = hosts.create_host(client_ip)
        client_at = autotest.Autotest(client)
        for test_name, argv in self.CLIENT_FUNCTIONAL_TESTS:
            client_at.run_test(test_name,
                               disable_sysinfo=True,
                               tag=client_tag,
                               **argv)

        # Test real life performance
        for script in self.CRYPTO_TESTS:
            client_at.run_test('platform_CryptohomeFio',
                               disable_sysinfo=True,
                               from_internal_disk_only=True,
                               script=script,
                               tag='_'.join([client_tag, script]),
                               runtime=crypto_runtime,
                               disk_configs=['crypto', 'plain'])
コード例 #10
0
    def __init__(self, server_job, machine, work_dir, test_queue, queue_lock,
                 continuous_parsing=False):
        """Creates an instance of machine_worker to run tests on a remote host.

        Retrieves that host attributes for this machine and creates the set of
        True attributes to validate against test include/exclude attributes.

        Creates a directory to hold the log files for tests run and writes the
        hostname and tko parser version into keyvals file.

        Args:
            server_job: run tests for this server_job.
            machine: name of remote host.
            work_dir: directory server job is using.
            test_queue: queue of tests.
            queue_lock: lock protecting test_queue.
            continuous_parsing: bool, enable continuous parsing.
        """
        self._server_job = server_job
        self._test_queue = test_queue
        self._test_queue_lock = queue_lock
        self._continuous_parsing = continuous_parsing
        self._tests_run = 0
        self._machine = machine
        self._host = hosts.create_host(self._machine)
        self._client_at = autotest.Autotest(self._host)
        client_attributes = host_attributes.host_attributes(machine)
        self.attribute_set = set(client_attributes.get_attributes())
        self._results_dir = work_dir
        if not os.path.exists(self._results_dir):
            os.makedirs(self._results_dir)
        machine_data = {'hostname': self._machine,
                        'status_version': str(1)}
        utils.write_keyval(self._results_dir, machine_data)
コード例 #11
0
 def run_once(self, host, client_autotest):
     """This test verify that user should get OOBE after booting
     the device with corrupted statefull partition.
     Test fails if not able to recover the device with corrupted
     stateful partition.
     """
     if host.get_board_type() == 'OTHER':
         raise error.TestNAError(
             'Test can not processed on OTHER board type devices')
     autotest_client = autotest.Autotest(host)
     host.reboot()
     autotest_client.run_test(client_autotest, exit_without_logout=True)
     if not host.run(self.CMD_CORRUPT, ignore_status=True).exit_status == 0:
         raise error.TestFail('Unable to corrupt stateful partition')
     host.run('sync', ignore_status=True)
     time.sleep(self._WAIT_DELAY)
     host.reboot()
     host.run('sync', ignore_status=True)
     time.sleep(self._WAIT_DELAY)
     if host.path_exists(self.OOBE_FILE):
         raise error.TestFail('Did not get OOBE screen after '
                              'rebooting the device with '
                              'corrupted statefull partition')
     autotest_client.run_test(client_autotest, exit_without_logout=True)
     time.sleep(self._WAIT_DELAY)
     for new_file in self.FILES_LIST:
         if not host.path_exists(new_file):
             raise error.TestFail('%s is missing after rebooting '
                                  'the device with corrupted '
                                  'statefull partition' % new_file)
コード例 #12
0
    def run_once(self, full_payload=True, job_repo_url=None):
        """
        Trys an autoupdate during ChromeOS OOBE without a deadline.

        @param full_payload: True for a full payload. False for delta.
        @param job_repo_url: Used for debugging locally. This is used to figure
                             out the current build and the devserver to use.
                             The test will read this from a host argument
                             when run in the lab.

        """
        tpm_utils.ClearTPMOwnerRequest(self._host)
        self._host.run('ls /home/chronos/.oobe_completed', ignore_status=True)

        # veyron_rialto is a medical device with a different OOBE that auto
        # completes so this test is not valid on that device.
        if 'veyron_rialto' in self._host.get_board():
            raise error.TestNAError('Rialto has a custom OOBE. Skipping test.')

        update_url = self.get_update_url_for_test(job_repo_url,
                                                  full_payload=full_payload,
                                                  critical_update=False)

        # Call client test to start the OOBE update.
        client_at = autotest.Autotest(self._host)
        client_at.run_test('autoupdate_StartOOBEUpdate',
                           image_url=update_url,
                           full_payload=full_payload,
                           critical_update=False)

        # Ensure that the update failed as expected.
        err_str = 'Update did not fail with kNonCriticalUpdateInOOBE'
        self._check_update_engine_log_for_entry(self._NON_CRITICAL_ERROR,
                                                raise_error=True,
                                                err_str=err_str)
コード例 #13
0
    def run_through_power_states(self):
        """Go through S0ix, S3, and G3. Verify there are no interrupt storms"""
        self.run_errors = {}
        self.ccd_str = 'ccd ' + ('enabled' if self.ccd_enabled else 'disabled')
        logging.info('Running through states with %s', self.ccd_str)

        # Initialize the Test IRQ counts
        self.reset_irq_counts()

        # Make sure the DUT is in s0
        self.enter_state('S0')

        # Check if the device supports S0ix. The exit status will be 0 if it
        # does 1 if it doesn't.
        result = self.host.run('check_powerd_config --suspend_to_idle',
                ignore_status=True)
        if not result.exit_status:
            # Login before entering S0ix so cr50 will be able to enter regular
            # sleep
            client_at = autotest.Autotest(self.host)
            client_at.run_test('login_LoginSuccess')
            self.verify_state('S0ix')

        # Enter S3
        self.verify_state('S3')

        # Enter G3
        self.verify_state('G3')
        if self.run_errors:
            self.all_errors[self.ccd_str] = self.run_errors
コード例 #14
0
    def run_once(self, host=None):
        self.client = host

        tpm_utils.ClearTPMOwnerRequest(self.client)
        autotest.Autotest(self.client).run_test('enterprise_RemoraRequisition',
                                                check_client_result=True)
        tpm_utils.ClearTPMOwnerRequest(self.client)
コード例 #15
0
    def _run_while_paused(self, host):
        self._host = host
        client_at = autotest.Autotest(host)
        self._exact_copy(_CONSENT_FILE, _STOWED_CONSENT_FILE)

        client_at.run_test('logging_KernelCrash',
                           tag='before-crash',
                           is_before=True,
                           consent=True)

        client_attributes = site_host_attributes.HostAttributes(host.hostname)
        if not client_attributes.has_chromeos_firmware:
            raise error.TestNAError(
                'This device is unable to report kernel crashes')

        self._crash_it(True)

        # Check for crash handling with consent.
        client_at.run_test('logging_KernelCrash',
                           tag='after-crash-consent',
                           is_before=False,
                           consent=True)

        if not self._can_disable_consent():
            logging.info('This device always has metrics enabled, '
                         'skipping test of metrics disabled mode.')
        else:
            self._crash_it(False)

            # Check for crash handling without consent.
            client_at.run_test('logging_KernelCrash',
                               tag='after-crash-no-consent',
                               is_before=False,
                               consent=False)
コード例 #16
0
    def run_once(self,
                 host,
                 pre_init_delay=0,
                 upload_perf=False,
                 graph_name=None):
        """Run a single iteration.

        @param pre_init_delay: Delay before initialization during first boot.
        @param upload_perf: Do we need to upload the results?
        @param graph_name: Graph name to use when uploading the results.

        """
        if self.iteration is None:
            self.iteration = 1
        logging.info('Start iteration %s', self.iteration)

        self.client = host
        self.pre_init_delay = pre_init_delay
        self.upload_perf = upload_perf
        self.graph_name = graph_name
        self.client_results = {}
        self.client_test = CLIENT_TEST_NAME
        self.client_at = autotest.Autotest(self.client)

        logging.info('Clear the owner before the test')
        tpm_utils.ClearTPMOwnerRequest(self.client, wait_for_ready=False)

        self.run_stage(STAGE_OOBE)
        self.client.reboot()
        self.run_stage(STAGE_REGULAR)
        self.save_perf_data()
コード例 #17
0
    def run_once(self, host=None):
        self.client = host
        self.client_at = autotest.Autotest(self.client)
        self.client_test = 'platform_CryptohomeTPMReOwn'

        self.job.set_state("client_status", None)

        # Set up the client in the unowned state.
        self.reboot_client()
        self.tpm_run("clear_tpm", ignore_status=True)

        self.reboot_client()
        self.tpm_run("enable_tpm", ignore_status=True)

        self.reboot_client()
        self.tpm_run("mount_cryptohome")

        self.reboot_client()
        self.tpm_run("mount_cryptohome_after_reboot")

        self.reboot_client()
        self.tpm_run("clear_tpm", ignore_status=True)

        self.reboot_client()
        self.tpm_run("enable_tpm", ignore_status=True)

        self.reboot_client()
        self.tpm_run("mount_cryptohome_check_recreate")
コード例 #18
0
 def run_once(self, client_ip, testname, loops):
     host = hosts.create_host(client_ip)
     autotest_client = autotest.Autotest(host)
     for i in xrange(loops):
         logging.debug('Starting loop #%d', i)
         autotest_client.run_test(testname)
         host.reboot()
    def run_once(self, host):
        """Set up two APs, run the client side test and then exit.

        """
        self.context.router.require_capabilities(
            [site_linux_system.LinuxSystem.CAPABILITY_MULTI_AP])
        self.context.router.deconfig()
        self._host = host

        if not self._host.servo:
            raise error.TestNAError(
                'Servo object returned None. Check if servo is missing or bad')

        # Configure first AP with channel 5 and mode G and default ssid.
        self._config_ap(5, hostap_config.HostapConfig.MODE_11G)

        client_at = autotest.Autotest(self._host)
        ssid = self.context.router.get_ssid(instance=0)
        time.sleep(chrome_net_constants.LONG_TIMEOUT)
        client_at.run_test('network_RoamWifiEndToEnd',
                           ssid=ssid,
                           test=chrome_net_constants.OPEN_CONNECT)

        # Configure second AP with channel 149, mode N and same ssid as before.
        self._config_ap(149, hostap_config.HostapConfig.MODE_11N_PURE, ssid)
        ssid = self.context.router.get_ssid(instance=1)

        # Suspend the DUT for 15 seconds and tear down the first AP.
        self._do_suspend_deconfig(15)
        client_at.run_test('network_RoamWifiEndToEnd',
                           ssid=ssid,
                           test=chrome_net_constants.OPEN_ROAM)
        self.context.router.deconfig()
コード例 #20
0
    def run_once(self, host, job_repo_url=None):
        """Runs the test.

        @param host: a host object representing the DUT
        @param job_repo_url: URL to get the image.

        @raise error.TestError if anything went wrong with setting up the test;
               error.TestFail if any part of the test has failed.

        """
        updater = autoupdate_utils.get_updater_from_repo_url(
            host, job_repo_url)
        updater.update_stateful(clobber=True)

        logging.info('Rebooting after performing update.')
        self.reboot_with_timeout(host, 'update')

        # TODO(sosa): Ideally we would be able to just use
        # autotest.run_static_method to login/logout, however, this
        # functionality is currently nested deep into the test logic. Once
        # telemetry has replaced pyauto login and has been librarized, we
        # should switch to using that code and not have to rely on running a
        # client test to do what we want.
        logging.info('Running sanity desktop login to see that we can '
                     'login and logout after performing an update.')
        client_at = autotest.Autotest(host)
        self.job.set_state('client_success', False)
        client_at.run_test('login_LoginSuccess')
        if not self.job.get_state('client_success'):
            raise error.TestFail(
                'Failed to login successfully after an update.')

        logging.info('Rebooting the DUT after first login/logout.')
        self.reboot_with_timeout(host, 'first login')
コード例 #21
0
    def run_once(self, bootup_time=8, boot_type='reboot'):
        """Checks the boot up time

        @param bootup_time: Expected boot up time
        @param boot_type: Reboot type, Ex: Reboot, lid_close_open etc
        """
        autotest_client = autotest.Autotest(self.host)

        # Assume that running the test case after immediate flash and
        # keeping the DUT at logout screen.
        autotest_client.run_test('login_LoginSuccess', disable_sysinfo=True)
        if boot_type == 'reboot':
            self.host.reboot()
        elif boot_type == 'lid_close_open':
            logging.info("Closing lid")
            self.host.servo.lid_close()
            self.switcher.wait_for_client_offline(
                timeout=self._WAIT_TIME_CLOSE_LID)
            logging.info('Opening lid')
            self.host.servo.lid_open()
            if not self.faft_config.lid_wake_from_power_off:
                logging.info('Pressing power button')
                self.host.servo.power_normal_press()
            self.switcher.wait_for_client(timeout=self._WAIT_TIME_OPEN_LID)
        else:
            raise error.TestError("Invalid boot_type, check the boot_type"
                                  " in control file")

        autotest_client.run_test(
            'platform_BootPerf',
            constraints=['seconds_power_on_to_login <= %d' % bootup_time])
コード例 #22
0
    def run_once(self, host, power_status_sets):
        self.host = host
        self.autotest_client = autotest.Autotest(self.host)

        if not self.is_chrome_available():
            raise error.TestNAError('Chrome does not reside on DUT. Test Skipped')

        if not self.host.get_board_type() == 'CHROMEBOOK':
            raise error.TestNAError('DUT is not Chromebook. Test Skipped')

        if self.host.has_power():
            self.host.power_on()
        else:
            raise error.TestError('No RPM is setup to device')

        online, state, percentage, current = self.get_power_supply_parameters()
        if not ( online == 'yes' and percentage > 95 ):
            raise error.TestError('The DUT is not on AC or Battery charge is low ')

        self.action_login()

        for power_status_set in power_status_sets:
            before_suspend, after_suspend, before_resume = power_status_set
            logging.info('Power status set: %s', str(power_status_set))

            # Set power before suspend
            if not before_suspend:
                self.host.power_off()
            time.sleep(_WAIT_DELAY)

            # Suspend DUT(powerd_dbus_suspend)
            boot_id = self.action_suspend()
            logging.info('DUT suspended')

            # Set power after suspend
            if after_suspend:
                self.host.power_on()
            else:
                self.host.power_off()
                time.sleep(_WAIT_DELAY)
            time.sleep(_WAIT_DELAY)

            # Set power before resume
            if before_resume:
                self.host.power_on()
            else:
                self.host.power_off()
                time.sleep(_WAIT_DELAY)
            time.sleep(_WAIT_DELAY)

            # Wait to resume DUT
            self.host.test_wait_for_resume(boot_id, _LONG_TIMEOUT)
            logging.info('DUT resumed')

            # Set power to on after resume if needed
            if not before_resume:
                self.host.power_on()
            time.sleep(_WAIT_DELAY)

            self.check_power_charge_status(str(power_status_set))
コード例 #23
0
ファイル: test.py プロジェクト: renormalist/autotest
    def _install(self):
        if not self.host:
            from autotest_lib.server import hosts, autotest
            self.host = hosts.create_host(self.job.machines[0],
                                          auto_monitor=False)
            try:
                tmp_dir = self.host.get_tmp_dir(parent="/tmp/sysinfo")
                self.autotest = autotest.Autotest(self.host)
                self.autotest.install(autodir=tmp_dir)
                self.outputdir = self.host.get_tmp_dir()
            except:
                # if installation fails roll back the host
                try:
                    self.host.close()
                except:
                    logging.exception("Unable to close host %s",
                                      self.host.hostname)
                self.host = None
                self.autotest = None
                raise
        else:
            host = self.host

            # if autotest client dir does not exist, reinstall (it may have
            # been removed by the test code)
            autodir = host.get_autodir()
            if not autodir or not host.path_exists(autodir):
                self.autotest.install(autodir=autodir)

            # if the output dir does not exist, recreate it
            if not host.path_exists(self.outputdir):
                host.run('mkdir -p %s' % self.outputdir)

        return self.host, self.autotest, self.outputdir
コード例 #24
0
    def run_test(self, host):
        """Run the autotest from its control file on the specified DUT.

        @param host: CrosHost object representing the DUT.
        """
        autotest_client = autotest.Autotest(host)
        autotest_client.run(self._test_control_file)
コード例 #25
0
    def _run_tests_minimal_telemetry(self):
        """Run the benchmarks using the minimal support from Telemetry.

        The benchmarks are run using a client side autotest test. This test
        will control Chrome directly using the chrome.Chrome support and it
        will ask Chrome to display the benchmark pages directly instead of
        using the "page sets" and "measurements" support from Telemetry.
        In this way we avoid using Telemetry benchmark support which is not
        stable on ChromeOS yet.
        """
        AFDO_GENERATE_CLIENT_TEST = 'telemetry_AFDOGenerateClient'

        # We dont want to "inherit" the profiler settings for this test
        # to the client test. Doing so will end up in two instances of
        # the profiler (perf) being executed at the same time.
        # Filed a feature request about this. See crbug/342958.

        # Save the current settings for profilers.
        saved_profilers = self.job.profilers
        saved_default_profile_only = self.job.default_profile_only

        # Reset the state of the profilers.
        self.job.default_profile_only = False
        self.job.profilers = profilers.profilers(self.job)

        # Execute the client side test.
        client_at = autotest.Autotest(self._host)
        client_at.run_test(AFDO_GENERATE_CLIENT_TEST, args='')

        # Restore the settings for the profilers.
        self.job.default_profile_only = saved_default_profile_only
        self.job.profiler = saved_profilers
コード例 #26
0
    def __init__(self,
                 host,
                 no_chrome=False,
                 install_autotest=True,
                 results_dir=None,
                 extra_browser_args=None):
        """Construct a RemoteFacadeFactory.

        @param host: Host object representing a remote host.
        @param no_chrome: Don't start Chrome by default.
        @param install_autotest: Install autotest on host.
        @param results_dir: A directory to store multimedia server init log.
        @param extra_browser_args: A list containing extra browser args passed
                                   to Chrome in addition to default ones.
        If it is not None, we will get multimedia init log to the results_dir.

        """
        self._client = host
        if install_autotest:
            # Make sure the client library is on the device so that
            # the proxy code is there when we try to call it.
            client_at = autotest.Autotest(self._client)
            client_at.install()
        try:
            self._proxy = RemoteFacadeProxy(
                host=self._client,
                no_chrome=no_chrome,
                extra_browser_args=extra_browser_args)
        finally:
            if results_dir:
                host.get_file(
                    constants.MULTIMEDIA_XMLRPC_SERVER_LOG_FILE,
                    os.path.join(results_dir,
                                 'multimedia_xmlrpc_server.log.init'))
コード例 #27
0
    def run_once(self, client_ip=None, ethname='eth0'):
        """Run the test.

        Args:
          client_ip: string of client's ip address
          ethname: string of ethernet device under test
        """
        if not client_ip:
            error.TestError("Must provide client's IP address to test")

        sleep_secs = 20

        self._ethname = ethname
        self._client_ip = client_ip
        self._client = hosts.create_host(client_ip)
        client_at = autotest.Autotest(self._client)

        # retrieve ifconfig info for mac address of client
        cmd = "ifconfig %s" % self._ethname
        ifconfig_filename = self._client_cmd(cmd, results="ifconfig.log")
        self._parse_ifconfig(ifconfig_filename)

        # thread to wake the device using WOL
        wol_wake = WolWake(self._client_ip, self._mac_addr, sleep_secs)
        wol_wake.start()

        # create and run client test to prepare and suspend device
        client_at.run_test("network_EthCaps",
                           ethname=ethname,
                           threshold_secs=sleep_secs * 2)

        wol_wake.join()
コード例 #28
0
    def run_once(self, host):
        # Login as a normal user and stay there. Closing lid at the login
        # screen may shut the machine down, that also verifies the lid switch
        # but take more time. Once logged in, closing lid triggers suspend.
        autotest_client = autotest.Autotest(host)
        autotest_client.run_test("desktopui_SimpleLogin",
                                 exit_without_logout=True)

        original_boot_id = host.get_boot_id()

        for i in xrange(self.faft_iterations):
            logging.info('======== Running FAFT ITERATION %d/%d ========',
                         i + 1, self.faft_iterations)

            logging.info("Close lid to suspend.")
            self.servo.set('lid_open', 'no')
            logging.info("Expected going to suspend. Waiting DUT offline...")
            self.switcher.wait_for_client_offline()
            time.sleep(self.LID_DELAY)

            logging.info("Wake DUT by lid switch.")
            self.servo.set('lid_open', 'yes')
            logging.info("Expected going to resume. Waiting DUT online...")
            self.switcher.wait_for_client()
            time.sleep(self.LID_DELAY)

            boot_id = host.get_boot_id()
            if boot_id != original_boot_id:
                raise error.TestFail('Different boot_id. Unexpected reboot.')
コード例 #29
0
    def __init__(self, device_host):
        """Construct a BluetoothDevice.

        @param device_host: host object representing a remote host.

        """
        self.host = device_host
        # Make sure the client library is on the device so that the proxy code
        # is there when we try to call it.
        client_at = autotest.Autotest(self.host)
        client_at.install()
        # Start up the XML-RPC proxy on the client.
        self._proxy = self.host.rpc_server_tracker.xmlrpc_connect(
            constants.BLUETOOTH_DEVICE_XMLRPC_SERVER_COMMAND,
            constants.BLUETOOTH_DEVICE_XMLRPC_SERVER_PORT,
            command_name=constants.
            BLUETOOTH_DEVICE_XMLRPC_SERVER_CLEANUP_PATTERN,
            ready_test_name=constants.
            BLUETOOTH_DEVICE_XMLRPC_SERVER_READY_METHOD,
            timeout_seconds=self.XMLRPC_BRINGUP_TIMEOUT_SECONDS,
            logfile=self.XMLRPC_LOG_PATH)

        # Get some static information about the bluetooth adapter.
        properties = self.get_adapter_properties()
        self.bluez_version = properties.get('Name')
        self.address = properties.get('Address')
        self.bluetooth_class = properties.get('Class')
        self.UUIDs = properties.get('UUIDs')
コード例 #30
0
    def run_once(self, client_ip=None, seconds=3600, size=0, suspend=True):
        """
        Run the test
        Use ram drive and hardware_Storage fio verify feature to verify the
        integrity of memory system. The test will write data to memory and then
        idle or suspend for specify time and verify the integrity of that data.

        @param client_ip: string of client's ip address (required)
        @param seconds:   seconds to idle / suspend. default = 3600 (1 hour)
        @param size:      size to used. 0 means use all tesable memory (default)
        @param suspend:   set to suspend between write and verify phase.
        """

        if not client_ip:
            error.TestError("Must provide client's IP address to test")

        self._client = hosts.create_host(client_ip)
        self._client_at = autotest.Autotest(self._client)

        if size == 0:
            size = self._determine_usable_memory()
        logging.info('size: %d', size)

        self._create_ramfs()

        self._write_test_data(size)

        self._check_alive()
        self._wait(seconds, suspend)
        self._check_alive()

        self._verify_test_data(size)

        self._check_alive()
        self._clean_up()