summaryrefslogtreecommitdiffstats
path: root/tools/testing/selftests/tc-testing/TdcPlugin.py
blob: b980a565fa89995ece1505b963d42d7c7a84f565 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
#!/usr/bin/env python3

class TdcPlugin:
    def __init__(self):
        super().__init__()
        print(' -- {}.__init__'.format(self.sub_class))

    def pre_suite(self, testcount, testidlist):
        '''run commands before test_runner goes into a test loop'''
        self.testcount = testcount
        self.testidlist = testidlist
        if self.args.verbose > 1:
            print(' -- {}.pre_suite'.format(self.sub_class))

    def post_suite(self, index):
        '''run commands after test_runner completes the test loop
        index is the last ordinal number of test that was attempted'''
        if self.args.verbose > 1:
            print(' -- {}.post_suite'.format(self.sub_class))

    def pre_case(self, testid, test_name, test_skip):
        '''run commands before test_runner does one test'''
        if self.args.verbose > 1:
            print(' -- {}.pre_case'.format(self.sub_class))
        self.args.testid = testid
        self.args.test_name = test_name
        self.args.test_skip = test_skip

    def post_case(self):
        '''run commands after test_runner does one test'''
        if self.args.verbose > 1:
            print(' -- {}.post_case'.format(self.sub_class))

    def pre_execute(self):
        '''run command before test-runner does the execute step'''
        if self.args.verbose > 1:
            print(' -- {}.pre_execute'.format(self.sub_class))

    def post_execute(self):
        '''run command after test-runner does the execute step'''
        if self.args.verbose > 1:
            print(' -- {}.post_execute'.format(self.sub_class))

    def adjust_command(self, stage, command):
        '''adjust the command'''
        if self.args.verbose > 1:
            print(' -- {}.adjust_command {}'.format(self.sub_class, stage))

        # if stage == 'pre':
        #     pass
        # elif stage == 'setup':
        #     pass
        # elif stage == 'execute':
        #     pass
        # elif stage == 'verify':
        #     pass
        # elif stage == 'teardown':
        #     pass
        # elif stage == 'post':
        #     pass
        # else:
        #     pass

        return command

    def add_args(self, parser):
        '''Get the plugin args from the command line'''
        self.argparser = parser
        return self.argparser

    def check_args(self, args, remaining):
        '''Check that the args are set correctly'''
        self.args = args
        if self.args.verbose > 1:
            print(' -- {}.check_args'.format(self.sub_class))