blob: 0a7df11386cf224bf2f1d70837ca7aa2f3b671e4 [file] [log] [blame]
# Copyright (c) 2011 The Chromium OS Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
import cPickle as pickle
import logging
import os
from autotest_lib.client.common_lib import error
from autotest_lib.server import test, autotest
from autotest_lib.server.cros import recall_test, recall
class test_RecallServer(recall_test.RecallServerTest):
version = 1
_certificate_authority_subject = "/O=Google/OU=Chromium OS Test Server"
def initialize(self, host, pickle_file=None, proxy_only=False):
if pickle_file is not None:"Restoring from pickle %s", pickle_file)
self.certificate_authority, self.dns_client, self.http_client \
= pickle.load(open(pickle_file))
else:"Setting up recall server")
self.certificate_authority = recall.CertificateAuthority(
if proxy_only:
self.dns_client = recall.DNSClient()
self.http_client = recall.HTTPClient()
self.dns_client = recall.SymmetricDNSClient()
self.http_client = recall.ArchivingHTTPClient(
recall_test.RecallServerTest.initialize(self, host)
def run_once(self, host, test, proxy_only=False, num_iterations=1, **args):"Running test %s on remote client %s", test, host.ip)
self.RunTestOnHost(test, host, **args)
# Remove the second-level client so further iterations, including
# later runs with the pickle we write out, don't proxy
del self.dns_client.dns_client
del self.http_client.http_client"Recording/proxying disabled")
if not proxy_only:
dump_file = os.path.join(self.resultsdir, 'pickle')
logging.debug("Saving results to %s", dump_file)
self.dns_client, self.http_client),
open(dump_file, 'w'))
# Repeat test for subsequent iterations now proxying is disabled
if isinstance(num_iterations, str):
num_iterations = int(num_iterations)
if num_iterations > 1:"Running %d more iterations", num_iterations - 1)
self.RunTestOnHost(test, host, iterations=(num_iterations - 1),