示例#1
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)
示例#2
0
    def run_once(self, host=None):
        """Runs the test."""
        self.client = host

        factory = remote_facade_factory.RemoteFacadeFactory(host,
                                                            no_chrome=True)
        self.cfm_facade = factory.create_cfm_facade()

        tpm_utils.ClearTPMOwnerRequest(self.client)

        if self.client.servo:
            self.client.servo.switch_usbkey('dut')
            self.client.servo.set('usb_mux_sel3', 'dut_sees_usbkey')
            time.sleep(SHORT_TIMEOUT)
            self.client.servo.set('dut_hub1_rst1', 'off')
            time.sleep(SHORT_TIMEOUT)

        try:
            self.cfm_facade.enroll_device()
            self.cfm_facade.restart_chrome_for_cfm()

            self._hangouts_sanity_test()
            self._peripherals_sanity_test()
            self._diagnostics_sanity_test()
        except Exception as e:
            raise error.TestFail(str(e))

        tpm_utils.ClearTPMOwnerRequest(self.client)

        if FAILED_TEST_LIST:
            raise error.TestFail(
                'Test failed because of following reasons: %s' %
                ', '.join(map(str, FAILED_TEST_LIST)))
示例#3
0
    def run_once(self, host, repeat, cmd):
        """Runs the test."""
        self.client = host

        factory = remote_facade_factory.RemoteFacadeFactory(host,
                                                            no_chrome=True)
        self.cfm_facade = factory.create_cfm_facade()

        tpm_utils.ClearTPMOwnerRequest(self.client)

        if self.client.servo:
            self.client.servo.switch_usbkey('dut')
            self.client.servo.set('usb_mux_sel3', 'dut_sees_usbkey')
            time.sleep(_LONG_TIMEOUT)
            self.client.servo.set('dut_hub1_rst1', 'off')
            time.sleep(_LONG_TIMEOUT)

        try:
            self._enroll_device()
            self._start_hangout_session()
            self._change_volume(repeat, cmd)
            self._end_hangout_session()
        except Exception as e:
            raise error.TestFail(str(e))

        tpm_utils.ClearTPMOwnerRequest(self.client)
