VirtualBox

Changeset 61462 in vbox


Ignore:
Timestamp:
Jun 4, 2016 1:21:11 AM (9 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
107789
Message:

testmanager: Adding idTestSet to TestResultFiles and TestResultMsgs. Also adding proper indexes to these two tables.

Location:
trunk/src/VBox/ValidationKit/testmanager
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/ValidationKit/testmanager/core/testresults.py

    r61456 r61462  
    251251    ksParam_iUnit               = 'TestResultValue_iUnit';
    252252
     253    kasAllowNullAttributes      = [ 'idTestSet', ];
     254
    253255    def __init__(self):
    254256        ModelDataBase.__init__(self)
     
    313315    ksIdAttr    = 'idTestResultMsg';
    314316
    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
    320327
    321328    def __init__(self):
     
    323330        self.idTestResultMsg    = None;
    324331        self.idTestResult       = None;
     332        self.idTestSet          = None;
    325333        self.tsCreated          = None;
    326334        self.idStrMsg           = None;
     
    337345        self.idTestResultMsg    = aoRow[0];
    338346        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];
    342351        return self;
    343352
     
    361370        """
    362371        TestResultMsgData.initFromDbRow(self, aoRow);
    363         self.sMsg = aoRow[5];
     372        self.sMsg = aoRow[self.kcDbColumns];
    364373        return self;
     374
    365375
    366376class TestResultFileData(ModelDataBase):
     
    402412    ## @}
    403413
     414    kasAllowNullAttributes      = [ 'idTestSet', ];
     415
     416    kcDbColumns                 =  8
     417
    404418    def __init__(self):
    405419        ModelDataBase.__init__(self)
    406420        self.idTestResultFile   = None;
    407421        self.idTestResult       = None;
     422        self.idTestSet          = None;
    408423        self.tsCreated          = None;
    409424        self.idStrFile          = None;
     
    422437        self.idTestResultFile   = aoRow[0];
    423438        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];
    429445        return self;
    430446
     
    454470        """
    455471        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];
    460476        return self;
    461477
     
    10301046                          'SELECT TestResultFiles.tsCreated\n'
    10311047                          'FROM   TestResultFiles\n'
    1032                           '  JOIN TestResults ON TestResultFiles.idTestResult = TestResults.idTestResult\n'
    10331048                          'WHERE  idTestSet = %s\n'
    10341049                          ') UNION (\n'
     
    10391054                          'SELECT TestResultMsgs.tsCreated\n'
    10401055                          'FROM   TestResultMsgs\n'
    1041                           '  JOIN TestResults ON TestResultMsgs.idTestResult = TestResults.idTestResult\n'
    10421056                          'WHERE  idTestSet = %s\n'
    10431057                          ') ORDER by 1'
     
    13861400        # First add a message.
    13871401        #
    1388         self._newFailureDetails(aoStack[0].idTestResult, sError, None);
     1402        self._newFailureDetails(aoStack[0].idTestResult, idTestSet, sError, None);
    13891403
    13901404        #
     
    15781592        return True;
    15791593
    1580     def _newFailureDetails(self, idTestResult, sText, dCounts, tsCreated = None, fCommit = False):
     1594    def _newFailureDetails(self, idTestResult, idTestSet, sText, dCounts, tsCreated = None, fCommit = False):
    15811595        """
    15821596        Creates a record detailing cause of failure.
     
    16091623            self._oDb.execute('INSERT INTO TestResultMsgs (\n'
    16101624                              '         idTestResult,\n'
     1625                              '         idTestSet,\n'
    16111626                              '         idStrMsg,\n'
    16121627                              '         enmLevel)\n'
    1613                               'VALUES ( %s, %s, %s)\n'
    1614                               , ( idTestResult, idStrMsg, 'failure',) );
     1628                              'VALUES ( %s, %s, %s, %s)\n'
     1629                              , ( idTestResult, idTestSet, idStrMsg, 'failure',) );
    16151630        else:
    16161631            self._oDb.execute('INSERT INTO TestResultMsgs (\n'
    16171632                              '         idTestResult,\n'
     1633                              '         idTestSet,\n'
    16181634                              '         tsCreated,\n'
    16191635                              '         idStrMsg,\n'
    16201636                              '         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',) );
    16231639
    16241640        self._oDb.maybeCommit(fCommit);
     
    16861702        return None;
    16871703
    1688     def _doPopHint(self, aoStack, cStackEntries, dCounts):
     1704    def _doPopHint(self, aoStack, cStackEntries, dCounts, idTestSet):
    16891705        """ Executes a PopHint. """
    16901706        assert cStackEntries >= 0;
    16911707        while len(aoStack) > cStackEntries:
    16921708            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);
    16941710                self._completeTestResults(aoStack[0], tsDone = None, cErrors = 1,
    16951711                                          enmStatus = TestResultData.ksTestStatus_Failure, fCommit = True);
     
    18581874
    18591875        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);
    18621879
    18631880        elif sName == 'Passed':
     
    18941911            iDesiredTestDepth = int(dAttribs['testdepth']);
    18951912            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.
    18971914            if iDesiredTestDepth != iTestDepth:
    18981915                return 'PopHint tag has different testdepth: %d, on stack %d.' % (iDesiredTestDepth, iTestDepth);
     
    19922009            sError = 'Expected </PopHint> before the end of the XML section.'
    19932010        if len(aaiHints) > 0:
    1994             self._doPopHint(aoStack, aaiHints[-1][0], dCounts);
     2011            self._doPopHint(aoStack, aaiHints[-1][0], dCounts, idTestSet);
    19952012
    19962013        #
  • trunk/src/VBox/ValidationKit/testmanager/core/testset.py

    r61424 r61462  
    381381                                  'WHERE    idTestResult = %s\n'
    382382                                  , (aoRow[0],));
    383                 self._oDb.execute('INSERT INTO TestResultMsgs (idTestResult, idStrMsg, enmLevel)\n'
    384                                   'VALUES ( %s, %s, \'failure\'::TestResultMsgLevel_T)\n'
    385                                   , (aoRow[0], idStr,));
     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,));
    386386
    387387        #
     
    476476
    477477            idStr = self.strTabString('The test was abandond by the testbox', fCommit = fCommit);
    478             self._oDb.execute('INSERT INTO TestResultMsgs (idTestResult, idStrMsg, enmLevel)\n'
    479                               'VALUES ( %s, %s, \'failure\'::TestResultMsgLevel_T)\n'
    480                               , (oData.idTestResult, idStr,));
     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,));
    481481
    482482        #
     
    519519
    520520        idStr = self.strTabString('Gang gathering timed out', fCommit = fCommit);
    521         self._oDb.execute('INSERT INTO TestResultMsgs (idTestResult, idStrMsg, enmLevel)\n'
    522                           'VALUES ( %s, %s, \'failure\'::TestResultMsgLevel_T)\n'
    523                           , (oData.idTestResult, idStr,));
     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,));
    524524
    525525        self._oDb.execute('UPDATE   TestSets\n'
     
    602602                raise TMExceptionBase('Failed to find unique name for %s.' % (sOrgName,));
    603603
    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'
    606607                          , ( idTestResult,
     608                              oTestSet.idTestSet,
    607609                              self.strTabString(sName),
    608610                              self.strTabString(sDesc),
  • trunk/src/VBox/ValidationKit/testmanager/db/TestManagerDatabaseInit.pgsql

    r61457 r61462  
    12931293    -- This is NULL for the top test result.
    12941294    idTestResultParent  INTEGER     REFERENCES TestResults(idTestResult),
    1295     --- The testsest this result is a part of.
     1295    --- The test set this result is a part of.
    12961296    -- Note! This is a foreign key, but we have to add it after TestSets has
    12971297    --       been created, see further down.
     
    13541354    --- The test result it was reported within.
    13551355    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).
    13571357    -- Note! This is a foreign key, but we have to add it after TestSets has
    13581358    --       been created, see further down.
     
    14001400    --- The test result it was reported within.
    14011401    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,
    14021406    --- Creation time stamp.
    14031407    tsCreated           TIMESTAMP WITH TIME ZONE  DEFAULT current_timestamp  NOT NULL,
     
    14251429
    14261430CREATE INDEX TestResultFilesIdx ON TestResultFiles(idTestResult);
     1431CREATE INDEX TestResultFilesIdx2 ON TestResultFiles(idTestSet, tsCreated DESC);
    14271432
    14281433
     
    14531458    --- The test result it was reported within.
    14541459    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,
    14551464    --- Creation time stamp.
    14561465    tsCreated           TIMESTAMP WITH TIME ZONE  DEFAULT current_timestamp  NOT NULL,
     
    14611470);
    14621471
    1463 CREATE INDEX TestResultMsgsIdx ON TestResultMsgs(idTestResult);
     1472CREATE INDEX TestResultMsgsIdx  ON TestResultMsgs(idTestResult);
     1473CREATE INDEX TestResultMsgsIdx2 ON TestResultMsgs(idTestSet, tsCreated DESC);
    14641474
    14651475
     
    15711581ALTER TABLE TestResults      ADD FOREIGN KEY (idTestSet) REFERENCES TestSets(idTestSet) MATCH FULL;
    15721582ALTER TABLE TestResultValues ADD FOREIGN KEY (idTestSet) REFERENCES TestSets(idTestSet) MATCH FULL;
     1583ALTER TABLE TestResultFiles  ADD FOREIGN KEY (idTestSet) REFERENCES TestSets(idTestSet) MATCH FULL;
     1584ALTER TABLE TestResultMsgs   ADD FOREIGN KEY (idTestSet) REFERENCES TestSets(idTestSet) MATCH FULL;
    15731585ALTER TABLE TestResultFailures ADD CONSTRAINT idTestSetFk FOREIGN KEY (idTestSet) REFERENCES TestSets(idTestSet) MATCH FULL;
    15741586
Note: See TracChangeset for help on using the changeset viewer.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette