Modify read_keyval and write_keyval to allow '.' (periods/decimal points) in the key names (allow python timestamps in perfkeys).
Signed-off-by: Will Chan <williamchan@google.com>
git-svn-id: http://test.kernel.org/svn/autotest/trunk@2866 592f7852-d20e-0410-864c-8624ca9c26a4
diff --git a/client/common_lib/utils.py b/client/common_lib/utils.py
index 39bb7ec..f76b8bf 100644
--- a/client/common_lib/utils.py
+++ b/client/common_lib/utils.py
@@ -164,7 +164,7 @@
keyval = {}
for line in open(path):
line = re.sub('#.*', '', line).rstrip()
- if not re.search(r'^[-\w]+=', line):
+ if not re.search(r'^[-\.\w]+=', line):
raise ValueError('Invalid format line: %s' % line)
key, value = line.split('=', 1)
if re.search('^\d+$', value):
@@ -191,12 +191,12 @@
keyval = open(path, 'a')
if type_tag is None:
- key_regex = re.compile(r'^[-\w]+$')
+ key_regex = re.compile(r'^[-\.\w]+$')
else:
if type_tag not in ('attr', 'perf'):
raise ValueError('Invalid type tag: %s' % type_tag)
escaped_tag = re.escape(type_tag)
- key_regex = re.compile(r'^[-\w]+\{%s\}$' % escaped_tag)
+ key_regex = re.compile(r'^[-\.\w]+\{%s\}$' % escaped_tag)
try:
for key, value in dictionary.iteritems():
if not key_regex.search(key):