示例#4
0
    def run_once(self, host=None):
        self.client = host

        factory = remote_facade_factory.RemoteFacadeFactory(host,
                                                            no_chrome=True)
        self.system_facade = factory.create_system_facade()
        self.cfm_facade = factory.create_cfm_facade()

        tpm_utils.ClearTPMOwnerRequest(self.client)

        if self.client.servo:
            self.client.servo.switch_usbkey('dut')
            self.client.servo.set('usb_mux_sel3', 'dut_sees_usbkey')
            time.sleep(_SHORT_TIMEOUT)
            self.client.servo.set('dut_hub1_rst1', 'off')
            time.sleep(_SHORT_TIMEOUT)

        try:
            self.enroll_device_and_start_hangout()
            self.collect_perf_data()
            self.cfm_facade.end_hangout_session()
            self.upload_jmidata()
        except Exception as e:
            raise error.TestFail(str(e))

        tpm_utils.ClearTPMOwnerRequest(self.client)
    def run_once(self, host=None, kiosk_app_attributes=None):
        self.client = host

        tpm_utils.ClearTPMOwnerRequest(self.client)
        autotest.Autotest(self.client).run_test('enterprise_KioskEnrollment',
                kiosk_app_attributes=kiosk_app_attributes,
                check_client_result=True)
        tpm_utils.ClearTPMOwnerRequest(self.client)
    def run_once(self, host, hangout, repeat):
        """Main function to run autotest.

        @param host: Host object representing the DUT.
        @hangout: Name of meeting that DUT will join/leave.
        @param repeat: Number of times CfM joins and leaves meeting.
        """
        counter = 1
        self.client = host
        factory = remote_facade_factory.RemoteFacadeFactory(host,
                                                            no_chrome=True)
        self.cfm_facade = factory.create_cfm_facade()

        tpm_utils.ClearTPMOwnerRequest(self.client)

        if self.client.servo:
            self.client.servo.switch_usbkey('dut')
            self.client.servo.set('usb_mux_sel3', 'dut_sees_usbkey')
            time.sleep(SHORT_TIMEOUT)
            self.client.servo.set('dut_hub1_rst1', 'off')
            time.sleep(SHORT_TIMEOUT)

        try:
            self.cfm_facade.enroll_device()
            self.cfm_facade.restart_chrome_for_cfm()
            self.cfm_facade.wait_for_telemetry_commands()
            if not self.cfm_facade.is_oobe_start_page():
                self.cfm_facade.wait_for_oobe_start_page()
            self.cfm_facade.skip_oobe_screen()
        except Exception as e:
            raise error.TestFail(str(e))

        usb_original_output = host.run(CMD).stdout.rstrip()
        logging.info('The initial usb devices:\n %s', usb_original_output)
        usb_original_list = usb_original_output.splitlines()

        while repeat > 0:
            self.client.reboot()
            time.sleep(random.randrange(1, IDLE_TIME))
            self.cfm_facade.restart_chrome_for_cfm()
            self.cfm_facade.wait_for_telemetry_commands()
            if not self._compare_cmd_output(usb_original_list):
                raise error.TestFail(
                    "After reboot list of USB devices is not the same.")

            for test in range(random.randrange(1, MEETS_BETWEEN_REBOOT)):
                logging.info('Start meeting for loop: #%d', counter)
                counter += 1
                self._run_hangout_session(hangout, usb_original_list)
                if FAILED_TEST_LIST:
                    raise error.TestFail(
                        'Test failed because of following reasons: %s' %
                        ', '.join(map(str, FAILED_TEST_LIST)))
                repeat -= 1
                if repeat == 0:
                    break

        tpm_utils.ClearTPMOwnerRequest(self.client)
    def run_once(self, host, peripheral_whitelist_dict):
        """Main function to run autotest.

        @param host: Host object representing the DUT.

        """
        self.client = host

        factory = remote_facade_factory.RemoteFacadeFactory(host,
                                                            no_chrome=True)
        self.cfm_facade = factory.create_cfm_facade()

        tpm_utils.ClearTPMOwnerRequest(self.client)

        if self.client.servo:
            self.client.servo.switch_usbkey('dut')
            self.client.servo.set('usb_mux_sel3', 'dut_sees_usbkey')
            time.sleep(_WAIT_DELAY)
            self._set_hub_power(True)

        usb_list_dir_on = self._get_usb_device_dirs()

        cros_peripheral_dict = self._parse_device_dir_for_info(
            usb_list_dir_on, peripheral_whitelist_dict)
        logging.debug('Peripherals detected by CrOS: %s', cros_peripheral_dict)

        try:
            self._enroll_device_and_skip_oobe()
            self._set_preferred_peripherals(cros_peripheral_dict)
            cfm_peripheral_dict = self._peripheral_detection()
            logging.debug('Peripherals detected by hotrod: %s',
                          cfm_peripheral_dict)
        except Exception as e:
            raise error.TestFail(str(e))

        tpm_utils.ClearTPMOwnerRequest(self.client)

        cros_peripherals = set(cros_peripheral_dict.iteritems())
        cfm_peripherals = set(cfm_peripheral_dict.iteritems())

        peripheral_diff = cros_peripherals.difference(cfm_peripherals)

        if peripheral_diff:
            no_match_list = list()
            for item in peripheral_diff:
                no_match_list.append(item[0])
            raise error.TestFail('Following peripherals do not match: %s' %
                                 ', '.join(no_match_list))
    def run_once(self, host=None):
        self.client = host

        # Start by clearing TPM to make sure the device is in a known state.
        tpm_utils.ClearTPMOwnerRequest(self.client, wait_for_ready=True)

        # U2fd does will not start normally if the device has not gone
        # through OOBE. Force it to startup.
        cr50_dev = g2f_utils.StartU2fd(self.client)

        # Register to create a new key handle.
        g2f_reg = g2f_utils.G2fRegister(
            self.client, cr50_dev,
            hashlib.sha256('test_challenge').hexdigest(),
            hashlib.sha256('test_application').hexdigest())

        # Sanity check that we managed to register.
        if not g2f_reg.exit_status == 0:
            raise error.TestError('Register failed.')

        # Extract newly created key handle.
        key_handle = self.parse_g2ftool_output(g2f_reg.stdout)['key_handle']

        # Sanity check that we can authenticate with the new key handle.
        g2f_auth = g2f_utils.G2fAuth(
            self.client, cr50_dev,
            hashlib.sha256('test_challenge').hexdigest(),
            hashlib.sha256('test_application').hexdigest(), key_handle)

        if not g2f_auth.exit_status == 0:
            raise error.TestError('Authenticate failed.')

        # Clear TPM. We should no longer be able to authenticate with the
        # key handle after this.
        tpm_utils.ClearTPMOwnerRequest(self.client, wait_for_ready=True)

        # U2fd does will not start normally if the device has not gone
        # through OOBE. Force it to startup.
        cr50_dev = g2f_utils.StartU2fd(self.client)

        # Check the key handle is no longer valid.
        g2f_auth_clear = g2f_utils.G2fAuth(
            self.client, cr50_dev,
            hashlib.sha256('test_challenge').hexdigest(),
            hashlib.sha256('test_application').hexdigest(), key_handle)

        if g2f_auth_clear.exit_status == 0:
            raise error.TestError('Authenticate succeeded; should have failed')
    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()
