diff options
author | jasplin <qt-info@nokia.com> | 2011-05-26 15:07:14 +0200 |
---|---|---|
committer | jasplin <qt-info@nokia.com> | 2011-05-26 15:07:14 +0200 |
commit | cac600fc0a2069e34036c5112ba4cfb8483bb559 (patch) | |
tree | 8fba1a4e47113b902582cc6c5f03af909b6e9e73 /database/scripts/updatetestcaseids.py | |
parent | eae8ff839296559a637ff100d7585562d68b5cb1 (diff) |
Added Top Changes page to replace ranking feature.
This commit introduces the Top Changes page. This page retrieves
'top 10' changes for all host/platform/branch combinations from
a new 'change' database table. The script that updates this table
for a given host/platform/branch combination is run automatically
after uploading a new set of results (since this is when new
changes may potentially arise).
This commit also removes the ranking feature as this is obsoleted
(more or less) by the new feature.
Diffstat (limited to 'database/scripts/updatetestcaseids.py')
-rwxr-xr-x | database/scripts/updatetestcaseids.py | 45 |
1 files changed, 45 insertions, 0 deletions
diff --git a/database/scripts/updatetestcaseids.py b/database/scripts/updatetestcaseids.py new file mode 100755 index 0000000..d11cb80 --- /dev/null +++ b/database/scripts/updatetestcaseids.py @@ -0,0 +1,45 @@ +#!/usr/bin/env python + +""" +This script updates the testCaseId attribute of all rows in the benchmark table. +""" + +import sys +from dbaccess import setDatabase, execQuery, commit +from misc import findOrInsertId, getOptions, benchmarkToComponents + +# --- BEGIN Global functions ---------------------------------------------- +def printUsage(): + sys.stderr.write( + "usage: " + sys.argv[0] + " [--dbhost H] [--dbport P] --db D\n") +# --- END Global functions ---------------------------------------------- + + +# --- BEGIN Main program ---------------------------------------------- + +options, http_get = getOptions() + +if not ("db" in options): + printUsage() + sys.exit(1) + +setDatabase( + options["dbhost"] if "dbhost" in options else None, + options["dbport"] if "dbport" in options else None, + options["db"]) + +for benchmark_id, benchmark in execQuery( + "SELECT id, value FROM benchmark;", ()): + + test_case, test_function, data_tag = ( + benchmarkToComponents(benchmark)) + test_case_id = findOrInsertId("testCase", test_case) + + execQuery( + "UPDATE benchmark" + " SET testCaseId = %s" + " WHERE id = %s", (test_case_id, benchmark_id), False) + +commit() + +# --- END Main program ---------------------------------------------- |