File assign-correct-value-to-subtest_dirs-from-provider.patch of Package virt-test
--- virttest/utils_test/__init__.py 2014-03-13 15:13:47.336427830 +0800
+++ virttest/utils_test/__init__.py.patch 2014-03-13 15:50:27.846134398 +0800
@@ -39,6 +39,14 @@
import qemu
import libguestfs
+import sys, inspect
+current_file = inspect.getfile(inspect.currentframe())
+current_path=os.path.abspath(os.path.dirname(current_file))
+parent_path=current_path[0:current_path.rfind('/')]
+sys.path.append(parent_path)
+import asset
+import bootstrap
+
try:
from virttest.staging import utils_cgroup
except ImportError:
@@ -1024,6 +1032,24 @@
subtest_dir_specific = os.path.join(test.bindir, params.get('vm_type'),
"tests")
subtest_dirs += data_dir.SubdirList(subtest_dir_specific)
+ provider = params.get("provider", None)
+
+ if provider is None:
+ # Verify if we have the correspondent source file for it
+ for generic_subdir in asset.get_test_provider_subdirs('generic'):
+ subtest_dirs += data_dir.SubdirList(generic_subdir,
+ bootstrap.test_filter)
+
+ for specific_subdir in asset.get_test_provider_subdirs(params.get("vm_type")):
+ subtest_dirs += data_dir.SubdirList(specific_subdir,
+ bootstrap.test_filter)
+ else:
+ provider_info = asset.get_test_provider_info(provider)
+ for key in provider_info['backends']:
+ subtest_dirs += data_dir.SubdirList(
+ provider_info['backends'][key]['path'],
+ bootstrap.test_filter)
+ logging.debug("subtest_dirs=%s",subtest_dirs)
for d in subtest_dirs:
module_path = os.path.join(d, "%s.py" % sub_type)
if os.path.isfile(module_path):