[autotest] Move dynamic suite code into its own module
No big rewrite, just moving files around
BUG=chromium-os:30266
TEST=unit
TEST=successful run_suite.py run
TEST=suite_enumerator.py, suite_preprocessor.py, and suite_scheduler.py
Change-Id: I2fbcae0332104ce3adcb10a1e90ce94cb209aca8
Reviewed-on: https://gerrit.chromium.org/gerrit/30267
Reviewed-by: Scott Zawalski <[email protected]>
Commit-Ready: Chris Masone <[email protected]>
Tested-by: Chris Masone <[email protected]>
diff --git a/client/common_lib/error.py b/client/common_lib/error.py
index c6febba..42a0875 100644
--- a/client/common_lib/error.py
+++ b/client/common_lib/error.py
@@ -498,7 +498,8 @@
class CrosDynamicSuiteException(Exception):
"""
- Base class for exceptions coming from dynamic suite code in server/cros/*.
+ Base class for exceptions coming from dynamic suite code in
+ server/cros/dynamic_suite/*.
"""
pass
diff --git a/frontend/afe/site_rpc_interface.py b/frontend/afe/site_rpc_interface.py
index eb09da8..6065360 100644
--- a/frontend/afe/site_rpc_interface.py
+++ b/frontend/afe/site_rpc_interface.py
@@ -10,8 +10,9 @@
import sys
from autotest_lib.client.common_lib import error, global_config
from autotest_lib.client.common_lib.cros import dev_server
-from autotest_lib.server.cros import control_file_getter, dynamic_suite
-from autotest_lib.server.cros import job_status
+from autotest_lib.server.cros.dynamic_suite import control_file_getter
+from autotest_lib.server.cros.dynamic_suite import dynamic_suite
+from autotest_lib.server.cros.dynamic_suite import job_status
# Relevant CrosDynamicSuiteExceptions are defined in client/common_lib/error.py.
diff --git a/frontend/afe/site_rpc_interface_unittest.py b/frontend/afe/site_rpc_interface_unittest.py
index b8e99f7..91a9d1c 100644
--- a/frontend/afe/site_rpc_interface_unittest.py
+++ b/frontend/afe/site_rpc_interface_unittest.py
@@ -12,7 +12,8 @@
from autotest_lib.client.common_lib import error
from autotest_lib.client.common_lib.cros import dev_server
from autotest_lib.frontend.afe import site_rpc_interface
-from autotest_lib.server.cros import control_file_getter, dynamic_suite
+from autotest_lib.server.cros.dynamic_suite import control_file_getter
+from autotest_lib.server.cros.dynamic_suite import dynamic_suite
class SiteRpcInterfaceTest(mox.MoxTestBase):
diff --git a/server/cros/dynamic_suite/__init__.py b/server/cros/dynamic_suite/__init__.py
new file mode 100644
index 0000000..dd0d382
--- /dev/null
+++ b/server/cros/dynamic_suite/__init__.py
@@ -0,0 +1 @@
+from dynamic_suite import *
diff --git a/server/cros/control_file_getter.py b/server/cros/dynamic_suite/control_file_getter.py
similarity index 100%
rename from server/cros/control_file_getter.py
rename to server/cros/dynamic_suite/control_file_getter.py
diff --git a/server/cros/control_file_getter_unittest.py b/server/cros/dynamic_suite/control_file_getter_unittest.py
similarity index 98%
rename from server/cros/control_file_getter_unittest.py
rename to server/cros/dynamic_suite/control_file_getter_unittest.py
index a91e4d1..d173e48 100644
--- a/server/cros/control_file_getter_unittest.py
+++ b/server/cros/dynamic_suite/control_file_getter_unittest.py
@@ -14,7 +14,7 @@
from autotest_lib.client.common_lib import error
from autotest_lib.client.common_lib.cros import dev_server
-from autotest_lib.server.cros import control_file_getter
+from autotest_lib.server.cros.dynamic_suite import control_file_getter
class DevServerGetterTest(mox.MoxTestBase):
diff --git a/server/cros/dynamic_suite.py b/server/cros/dynamic_suite/dynamic_suite.py
similarity index 98%
rename from server/cros/dynamic_suite.py
rename to server/cros/dynamic_suite/dynamic_suite.py
index 149b8d9..cb910f1 100644
--- a/server/cros/dynamic_suite.py
+++ b/server/cros/dynamic_suite/dynamic_suite.py
@@ -8,9 +8,10 @@
from autotest_lib.client.common_lib import base_job, control_data, global_config
from autotest_lib.client.common_lib import error, utils
from autotest_lib.client.common_lib.cros import dev_server
-from autotest_lib.server.cros import control_file_getter, frontend_wrappers
-from autotest_lib.server.cros import host_lock_manager, job_status
-from autotest_lib.server.cros.job_status import Status
+from autotest_lib.server.cros.dynamic_suite import control_file_getter
+from autotest_lib.server.cros.dynamic_suite import frontend_wrappers
+from autotest_lib.server.cros.dynamic_suite import host_lock_manager, job_status
+from autotest_lib.server.cros.dynamic_suite.job_status import Status
from autotest_lib.server import frontend
from autotest_lib.frontend.afe.json_rpc import proxy
@@ -34,7 +35,7 @@
Example control file:
import common
-from autotest_lib.server.cros import dynamic_suite
+from autotest_lib.server.cros.dynamic_suite import dynamic_suite
dynamic_suite.reimage_and_run(
build=build, board=board, name='bvt', job=job, pool=pool,
diff --git a/server/cros/dynamic_suite_unittest.py b/server/cros/dynamic_suite/dynamic_suite_unittest.py
similarity index 98%
rename from server/cros/dynamic_suite_unittest.py
rename to server/cros/dynamic_suite/dynamic_suite_unittest.py
index 1de8e08..7f5b6db 100755
--- a/server/cros/dynamic_suite_unittest.py
+++ b/server/cros/dynamic_suite/dynamic_suite_unittest.py
@@ -4,7 +4,7 @@
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
-"""Unit tests for server/cros/dynamic_suite.py."""
+"""Unit tests for server/cros/dynamic_suite/dynamic_suite.py."""
import logging
import mox
@@ -20,11 +20,12 @@
from autotest_lib.client.common_lib import global_config
from autotest_lib.client.common_lib.cros import dev_server
from autotest_lib.frontend.afe.json_rpc import proxy
-from autotest_lib.server.cros import control_file_getter, dynamic_suite
-from autotest_lib.server.cros import host_lock_manager, job_status
-from autotest_lib.server.cros.dynamic_suite_fakes import FakeControlData
-from autotest_lib.server.cros.dynamic_suite_fakes import FakeHost, FakeJob
-from autotest_lib.server.cros.dynamic_suite_fakes import FakeLabel
+from autotest_lib.server.cros.dynamic_suite import control_file_getter
+from autotest_lib.server.cros.dynamic_suite import dynamic_suite
+from autotest_lib.server.cros.dynamic_suite import host_lock_manager, job_status
+from autotest_lib.server.cros.dynamic_suite.fakes import FakeControlData
+from autotest_lib.server.cros.dynamic_suite.fakes import FakeHost, FakeJob
+from autotest_lib.server.cros.dynamic_suite.fakes import FakeLabel
from autotest_lib.server import frontend
diff --git a/server/cros/dynamic_suite_fakes.py b/server/cros/dynamic_suite/fakes.py
similarity index 97%
rename from server/cros/dynamic_suite_fakes.py
rename to server/cros/dynamic_suite/fakes.py
index 29bede0..87df4e2 100644
--- a/server/cros/dynamic_suite_fakes.py
+++ b/server/cros/dynamic_suite/fakes.py
@@ -5,7 +5,7 @@
"""Fakes for dynamic_suite-related unit tests."""
import datetime
-from autotest_lib.server.cros import job_status
+from autotest_lib.server.cros.dynamic_suite import job_status
class FakeControlData(object):
diff --git a/server/cros/frontend_wrappers.py b/server/cros/dynamic_suite/frontend_wrappers.py
similarity index 100%
rename from server/cros/frontend_wrappers.py
rename to server/cros/dynamic_suite/frontend_wrappers.py
diff --git a/server/cros/frontend_wrappers_unittest.py b/server/cros/dynamic_suite/frontend_wrappers_unittest.py
similarity index 93%
rename from server/cros/frontend_wrappers_unittest.py
rename to server/cros/dynamic_suite/frontend_wrappers_unittest.py
index 49e6ad3a..0d58481 100644
--- a/server/cros/frontend_wrappers_unittest.py
+++ b/server/cros/dynamic_suite/frontend_wrappers_unittest.py
@@ -2,7 +2,7 @@
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
-"""Unit tests for server/cros/frontend_wrappers.py."""
+"""Unit tests for server/cros/dynamic_suite/frontend_wrappers.py."""
import logging
import mox
@@ -10,7 +10,7 @@
import unittest
from autotest_lib.client.common_lib.cros import retry
-from autotest_lib.server.cros import frontend_wrappers
+from autotest_lib.server.cros.dynamic_suite import frontend_wrappers
from autotest_lib.server import frontend
class FrontendWrappersTest(mox.MoxTestBase):
diff --git a/server/cros/host_lock_manager.py b/server/cros/dynamic_suite/host_lock_manager.py
similarity index 96%
rename from server/cros/host_lock_manager.py
rename to server/cros/dynamic_suite/host_lock_manager.py
index a9053f1..59b3964 100644
--- a/server/cros/host_lock_manager.py
+++ b/server/cros/dynamic_suite/host_lock_manager.py
@@ -6,7 +6,7 @@
import common
from autotest_lib.client.common_lib import error
-from autotest_lib.server.cros import frontend_wrappers
+from autotest_lib.server.cros.dynamic_suite import frontend_wrappers
"""HostLockManager class, for the dynamic_suite module.
diff --git a/server/cros/host_lock_manager_unittest.py b/server/cros/dynamic_suite/host_lock_manager_unittest.py
similarity index 94%
rename from server/cros/host_lock_manager_unittest.py
rename to server/cros/dynamic_suite/host_lock_manager_unittest.py
index ea013a6..9e4bbce 100644
--- a/server/cros/host_lock_manager_unittest.py
+++ b/server/cros/dynamic_suite/host_lock_manager_unittest.py
@@ -4,7 +4,7 @@
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
-"""Unit tests for server/cros/host_lock_manager.py."""
+"""Unit tests for server/cros/dynamic_suite/host_lock_manager.py."""
import logging
import mox
@@ -12,7 +12,7 @@
import unittest
from autotest_lib.client.common_lib import error
-from autotest_lib.server.cros import host_lock_manager
+from autotest_lib.server.cros.dynamic_suite import host_lock_manager
from autotest_lib.server import frontend
diff --git a/server/cros/job_status.py b/server/cros/dynamic_suite/job_status.py
similarity index 100%
rename from server/cros/job_status.py
rename to server/cros/dynamic_suite/job_status.py
diff --git a/server/cros/job_status_unittest.py b/server/cros/dynamic_suite/job_status_unittest.py
similarity index 97%
rename from server/cros/job_status_unittest.py
rename to server/cros/dynamic_suite/job_status_unittest.py
index 08682e1..93aece6 100644
--- a/server/cros/job_status_unittest.py
+++ b/server/cros/dynamic_suite/job_status_unittest.py
@@ -4,7 +4,7 @@
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
-"""Unit tests for server/cros/job_status.py."""
+"""Unit tests for server/cros/dynamic_suite/job_status.py."""
import logging
import mox
@@ -13,9 +13,9 @@
import time
import unittest
-from autotest_lib.server.cros import job_status, host_lock_manager
-from autotest_lib.server.cros.dynamic_suite_fakes import FakeHost, FakeJob
-from autotest_lib.server.cros.dynamic_suite_fakes import FakeStatus
+from autotest_lib.server.cros.dynamic_suite import job_status, host_lock_manager
+from autotest_lib.server.cros.dynamic_suite.fakes import FakeHost, FakeJob
+from autotest_lib.server.cros.dynamic_suite.fakes import FakeStatus
from autotest_lib.server import frontend
diff --git a/server/site_tests/autoupdate/control b/server/site_tests/autoupdate/control
index 0f36977..3d992a1 100644
--- a/server/site_tests/autoupdate/control
+++ b/server/site_tests/autoupdate/control
@@ -19,12 +19,12 @@
@param image_name: the name of the image, used to label the device a.k.a. build
"""
-from autotest_lib.server.cros import frontend_wrappers
+from autotest_lib.server.cros.dynamic_suite import frontend_wrappers
vers = 'cros-version:'
repo_url = None
if 'image_name' in locals():
- from autotest_lib.server.cros import dynamic_suite
+ from autotest_lib.server.cros.dynamic_suite import dynamic_suite
vers = dynamic_suite.VERSION_PREFIX
repo_url = dynamic_suite.get_package_url(build=image_name)
diff --git a/site_utils/admin/clean_staged_images.py b/site_utils/admin/clean_staged_images.py
index cb20798..0725107 100755
--- a/site_utils/admin/clean_staged_images.py
+++ b/site_utils/admin/clean_staged_images.py
@@ -30,7 +30,7 @@
from autotest_lib.frontend.afe import rpc_client_lib
from autotest_lib.cli.rpc import AFE_RPC_PATH
from autotest_lib.client.common_lib import global_config, logging_config
-from autotest_lib.server.cros.dynamic_suite import VERSION_PREFIX
+from autotest_lib.server.cros.dynamic_suite.dynamic_suite import VERSION_PREFIX
# This filename must be kept in sync with devserver's downloader.py
_TIMESTAMP_FILENAME = 'staged.timestamp'
diff --git a/site_utils/run_suite.py b/site_utils/run_suite.py
index aae7b8e..94bdc60 100755
--- a/site_utils/run_suite.py
+++ b/site_utils/run_suite.py
@@ -18,8 +18,9 @@
import common
import logging
from autotest_lib.client.common_lib import global_config
-from autotest_lib.server.cros import dynamic_suite, frontend_wrappers
-from autotest_lib.server.cros import job_status
+from autotest_lib.server.cros.dynamic_suite import dynamic_suite
+from autotest_lib.server.cros.dynamic_suite import frontend_wrappers
+from autotest_lib.server.cros.dynamic_suite import job_status
CONFIG = global_config.global_config
diff --git a/site_utils/suite_enumerator.py b/site_utils/suite_enumerator.py
index 7b07a08..923dfe6 100755
--- a/site_utils/suite_enumerator.py
+++ b/site_utils/suite_enumerator.py
@@ -21,7 +21,8 @@
import optparse, os, sys, time
import common
-from autotest_lib.server.cros import control_file_getter, dynamic_suite
+from autotest_lib.server.cros.dynamic_suite import control_file_getter
+from autotest_lib.server.cros.dynamic_suite import dynamic_suite
def parse_options():
usage = "usage: %prog [options] suite_name"
diff --git a/site_utils/suite_preprocessor.py b/site_utils/suite_preprocessor.py
index a6768ea..d975a0f 100755
--- a/site_utils/suite_preprocessor.py
+++ b/site_utils/suite_preprocessor.py
@@ -25,7 +25,8 @@
import optparse, os, sys
import common
from autotest_lib.client.common_lib import control_data
-from autotest_lib.server.cros import control_file_getter, dynamic_suite
+from autotest_lib.server.cros.dynamic_suite import control_file_getter
+from autotest_lib.server.cros.dynamic_suite import dynamic_suite
def parse_options():
parser = optparse.OptionParser()
diff --git a/site_utils/suite_scheduler/board_enumerator.py b/site_utils/suite_scheduler/board_enumerator.py
index 57ddc95..c4eb2fd 100644
--- a/site_utils/suite_scheduler/board_enumerator.py
+++ b/site_utils/suite_scheduler/board_enumerator.py
@@ -2,7 +2,7 @@
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
-from autotest_lib.server.cros import frontend_wrappers
+from autotest_lib.server.cros.dynamic_suite import frontend_wrappers
from autotest_lib.server import frontend
from constants import Labels
diff --git a/site_utils/suite_scheduler/deduping_scheduler.py b/site_utils/suite_scheduler/deduping_scheduler.py
index 4545c7c..550c5dc 100644
--- a/site_utils/suite_scheduler/deduping_scheduler.py
+++ b/site_utils/suite_scheduler/deduping_scheduler.py
@@ -3,7 +3,7 @@
# found in the LICENSE file.
import logging
-from autotest_lib.server.cros import frontend_wrappers
+from autotest_lib.server.cros.dynamic_suite import frontend_wrappers
from autotest_lib.server import frontend
diff --git a/site_utils/suite_scheduler/suite_scheduler.py b/site_utils/suite_scheduler/suite_scheduler.py
index d5a4631..8d43b7e 100755
--- a/site_utils/suite_scheduler/suite_scheduler.py
+++ b/site_utils/suite_scheduler/suite_scheduler.py
@@ -41,7 +41,7 @@
import manifest_versions
from autotest_lib.client.common_lib import global_config
from autotest_lib.client.common_lib import logging_config, logging_manager
-from autotest_lib.server.cros import frontend_wrappers
+from autotest_lib.server.cros.dynamic_suite import frontend_wrappers
CONFIG_SECTION = 'SCHEDULER'