193707cbaSBrenda J. Butler#!/usr/bin/env python3
293707cbaSBrenda J. Butler
393707cbaSBrenda J. Butlerclass TdcPlugin:
493707cbaSBrenda J. Butler    def __init__(self):
593707cbaSBrenda J. Butler        super().__init__()
693707cbaSBrenda J. Butler        print(' -- {}.__init__'.format(self.sub_class))
793707cbaSBrenda J. Butler
8*98cfbe42SPedro Tammela    def pre_suite(self, testcount, testlist):
993707cbaSBrenda J. Butler        '''run commands before test_runner goes into a test loop'''
1093707cbaSBrenda J. Butler        self.testcount = testcount
11*98cfbe42SPedro Tammela        self.testlist = testlist
1293707cbaSBrenda J. Butler        if self.args.verbose > 1:
1393707cbaSBrenda J. Butler            print(' -- {}.pre_suite'.format(self.sub_class))
1493707cbaSBrenda J. Butler
1593707cbaSBrenda J. Butler    def post_suite(self, index):
1693707cbaSBrenda J. Butler        '''run commands after test_runner completes the test loop
1793707cbaSBrenda J. Butler        index is the last ordinal number of test that was attempted'''
1893707cbaSBrenda J. Butler        if self.args.verbose > 1:
1993707cbaSBrenda J. Butler            print(' -- {}.post_suite'.format(self.sub_class))
2093707cbaSBrenda J. Butler
21a7d50a0dSLucas Bates    def pre_case(self, caseinfo, test_skip):
2293707cbaSBrenda J. Butler        '''run commands before test_runner does one test'''
2393707cbaSBrenda J. Butler        if self.args.verbose > 1:
2493707cbaSBrenda J. Butler            print(' -- {}.pre_case'.format(self.sub_class))
25a7d50a0dSLucas Bates        self.args.caseinfo = caseinfo
26255c1c72SLucas Bates        self.args.test_skip = test_skip
2793707cbaSBrenda J. Butler
2893707cbaSBrenda J. Butler    def post_case(self):
2993707cbaSBrenda J. Butler        '''run commands after test_runner does one test'''
3093707cbaSBrenda J. Butler        if self.args.verbose > 1:
3193707cbaSBrenda J. Butler            print(' -- {}.post_case'.format(self.sub_class))
3293707cbaSBrenda J. Butler
3393707cbaSBrenda J. Butler    def pre_execute(self):
3493707cbaSBrenda J. Butler        '''run command before test-runner does the execute step'''
3593707cbaSBrenda J. Butler        if self.args.verbose > 1:
3693707cbaSBrenda J. Butler            print(' -- {}.pre_execute'.format(self.sub_class))
3793707cbaSBrenda J. Butler
3893707cbaSBrenda J. Butler    def post_execute(self):
3993707cbaSBrenda J. Butler        '''run command after test-runner does the execute step'''
4093707cbaSBrenda J. Butler        if self.args.verbose > 1:
4193707cbaSBrenda J. Butler            print(' -- {}.post_execute'.format(self.sub_class))
4293707cbaSBrenda J. Butler
4393707cbaSBrenda J. Butler    def adjust_command(self, stage, command):
4493707cbaSBrenda J. Butler        '''adjust the command'''
4593707cbaSBrenda J. Butler        if self.args.verbose > 1:
4693707cbaSBrenda J. Butler            print(' -- {}.adjust_command {}'.format(self.sub_class, stage))
4793707cbaSBrenda J. Butler
4893707cbaSBrenda J. Butler        # if stage == 'pre':
4993707cbaSBrenda J. Butler        #     pass
5093707cbaSBrenda J. Butler        # elif stage == 'setup':
5193707cbaSBrenda J. Butler        #     pass
5293707cbaSBrenda J. Butler        # elif stage == 'execute':
5393707cbaSBrenda J. Butler        #     pass
5493707cbaSBrenda J. Butler        # elif stage == 'verify':
5593707cbaSBrenda J. Butler        #     pass
5693707cbaSBrenda J. Butler        # elif stage == 'teardown':
5793707cbaSBrenda J. Butler        #     pass
5893707cbaSBrenda J. Butler        # elif stage == 'post':
5993707cbaSBrenda J. Butler        #     pass
6093707cbaSBrenda J. Butler        # else:
6193707cbaSBrenda J. Butler        #     pass
6293707cbaSBrenda J. Butler
6393707cbaSBrenda J. Butler        return command
6493707cbaSBrenda J. Butler
6593707cbaSBrenda J. Butler    def add_args(self, parser):
6693707cbaSBrenda J. Butler        '''Get the plugin args from the command line'''
6793707cbaSBrenda J. Butler        self.argparser = parser
6893707cbaSBrenda J. Butler        return self.argparser
6993707cbaSBrenda J. Butler
7093707cbaSBrenda J. Butler    def check_args(self, args, remaining):
7193707cbaSBrenda J. Butler        '''Check that the args are set correctly'''
7293707cbaSBrenda J. Butler        self.args = args
7393707cbaSBrenda J. Butler        if self.args.verbose > 1:
7493707cbaSBrenda J. Butler            print(' -- {}.check_args'.format(self.sub_class))
75