@@ -21,6 +21,7 @@ import random
21
21
import re
22
22
import shutil
23
23
import sys
24
+ import unittest
24
25
25
26
import common
26
27
@@ -77,11 +78,32 @@ def workspace_comment():
77
78
return None
78
79
79
80
81
+ # Utility class for testing run_cperf against various data discovered in
82
+ # the field; unfortunately we are not yet at the point where there's a
83
+ # real testsuite for it, but this is a step.
84
+ class SelfTest (unittest .TestCase ):
85
+
86
+ args = None
87
+
88
+ def test_failed_modules (self ):
89
+ configs = get_configs (self .args .suite )
90
+ (passed_modules , failed_modules ) = find_module_statuses (configs ,
91
+ self .args )
92
+ print ("passed: " + str (passed_modules ))
93
+ print ("failed: " + str (failed_modules ))
94
+
95
+
80
96
def main ():
97
+
98
+ args = parse_args ()
99
+ if args .self_test :
100
+ SelfTest .args = args
101
+ suite = unittest .TestLoader ().loadTestsFromTestCase (SelfTest )
102
+ return unittest .TextTestRunner (verbosity = 2 ).run (suite )
103
+
81
104
common .debug_print ('** RUN PULL-REQUEST CPERF **' )
82
105
os .chdir (os .path .dirname (__file__ ))
83
106
84
- args = parse_args ()
85
107
instances = [NEW_INSTANCE , OLD_INSTANCE ]
86
108
configs = get_configs (args .suite )
87
109
@@ -601,6 +623,8 @@ def parse_args():
601
623
type = bool , default = False )
602
624
parser .add_argument ('--group-by-module' ,
603
625
type = bool , default = False )
626
+ parser .add_argument ('--self-test' ,
627
+ action = 'store_true' )
604
628
return parser .parse_args ()
605
629
606
630
0 commit comments