logging.debug ("processing sumfile %s logfile %s tool %s",
sumfile.path, logfile.path if logfile else None, tool)
+ # Drop preexisting rows in dejagnu_testsuite and dejagnu_testcase,
+ # so we can create new rows without risk of duplication, even without
+ # unique indexes. We save space by enforcing this constraint manually.
+ # This will drop foreign-key derived tables too, so other i-* engines
+ # need to run, which normally is automatic.
+ db.execute("delete from dejagnu_testsuite where tr=? and sumfile=?", (trid, sumfile.path))
+ db.commit()
+
# create dejagnu testsuite record
- db.execute("insert or ignore into dejagnu_testsuite (tr, logfile, sumfile) values (?, ?, ?);",
+ db.execute("insert into dejagnu_testsuite (tr, logfile, sumfile) values (?, ?, ?);",
(trid, logfile.path if logfile else None, sumfile.path))
db.commit()
# and fetch the testsuite record id right away
logline_number += 1
# time to add the dejagnu_testcase record
- db.execute("insert or ignore into dejagnu_testcase (testsuite, expfile, subtest, result, logcursor, logcursor2, sumcursor)"+
+ db.execute("insert into dejagnu_testcase (testsuite, expfile, subtest, result, logcursor, logcursor2, sumcursor)"+
"values (?,?,?,?,?,?,?);",
(tstid, expfileid, subtestid, resultid,
logline_number_last if loglinefound else None,
tr integer not null, /* testrun ref */
logfile string, /* e.g. testsuite/systemtap.log */
sumfile string not null, /* e.g. testsuite/systemtap.sum */
- unique (tr, sumfile),
+ /* unique (tr, sumfile), */ /* one sumfile per testsuite */
foreign key (tr) references testrun(id) on delete cascade);
+CREATE INDEX if not exists dejagnu_ts_tr on dejagnu_testsuite(tr);
CREATE TABLE if not exists dejagnu_string ( /* string interning table */
id integer primary key,
name string unique);
logcursor integer, /* line# in logfile */
logcursor2 integer, /* line# in logfile */
sumcursor integer, /* line# in logfile */
- unique (testsuite, sumcursor), /* one test case record per sum file line; dupe subtests sometimes appear */
+ /* unique (testsuite, sumcursor), */ /* one test case record per sum file line; dupe subtests sometimes appear */
foreign key (expfile) references dejagnu_string(id) on delete cascade,
foreign key (subtest) references dejagnu_string(id) on delete cascade,
foreign key (testsuite) references dejagnu_testsuite(id) on delete cascade);
+CREATE INDEX if not exists dejagnu_testcase_te on dejagnu_testcase (testsuite, expfile);
CREATE VIEW if not exists dejagnu_testcase_v (testsuite, expfile, subtest, result, logcursor, logcursor2, sumcursor) as
select t.testsuite, es.name, ss.name, rs.name, t.logcursor, t.logcursor2, t.sumcursor
from dejagnu_testcase t, dejagnu_string es, dejagnu_string ss, dejagnu_string rs