Skip to content

Commit

Permalink
API: client: Drop bin directory
Browse files Browse the repository at this point in the history
This patch introduces API changes for test writers

Drop the client/bin directory to make autotest
more palatable for distro packagers, also making
the API more flat. Now all uses of

autotest_lib.client.bin.[library]

become

autotest_lib.client.[library]

The conversion was mostly automated, plus some
tweaks to make autotest-local work, and moving
profilers.py code to the __init__.py of the profilers
directory.

Signed-off-by: Lucas Meneghel Rodrigues <[email protected]>
  • Loading branch information
lmr committed Apr 18, 2012
1 parent 295fefe commit 4ece855
Show file tree
Hide file tree
Showing 302 changed files with 319 additions and 320 deletions.
File renamed without changes.
2 changes: 1 addition & 1 deletion client/bin/autotest → client/autotest
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ try:
except ImportError:
import common

from autotest_lib.client.bin import autotest_local
from autotest_lib.client import autotest_local

if __name__ == '__main__':
app = autotest_local.AutotestLocalApp()
Expand Down
2 changes: 1 addition & 1 deletion client/bin/autotest-local → client/autotest-local
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ try:
except ImportError:
import common

from autotest_lib.client.bin import autotest_local
from autotest_lib.client import autotest_local

if __name__ == '__main__':
app = autotest_local.AutotestLocalApp()
Expand Down
File renamed without changes.
8 changes: 4 additions & 4 deletions client/bin/autotest_local.py → client/autotest_local.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,13 @@
autodirbin = os.path.join(rootdir, 'client', 'bin')
except ImportError:
import common
autodirbin = os.path.dirname(os.path.realpath(sys.argv[0]))
autodirbin = os.path.realpath(sys.argv[0])
autodir = os.path.dirname(autodirbin)
sys.path.insert(0, autodirbin)

from autotest_lib.client.bin import job
from autotest_lib.client import job
from autotest_lib.client.common_lib import global_config
from autotest_lib.client.bin import cmdparser, optparser
from autotest_lib.client import cmdparser, optparser

autodirtest = os.path.join(autodir, "tests")

Expand Down Expand Up @@ -61,7 +61,7 @@ def main(self):
default=True)

if self.options.client_test_setup:
from autotest_lib.client.bin import setup_job
from autotest_lib.client import setup_job
exit_code = 0
try:
setup_job.setup_tests(self.options)
Expand Down
File renamed without changes.
File renamed without changes.
2 changes: 1 addition & 1 deletion client/bin/base_sysinfo.py → client/base_sysinfo.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import os, shutil, re, glob, subprocess, logging, gzip

from autotest_lib.client.common_lib import log, global_config
from autotest_lib.client.bin import utils, package
from autotest_lib.client import utils, package

GLOBAL_CONFIG = global_config.global_config

Expand Down
File renamed without changes.
Empty file removed client/bin/net/__init__.py
Empty file.
36 changes: 0 additions & 36 deletions client/bin/profilers.py

This file was deleted.

File renamed without changes.
File renamed without changes.
2 changes: 1 addition & 1 deletion client/bin/cmdparser.py → client/cmdparser.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
"""

import os, re, sys
from autotest_lib.client.bin import os_dep
from autotest_lib.client import os_dep
from autotest_lib.client.common_lib import global_config

GLOBAL_CONFIG = global_config.global_config
Expand Down
3 changes: 1 addition & 2 deletions client/bin/net/common.py → client/common.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,7 @@
import autotest.client.setup_modules as setup_modules
client_dir = os.path.dirname(setup_modules.__file__)
except ImportError:
dirname = os.path.dirname(sys.modules[__name__].__file__)
client_dir = os.path.abspath(os.path.join(dirname, "../.."))
client_dir = os.path.dirname(sys.modules[__name__].__file__)
sys.path.insert(0, client_dir)
import setup_modules
sys.path.pop(0)
Expand Down
2 changes: 1 addition & 1 deletion client/common_lib/base_job.py
Original file line number Diff line number Diff line change
Expand Up @@ -1023,7 +1023,7 @@ def readwrite_dir(*args):
return self._job_directory(os.path.join(*args), True)

# various client-specific directories
self._bindir = readonly_dir(self.clientdir, 'bin')
self._bindir = readonly_dir(self.clientdir)
self._configdir = readonly_dir(self.clientdir, 'config')
self._profdir = readonly_dir(self.clientdir, 'profilers')
self._pkgdir = readwrite_dir(self.clientdir, 'packages')
Expand Down
2 changes: 1 addition & 1 deletion client/common_lib/base_packages.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
"""

import fcntl, logging, os, re, shutil
from autotest_lib.client.bin import os_dep
from autotest_lib.client import os_dep
from autotest_lib.client.common_lib import error, utils, global_config


Expand Down
2 changes: 1 addition & 1 deletion client/common_lib/base_syncdata.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
from autotest_lib.client.common_lib import barrier
from autotest_lib.client.common_lib import utils
from autotest_lib.client.common_lib import autotemp
from autotest_lib.client.bin import parallel
from autotest_lib.client import parallel

_DEFAULT_PORT = 13234
_DEFAULT_TIMEOUT = 10
Expand Down
2 changes: 1 addition & 1 deletion client/common_lib/git.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

import os, logging
import error
from autotest_lib.client.bin import utils, os_dep
from autotest_lib.client import utils, os_dep


__all__ = ["GitRepoHelper", "get_repo"]
Expand Down
2 changes: 1 addition & 1 deletion client/common_lib/hosts/base_classes.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@

from autotest_lib.client.common_lib import global_config, error, utils
from autotest_lib.client.common_lib import host_protections
from autotest_lib.client.bin import partition
from autotest_lib.client import partition


class Host(object):
Expand Down
2 changes: 1 addition & 1 deletion client/common_lib/software_manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
import autotest.common as common
except ImportError:
import common
from autotest_lib.client.bin import os_dep, utils
from autotest_lib.client import os_dep, utils
from autotest_lib.client.common_lib import error
from autotest_lib.client.common_lib import logging_config, logging_manager

Expand Down
2 changes: 1 addition & 1 deletion client/common_lib/test.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
import fcntl, getpass, os, re, sys, shutil, tempfile, time, traceback, logging

from autotest_lib.client.common_lib import error, global_config
from autotest_lib.client.bin import utils
from autotest_lib.client import utils


GLOBAL_CONFIG = global_config.global_config
Expand Down
File renamed without changes.
2 changes: 1 addition & 1 deletion client/bin/cpuset.py → client/cpuset.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
# for use on kernels not running some site-specific container manager

import os, sys, re, glob, fcntl, logging
from autotest_lib.client.bin import utils
from autotest_lib.client import utils
from autotest_lib.client.common_lib import error

SUPER_ROOT = '' # root of all containers or cgroups
Expand Down
2 changes: 1 addition & 1 deletion client/deps/boottool/boottool.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#!/usr/bin/python

import os
from autotest_lib.client.bin import utils
from autotest_lib.client import utils

# To use this, you have to set PERL5LIB to:
# autodir+'deps/boottool/lib/perl'
Expand Down
2 changes: 1 addition & 1 deletion client/deps/dejagnu/dejagnu.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#!/usr/bin/python

import os
from autotest_lib.client.bin import utils
from autotest_lib.client import utils

version = 1

Expand Down
2 changes: 1 addition & 1 deletion client/deps/grubby/grubby.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#!/usr/bin/python

import os
from autotest_lib.client.bin import utils
from autotest_lib.client import utils

version = 1

Expand Down
2 changes: 1 addition & 1 deletion client/deps/libaio/libaio.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#!/usr/bin/python

import os
from autotest_lib.client.bin import utils
from autotest_lib.client import utils

version = 1

Expand Down
2 changes: 1 addition & 1 deletion client/deps/libcap/libcap.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#!/usr/bin/python

import os
from autotest_lib.client.bin import utils
from autotest_lib.client import utils

version = 2