示例#10
0
 def clear_tpm_if_owned(self):
     """Clear the TPM only if device is already owned."""
     tpm_status = tpm_utils.TPMStatus(self._host)
     logging.info('TPM status: %s', tpm_status)
     if tpm_status['Owned']:
         logging.info('Clearing TPM because this device is owned.')
         tpm_utils.ClearTPMOwnerRequest(self._host)
示例#11
0
    def run_once(self, host=None, kiosk_app_attributes=None):
        self.client = host
        self.kiosk_app_name = None

        factory = remote_facade_factory.RemoteFacadeFactory(
                host, no_chrome=True)
        self.system_facade = factory.create_system_facade()
        self.kiosk_facade = factory.create_kiosk_facade()

        self._setup_kiosk_app_on_dut(kiosk_app_attributes)
        time.sleep(STABILIZATION_DURATION)
        self._initialize_test_variables()

        self.perf_results = {'cpu': '0', 'mem': '0', 'temp': '0'}
        for iteration in range(PERF_CAPTURE_ITERATIONS):
            #TODO(krishnargv@): Add a method to verify that the Kiosk app is
            #                   active and is running on the DUT.
            logging.info("Running perf_capture Iteration: %d", iteration+1)
            self.perf_results = self._run_perf_capture_cycle()
            self._write_perf_keyvals(self.perf_results)
            self._write_perf_results(self.perf_results)

            # Post perf results directly to performance dashboard. You may view
            # uploaded data at https://chromeperf.appspot.com/new_points,
            # with test path pattern=ChromeOS_Enterprise/cros-*/longevity*/*
            chart_data = self._read_perf_results()
            data_obj = self._format_data_for_upload(chart_data)
            self._send_to_dashboard(data_obj)
        tpm_utils.ClearTPMOwnerRequest(self.client)
示例#12
0
    def initialize(self,
                   host,
                   cmdline_args,
                   full_args,
                   restore_cr50_state=False,
                   cr50_dev_path='',
                   provision_update=False):
        self._saved_state = self.NONE
        self._raise_error_on_mismatch = not restore_cr50_state
        self._provision_update = provision_update
        super(Cr50Test, self).initialize(host, cmdline_args)

        if not hasattr(self, 'cr50'):
            raise error.TestNAError('Test can only be run on devices with '
                                    'access to the Cr50 console')

        logging.info('Test Args: %r', full_args)

        self.can_set_ccd_level = (not self.cr50.using_ccd()
                                  or self.cr50.testlab_is_on())
        self.original_ccd_level = self.cr50.get_ccd_level()
        self.original_ccd_settings = self.cr50.get_cap_dict(
            info=self.cr50.CAP_SETTING)

        self.host = host
        tpm_utils.ClearTPMOwnerRequest(self.host, wait_for_ready=True)
        # Clear the FWMP, so it can't disable CCD.
        self.clear_fwmp()

        if self.can_set_ccd_level:
            # Lock cr50 so the console will be restricted
            self.cr50.set_ccd_level('lock')
        elif self.original_ccd_level != 'lock':
            raise error.TestNAError(
                'Lock the console before running cr50 test')

        self._save_original_state()

        # Verify cr50 is still running the correct version
        cr50_qual_version = full_args.get('cr50_qual_version', '').strip()
        if cr50_qual_version:
            _, running_rw, running_bid = self.get_saved_cr50_original_version()
            expected_rw, expected_bid_sym = cr50_qual_version.split('/')
            expected_bid = cr50_utils.GetBoardIdInfoString(expected_bid_sym,
                                                           symbolic=False)
            logging.debug('Running %s %s Expect %s %s', running_rw,
                          running_bid, expected_rw, expected_bid)
            if running_rw != expected_rw or expected_bid != running_bid:
                raise error.TestError('Not running %s' % cr50_qual_version)

        # We successfully saved the device state
        self._saved_state |= self.INITIAL_STATE
        try:
            self._save_node_locked_dev_image(cr50_dev_path)
            self._save_original_images(full_args.get('release_path', ''))
            # We successfully saved the device images
            self._saved_state |= self.IMAGES
        except:
            if restore_cr50_state:
                raise
