Add a key-value file at the test level
At the moment, we put key-value pairs in for performance results.
As well as those per-iteration datums, we have some things we'd like
to record about the test itself - most significantly it's version.
Add another keyval file at the test subdirectory level. I used
a generic helper to do this ... will go back and clean up all
the tests to use it.
Signed-off-by: Martin J. Bligh <mbligh@google.com>
git-svn-id: http://test.kernel.org/svn/autotest/trunk@749 592f7852-d20e-0410-864c-8624ca9c26a4
diff --git a/client/bin/autotest_utils.py b/client/bin/autotest_utils.py
index 507396f..84d8b4c 100755
--- a/client/bin/autotest_utils.py
+++ b/client/bin/autotest_utils.py
@@ -534,3 +534,15 @@
except:
return False
return True
+
+
+def write_keyval(dirname, dictionary):
+ keyval = open(os.path.join(dirname, 'keyval'), 'w')
+ for key in dictionary.keys():
+ value = '%s' % dictionary[key] # convert numbers to strings
+ if re.search(r'\W', key):
+ raise 'Invalid key: ' + key
+ if re.search(r'[^\d\.]', value):
+ raise 'Invalid value %s for key %s' % (value, key)
+ keyval.write('%s=%s\n' % (key, value))
+ keyval.close()