Changeset 61453 in vbox for trunk/src/VBox
- Timestamp:
- Jun 3, 2016 4:40:06 PM (9 years ago)
- Location:
- trunk/src/VBox/ValidationKit/testmanager
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/ValidationKit/testmanager/core/testresults.py
r61424 r61453 503 503 """ 504 504 505 class FailureReasonListingData(object): 506 """ Failure reason listing data """ 507 def __init__(self): 508 self.oFailureReason = None; 509 self.oFailureReasonAssigner = None; 510 self.tsFailureReasonAssigned = None; 511 self.sFailureReasonComment = None; 512 505 513 def __init__(self): 506 514 """Initialize""" … … 544 552 self.iRevisionTestSuite = None; 545 553 546 self.oFailureReason = None; 547 self.oFailureReasonAssigner = None; 548 self.tsFailureReasonAssigned = None; 549 self.sFailureReasonComment = None; 554 self.aoFailureReasons = []; 550 555 551 556 def initFromDbRowEx(self, aoRow, oFailureReasonLogic, oUserAccountLogic): … … 594 599 self.iRevisionTestSuite = aoRow[30]; 595 600 596 self.oFailureReason = None; 597 if aoRow[31] is not None: 598 self.oFailureReason = oFailureReasonLogic.cachedLookup(aoRow[31]); 599 self.oFailureReasonAssigner = None; 600 if aoRow[32] is not None: 601 self.oFailureReasonAssigner = oUserAccountLogic.cachedLookup(aoRow[32]); 602 self.tsFailureReasonAssigned = aoRow[33]; 603 self.sFailureReasonComment = aoRow[34]; 601 self.aoFailureReasons = []; 602 for i, _ in enumerate(aoRow[31]): 603 if aoRow[31][i] is not None \ 604 or aoRow[32][i] is not None \ 605 or aoRow[33][i] is not None \ 606 or aoRow[34][i] is not None: 607 oReason = self.FailureReasonListingData(); 608 if aoRow[31][i] is not None: 609 oReason.oFailureReason = oFailureReasonLogic.cachedLookup(aoRow[31][i]); 610 if aoRow[32][i] is not None: 611 oReason.oFailureReasonAssigner = oUserAccountLogic.cachedLookup(aoRow[32][i]); 612 oReason.tsFailureReasonAssigned = aoRow[33][i]; 613 oReason.sFailureReasonComment = aoRow[34][i]; 614 self.aoFailureReasons.append(oReason); 604 615 605 616 return self … … 677 688 ## Default sort by map. 678 689 kdResultSortByMap = { 679 ksResultsSortByRunningAndStart: ( '', None, None, ''),690 ksResultsSortByRunningAndStart: ( '', None, None, '', '' ), 680 691 ksResultsSortByBuildRevision: ( 681 692 # Sorting tables. … … 688 699 ' Builds.iRevision DESC', 689 700 # Extra columns to fetch for the above ORDER BY to work in a SELECT DISTINCT statement. 690 '' ), 701 '', 702 # Columns for the GROUP BY 703 ''), 691 704 ksResultsSortByTestBoxName: ( 692 705 ', TestBoxes', 693 706 ' AND TestSets.idGenTestBox = TestBoxes.idGenTestBox', 694 707 ' TestBoxes.sName DESC', 695 '' ),708 '', '' ), 696 709 ksResultsSortByTestBoxOsArch: ( 697 710 ', TestBoxes', 698 711 ' AND TestSets.idGenTestBox = TestBoxes.idGenTestBox', 699 712 ' TestBoxes.sOs, TestBoxes.sCpuArch', 700 '' ),713 '', '' ), 701 714 ksResultsSortByTestBoxOs: ( 702 715 ', TestBoxes', 703 716 ' AND TestSets.idGenTestBox = TestBoxes.idGenTestBox', 704 717 ' TestBoxes.sOs', 705 '' ),718 '', '' ), 706 719 ksResultsSortByTestBoxOsVersion: ( 707 720 ', TestBoxes', 708 721 ' AND TestSets.idGenTestBox = TestBoxes.idGenTestBox', 709 722 ' TestBoxes.sOs, TestBoxes.sOsVersion DESC', 710 '' ),723 '', '' ), 711 724 ksResultsSortByTestBoxArch: ( 712 725 ', TestBoxes', 713 726 ' AND TestSets.idGenTestBox = TestBoxes.idGenTestBox', 714 727 ' TestBoxes.sCpuArch', 715 '' ),728 '', '' ), 716 729 ksResultsSortByTestBoxCpuVendor: ( 717 730 ', TestBoxes', 718 731 ' AND TestSets.idGenTestBox = TestBoxes.idGenTestBox', 719 732 ' TestBoxes.sCpuVendor', 720 '' ),733 '', '' ), 721 734 ksResultsSortByTestBoxCpuName: ( 722 735 ', TestBoxes', 723 736 ' AND TestSets.idGenTestBox = TestBoxes.idGenTestBox', 724 737 ' TestBoxes.sCpuVendor, TestBoxes.sCpuName', 725 '' ),738 '', '' ), 726 739 ksResultsSortByTestBoxCpuRev: ( 727 740 ', TestBoxes', 728 741 ' AND TestSets.idGenTestBox = TestBoxes.idGenTestBox', 729 742 ' TestBoxes.sCpuVendor, TestBoxes.lCpuRevision DESC', 730 ', TestBoxes.lCpuRevision' ), 743 ', TestBoxes.lCpuRevision', 744 ', TestBoxes.lCpuRevision' ), 731 745 ksResultsSortByTestBoxCpuFeatures: ( 732 746 ', TestBoxes', 733 747 ' AND TestSets.idGenTestBox = TestBoxes.idGenTestBox', 734 748 ' TestBoxes.fCpuHwVirt DESC, TestBoxes.fCpuNestedPaging DESC, TestBoxes.fCpu64BitGuest DESC, TestBoxes.cCpus DESC', 749 ', TestBoxes.cCpus', 735 750 ', TestBoxes.cCpus' ), 736 751 ksResultsSortByTestCaseName: ( … … 738 753 ' AND TestSets.idGenTestCase = TestCases.idGenTestCase', 739 754 ' TestCases.sName', 740 '' ),755 '', '' ), 741 756 ksResultsSortByFailureReason: ( 742 757 '', '', 743 'sSortByFailureReason ASC', 744 ', FailureReasons.sShort AS sSortByFailureReason' ), 758 'asSortByFailureReason ASC', 759 ', array_agg(FailureReasons.sShort ORDER BY TestResultFailures.idTestResult) AS asSortByFailureReason', 760 '' ), 745 761 }; 746 762 … … 748 764 ksResultsGroupingTypeNone: ( 749 765 # Grouping tables; # Grouping field; # Grouping where addition. # Sort by overrides. 750 '', None, None, {}766 '', None, None, {}, 751 767 ), 752 ksResultsGroupingTypeTestGroup: ('', 'TestSets.idTestGroup', None, {}),753 ksResultsGroupingTypeTestBox: ('', 'TestSets.idTestBox', None, {}),754 ksResultsGroupingTypeTestCase: ('', 'TestSets.idTestCase', None, {}),768 ksResultsGroupingTypeTestGroup: ('', 'TestSets.idTestGroup', None, {},), 769 ksResultsGroupingTypeTestBox: ('', 'TestSets.idTestBox', None, {},), 770 ksResultsGroupingTypeTestCase: ('', 'TestSets.idTestCase', None, {},), 755 771 ksResultsGroupingTypeBuildRev: ( 756 772 ', Builds', … … 765 781 'TestBoxes.idSchedGroup', 766 782 ' AND TestSets.idGenTestBox = TestBoxes.idGenTestBox', 767 { ksResultsSortByTestBoxName: ( '', None, ' TestBoxes.sName DESC', '' ),768 ksResultsSortByTestBoxOsArch: ( '', None, ' TestBoxes.sOs, TestBoxes.sCpuArch', '' 769 ksResultsSortByTestBoxOs: ( '', None, 770 ksResultsSortByTestBoxOsVersion: ( '', None, ' TestBoxes.sOs, TestBoxes.sOsVersion DESC', '' 783 { ksResultsSortByTestBoxName: ( '', None, ' TestBoxes.sName DESC', '', '' ), 784 ksResultsSortByTestBoxOsArch: ( '', None, ' TestBoxes.sOs, TestBoxes.sCpuArch', '', '' ), 785 ksResultsSortByTestBoxOs: ( '', None, ' TestBoxes.sOs', '' ), 786 ksResultsSortByTestBoxOsVersion: ( '', None, ' TestBoxes.sOs, TestBoxes.sOsVersion DESC', '', '' ), 771 787 ksResultsSortByTestBoxArch: ( '', None, ' TestBoxes.sCpuArch', '' ), 772 788 ksResultsSortByTestBoxCpuVendor: ( '', None, ' TestBoxes.sCpuVendor', '' ), 773 ksResultsSortByTestBoxCpuName: ( '', None, ' TestBoxes.sCpuVendor, TestBoxes.sCpuName', '' 789 ksResultsSortByTestBoxCpuName: ( '', None, ' TestBoxes.sCpuVendor, TestBoxes.sCpuName', '', '' ), 774 790 ksResultsSortByTestBoxCpuRev: ( 775 '', None, ' TestBoxes.sCpuVendor, TestBoxes.lCpuRevision DESC', ', TestBoxes.lCpuRevision' 791 '', None, ' TestBoxes.sCpuVendor, TestBoxes.lCpuRevision DESC', ', TestBoxes.lCpuRevision', '' ), 776 792 ksResultsSortByTestBoxCpuFeatures: ( 777 793 ' TestBoxes.fCpuHwVirt DESC, TestBoxes.fCpuNestedPaging DESC, TestBoxes.fCpu64BitGuest DESC, ' 778 794 + 'TestBoxes.cCpus DESC', 779 ', TestBoxes.cCpus' ), } 795 ', TestBoxes.cCpus', 796 '' ), } 780 797 ), 781 798 }; … … 835 852 sGroupingTables, sGroupingField, sGroupingCondition, dSortingOverrides = self.kdResultGroupingMap[enmResultsGroupingType]; 836 853 if enmResultSortBy in dSortingOverrides: 837 sSort ingTables, sSortingWhere, sSortingOrderBy, sSortingColumns= dSortingOverrides[enmResultSortBy];854 sSortTables, sSortWhere, sSortOrderBy, sSortColumns, sSortGroupBy = dSortingOverrides[enmResultSortBy]; 838 855 else: 839 sSort ingTables, sSortingWhere, sSortingOrderBy, sSortingColumns= self.kdResultSortByMap[enmResultSortBy];856 sSortTables, sSortWhere, sSortOrderBy, sSortColumns, sSortGroupBy = self.kdResultSortByMap[enmResultSortBy]; 840 857 841 858 # … … 863 880 ' TestBoxes.sName,\n' \ 864 881 ' TestResults.tsCreated,\n' \ 865 ' COALESCE(TestResults.tsElapsed, CURRENT_TIMESTAMP - TestResults.tsCreated) ,\n' \882 ' COALESCE(TestResults.tsElapsed, CURRENT_TIMESTAMP - TestResults.tsCreated) AS tsElapsedTestResult,\n' \ 866 883 ' TestSets.enmStatus,\n' \ 867 884 ' TestResults.cErrors,\n' \ … … 873 890 ' TestSuiteBits.idBuild AS idBuildTestSuite,\n' \ 874 891 ' TestSuiteBits.iRevision AS iRevisionTestSuite,\n' \ 875 ' TestResultFailures.idFailureReason as idFailureReason,\n' \876 ' TestResultFailures.uidAuthor as uidFailureReasonAssigner,\n' \877 ' TestResultFailures.tsEffective as tsFailureReasonAssigned,\n' \878 ' TestResultFailures.sComment as sFailureReasonComment,\n' \879 ' (TestSets.tsDone IS NULL) SortRunningFirst' + sSort ingColumns + '\n' \892 ' array_agg(TestResultFailures.idFailureReason ORDER BY TestResultFailures.idTestResult),\n' \ 893 ' array_agg(TestResultFailures.uidAuthor ORDER BY TestResultFailures.idTestResult),\n' \ 894 ' array_agg(TestResultFailures.tsEffective ORDER BY TestResultFailures.idTestResult),\n' \ 895 ' array_agg(TestResultFailures.sComment ORDER BY TestResultFailures.idTestResult),\n' \ 896 ' (TestSets.tsDone IS NULL) SortRunningFirst' + sSortColumns + '\n' \ 880 897 'FROM BuildCategories,\n' \ 881 898 ' Builds,\n' \ 882 899 ' TestBoxes,\n' \ 883 ' TestResults\n' \ 884 ' LEFT OUTER JOIN TestResultFailures\n' \ 885 ' ON TestResults.idTestResult = TestResultFailures.idTestResult\n' \ 886 ' AND TestResultFailures.tsExpire = \'infinity\'::TIMESTAMP'; 887 if sSortingOrderBy is not None and sSortingOrderBy.find('FailureReason') >= 0: 888 sQuery += '\n' \ 889 ' LEFT OUTER JOIN FailureReasons\n' \ 890 ' ON TestResultFailures.idFailureReason = FailureReasons.idFailureReason\n' \ 891 ' AND FailureReasons.tsExpire = \'infinity\'::TIMESTAMP'; 892 sQuery += ',\n'\ 900 ' TestResults,\n' \ 893 901 ' TestCases,\n' \ 894 902 ' TestCaseArgs,\n' \ … … 909 917 ' AND TestResultFailures.tsExpire = \'infinity\'::TIMESTAMP'; 910 918 sQuery += sGroupingTables.replace(',', ',\n '); 911 sQuery += sSort ingTables.replace( ',', ',\n ');919 sQuery += sSortTables.replace( ',', ',\n '); 912 920 sQuery += '\n' \ 913 921 ' WHERE ' + self._getTimePeriodQueryPart(tsNow, sInterval, ' '); … … 921 929 if sGroupingCondition is not None: 922 930 sQuery += sGroupingCondition.replace(' AND ', ' AND '); 923 if sSort ingWhere is not None:924 sQuery += sSort ingWhere.replace(' AND ', ' AND ');931 if sSortWhere is not None: 932 sQuery += sSortWhere.replace(' AND ', ' AND '); 925 933 sQuery += ' ORDER BY '; 926 if sSort ingOrderBy is not None and sSortingOrderBy.find('FailureReason') < 0:927 sQuery += sSort ingOrderBy + ',\n ';934 if sSortOrderBy is not None and sSortOrderBy.find('FailureReason') < 0: 935 sQuery += sSortOrderBy + ',\n '; 928 936 sQuery += '(TestSets.tsDone IS NULL) DESC, TestSets.idTestSet DESC\n' \ 929 937 ' LIMIT %s OFFSET %s\n' % (cMaxRows, iStart,); … … 932 940 ' LEFT OUTER JOIN Builds AS TestSuiteBits\n' \ 933 941 ' ON TestSets.idBuildTestSuite = TestSuiteBits.idBuild\n' \ 934 'WHERE TestSets.idTestSet = TestResults.idTestSet\n' \ 942 ' LEFT OUTER JOIN TestResultFailures\n' \ 943 ' ON TestSets.idTestSet = TestResultFailures.idTestSet\n' \ 944 ' AND TestResultFailures.tsExpire = \'infinity\'::TIMESTAMP\n'; 945 if sSortOrderBy is not None and sSortOrderBy.find('FailureReason') >= 0: 946 sQuery += '\n' \ 947 ' LEFT OUTER JOIN FailureReasons\n' \ 948 ' ON TestResultFailures.idFailureReason = FailureReasons.idFailureReason\n' \ 949 ' AND FailureReasons.tsExpire = \'infinity\'::TIMESTAMP\n'; 950 sQuery += 'WHERE TestSets.idTestSet = TestResults.idTestSet\n' \ 935 951 ' AND TestResults.idTestResultParent is NULL\n' \ 936 952 ' AND TestSets.idBuild = Builds.idBuild\n' \ … … 940 956 ' AND TestSets.idGenTestBox = TestBoxes.idGenTestBox\n' \ 941 957 ' AND TestSets.idGenTestCase = TestCases.idGenTestCase\n' \ 942 ' AND TestSets.idGenTestCaseArgs = TestCaseArgs.idGenTestCaseArgs\n' \ 943 'ORDER BY '; 944 if sSortingOrderBy is not None: 945 sQuery += sSortingOrderBy + ',\n '; 958 ' AND TestSets.idGenTestCaseArgs = TestCaseArgs.idGenTestCaseArgs\n'; 959 sQuery += 'GROUP BY TestSets.idTestSet,\n' \ 960 ' BuildCategories.idBuildCategory,\n' \ 961 ' BuildCategories.sProduct,\n' \ 962 ' BuildCategories.sRepository,\n' \ 963 ' BuildCategories.sBranch,\n' \ 964 ' BuildCategories.sType,\n' \ 965 ' Builds.idBuild,\n' \ 966 ' Builds.sVersion,\n' \ 967 ' Builds.iRevision,\n' \ 968 ' TestBoxes.sOs,\n' \ 969 ' TestBoxes.sOsVersion,\n' \ 970 ' TestBoxes.sCpuArch,\n' \ 971 ' TestBoxes.sCpuVendor,\n' \ 972 ' TestBoxes.sCpuName,\n' \ 973 ' TestBoxes.cCpus,\n' \ 974 ' TestBoxes.fCpuHwVirt,\n' \ 975 ' TestBoxes.fCpuNestedPaging,\n' \ 976 ' TestBoxes.fCpu64BitGuest,\n' \ 977 ' TestBoxes.idTestBox,\n' \ 978 ' TestBoxes.sName,\n' \ 979 ' TestResults.tsCreated,\n' \ 980 ' tsElapsedTestResult,\n' \ 981 ' TestSets.enmStatus,\n' \ 982 ' TestResults.cErrors,\n' \ 983 ' TestCases.idTestCase,\n' \ 984 ' TestCases.sName,\n' \ 985 ' TestCases.sBaseCmd,\n' \ 986 ' TestCaseArgs.sArgs,\n' \ 987 ' TestCaseArgs.sSubName,\n' \ 988 ' TestSuiteBits.idBuild,\n' \ 989 ' TestSuiteBits.iRevision,\n' \ 990 ' SortRunningFirst' + sSortGroupBy + '\n'; 991 sQuery += 'ORDER BY '; 992 if sSortOrderBy is not None: 993 sQuery += sSortOrderBy + ',\n '; 946 994 sQuery += '(TestSets.tsDone IS NULL) DESC, TestSets.idTestSet DESC\n'; 947 995 … … 961 1009 962 1010 return aoRows 1011 1012 1013 def fetchTimestampsForLogViewer(self, idTestSet): 1014 """ 1015 Returns an ordered list with all the test result timestamps, both start 1016 and end. 1017 1018 The log viewer create anchors in the log text so we can jump directly to 1019 the log lines relevant for a test event. 1020 """ 1021 self._oDb.execute('(\n' 1022 'SELECT tsCreated\n' 1023 'FROM TestResults\n' 1024 'WHERE idTestSet = %s\n' 1025 ') UNION (\n' 1026 'SELECT tsCreated + tsElapsed\n' 1027 'FROM TestResults\n' 1028 'WHERE idTestSet = %s\n' 1029 ') ORDER by 1' 1030 , ( idTestSet, idTestSet, )); 1031 return [aoRow[0] for aoRow in self._oDb.fetchAll()]; 1032 963 1033 964 1034 def getEntriesCount(self, tsNow, sInterval, enmResultsGroupingType, iResultsGroupingValue, fOnlyFailures, fOnlyNeedingReason): -
trunk/src/VBox/ValidationKit/testmanager/webui/wuitestresult.py
r61424 r61453 838 838 839 839 # Reason: 840 oReason = None; 841 #assert (oEntry.oFailureReason is None) == (oEntry.tsFailureReasonAssigned is None); 842 if oEntry.oFailureReason is not None: 843 sReasonTitle = 'Reason: \t%s\n' % ( oEntry.oFailureReason.sShort, ); 844 sReasonTitle += 'Category:\t%s\n' % ( oEntry.oFailureReason.oCategory.sShort, ); 845 sReasonTitle += 'Assigned:\t%s\n' % ( self.formatTsShort(oEntry.tsFailureReasonAssigned), ); 846 sReasonTitle += 'By User: \t%s\n' % ( oEntry.oFailureReasonAssigner.sUsername, ); 847 if oEntry.sFailureReasonComment is not None and len(oEntry.sFailureReasonComment) > 0: 848 sReasonTitle += 'Comment: \t%s\n' % ( oEntry.sFailureReasonComment, ); 849 if oEntry.oFailureReason.iTicket is not None and oEntry.oFailureReason.iTicket > 0: 850 sReasonTitle += 'xTracker:\t#%s\n' % ( oEntry.oFailureReason.iTicket, ); 851 for i, sUrl in enumerate(oEntry.oFailureReason.asUrls): 840 aoReasons = []; 841 for oIt in oEntry.aoFailureReasons: 842 sReasonTitle = 'Reason: \t%s\n' % ( oIt.oFailureReason.sShort, ); 843 sReasonTitle += 'Category:\t%s\n' % ( oIt.oFailureReason.oCategory.sShort, ); 844 sReasonTitle += 'Assigned:\t%s\n' % ( self.formatTsShort(oIt.tsFailureReasonAssigned), ); 845 sReasonTitle += 'By User: \t%s\n' % ( oIt.oFailureReasonAssigner.sUsername, ); 846 if oIt.sFailureReasonComment is not None and len(oIt.sFailureReasonComment) > 0: 847 sReasonTitle += 'Comment: \t%s\n' % ( oIt.sFailureReasonComment, ); 848 if oIt.oFailureReason.iTicket is not None and oIt.oFailureReason.iTicket > 0: 849 sReasonTitle += 'xTracker:\t#%s\n' % ( oIt.oFailureReason.iTicket, ); 850 for i, sUrl in enumerate(oIt.oFailureReason.asUrls): 852 851 sUrl = sUrl.strip(); 853 852 if len(sUrl) > 0: 854 853 sReasonTitle += 'URL#%u: \t%s\n' % ( i, sUrl, ); 855 oReason = WuiTmLink(oEntry.oFailureReason.sShort, WuiAdmin.ksScriptName,856 { WuiAdmin.ksParamAction: WuiAdmin.ksActionFailureReasonDetails,857 FailureReasonData.ksParam_idFailureReason: oEntry.oFailureReason.idFailureReason },858 sTitle = sReasonTitle);854 aoReasons.append(WuiTmLink(oIt.oFailureReason.sShort, WuiAdmin.ksScriptName, 855 { WuiAdmin.ksParamAction: WuiAdmin.ksActionFailureReasonDetails, 856 FailureReasonData.ksParam_idFailureReason: oIt.oFailureReason.idFailureReason }, 857 sTitle = sReasonTitle)); 859 858 860 859 return [ … … 886 885 oEntry.tsElapsed, 887 886 aoTestSetLinks, 888 oReason887 aoReasons 889 888 ];
Note:
See TracChangeset
for help on using the changeset viewer.