summaryrefslogtreecommitdiffstats
path: root/scripts/test-result-log
blob: 2b9879cf98196699a13a0516c664ccf21d2a14ed (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
#!/usr/bin/python3
#
# Helper script for storing test result & log data it git repository
# Then view summary test report
#
import os
import sys
import argparse
script_path = os.path.dirname(os.path.realpath(__file__))
lib_path = script_path + '/lib'
sys.path = sys.path + [lib_path]
import testresultlog.testresultcreator
import testresultlog.testresultupdator
import testresultlog.testresultviewer
import testresultlog.testresultmanualcreator

def _get_default_git_dir(git_dir):
    base_path = script_path + '/..'
    if git_dir == 'default':
        git_dir = os.path.join(base_path, 'test-result-log.git')
    return git_dir

def _get_oeqa_source_dir(poky_dir, source):
    if source == 'runtime':
        oeqa_dir = os.path.join(poky_dir, 'meta/lib/oeqa/runtime/cases')
    elif source == 'selftest':
        oeqa_dir = os.path.join(poky_dir, 'meta/lib/oeqa/selftest/cases')
    elif source == 'sdk':
        oeqa_dir = os.path.join(poky_dir, 'meta/lib/oeqa/sdk/cases')
    else:
        oeqa_dir = os.path.join(poky_dir, 'meta/lib/oeqa/sdkext/cases')
    return oeqa_dir

def _get_poky_dir(poky_dir):
    base_path = script_path + '/..'
    if poky_dir == 'default':
        poky_dir = base_path
    return poky_dir

def main():
    parser = argparse.ArgumentParser(description="test-result-log script to store test status and failure log then view summary test report.")
    subparser = parser.add_subparsers()
    testresultlog.testresultcreator.register_commands(subparser)
    testresultlog.testresultupdator.register_commands(subparser)
    testresultlog.testresultviewer.register_commands(subparser)
    testresultlog.testresultmanualcreator.register_commands(subparser)
    args = parser.parse_args()
    args.script_path = script_path
    args.git_repo = _get_default_git_dir(args.git_repo)
    poky_dir = getattr(args,"poky_dir",None)
    if poky_dir:
        args.poky_dir = _get_poky_dir(args.poky_dir)
        args.oeqa_dir = _get_oeqa_source_dir(args.poky_dir, args.source)
    args.func(args)

if __name__ == "__main__":
    sys.exit(main())