[KVM-AUTOTEST PATCH 3/5] kvm_config: store filename on configreader

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



From: Eduardo Habkost <ehabkost@xxxxxxxxxxx>

It will be useful to generate better error messages.

Signed-off-by: Eduardo Habkost <ehabkost@xxxxxxxxxxx>
---
 client/tests/kvm/kvm_config.py |    9 +++++----
 1 files changed, 5 insertions(+), 4 deletions(-)

diff --git a/client/tests/kvm/kvm_config.py b/client/tests/kvm/kvm_config.py
index 5be2e66..35e2ab9 100755
--- a/client/tests/kvm/kvm_config.py
+++ b/client/tests/kvm/kvm_config.py
@@ -48,7 +48,7 @@ class config:
             raise IOError("File %s not found" % filename)
         self.filename = filename
         str = open(filename).read()
-        self.list = self.parse(configreader(str), self.list)
+        self.list = self.parse(configreader(filename, str), self.list)
 
 
     def parse_string(self, str):
@@ -57,7 +57,7 @@ class config:
 
         @param str: String to parse.
         """
-        self.list = self.parse(configreader(str), self.list)
+        self.list = self.parse(configreader('<string>', str), self.list)
 
 
     def fork_and_parse(self, filename=None, str=None):
@@ -342,7 +342,7 @@ class config:
                                             words[1])
                     if os.path.exists(filename):
                         str = open(filename).read()
-                        list = self.parse(configreader(str), list, restricted)
+                        list = self.parse(configreader(filename, str), list, restricted)
                         if self.debug and not restricted:
                             _debug_print("", "Leaving file %s" % words[1])
                     else:
@@ -539,12 +539,13 @@ class configreader:
     whose readline() and/or seek() methods seem to be slow.
     """
 
-    def __init__(self, str):
+    def __init__(self, filename, str):
         """
         Initialize the reader.
 
         @param str: The string to parse.
         """
+        self.filename = filename
         self.line_index = 0
         self.lines = []
         for line in str.splitlines():
-- 
1.7.3.2

--
To unsubscribe from this list: send the line "unsubscribe kvm" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [KVM ARM]     [KVM ia64]     [KVM ppc]     [Virtualization Tools]     [Spice Development]     [Libvirt]     [Libvirt Users]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite Questions]     [Linux Kernel]     [Linux SCSI]     [XFree86]
  Powered by Linux