Skip to content

Commit 6952162

Browse files
committed
[run_cperf] Add a little self-test stub for testing fixes against field data.
1 parent 03fb7a0 commit 6952162

File tree

1 file changed

+25
-1
lines changed

1 file changed

+25
-1
lines changed

run_cperf

Lines changed: 25 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ import random
2121
import re
2222
import shutil
2323
import sys
24+
import unittest
2425

2526
import common
2627

@@ -77,11 +78,32 @@ def workspace_comment():
7778
return None
7879

7980

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+
8096
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+
81104
common.debug_print('** RUN PULL-REQUEST CPERF **')
82105
os.chdir(os.path.dirname(__file__))
83106

84-
args = parse_args()
85107
instances = [NEW_INSTANCE, OLD_INSTANCE]
86108
configs = get_configs(args.suite)
87109

@@ -601,6 +623,8 @@ def parse_args():
601623
type=bool, default=False)
602624
parser.add_argument('--group-by-module',
603625
type=bool, default=False)
626+
parser.add_argument('--self-test',
627+
action='store_true')
604628
return parser.parse_args()
605629

606630

0 commit comments

Comments
 (0)