- Timestamp:
- Jan 5, 2017 3:58:28 PM (8 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/ValidationKit/testmanager/core/testresults.py
r65155 r65156 647 647 648 648 kiTestStatus = 0; 649 kiBranches = 1; 650 kiSchedGroups = 2; 651 kiTestBoxes = 3; 652 kiTestCases = 4; 653 kiTestCaseMisc = 5; 654 kiRevisions = 6; 655 kiCpuArches = 7; 656 kiCpuVendors = 8; 657 kiCpuCounts = 9; 658 kiMemory = 10; 659 kiTestboxMisc = 11; 660 kiOses = 12; 661 kiPythonVersions = 13; 662 kiFailReasons = 14 649 kiErrorCounts = 1; 650 kiBranches = 2; 651 kiBuildTypes = 3; 652 kiRevisions = 4; 653 kiFailReasons = 5; 654 kiTestCases = 6; 655 kiTestCaseMisc = 7; 656 kiTestBoxes = 8 657 kiOses = 9; 658 kiCpuArches = 10; 659 kiCpuVendors = 11; 660 kiCpuCounts = 12; 661 kiMemory = 13; 662 kiTestboxMisc = 14; 663 kiPythonVersions = 15; 664 kiSchedGroups = 16; 663 665 664 666 ## Misc test case / variation name filters. … … 697 699 def __init__(self): 698 700 ModelFilterBase.__init__(self); 701 702 # Test statuses 699 703 oCrit = FilterCriterion('Test statuses', sVarNm = 'ts', sType = FilterCriterion.ksType_String, 700 704 sTable = 'TestSets', sColumn = 'enmStatus'); … … 702 706 assert self.aCriteria[self.kiTestStatus] is oCrit; 703 707 708 # Error counts 709 oCrit = FilterCriterion('Error counts', sVarNm = 'ec', sTable = 'TestResults', sColumn = 'cErrors'); 710 self.aCriteria.append(oCrit); 711 assert self.aCriteria[self.kiErrorCounts] is oCrit; 712 713 # Branches 704 714 oCrit = FilterCriterion('Branches', sVarNm = 'br', sType = FilterCriterion.ksType_String, 705 715 sTable = 'BuildCategories', sColumn = 'sBranch'); … … 707 717 assert self.aCriteria[self.kiBranches] is oCrit; 708 718 709 oCrit = FilterCriterion('Sched groups', sVarNm = 'sg', sTable = 'TestSets', sColumn = 'idSchedGroup'); 719 # Build types 720 oCrit = FilterCriterion('Build types', sVarNm = 'bt', sType = FilterCriterion.ksType_String, 721 sTable = 'BuildCategories', sColumn = 'sType'); 710 722 self.aCriteria.append(oCrit); 711 assert self.aCriteria[self.kiSchedGroups] is oCrit; 712 713 oCrit = FilterCriterion('Testboxes', sVarNm = 'tb', sTable = 'TestSets', sColumn = 'idTestBox'); 723 assert self.aCriteria[self.kiBuildTypes] is oCrit; 724 725 # Revisions 726 oCrit = FilterCriterion('Revisions', sVarNm = 'rv', sTable = 'Builds', sColumn = 'iRevision'); 714 727 self.aCriteria.append(oCrit); 715 assert self.aCriteria[self.kiTestBoxes] is oCrit; 716 728 assert self.aCriteria[self.kiRevisions] is oCrit; 729 730 # Failure reasons 731 oCrit = FilterCriterion('Failure reasons', sVarNm = 'fr', sTable = 'TestResultFailures', sColumn = 'idFailureReason'); 732 self.aCriteria.append(oCrit); 733 assert self.aCriteria[self.kiFailReasons] is oCrit; 734 735 # Test cases and variations. 717 736 oCrit = FilterCriterion('Test case / var', sVarNm = 'tc', sTable = 'TestSets', sColumn = 'idTestCase', 718 737 oSub = FilterCriterion('Test variations', sVarNm = 'tv', … … 721 740 assert self.aCriteria[self.kiTestCases] is oCrit; 722 741 742 # Special test case and varation name sub string matching. 723 743 oCrit = FilterCriterion('Test case name', sVarNm = 'cm', sKind = FilterCriterion.ksKind_Special, 724 744 asTables = ('TestCases', 'TestCaseArgs')); … … 732 752 assert self.aCriteria[self.kiTestCaseMisc] is oCrit; 733 753 734 oCrit = FilterCriterion('Revisions', sVarNm = 'rv', sTable = 'Builds', sColumn = 'iRevision'); 754 # Testboxes 755 oCrit = FilterCriterion('Testboxes', sVarNm = 'tb', sTable = 'TestSets', sColumn = 'idTestBox'); 735 756 self.aCriteria.append(oCrit); 736 assert self.aCriteria[self.kiRevisions] is oCrit; 737 757 assert self.aCriteria[self.kiTestBoxes] is oCrit; 758 759 # Testbox OS and OS version. 760 oCrit = FilterCriterion('OS / version', sVarNm = 'os', sTable = 'TestBoxesWithStrings', sColumn = 'idStrOs', 761 oSub = FilterCriterion('OS Versions', sVarNm = 'ov', 762 sTable = 'TestBoxesWithStrings', sColumn = 'idStrOsVersion')); 763 self.aCriteria.append(oCrit); 764 assert self.aCriteria[self.kiOses] is oCrit; 765 766 # Testbox CPU architectures. 738 767 oCrit = FilterCriterion('CPU arches', sVarNm = 'ca', sTable = 'TestBoxesWithStrings', sColumn = 'idStrCpuArch'); 739 768 self.aCriteria.append(oCrit); 740 769 assert self.aCriteria[self.kiCpuArches] is oCrit; 741 770 771 # Testbox CPU vendors and revisions. 742 772 oCrit = FilterCriterion('CPU vendor / rev', sVarNm = 'cv', sTable = 'TestBoxesWithStrings', sColumn = 'idStrCpuVendor', 743 773 oSub = FilterCriterion('CPU revisions', sVarNm = 'cr', … … 746 776 assert self.aCriteria[self.kiCpuVendors] is oCrit; 747 777 778 # Testbox CPU (thread) count 748 779 oCrit = FilterCriterion('CPU counts', sVarNm = 'cc', sTable = 'TestBoxesWithStrings', sColumn = 'cCpus'); 749 780 self.aCriteria.append(oCrit); 750 781 assert self.aCriteria[self.kiCpuCounts] is oCrit; 751 782 783 # Testbox memory sizes. 752 784 oCrit = FilterCriterion('Memory', sVarNm = 'mb', sTable = 'TestBoxesWithStrings', sColumn = 'cMbMemory'); 753 785 self.aCriteria.append(oCrit); 754 786 assert self.aCriteria[self.kiMemory] is oCrit; 755 787 756 oCrit = FilterCriterion('Testbox misc', sVarNm = 'tm', sKind = FilterCriterion.ksKind_Special, 788 # Testbox features. 789 oCrit = FilterCriterion('Testbox features', sVarNm = 'tm', sKind = FilterCriterion.ksKind_Special, 757 790 sTable = 'TestBoxesWithStrings'); 758 791 oCrit.aoPossible = [ … … 771 804 assert self.aCriteria[self.kiTestboxMisc] is oCrit; 772 805 773 oCrit = FilterCriterion('OS / version', sVarNm = 'os', sTable = 'TestBoxesWithStrings', sColumn = 'idStrOs', 774 oSub = FilterCriterion('OS Versions', sVarNm = 'ov', 775 sTable = 'TestBoxesWithStrings', sColumn = 'idStrOsVersion')); 776 self.aCriteria.append(oCrit); 777 assert self.aCriteria[self.kiOses] is oCrit; 778 806 # Testbox python versions. 779 807 oCrit = FilterCriterion('Python', sVarNm = 'py', sTable = 'TestBoxesWithStrings', sColumn = 'iPythonHexVersion'); 780 808 self.aCriteria.append(oCrit); 781 809 assert self.aCriteria[self.kiPythonVersions] is oCrit; 782 810 783 oCrit = FilterCriterion('Failure reasons', sVarNm = 'fr', sTable = 'TestResultFailures', sColumn = 'idFailureReason'); 811 # Scheduling groups. 812 oCrit = FilterCriterion('Sched groups', sVarNm = 'sg', sTable = 'TestSets', sColumn = 'idSchedGroup'); 784 813 self.aCriteria.append(oCrit); 785 assert self.aCriteria[self.kiFailReasons] is oCrit; 786 787 ## @todo Add build type, error count, gang counts (if any > 1)... 814 assert self.aCriteria[self.kiSchedGroups] is oCrit; 815 788 816 789 817 kdTbMiscConditions = { … … 866 894 '%s AND Builds.tsEffective <= TestSets.tsCreated\n' \ 867 895 % ( sExtraIndent, sExtraIndent, sExtraIndent, sExtraIndent, ); 868 elif sTable == 'TestResultFailures': 869 sQuery += '%sLEFT OUTER JOIN TestResultFailures\n' \ 870 '%s ON TestResultFailures.idTestSet = TestSets.idTestSet\n' \ 871 '%s AND TestResultFailures.tsExpire = \'infinity\'::TIMESTAMP\n' \ 872 % ( sExtraIndent, sExtraIndent, sExtraIndent, ); 896 elif sTable == 'BuildCategories': 897 sQuery += '%sINNER JOIN BuildCategories\n' \ 898 '%s ON BuildCategories.idBuildCategory = TestSets.idBuildCategory\n' \ 899 % ( sExtraIndent, sExtraIndent, ); 873 900 elif sTable == 'TestBoxesWithStrings': 874 901 sQuery += '%sLEFT OUTER JOIN TestBoxesWithStrings\n' \ 875 902 '%s ON TestBoxesWithStrings.idGenTestBox = TestSets.idGenTestBox\n' \ 876 % ( sExtraIndent, sExtraIndent, );877 elif sTable == 'BuildCategories':878 sQuery += '%sINNER JOIN BuildCategories\n' \879 '%s ON BuildCategories.idBuildCategory = TestSets.idBuildCategory\n' \880 903 % ( sExtraIndent, sExtraIndent, ); 881 904 elif sTable == 'TestCases': … … 887 910 '%s ON TestCaseArgs.idGenTestCaseArgs = TestSets.idGenTestCaseArgs\n' \ 888 911 % ( sExtraIndent, sExtraIndent, ); 912 elif sTable == 'TestResults': 913 sQuery += '%sINNER JOIN TestResults\n' \ 914 '%s ON TestResults.idTestResult = TestSets.idTestResult\n' \ 915 % ( sExtraIndent, sExtraIndent, ); 916 elif sTable == 'TestResultFailures': 917 sQuery += '%sLEFT OUTER JOIN TestResultFailures\n' \ 918 '%s ON TestResultFailures.idTestSet = TestSets.idTestSet\n' \ 919 '%s AND TestResultFailures.tsExpire = \'infinity\'::TIMESTAMP\n' \ 920 % ( sExtraIndent, sExtraIndent, sExtraIndent, ); 889 921 else: 890 922 assert False, sTable; … … 1899 1931 workerDoFetch(None, fIdIsName = True); 1900 1932 1933 # Build types. 1934 oCrit = oFilter.aCriteria[TestResultFilter.kiBuildTypes]; 1935 self._oDb.execute('SELECT BuildCategories.sType, BuildCategories.sType, SUM(BuildCategoryIDs.cTimes)\n' 1936 'FROM ( SELECT TestSets.idBuildCategory,\n' 1937 ' COUNT(TestSets.idTestSet) AS cTimes\n' 1938 ' FROM TestSets\n' + oFilter.getTableJoins(iOmit = TestResultFilter.kiBuildTypes) + 1939 ''.join(' , %s\n' % (sTable,) for sTable in oReportModel.getExtraSubjectTables()) + 1940 ' WHERE ' + self._getTimePeriodQueryPart(tsNow, sPeriod, ' ') + 1941 oFilter.getWhereConditions(iOmit = TestResultFilter.kiBuildTypes) + 1942 oReportModel.getExtraSubjectWhereExpr() + 1943 ' GROUP BY TestSets.idBuildCategory\n' 1944 ' ) AS BuildCategoryIDs\n' 1945 ' INNER JOIN BuildCategories\n' 1946 ' ON BuildCategories.idBuildCategory = BuildCategoryIDs.idBuildCategory\n' 1947 'GROUP BY BuildCategories.sType\n' 1948 'ORDER BY BuildCategories.sType DESC\n' ); 1949 workerDoFetch(None, fIdIsName = True); 1950 1901 1951 # Failure reasons. 1902 1952 oCrit = oFilter.aCriteria[TestResultFilter.kiFailReasons]; … … 1920 1970 'ORDER BY FailureReasons.sShort\n' ); 1921 1971 workerDoFetch(FailureReasonLogic, 'sShort'); 1972 1973 # Error counts. 1974 oCrit = oFilter.aCriteria[TestResultFilter.kiErrorCounts]; 1975 self._oDb.execute('SELECT TestResults.cErrors, CAST(TestResults.cErrors AS TEXT), COUNT(TestResults.idTestResult)\n' 1976 'FROM ( SELECT TestSets.idTestResult AS idTestResult\n' 1977 ' FROM TestSets\n' + 1978 oFilter.getTableJoins(iOmit = TestResultFilter.kiFailReasons) + 1979 ''.join(' , %s\n' % (sTable,) for sTable in oReportModel.getExtraSubjectTables()) + 1980 ' WHERE ' + self._getTimePeriodQueryPart(tsNow, sPeriod, ' ') + 1981 oFilter.getWhereConditions(iOmit = TestResultFilter.kiFailReasons) + 1982 oReportModel.getExtraSubjectWhereExpr() + 1983 ' ) AS TestSetIDs\n' 1984 ' INNER JOIN TestResults\n' 1985 ' ON TestResults.idTestResult = TestSetIDs.idTestResult\n' 1986 'GROUP BY TestResults.cErrors\n' 1987 'ORDER BY TestResults.cErrors\n'); 1988 1989 workerDoFetch(None, fIdIsName = True); 1922 1990 1923 1991 return oFilter;
Note:
See TracChangeset
for help on using the changeset viewer.