Skip to content

Commit

Permalink
API: Move common_lib to shared
Browse files Browse the repository at this point in the history
This patch brings API changes to test writers.

Move common_lib to the cleaner and shorter shared,
since that is a shared library space among all
autotest modules. So all references to

autotest.client.common_lib.[lib]

become

autotest.client.shared.[lib]

Signed-off-by: Lucas Meneghel Rodrigues <[email protected]>
  • Loading branch information
lmr committed Apr 18, 2012
1 parent 7e83868 commit 86c1b8e
Show file tree
Hide file tree
Showing 428 changed files with 535 additions and 535 deletions.
16 changes: 8 additions & 8 deletions CODING_STYLE
Original file line number Diff line number Diff line change
Expand Up @@ -52,15 +52,15 @@ Modules should be lumped together on the same line.
Wildcard imports (from x import *) should be avoided if possible.
Classes should not be imported from modules, but modules may be imported
from packages, i.e.:
from common_lib import error
from shared import error
and not
from common_lib.error import AutoservError
from shared.error import AutoservError

For example:
import os, pickle, random, re, select, shutil, signal, StringIO, subprocess
import sys, time, urllib, urlparse
import MySQLdb
from common_lib import error
from shared import error


Importing modules
Expand All @@ -77,9 +77,9 @@ Modules should be lumped together on the same line.
Wildcard imports (from x import *) should be avoided if possible.
Classes should not be imported from modules, but modules may be imported
from packages, i.e.:
from common_lib import error
from shared import error
and not
from common_lib.error import AutoservError
from shared.error import AutoservError

For example:
import os, pickle, random, re, select, shutil, signal, StringIO, subprocess
Expand All @@ -89,7 +89,7 @@ try:
except ImportError:
import common # Magic autotest module and sys.path setup code.
import MySQLdb # After common so that we check our site-packages first.
from common_lib import error
from shared import error

Testing None

Expand Down Expand Up @@ -182,10 +182,10 @@ raise FooException('Exception Message')
Please don't raise string exceptions, as they're deprecated and will be removed
from future versions of python. If you're in doubt about what type of exception
you will raise, please look at http://docs.python.org/lib/module-exceptions.html
and client/common_lib/error.py, the former is a list of python built in
and client/shared/error.py, the former is a list of python built in
exceptions and the later is a list of autotest/autoserv internal exceptions. Of
course, if you really need to, you can extend the exception definitions on
client/common_lib/error.py.
client/shared/error.py.


Submitting patches
Expand Down
2 changes: 1 addition & 1 deletion cli/autotest-rpc-compose-query
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ try:
import autotest.common
except ImportError:
import common
from autotest.client.common_lib import kernel_versions
from autotest.client.shared import kernel_versions
from autotest.tko import display, frontend, db, query_lib

# First do all the options parsing
Expand Down
4 changes: 2 additions & 2 deletions cli/cli_mock.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@
from autotest.cli import atest, topic_common, rpc
from autotest.frontend.afe import rpc_client_lib
from autotest.frontend.afe.json_rpc import proxy
from autotest.client.common_lib.test_utils import mock
from autotest.client.common_lib import autotemp
from autotest.client.shared.test_utils import mock
from autotest.client.shared import autotemp

CLI_USING_PDB = False
CLI_UT_DEBUG = False
Expand Down
2 changes: 1 addition & 1 deletion cli/contrib/why_isnt_my_job_running.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
except ImportError:
import common
from autotest.cli import rpc, host
from autotest.client.common_lib import host_queue_entry_states
from autotest.client.shared import host_queue_entry_states