示例#13
0
    def run_once(self):
        """Verify FWMP disable with different flag values."""
        errors = []
        # Try enabling factory mode in each valid state. Cr50 checks write
        # protect, password, and fwmp before allowing fwmp to be enabled.
        for lockout_ccd_with_fwmp in self.BOOL_VALUES:
            for set_password in self.BOOL_VALUES:
                for enable_wp in self.BOOL_VALUES:
                    # make sure all of the ccd stuff is reset
                    self.cr50.send_command('ccd testlab open')
                    # Run ccd reset to make sure all ccd state is cleared
                    self.cr50.send_command('ccd reset')
                    # Clear the TPM owner, so we can set the ccd password and
                    # create the FWMP
                    tpm_utils.ClearTPMOwnerRequest(self.host,
                                                   wait_for_ready=True)
                    self.setup_ccd_password(set_password)
                    self.set_wp(enable_wp)
                    self.set_fwmp_lockout(lockout_ccd_with_fwmp)
                    self.cr50.set_ccd_level('lock')
                    logging.info('RUN: %s', self.get_state_message())

                    try:
                        self.set_factory_mode(True)
                        self.set_factory_mode(False)
                    except Exception, e:
                        message = 'FAILURE %r %r' % (self.get_state_message(),
                                                     e)
                        logging.info(message)
                        errors.append(message)
示例#14
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)
    def run_once(self, host):
        """Runs the client test and clears TPM owner on DUT after it's done."""

        client_at = autotest.Autotest(host)
        client_at.run_test(_CLIENT_TEST)
        client_at._check_client_test_result(host, _CLIENT_TEST)

        tpm_utils.ClearTPMOwnerRequest(host)
    def unlock_test(self, unlock_func, unlock_allowed):
        """Verify cr50 can or cannot be unlocked with the given unlock_func"""
        self.cr50.set_ccd_level('lock')

        # Clear the TPM owner. The login state can affect unlock abilities
        tpm_utils.ClearTPMOwnerRequest(self.host)

        unlock_func(unlock_allowed)
 def cleanup(self, run_test_only=False):
     """Takes a screenshot, saves log files and clears the TPM."""
     self.take_screenshot('%s' % self.tagged_testname)
     self.save_callgrok_logs()
     self.save_packaged_app_logs()
     if not self._run_test_only:
         tpm_utils.ClearTPMOwnerRequest(self._host)
     super(CfmBaseTest, self).cleanup()
示例#18
0
 def _rootfs_verification_is_disabled(self):
     """Returns true if rootfs verification is enabled."""
     # Clear the TPM owner before trying to check rootfs verification
     tpm_utils.ClearTPMOwnerRequest(self.host, wait_for_ready=True)
     self.rootfs_tool = debugd_dev_tools.RootfsVerificationTool()
     self.rootfs_tool.initialize(self.host)
     # rootfs_tool.is_enabled is True, that means rootfs verification is
     # disabled.
     return self.rootfs_tool.is_enabled()
    def cleanup(self):
        """Remove g2f.force"""
        if self.start_u2fd:
            if self.u2fd_is_running():
                self.host.run('stop u2fd')
            if self.create_g2f_force:
                self.host.run('rm /var/lib/u2f/force/g2f.force')
            tpm_utils.ClearTPMOwnerRequest(self.host)

        super(firmware_IntegratedU2F, self).cleanup()
