@ client/tests/virt/ $ ./run -c qemu/cfg/tests.cfg
  IOError: [Errno 20] Not a directory: '/home/devel/
  autotest/client/tests/virt/cfg/cfg/virtio-win.cfg'

The processed type name is 'cfg', it should be 'qemu'

I tried to execute run without 'type' parameter,
and got an error of wrong path of cfg file.
This patches fixed this problem. 'options.type' is
also used in other part, so assign the processed
type name to it.

v2: fix a wrong assignment

Signed-off-by: Amos Kong <[email protected]>
---
 virttest/standalone_test.py |    9 ++++++---
 1 files changed, 6 insertions(+), 3 deletions(-)

diff --git a/virttest/standalone_test.py b/virttest/standalone_test.py
index 3a528e2..9dad8dd 100644
--- a/virttest/standalone_test.py
+++ b/virttest/standalone_test.py
@@ -378,7 +378,8 @@ def create_config_files(options):
         test_dir = os.path.join(test_dir, options.type)
     elif options.config:
         parent_config_dir = os.path.dirname(options.config)
-        parent_config_dir = os.path.basename(parent_config_dir)
+        parent_config_dir = os.path.dirname(parent_config_dir)
+        options.type = parent_config_dir
         test_dir = os.path.join(test_dir, parent_config_dir)
 
     bootstrap.create_config_files(test_dir, shared_dir, interactive=False)
@@ -495,8 +496,10 @@ def bootstrap_tests(options):
         test_dir = os.path.abspath(os.path.join(os.path.dirname(test_dir),
                                                 options.type))
     elif options.config:
-        test_dir = os.path.dirname(os.path.dirname(options.config))
-        test_dir = os.path.abspath(test_dir)
+        parent_config_dir = os.path.dirname(os.path.dirname(options.config))
+        parent_config_dir = os.path.dirname(parent_config_dir)
+        options.type = parent_config_dir
+        test_dir = os.path.abspath(parent_config_dir)
 
     if options.type == 'qemu':
         check_modules = ["kvm", "kvm-%s" % 
utils_misc.get_cpu_vendor(verbose=False)]
-- 
1.7.1

_______________________________________________
Autotest-kernel mailing list
[email protected]
https://www.redhat.com/mailman/listinfo/autotest-kernel

Reply via email to