parser = optparse.OptionParser(
usage='Usage: %prog [options] <job id> [<hostname>]\n\n'
Expand Down
2 changes: 1 addition & 1 deletion cli/host.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@

import os, sys, socket
from autotest.cli import topic_common, action_common
from autotest.client.common_lib import host_protections
from autotest.client.shared import host_protections


class host(topic_common.atest):
Expand Down
2 changes: 1 addition & 1 deletion cli/job_unittest.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
except ImportError:
import common
from autotest.cli import cli_mock, topic_common, job
from autotest.client.common_lib.test_utils import mock
from autotest.client.shared.test_utils import mock


class job_unittest(cli_mock.cli_unittest):
Expand Down
2 changes: 1 addition & 1 deletion cli/rpc.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
import os
from autotest.frontend.afe import rpc_client_lib
from autotest.frontend.afe.json_rpc import proxy
from autotest.client.common_lib import global_config, utils
from autotest.client.shared import global_config, utils

GLOBAL_CONFIG = global_config.global_config
DEFAULT_SERVER = 'autotest'
Expand Down
2 changes: 1 addition & 1 deletion cli/rpc_unittest.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
except ImportError:
import common
from autotest.cli import rpc
from autotest.client.common_lib import global_config
from autotest.client.shared import global_config
from autotest.frontend.afe import rpc_client_lib
from autotest.frontend.afe.json_rpc import proxy

Expand Down
2 changes: 1 addition & 1 deletion cli/setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
except ImportError:
import common

from autotest.client.common_lib import version
from autotest.client.shared import version

# Mostly needed when called one level up
cli_dir = os.path.dirname(sys.modules[__name__].__file__) or '.'
Expand Down
2 changes: 1 addition & 1 deletion cli/topic_common.py
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ class __init__() before adding its own parser arguments.
import socket, string, urllib2
from autotest.cli import rpc
from autotest.frontend.afe.json_rpc import proxy
from autotest.client.common_lib.test_utils import mock
from autotest.client.shared.test_utils import mock


# Maps the AFE keys to printable names.
Expand Down
2 changes: 1 addition & 1 deletion client/autotest_client
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ except ImportError:

import sys, os, time, subprocess

from autotest.client.common_lib import utils
from autotest.client.shared import utils

# We want to set the output (stdout&stderr) of the autotest binary onto our
# stdout channel. We went to get the status stream of autotest back on our
Expand Down
2 changes: 1 addition & 1 deletion client/autotest_local.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
sys.path.insert(0, autodirbin)

from autotest.client import job
from autotest.client.common_lib import global_config
from autotest.client.shared import global_config
from autotest.client import cmdparser, optparser

autodirtest = os.path.join(autodir, "tests")
Expand Down
2 changes: 1 addition & 1 deletion client/base_sysinfo.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import os, shutil, re, glob, subprocess, logging, gzip

from autotest.client.common_lib import log, global_config
from autotest.client.shared import log, global_config
from autotest.client import utils, package

GLOBAL_CONFIG = global_config.global_config
Expand Down
2 changes: 1 addition & 1 deletion client/base_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
"""
import os, shutil, sys, signal, commands, pickle, glob, statvfs
import math, re, string, fnmatch, logging
from autotest.client.common_lib import error, utils, magic
from autotest.client.shared import error, utils, magic


def grep(pattern, file):
Expand Down
4 changes: 2 additions & 2 deletions client/boottool.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import os
from autotest.client.common_lib import utils, error
from autotest.client.common_lib import boottool as common_boottool
from autotest.client.shared import utils, error
from autotest.client.shared import boottool as common_boottool

class boottool(common_boottool.boottool):
def __init__(self, boottool_exec=None):
Expand Down
2 changes: 1 addition & 1 deletion client/client_logging_config.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
except ImportError:
import common
import logging, os
from autotest.client.common_lib import logging_config, global_config
from autotest.client.shared import logging_config, global_config

class ClientLoggingConfig(logging_config.LoggingConfig):
def add_debug_file_handlers(self, log_dir, log_name=None):
Expand Down
2 changes: 1 addition & 1 deletion client/cmdparser.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

import os, re, sys
from autotest.client import os_dep
from autotest.client.common_lib import global_config
from autotest.client.shared import global_config

GLOBAL_CONFIG = global_config.global_config

Expand Down
2 changes: 1 addition & 1 deletion client/cpuset.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

import os, sys, re, glob, fcntl, logging
from autotest.client import utils
from autotest.client.common_lib import error
from autotest.client.shared import error

SUPER_ROOT = '' # root of all containers or cgroups
NO_LIMIT = (1 << 63) - 1 # containername/memory.limit_in_bytes if no limit
Expand Down
2 changes: 1 addition & 1 deletion client/fsdev_disks.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import sys, os, re, string
from autotest.client import utils, fsinfo, fsdev_mgr, partition
from autotest.client.common_lib import error
from autotest.client.shared import error


fd_mgr = fsdev_mgr.FsdevManager()
Expand Down
2 changes: 1 addition & 1 deletion client/fsinfo.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
import autotest.common as common
except ImportError:
import common
from autotest.client.common_lib import error, utils
from autotest.client.shared import error, utils


def opt_string2dict(opt_string):
Expand Down
2 changes: 1 addition & 1 deletion client/fsinfo_unittest.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
except ImportError:
import common
from autotest.client import fsinfo
from autotest.client.common_lib.test_utils import mock
from autotest.client.shared.test_utils import mock

class fsionfo_test(unittest.TestCase):

Expand Down
6 changes: 3 additions & 3 deletions client/harness_autoserv.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import os, logging, ConfigParser
from autotest.client.common_lib import autotemp, base_packages, error
from autotest.client.common_lib import global_config
from autotest.client.shared import autotemp, base_packages, error
from autotest.client.shared import global_config
from autotest.client import harness


Expand Down Expand Up @@ -86,7 +86,7 @@ def fetch_package(self, pkg_name, dest_path):
"""Request a package from the remote autoserv.
@param pkg_name: The name of the package, as generally used by the
client.common_lib.packages infrastructure.
client.shared.packages infrastructure.
@param dest_path: The path the package should be copied to.
"""
self._send_and_wait('AUTOTEST_FETCH_PACKAGE', pkg_name, dest_path)
Expand Down
2 changes: 1 addition & 1 deletion client/harness_standalone.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

__author__ = """Copyright Andy Whitcroft 2007"""

from autotest.client.common_lib import error
from autotest.client.shared import error
from autotest.client import utils
import os, harness, shutil, logging

Expand Down
2 changes: 1 addition & 1 deletion client/harness_unittest.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
import autotest.common as common
except ImportError:
import common
from autotest.client.common_lib.test_utils import mock
from autotest.client.shared.test_utils import mock
from autotest.client import harness, harness_standalone, harness_ABAT


Expand Down
12 changes: 6 additions & 6 deletions client/job.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,17 +13,17 @@
from autotest.client import profilers, boottool, harness
from autotest.client import config, sysinfo, test, local_host
from autotest.client import partition as partition_lib
from autotest.client.common_lib import base_job
from autotest.client.common_lib import error, barrier, log, logging_manager
from autotest.client.common_lib import base_packages, packages
from autotest.client.common_lib import global_config
from autotest.client.shared import base_job
from autotest.client.shared import error, barrier, log, logging_manager
from autotest.client.shared import base_packages, packages
from autotest.client.shared import global_config
from autotest.client.tools import html_report

GLOBAL_CONFIG = global_config.global_config

LAST_BOOT_TAG = object()
JOB_PREAMBLE = """
from autotest.client.common_lib.error import *
from autotest.client.shared.error import *
from autotest.client.utils import *
"""

Expand Down Expand Up @@ -629,7 +629,7 @@ def run_test_detail(self, url, *args, **dargs):
to the subdir name.
@returns Test status
@see: client/common_lib/error.py, exit_status
@see: client/shared/error.py, exit_status
"""
(subdir, testname, group_func, timeout) = self._run_test_base(url,
*args,
Expand Down
10 changes: 5 additions & 5 deletions client/job_unittest.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,11 @@

from autotest.client import job, boottool, config, sysinfo, harness
from autotest.client import test, xen, kernel, utils
from autotest.client.common_lib import packages, error, log, global_config
from autotest.client.common_lib.global_config import global_config
from autotest.client.common_lib import logging_manager, logging_config
from autotest.client.common_lib import base_job_unittest
from autotest.client.common_lib.test_utils import mock, unittest
from autotest.client.shared import packages, error, log, global_config
from autotest.client.shared.global_config import global_config
from autotest.client.shared import logging_manager, logging_config
from autotest.client.shared import base_job_unittest
from autotest.client.shared.test_utils import mock, unittest


class job_test_case(unittest.TestCase):
Expand Down
2 changes: 1 addition & 1 deletion client/kernel.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import os, shutil, copy, pickle, re, glob, time, logging
from autotest.client import kernel_config, os_dep, kernelexpand, test
from autotest.client import utils
from autotest.client.common_lib import log, error, packages
from autotest.client.shared import log, error, packages


def tee_output_logdir_mark(fn):
Expand Down
2 changes: 1 addition & 1 deletion client/kernel_config.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

import shutil, os
from autotest.client import utils
from autotest.client.common_lib import error, kernel_versions
from autotest.client.shared import error, kernel_versions

def apply_overrides(orig_file, changes_file, output_file):
override = dict()
Expand Down
2 changes: 1 addition & 1 deletion client/kernel_unittest.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
import autotest.common as common
except ImportError:
import common
from autotest.client.common_lib.test_utils import mock
from autotest.client.shared.test_utils import mock
from autotest.client import kernel, job, utils, kernelexpand
from autotest.client import kernel_config, boottool, os_dep

Expand Down
2 changes: 1 addition & 1 deletion client/kernelexpand.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
except ImportError:
import common

from autotest.client.common_lib import global_config
from autotest.client.shared import global_config
import sys, re, os, urllib2

GLOBAL_CONFIG = global_config.global_config
Expand Down
6 changes: 3 additions & 3 deletions client/kernelexpand_unittest.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@
import common
from kernelexpand import decompose_kernel
from kernelexpand import mirror_kernel_components
from autotest.client.common_lib import global_config
from autotest.client.common_lib.global_config import global_config
from autotest.client.common_lib.test_utils import mock
from autotest.client.shared import global_config
from autotest.client.shared.global_config import global_config
from autotest.client.shared.test_utils import mock

km = 'http://www.kernel.org/pub/linux/kernel/'
akpm = km + 'people/akpm/patches/'
Expand Down
2 changes: 1 addition & 1 deletion client/kvm_control.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"""

from autotest.client import utils
from autotest.client.common_lib import error
from autotest.client.shared import error

def get_kvm_arch():
"""
Expand Down
4 changes: 2 additions & 2 deletions client/local_host.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
"""

import glob, os, platform
from autotest.client.common_lib import hosts, error
from autotest.client.shared import hosts, error
from autotest.client import utils

class LocalHost(hosts.Host):
Expand All @@ -29,7 +29,7 @@ def run(self, command, timeout=3600, ignore_status=False,
stdout_tee=utils.TEE_TO_LOGS, stderr_tee=utils.TEE_TO_LOGS,
stdin=None, args=()):
"""
@see common_lib.hosts.Host.run()
@see shared.hosts.Host.run()
"""
try:
result = utils.run(
Expand Down
Loading

0 comments on commit 86c1b8e

Please sign in to comment.