162306a36Sopenharmony_ci#!/usr/bin/env python3
262306a36Sopenharmony_ci
362306a36Sopenharmony_ciclass TdcPlugin:
462306a36Sopenharmony_ci    def __init__(self):
562306a36Sopenharmony_ci        super().__init__()
662306a36Sopenharmony_ci        print(' -- {}.__init__'.format(self.sub_class))
762306a36Sopenharmony_ci
862306a36Sopenharmony_ci    def pre_suite(self, testcount, testidlist):
962306a36Sopenharmony_ci        '''run commands before test_runner goes into a test loop'''
1062306a36Sopenharmony_ci        self.testcount = testcount
1162306a36Sopenharmony_ci        self.testidlist = testidlist
1262306a36Sopenharmony_ci        if self.args.verbose > 1:
1362306a36Sopenharmony_ci            print(' -- {}.pre_suite'.format(self.sub_class))
1462306a36Sopenharmony_ci
1562306a36Sopenharmony_ci    def post_suite(self, index):
1662306a36Sopenharmony_ci        '''run commands after test_runner completes the test loop
1762306a36Sopenharmony_ci        index is the last ordinal number of test that was attempted'''
1862306a36Sopenharmony_ci        if self.args.verbose > 1:
1962306a36Sopenharmony_ci            print(' -- {}.post_suite'.format(self.sub_class))
2062306a36Sopenharmony_ci
2162306a36Sopenharmony_ci    def pre_case(self, caseinfo, test_skip):
2262306a36Sopenharmony_ci        '''run commands before test_runner does one test'''
2362306a36Sopenharmony_ci        if self.args.verbose > 1:
2462306a36Sopenharmony_ci            print(' -- {}.pre_case'.format(self.sub_class))
2562306a36Sopenharmony_ci        self.args.caseinfo = caseinfo
2662306a36Sopenharmony_ci        self.args.test_skip = test_skip
2762306a36Sopenharmony_ci
2862306a36Sopenharmony_ci    def post_case(self):
2962306a36Sopenharmony_ci        '''run commands after test_runner does one test'''
3062306a36Sopenharmony_ci        if self.args.verbose > 1:
3162306a36Sopenharmony_ci            print(' -- {}.post_case'.format(self.sub_class))
3262306a36Sopenharmony_ci
3362306a36Sopenharmony_ci    def pre_execute(self):
3462306a36Sopenharmony_ci        '''run command before test-runner does the execute step'''
3562306a36Sopenharmony_ci        if self.args.verbose > 1:
3662306a36Sopenharmony_ci            print(' -- {}.pre_execute'.format(self.sub_class))
3762306a36Sopenharmony_ci
3862306a36Sopenharmony_ci    def post_execute(self):
3962306a36Sopenharmony_ci        '''run command after test-runner does the execute step'''
4062306a36Sopenharmony_ci        if self.args.verbose > 1:
4162306a36Sopenharmony_ci            print(' -- {}.post_execute'.format(self.sub_class))
4262306a36Sopenharmony_ci
4362306a36Sopenharmony_ci    def adjust_command(self, stage, command):
4462306a36Sopenharmony_ci        '''adjust the command'''
4562306a36Sopenharmony_ci        if self.args.verbose > 1:
4662306a36Sopenharmony_ci            print(' -- {}.adjust_command {}'.format(self.sub_class, stage))
4762306a36Sopenharmony_ci
4862306a36Sopenharmony_ci        # if stage == 'pre':
4962306a36Sopenharmony_ci        #     pass
5062306a36Sopenharmony_ci        # elif stage == 'setup':
5162306a36Sopenharmony_ci        #     pass
5262306a36Sopenharmony_ci        # elif stage == 'execute':
5362306a36Sopenharmony_ci        #     pass
5462306a36Sopenharmony_ci        # elif stage == 'verify':
5562306a36Sopenharmony_ci        #     pass
5662306a36Sopenharmony_ci        # elif stage == 'teardown':
5762306a36Sopenharmony_ci        #     pass
5862306a36Sopenharmony_ci        # elif stage == 'post':
5962306a36Sopenharmony_ci        #     pass
6062306a36Sopenharmony_ci        # else:
6162306a36Sopenharmony_ci        #     pass
6262306a36Sopenharmony_ci
6362306a36Sopenharmony_ci        return command
6462306a36Sopenharmony_ci
6562306a36Sopenharmony_ci    def add_args(self, parser):
6662306a36Sopenharmony_ci        '''Get the plugin args from the command line'''
6762306a36Sopenharmony_ci        self.argparser = parser
6862306a36Sopenharmony_ci        return self.argparser
6962306a36Sopenharmony_ci
7062306a36Sopenharmony_ci    def check_args(self, args, remaining):
7162306a36Sopenharmony_ci        '''Check that the args are set correctly'''
7262306a36Sopenharmony_ci        self.args = args
7362306a36Sopenharmony_ci        if self.args.verbose > 1:
7462306a36Sopenharmony_ci            print(' -- {}.check_args'.format(self.sub_class))
75