1# Copyright 2018 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.client.common_lib.cros import tpm_utils 6from autotest_lib.server import autotest 7from autotest_lib.server import test 8 9 10class policy_DeviceServer(test.test): 11 """ 12 policy_DeviceServer test used to kick off any arbitrary client test. 13 14 """ 15 version = 1 16 17 18 def cleanup(self): 19 """Cleanup for this test.""" 20 tpm_utils.ClearTPMIfOwned(self.host) 21 self.host.reboot() 22 23 24 def run_once(self, client_test, host, case=None): 25 """ 26 Starting point of this test. 27 28 Note: base class sets host as self._host. 29 30 @param client_test: the name of the Client test to run. 31 @param case: the case to run for the given Client test. 32 33 """ 34 35 # Clear TPM to ensure that client test can enroll device. 36 self.host = host 37 tpm_utils.ClearTPMIfOwned(self.host) 38 39 self.autotest_client = autotest.Autotest(self.host) 40 self.autotest_client.run_test( 41 client_test, case=case, check_client_result=True) 42