示例#20
0
    def run_once(self, host=None):
        self.client = host
        self.client_at = autotest.Autotest(self.client)
        self.client_test = 'platform_CryptohomeTPMReOwn'

        # Set up the client in the unowned state and init the TPM again.
        tpm_utils.ClearTPMOwnerRequest(self.client)
        self.tpm_run("take_tpm_ownership", ignore_status=True)

        self.tpm_run("mount_cryptohome")

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

        # Clear and re-own the TPM on the next boot.
        tpm_utils.ClearTPMOwnerRequest(self.client)
        self.tpm_run("take_tpm_ownership", ignore_status=True)

        self.tpm_run("mount_cryptohome_check_recreate")
    def run_once(self, host=None):
        """Runs the test."""
        self.client = host

        factory = remote_facade_factory.RemoteFacadeFactory(host,
                                                            no_chrome=True)
        self.cfm_facade = factory.create_cfm_facade()

        tpm_utils.ClearTPMOwnerRequest(self.client)

        # Enable USB port on the servo so device can see and talk to the
        # attached peripheral.
        if self.client.servo:
            self.client.servo.switch_usbkey('dut')
            self.client.servo.set('usb_mux_sel3', 'dut_sees_usbkey')
            time.sleep(SHORT_TIMEOUT)
            self.client.servo.set('dut_hub1_rst1', 'off')
            time.sleep(SHORT_TIMEOUT)

        try:
            self.cfm_facade.enroll_device()

            # The following reboot and sleep are a hack around devtools crash
            # issue tracked in crbug.com/739474.
            self.client.reboot()
            time.sleep(SHORT_TIMEOUT)

            self.cfm_facade.skip_oobe_after_enrollment()

            # Following trigger new Thor/Meetings APIs.
            self.cfm_facade.wait_for_meetings_telemetry_commands()
            self.cfm_facade.start_meeting_session()
            time.sleep(LONG_TIMEOUT)
            self.cfm_facade.end_meeting_session()
            time.sleep(SHORT_TIMEOUT)
        except Exception as e:
            raise error.TestFail(str(e))
        finally:
            tpm_utils.ClearTPMOwnerRequest(self.client)
示例#22
0
    def run_once(self, host=None):
        self.client = host

        # Skip the test if the TPM is unavailable.
        tpm_status = tpm_utils.TPMStatus(self.client)
        if 'Enabled' not in tpm_status:
            raise error.TestError('Error obtaining TPM enabled state. Status '
                                  'returned by cryptohome: ' + str(tpm_status))
        if not tpm_status['Enabled']:
            return

        # Clear the TPM, so that the client test is able to obtain the TPM owner
        # password.
        tpm_utils.ClearTPMOwnerRequest(self.client, wait_for_ready=True)

        # Run the client test which executes the cryptohome's TPM live test.
        autotest.Autotest(self.client).run_test(
            'platform_CryptohomeTpmLiveTest', check_client_result=True)

        # Clean the TPM up, so that the TPM state clobbered by the TPM live
        # tests doesn't affect subsequent tests.
        tpm_utils.ClearTPMOwnerRequest(self.client)
    def run_once(self, host=None):
        self.client = host

        # Skip the test if the TPM is unavailable.
        tpm_status = tpm_utils.TPMStatus(self.client)
        if 'Enabled' not in tpm_status:
            raise error.TestError('Error obtaining TPM enabled state. Status '
                                  'returned by cryptohome: ' + str(tpm_status))
        if not tpm_status['Enabled']:
            raise error.TestNAError("TPM is not enabled")

        # Clear the TPM, so that the client test is able to obtain the TPM owner
        # password.
        tpm_utils.ClearTPMOwnerRequest(self.client, wait_for_ready=True)

        # Run the client test which executes the Cr50VirtualNVRam test.
        autotest.Autotest(self.client).run_test('firmware_Cr50VirtualNVRam',
                                                check_client_result=True)

        # Clean the TPM up, so that the TPM state set by the firmware
        # tests doesn't affect subsequent tests.
        tpm_utils.ClearTPMOwnerRequest(self.client)