Expand Down
2 changes: 1 addition & 1 deletion client/deps/libnet/libnet.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#!/usr/bin/python

import os
from autotest_lib.client.bin import utils
from autotest_lib.client import utils

version = 1

Expand Down
2 changes: 1 addition & 1 deletion client/deps/mysql/mysql.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#!/usr/bin/python

import os
from autotest_lib.client.bin import utils
from autotest_lib.client import utils

version = 3

Expand Down
2 changes: 1 addition & 1 deletion client/deps/pgpool/pgpool.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#!/usr/bin/python

import os
from autotest_lib.client.bin import utils
from autotest_lib.client import utils

version = 1

Expand Down
2 changes: 1 addition & 1 deletion client/deps/pgsql/pgsql.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#!/usr/bin/python

import os
from autotest_lib.client.bin import utils
from autotest_lib.client import utils

version = 4

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

import os
import shutil
from autotest_lib.client.bin import utils
from autotest_lib.client import utils

version = 1

Expand Down
2 changes: 1 addition & 1 deletion client/bin/fsdev_disks.py → client/fsdev_disks.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import sys, os, re, string
from autotest_lib.client.bin import utils, fsinfo, fsdev_mgr, partition
from autotest_lib.client import utils, fsinfo, fsdev_mgr, partition
from autotest_lib.client.common_lib import error


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
import autotest.common as common
except ImportError:
import common
from autotest_lib.client.bin import fsdev_disks
from autotest_lib.client import fsdev_disks

class fsdev_disks_test(unittest.TestCase):
def test_legacy_str_to_test_flags(self):
Expand Down
4 changes: 2 additions & 2 deletions client/bin/fsdev_mgr.py → client/fsdev_mgr.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
to any of these methods should inherit this class.
"""

from autotest_lib.client.bin import utils
from autotest_lib.client import utils

class BaseFsdevManager(object):

Expand Down Expand Up @@ -43,7 +43,7 @@ def use_partition(self, part_name):


SiteFsdevManager = utils.import_site_class(
__file__, "autotest_lib.client.bin.site_fsdev", "SiteFsdevManager",
__file__, "autotest_lib.client.site_fsdev", "SiteFsdevManager",
BaseFsdevManager)

# Wrap whatever SiteFsdevManager class we've found above in a class
Expand Down
File renamed without changes.
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_lib.client.bin import fsinfo
from autotest_lib.client import fsinfo
from autotest_lib.client.common_lib.test_utils import mock

class fsionfo_test(unittest.TestCase):
Expand Down
2 changes: 1 addition & 1 deletion client/bin/harness.py → client/harness.py
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ def select(which, job, harness_args):

harness_name = 'harness_%s' % which
harness_module = common.setup_modules.import_module(harness_name,
'autotest_lib.client.bin')
'autotest_lib.client')
harness_instance = getattr(harness_module, harness_name)(job, harness_args)

return harness_instance
2 changes: 1 addition & 1 deletion client/bin/harness_ABAT.py → client/harness_ABAT.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

__author__ = """Copyright Andy Whitcroft 2006"""

from autotest_lib.client.bin import utils
from autotest_lib.client import utils
import os, harness, time, re

def autobench_load(fn):
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import os, logging, ConfigParser
from autotest_lib.client.common_lib import autotemp, base_packages, error
from autotest_lib.client.common_lib import global_config
from autotest_lib.client.bin import harness
from autotest_lib.client import harness


class harness_autoserv(harness.harness):
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
__author__ = """Copyright Andy Whitcroft 2007"""

from autotest_lib.client.common_lib import error
from autotest_lib.client.bin import utils
from autotest_lib.client import utils
import os, harness, shutil, logging

class harness_standalone(harness.harness):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
except ImportError:
import common
from autotest_lib.client.common_lib.test_utils import mock
from autotest_lib.client.bin import harness, harness_standalone, harness_ABAT
from autotest_lib.client import harness, harness_standalone, harness_ABAT


class harness_unittest(unittest.TestCase):
Expand Down
Loading

0 comments on commit 4ece855

Please sign in to comment.