summaryrefslogtreecommitdiff
path: root/tko/migrations
diff options
context:
space:
mode:
authorjadmanski <jadmanski@592f7852-d20e-0410-864c-8624ca9c26a4>2008-05-21 18:11:51 +0000
committerjadmanski <jadmanski@592f7852-d20e-0410-864c-8624ca9c26a4>2008-05-21 18:11:51 +0000
commitc1a338f71dde606f553addb9c8ac841d5f4a2e75 (patch)
tree9e74306aef27d71e1ed0fad29c8eaaf144ddf75d /tko/migrations
parente6632b954b288066ef2814e0c4f995cce4d9ef8a (diff)
Risk: Medium
Visibility: Changes the test keyval interface, deprecating the existing test.write_keyval method in favour of a pair of write_*_keyval methods for writing test & iteration keyvals. The deprecated method will still work as it did before, but will generate a warning. Adds a new iteration_attributes table to the database for storing generic string attributes on a per-iteration basis, in the same way that test_attributes allows generic string attributes on a per-test basis. This also adds new methods to the test class for writing these keyvals so that tests can write out attributes by calling self.write_test_keyval (or self.write_iteration_keyval). The iteration method accepts parameters for both generic attributes and performance data. In order to store both performance and non-performance data in the iteration keyvals, the format of the line has been extended to look like "key{blah}=value", with no {blah} being interpreted as equvalent to "{perf}", for backwards compatiblity. Signed-off-by: John Admanski <jadmanski@google.com> git-svn-id: svn://test.kernel.org/autotest/trunk@1535 592f7852-d20e-0410-864c-8624ca9c26a4
Diffstat (limited to 'tko/migrations')
-rw-r--r--tko/migrations/008_add_iteration_attributes.py22
1 files changed, 22 insertions, 0 deletions
diff --git a/tko/migrations/008_add_iteration_attributes.py b/tko/migrations/008_add_iteration_attributes.py
new file mode 100644
index 00000000..4ef176e4
--- /dev/null
+++ b/tko/migrations/008_add_iteration_attributes.py
@@ -0,0 +1,22 @@
+def migrate_up(manager):
+ manager.execute_script(CREATE_TABLE_SQL)
+
+def migrate_down(manager):
+ manager.execute_script(DROP_TABLE_SQL)
+
+
+CREATE_TABLE_SQL = """
+-- test iteration attributes (key value pairs at an iteration level)
+CREATE TABLE iteration_attributes (
+test_idx int(10) unsigned NOT NULL, -- ref to test table
+FOREIGN KEY (test_idx) REFERENCES tests(test_idx) ON DELETE CASCADE,
+iteration INTEGER, -- integer
+attribute VARCHAR(30), -- attribute name (e.g. 'run_id')
+value VARCHAR(100), -- attribute value
+KEY `test_idx` (`test_idx`)
+) TYPE=InnoDB;
+"""
+
+DROP_TABLE_SQL = """
+DROP TABLE iteration_attributes;
+"""