示例#24
0
    def initialize(self, host, cmdline_args, release_path="", release_ver="",
                   old_release_path="", old_release_ver="", dev_path="",
                   test=""):
        """Initialize servo and process the given images"""
        self.processed_images = False

        super(firmware_Cr50Update, self).initialize(host, cmdline_args)
        if not hasattr(self, "cr50"):
            raise error.TestNAError('Test can only be run on devices with '
                                    'access to the Cr50 console')

        if not release_ver and not os.path.isfile(release_path):
            raise error.TestError('Need to specify a release version or path')

        self.devid = self.servo.get('cr50_devid')

        # Make sure ccd is disabled so it won't interfere with the update
        self.cr50.ccd_disable()

        tpm_utils.ClearTPMOwnerRequest(host)
        self.rootfs_tool = debugd_dev_tools.RootfsVerificationTool()
        self.rootfs_tool.initialize(host)
        if not self.rootfs_tool.is_enabled():
            logging.debug('Removing rootfs verification.')
            # 'enable' actually disables rootfs verification
            self.rootfs_tool.enable()

        self.host = host
        self.erase_nvmem = test.lower() == self.ERASE_NVMEM

        # A dict used to store relevant information for each image
        self.images = {}

        # Get the original image from the cr50 firmware directory on the dut
        self.save_original_image(cr50_utils.CR50_FILE)

        # Process the given images in order of oldest to newest. Get the version
        # info and add them to the update order
        self.update_order = []
        if not self.erase_nvmem and (old_release_path or old_release_ver):
            self.add_image_to_update_order(self.OLD_RELEASE_NAME,
                                           old_release_path, old_release_ver)
        self.add_image_to_update_order(self.RELEASE_NAME, release_path,
                                       release_ver)
        self.add_image_to_update_order(self.DEV_NAME, dev_path)
        self.verify_update_order()
        self.processed_images = True
        logging.info("Update %s", self.update_order)

        # Update to the dev image
        self.run_update(self.DEV_NAME)
示例#25
0
    def run_once(self, host=None, is_meeting=False):
        self.client = host

        factory = remote_facade_factory.RemoteFacadeFactory(host,
                                                            no_chrome=True)
        self.system_facade = factory.create_system_facade()
        self.cfm_facade = factory.create_cfm_facade()

        tpm_utils.ClearTPMOwnerRequest(self.client)

        if self.client.servo:
            self.client.servo.switch_usbkey('dut')
            self.client.servo.set('usb_mux_sel3', 'dut_sees_usbkey')
            time.sleep(_SHORT_TIMEOUT)
            self.client.servo.set('dut_hub1_rst1', 'off')
            time.sleep(_SHORT_TIMEOUT)

        try:
            if is_meeting:
                self.enroll_device_and_join_meeting()
            else:
                self.enroll_device_and_start_hangout()

            self.collect_perf_data()

            if is_meeting:
                self.cfm_facade.end_meeting_session()
            else:
                self.cfm_facade.end_hangout_session()

            self.upload_jmidata()
        except Exception as e:
            # Clear tpm to remove device ownership before exiting to ensure
            # device is not left in an enrolled state.
            tpm_utils.ClearTPMOwnerRequest(self.client)
            raise error.TestFail(str(e))

        tpm_utils.ClearTPMOwnerRequest(self.client)
