tests: Allow test case descriptions to be written into database
"run-tests.py -S <db file> -L" can now be used to update a database table with the current set of test cases and their descriptions. Signed-hostap: Jouni Malinen <j@w1.fi>
This commit is contained in:
parent
1bd05d0423
commit
f3be6eea9b
2 changed files with 19 additions and 5 deletions
|
@ -189,4 +189,5 @@ cat | sqlite3 /tmp/example.db <<EOF
|
||||||
CREATE TABLE results (test,result,run,time,duration,build,commitid);
|
CREATE TABLE results (test,result,run,time,duration,build,commitid);
|
||||||
CREATE INDEX results_idx ON results (test);
|
CREATE INDEX results_idx ON results (test);
|
||||||
CREATE INDEX results_idx2 ON results (run);
|
CREATE INDEX results_idx2 ON results (run);
|
||||||
|
CREATE TABLE tests (test,description);
|
||||||
EOF
|
EOF
|
||||||
|
|
|
@ -90,10 +90,13 @@ def main():
|
||||||
|
|
||||||
if conn:
|
if conn:
|
||||||
run = str(int(time.time()))
|
run = str(int(time.time()))
|
||||||
with open("commit") as f:
|
try:
|
||||||
val = f.readlines()
|
with open("commit") as f:
|
||||||
if len(val) > 0:
|
val = f.readlines()
|
||||||
commit = val[0].rstrip()
|
if len(val) > 0:
|
||||||
|
commit = val[0].rstrip()
|
||||||
|
except IOError:
|
||||||
|
pass
|
||||||
|
|
||||||
tests = []
|
tests = []
|
||||||
for t in os.listdir("."):
|
for t in os.listdir("."):
|
||||||
|
@ -108,9 +111,19 @@ def main():
|
||||||
func = mod.__dict__.get(s)
|
func = mod.__dict__.get(s)
|
||||||
tests.append(func)
|
tests.append(func)
|
||||||
|
|
||||||
if len(sys.argv) > 1 and sys.argv[1] == '-L':
|
if len(sys.argv) > idx and sys.argv[idx] == '-L':
|
||||||
for t in tests:
|
for t in tests:
|
||||||
print t.__name__ + " - " + t.__doc__
|
print t.__name__ + " - " + t.__doc__
|
||||||
|
if conn:
|
||||||
|
sql = 'INSERT OR REPLACE INTO tests(test,description) VALUES ("' + t.__name__.replace('test_', '', 1) + '", "' + t.__doc__ + '")';
|
||||||
|
try:
|
||||||
|
conn.execute(sql)
|
||||||
|
except Exception, e:
|
||||||
|
print "sqlite: " + str(e)
|
||||||
|
print "sql: " + sql
|
||||||
|
if conn:
|
||||||
|
conn.commit()
|
||||||
|
conn.close()
|
||||||
sys.exit(0)
|
sys.exit(0)
|
||||||
|
|
||||||
if len(sys.argv) > idx:
|
if len(sys.argv) > idx:
|
||||||
|
|
Loading…
Reference in a new issue