On 03/21/2013 04:43 AM, Mike Qiu wrote:
From: Mike Qiu <[email protected]>

Currently, when create config files, autotest try to find out
the config files need to overridden to the testdir/cfg/*.cfg.

But it trys to pop the element for the list during traversing
itself, this is very dangous, and will cause fault when run
get_start.py, because the list has update yet, but the index
for traverse hasn't update.

All right, my fault, applied, thanks!

Signed-off-by: Mike Qiu <[email protected]>
---
  virttest/bootstrap.py |   10 ++++------
  1 files changed, 4 insertions(+), 6 deletions(-)

diff --git a/virttest/bootstrap.py b/virttest/bootstrap.py
index 83377ab..bdbdda8 100644
--- a/virttest/bootstrap.py
+++ b/virttest/bootstrap.py
@@ -323,16 +323,14 @@ def create_config_files(test_dir, shared_dir, 
interactive, step=None,
      # subtest.cfg.sample, this file takes precedence over the shared
      # subtest.cfg.sample. So, yank this file from the cfg file list.

-    idx = 0
+    config_file_list_shared_keep = []
      for cf in config_file_list_shared:
          basename = os.path.basename(cf)
          target = os.path.join(test_dir, "cfg", basename)
-        if target in config_file_list:
-            config_file_list_shared.pop(idx)
-        idx += 1
-
-    config_file_list += config_file_list_shared
+        if target not in config_file_list:
+            config_file_list_shared_keep.append(cf)

+    config_file_list += config_file_list_shared_keep
      for config_file in config_file_list:
          src_file = config_file
          dst_file = os.path.join(test_dir, "cfg", 
os.path.basename(config_file))


_______________________________________________
Virt-test-devel mailing list
[email protected]
https://www.redhat.com/mailman/listinfo/virt-test-devel

Reply via email to