示例#26
0
    def run_once(self, host, repeat):
        """Runs the test."""
        self.client = host

        factory = remote_facade_factory.RemoteFacadeFactory(host,
                                                            no_chrome=True)
        self.cfm_facade = factory.create_cfm_facade()

        tpm_utils.ClearTPMOwnerRequest(self.client)

        if self.client.servo:
            self.client.servo.switch_usbkey('dut')
            self.client.servo.set('usb_mux_sel3', 'dut_sees_usbkey')
            time.sleep(SHORT_TIMEOUT)
            self.client.servo.set('dut_hub1_rst1', 'off')
            time.sleep(SHORT_TIMEOUT)

        try:
            self.cfm_facade.enroll_device()
            self.cfm_facade.restart_chrome_for_cfm()
            self.cfm_facade.wait_for_telemetry_commands()
            self.cfm_facade.wait_for_oobe_start_page()

            if not self.cfm_facade.is_oobe_start_page():
                raise error.TestFail('CFM did not reach oobe screen.')

            self.cfm_facade.skip_oobe_screen()

            while repeat:
                self._run_hangout_session()
                time.sleep(SHORT_TIMEOUT)
                repeat -= 1
        except Exception as e:
            raise error.TestFail(str(e))

        tpm_utils.ClearTPMOwnerRequest(self.client)
    def run_once(self, host, repeat, peripheral_whitelist_dict):
        """Main function to run autotest.

        @param host: Host object representing the DUT.
        @param repeat: Number of times peripheral should be hotplugged.
        @param peripheral_whitelist_dict: Dictionary of peripherals to test.
        """
        self.client = host

        factory = remote_facade_factory.RemoteFacadeFactory(host,
                                                            no_chrome=True)
        self.cfm_facade = factory.create_cfm_facade()

        tpm_utils.ClearTPMOwnerRequest(self.client)

        if self.client.servo:
            self.client.servo.switch_usbkey('dut')
            self.client.servo.set('usb_mux_sel3', 'dut_sees_usbkey')
            time.sleep(_SHORT_TIMEOUT)
            self._set_hub_power(True)

        try:
            self._enroll_device_and_skip_oobe()
            self._set_peripheral(peripheral_whitelist_dict)

            on_off_list = [True, False]
            on_off = itertools.cycle(on_off_list)
            while repeat:
                reset_ = on_off.next()
                self._set_hub_power(reset_)
                self._peripheral_detection(peripheral_whitelist_dict, reset_)
                repeat -= 1
        except Exception as e:
            raise error.TestFail(str(e))

        tpm_utils.ClearTPMOwnerRequest(self.client)
    def _setup_kiosk_app_on_dut(self, kiosk_app_attributes=None):
        """Enroll the DUT and setup a Kiosk app."""
        info = self.client.host_info_store.get()
        app_config_id = info.get_label_value('app_config_id')
        if app_config_id and app_config_id.startswith(':'):
            app_config_id = app_config_id[1:]
        if kiosk_app_attributes:
            kiosk_app_attributes = kiosk_app_attributes.rstrip()
            self.kiosk_app_name, ext_id = kiosk_app_attributes.split(':')[:2]

        tpm_utils.ClearTPMOwnerRequest(self.client)
        logging.info("Enrolling the DUT to Kiosk mode")
        autotest.Autotest(self.client).run_test(
            'enterprise_KioskEnrollment',
            kiosk_app_attributes=kiosk_app_attributes,
            check_client_result=True)
    def run_once(self):
        self.check_fwmp('0xaa00', True)
        # Verify that the flags can be changed on the same boot
        self.check_fwmp('0xbb00', False)

        # Verify setting FWMP_DEV_DISABLE_CCD_UNLOCK disables ccd
        self.check_fwmp(hex(self.FWMP_DEV_DISABLE_CCD_UNLOCK), True)

        # 0x41 is the flag setting when dev boot is disabled. Make sure that
        # nothing unexpected happens.
        self.check_fwmp('0x41', True)

        # Clear the TPM owner and verify lock can still be enabled/disabled when
        # the FWMP has not been created
        tpm_utils.ClearTPMOwnerRequest(self.host)
        self.cr50_check_lock_control('0')
示例#30
0
  def __test_kh_invalidated_by_powerwash(self):
    registration = self.__u2f_generate(APP_ID, USER_SECRET_1, '00')

    self.servo.power_short_press()

    # Sanity check
    self.__u2f_sign(APP_ID, USER_SECRET_1, registration['keyHandle'],
                    HASH_TO_SIGN, '00', VENDOR_CMD_RESPONSE_SUCCESS)

    # Clear TPM. We should no longer be able to authenticate with the
    # key handle after this.
    tpm_utils.ClearTPMOwnerRequest(self.client, wait_for_ready=True)

    self.servo.power_short_press()

    self.__u2f_sign(APP_ID, USER_SECRET_1, registration['keyHandle'],
                    HASH_TO_SIGN, '00', VENDOR_CMD_RESPONSE_PASSWORD_REQUIRED)