Changeset 61462 in vbox
- Timestamp:
- Jun 4, 2016 1:21:11 AM (9 years ago)
- svn:sync-xref-src-repo-rev:
- 107789
- Location:
- trunk/src/VBox/ValidationKit/testmanager
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/ValidationKit/testmanager/core/testresults.py
r61456 r61462 251 251 ksParam_iUnit = 'TestResultValue_iUnit'; 252 252 253 kasAllowNullAttributes = [ 'idTestSet', ]; 254 253 255 def __init__(self): 254 256 ModelDataBase.__init__(self) … … 313 315 ksIdAttr = 'idTestResultMsg'; 314 316 315 ksParam_idTestResultMsg = 'TestResultValue_idTestResultMsg'; 316 ksParam_idTestResult = 'TestResultValue_idTestResult'; 317 ksParam_tsCreated = 'TestResultValue_tsCreated'; 318 ksParam_idStrMsg = 'TestResultValue_idStrMsg'; 319 ksParam_enmLevel = 'TestResultValue_enmLevel'; 317 ksParam_idTestResultMsg = 'TestResultValue_idTestResultMsg'; 318 ksParam_idTestResult = 'TestResultValue_idTestResult'; 319 ksParam_idTestSet = 'TestResultValue_idTestSet'; 320 ksParam_tsCreated = 'TestResultValue_tsCreated'; 321 ksParam_idStrMsg = 'TestResultValue_idStrMsg'; 322 ksParam_enmLevel = 'TestResultValue_enmLevel'; 323 324 kasAllowNullAttributes = [ 'idTestSet', ]; 325 326 kcDbColumns = 6 320 327 321 328 def __init__(self): … … 323 330 self.idTestResultMsg = None; 324 331 self.idTestResult = None; 332 self.idTestSet = None; 325 333 self.tsCreated = None; 326 334 self.idStrMsg = None; … … 337 345 self.idTestResultMsg = aoRow[0]; 338 346 self.idTestResult = aoRow[1]; 339 self.tsCreated = aoRow[2]; 340 self.idStrMsg = aoRow[3]; 341 self.enmLevel = aoRow[4]; 347 self.idTestSet = aoRow[2]; 348 self.tsCreated = aoRow[3]; 349 self.idStrMsg = aoRow[4]; 350 self.enmLevel = aoRow[5]; 342 351 return self; 343 352 … … 361 370 """ 362 371 TestResultMsgData.initFromDbRow(self, aoRow); 363 self.sMsg = aoRow[ 5];372 self.sMsg = aoRow[self.kcDbColumns]; 364 373 return self; 374 365 375 366 376 class TestResultFileData(ModelDataBase): … … 402 412 ## @} 403 413 414 kasAllowNullAttributes = [ 'idTestSet', ]; 415 416 kcDbColumns = 8 417 404 418 def __init__(self): 405 419 ModelDataBase.__init__(self) 406 420 self.idTestResultFile = None; 407 421 self.idTestResult = None; 422 self.idTestSet = None; 408 423 self.tsCreated = None; 409 424 self.idStrFile = None; … … 422 437 self.idTestResultFile = aoRow[0]; 423 438 self.idTestResult = aoRow[1]; 424 self.tsCreated = aoRow[2]; 425 self.idStrFile = aoRow[3]; 426 self.idStrDescription = aoRow[4]; 427 self.idStrKind = aoRow[5]; 428 self.idStrMime = aoRow[6]; 439 self.idTestSet = aoRow[2]; 440 self.tsCreated = aoRow[3]; 441 self.idStrFile = aoRow[4]; 442 self.idStrDescription = aoRow[5]; 443 self.idStrKind = aoRow[6]; 444 self.idStrMime = aoRow[7]; 429 445 return self; 430 446 … … 454 470 """ 455 471 TestResultFileData.initFromDbRow(self, aoRow); 456 self.sFile = aoRow[ 7];457 self.sDescription = aoRow[ 8];458 self.sKind = aoRow[ 9];459 self.sMime = aoRow[ 10];472 self.sFile = aoRow[self.kcDbColumns]; 473 self.sDescription = aoRow[self.kcDbColumns + 1]; 474 self.sKind = aoRow[self.kcDbColumns + 2]; 475 self.sMime = aoRow[self.kcDbColumns + 3]; 460 476 return self; 461 477 … … 1030 1046 'SELECT TestResultFiles.tsCreated\n' 1031 1047 'FROM TestResultFiles\n' 1032 ' JOIN TestResults ON TestResultFiles.idTestResult = TestResults.idTestResult\n'1033 1048 'WHERE idTestSet = %s\n' 1034 1049 ') UNION (\n' … … 1039 1054 'SELECT TestResultMsgs.tsCreated\n' 1040 1055 'FROM TestResultMsgs\n' 1041 ' JOIN TestResults ON TestResultMsgs.idTestResult = TestResults.idTestResult\n'1042 1056 'WHERE idTestSet = %s\n' 1043 1057 ') ORDER by 1' … … 1386 1400 # First add a message. 1387 1401 # 1388 self._newFailureDetails(aoStack[0].idTestResult, sError, None);1402 self._newFailureDetails(aoStack[0].idTestResult, idTestSet, sError, None); 1389 1403 1390 1404 # … … 1578 1592 return True; 1579 1593 1580 def _newFailureDetails(self, idTestResult, sText, dCounts, tsCreated = None, fCommit = False):1594 def _newFailureDetails(self, idTestResult, idTestSet, sText, dCounts, tsCreated = None, fCommit = False): 1581 1595 """ 1582 1596 Creates a record detailing cause of failure. … … 1609 1623 self._oDb.execute('INSERT INTO TestResultMsgs (\n' 1610 1624 ' idTestResult,\n' 1625 ' idTestSet,\n' 1611 1626 ' idStrMsg,\n' 1612 1627 ' enmLevel)\n' 1613 'VALUES ( %s, %s, %s )\n'1614 , ( idTestResult, id StrMsg, 'failure',) );1628 'VALUES ( %s, %s, %s, %s)\n' 1629 , ( idTestResult, idTestSet, idStrMsg, 'failure',) ); 1615 1630 else: 1616 1631 self._oDb.execute('INSERT INTO TestResultMsgs (\n' 1617 1632 ' idTestResult,\n' 1633 ' idTestSet,\n' 1618 1634 ' tsCreated,\n' 1619 1635 ' idStrMsg,\n' 1620 1636 ' enmLevel)\n' 1621 'VALUES ( %s, TIMESTAMP WITH TIME ZONE %s, %s, %s)\n'1622 , ( idTestResult, tsCreated, idStrMsg, 'failure',) );1637 'VALUES ( %s, %s, TIMESTAMP WITH TIME ZONE %s, %s, %s)\n' 1638 , ( idTestResult, idTestSet, tsCreated, idStrMsg, 'failure',) ); 1623 1639 1624 1640 self._oDb.maybeCommit(fCommit); … … 1686 1702 return None; 1687 1703 1688 def _doPopHint(self, aoStack, cStackEntries, dCounts ):1704 def _doPopHint(self, aoStack, cStackEntries, dCounts, idTestSet): 1689 1705 """ Executes a PopHint. """ 1690 1706 assert cStackEntries >= 0; 1691 1707 while len(aoStack) > cStackEntries: 1692 1708 if aoStack[0].enmStatus == TestResultData.ksTestStatus_Running: 1693 self._newFailureDetails(aoStack[0].idTestResult, 'XML error: Missing </Test>', dCounts);1709 self._newFailureDetails(aoStack[0].idTestResult, idTestSet, 'XML error: Missing </Test>', dCounts); 1694 1710 self._completeTestResults(aoStack[0], tsDone = None, cErrors = 1, 1695 1711 enmStatus = TestResultData.ksTestStatus_Failure, fCommit = True); … … 1858 1874 1859 1875 elif sName == 'FailureDetails': 1860 self._newFailureDetails(idTestResult = aoStack[0].idTestResult, tsCreated = dAttribs['timestamp'], 1861 sText = dAttribs['text'], dCounts = dCounts, fCommit = True); 1876 self._newFailureDetails(idTestResult = aoStack[0].idTestResult, idTestSet = idTestSet, 1877 tsCreated = dAttribs['timestamp'], sText = dAttribs['text'], dCounts = dCounts, 1878 fCommit = True); 1862 1879 1863 1880 elif sName == 'Passed': … … 1894 1911 iDesiredTestDepth = int(dAttribs['testdepth']); 1895 1912 cStackEntries, iTestDepth = aaiHints.pop(0); 1896 self._doPopHint(aoStack, cStackEntries, dCounts ); # Fake the necessary '<End/></Test>' tags.1913 self._doPopHint(aoStack, cStackEntries, dCounts, idTestSet); # Fake the necessary '<End/></Test>' tags. 1897 1914 if iDesiredTestDepth != iTestDepth: 1898 1915 return 'PopHint tag has different testdepth: %d, on stack %d.' % (iDesiredTestDepth, iTestDepth); … … 1992 2009 sError = 'Expected </PopHint> before the end of the XML section.' 1993 2010 if len(aaiHints) > 0: 1994 self._doPopHint(aoStack, aaiHints[-1][0], dCounts );2011 self._doPopHint(aoStack, aaiHints[-1][0], dCounts, idTestSet); 1995 2012 1996 2013 # -
trunk/src/VBox/ValidationKit/testmanager/core/testset.py
r61424 r61462 381 381 'WHERE idTestResult = %s\n' 382 382 , (aoRow[0],)); 383 self._oDb.execute('INSERT INTO TestResultMsgs (idTestResult, id StrMsg, enmLevel)\n'384 'VALUES ( %s, %s, \'failure\'::TestResultMsgLevel_T)\n'385 , (aoRow[0], id Str,));383 self._oDb.execute('INSERT INTO TestResultMsgs (idTestResult, idTestSet, idStrMsg, enmLevel)\n' 384 'VALUES ( %s, %s, %s, \'failure\'::TestResultMsgLevel_T)\n' 385 , (aoRow[0], idTestSet, idStr,)); 386 386 387 387 # … … 476 476 477 477 idStr = self.strTabString('The test was abandond by the testbox', fCommit = fCommit); 478 self._oDb.execute('INSERT INTO TestResultMsgs (idTestResult, id StrMsg, enmLevel)\n'479 'VALUES ( %s, %s, \'failure\'::TestResultMsgLevel_T)\n'480 , (oData.idTestResult, id Str,));478 self._oDb.execute('INSERT INTO TestResultMsgs (idTestResult, idTestSet, idStrMsg, enmLevel)\n' 479 'VALUES ( %s, %s, %s, \'failure\'::TestResultMsgLevel_T)\n' 480 , (oData.idTestResult, idTestSet, idStr,)); 481 481 482 482 # … … 519 519 520 520 idStr = self.strTabString('Gang gathering timed out', fCommit = fCommit); 521 self._oDb.execute('INSERT INTO TestResultMsgs (idTestResult, id StrMsg, enmLevel)\n'522 'VALUES ( %s, %s, \'failure\'::TestResultMsgLevel_T)\n'523 , (oData.idTestResult, id Str,));521 self._oDb.execute('INSERT INTO TestResultMsgs (idTestResult, idTestSet, idStrMsg, enmLevel)\n' 522 'VALUES ( %s, %s, %s, \'failure\'::TestResultMsgLevel_T)\n' 523 , (oData.idTestResult, idTestSet, idStr,)); 524 524 525 525 self._oDb.execute('UPDATE TestSets\n' … … 602 602 raise TMExceptionBase('Failed to find unique name for %s.' % (sOrgName,)); 603 603 604 self._oDb.execute('INSERT INTO TestResultFiles(idTestResult, idStrFile, idStrDescription, idStrKind, idStrMime)\n' 605 'VALUES (%s, %s, %s, %s, %s)\n' 604 self._oDb.execute('INSERT INTO TestResultFiles(idTestResult, idTestSet, idStrFile, idStrDescription,\n' 605 ' idStrKind, idStrMime)\n' 606 'VALUES (%s, %s, %s, %s, %s, %s)\n' 606 607 , ( idTestResult, 608 oTestSet.idTestSet, 607 609 self.strTabString(sName), 608 610 self.strTabString(sDesc), -
trunk/src/VBox/ValidationKit/testmanager/db/TestManagerDatabaseInit.pgsql
r61457 r61462 1293 1293 -- This is NULL for the top test result. 1294 1294 idTestResultParent INTEGER REFERENCES TestResults(idTestResult), 1295 --- The test sest this result is a part of.1295 --- The test set this result is a part of. 1296 1296 -- Note! This is a foreign key, but we have to add it after TestSets has 1297 1297 -- been created, see further down. … … 1354 1354 --- The test result it was reported within. 1355 1355 idTestResult INTEGER REFERENCES TestResults(idTestResult) NOT NULL, 1356 --- The test result it was reported within.1356 --- The test set this value is a part of (for avoiding joining thru TestResults). 1357 1357 -- Note! This is a foreign key, but we have to add it after TestSets has 1358 1358 -- been created, see further down. … … 1400 1400 --- The test result it was reported within. 1401 1401 idTestResult INTEGER REFERENCES TestResults(idTestResult) NOT NULL, 1402 --- The test set this file is a part of (for avoiding joining thru TestResults). 1403 -- Note! This is a foreign key, but we have to add it after TestSets has 1404 -- been created, see further down. 1405 idTestSet INTEGER NOT NULL, 1402 1406 --- Creation time stamp. 1403 1407 tsCreated TIMESTAMP WITH TIME ZONE DEFAULT current_timestamp NOT NULL, … … 1425 1429 1426 1430 CREATE INDEX TestResultFilesIdx ON TestResultFiles(idTestResult); 1431 CREATE INDEX TestResultFilesIdx2 ON TestResultFiles(idTestSet, tsCreated DESC); 1427 1432 1428 1433 … … 1453 1458 --- The test result it was reported within. 1454 1459 idTestResult INTEGER REFERENCES TestResults(idTestResult) NOT NULL, 1460 --- The test set this file is a part of (for avoiding joining thru TestResults). 1461 -- Note! This is a foreign key, but we have to add it after TestSets has 1462 -- been created, see further down. 1463 idTestSet INTEGER NOT NULL, 1455 1464 --- Creation time stamp. 1456 1465 tsCreated TIMESTAMP WITH TIME ZONE DEFAULT current_timestamp NOT NULL, … … 1461 1470 ); 1462 1471 1463 CREATE INDEX TestResultMsgsIdx ON TestResultMsgs(idTestResult); 1472 CREATE INDEX TestResultMsgsIdx ON TestResultMsgs(idTestResult); 1473 CREATE INDEX TestResultMsgsIdx2 ON TestResultMsgs(idTestSet, tsCreated DESC); 1464 1474 1465 1475 … … 1571 1581 ALTER TABLE TestResults ADD FOREIGN KEY (idTestSet) REFERENCES TestSets(idTestSet) MATCH FULL; 1572 1582 ALTER TABLE TestResultValues ADD FOREIGN KEY (idTestSet) REFERENCES TestSets(idTestSet) MATCH FULL; 1583 ALTER TABLE TestResultFiles ADD FOREIGN KEY (idTestSet) REFERENCES TestSets(idTestSet) MATCH FULL; 1584 ALTER TABLE TestResultMsgs ADD FOREIGN KEY (idTestSet) REFERENCES TestSets(idTestSet) MATCH FULL; 1573 1585 ALTER TABLE TestResultFailures ADD CONSTRAINT idTestSetFk FOREIGN KEY (idTestSet) REFERENCES TestSets(idTestSet) MATCH FULL; 1574 1586
Note:
See TracChangeset
for help on using the changeset viewer.