diff options
author | Richard Purdie <richard.purdie@linuxfoundation.org> | 2024-11-22 16:11:43 +0000 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2024-11-23 14:44:54 +0000 |
commit | 589bd28e4653c267fa170cd372bce9d2b04f1423 (patch) | |
tree | 698c788130bfc1bdfab38d42c00984010198408e /scripts/lib/resulttool/store.py | |
parent | e948ab903573a68c7fa6af84dac8e06d31eb6bdd (diff) | |
download | poky-589bd28e4653c267fa170cd372bce9d2b04f1423.tar.gz |
resulttool: Add --logfile-archive option to store mode
Storing the log files inside the testresults git repo isn't scaling and isn't
really appropriate use of a git repository. Allow these to be optionally stored
in a separate filesystem location so the git repo can remain managable.
(From OE-Core rev: 1afc0f3d7e93fa8496be241e9622d3b9a6904bd5)
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'scripts/lib/resulttool/store.py')
-rw-r--r-- | scripts/lib/resulttool/store.py | 19 |
1 files changed, 17 insertions, 2 deletions
diff --git a/scripts/lib/resulttool/store.py b/scripts/lib/resulttool/store.py index 903e29627a..578910d234 100644 --- a/scripts/lib/resulttool/store.py +++ b/scripts/lib/resulttool/store.py | |||
@@ -74,12 +74,25 @@ def store(args, logger): | |||
74 | 74 | ||
75 | logger.info('Storing test result into git repository %s' % args.git_dir) | 75 | logger.info('Storing test result into git repository %s' % args.git_dir) |
76 | 76 | ||
77 | gitarchive.gitarchive(tempdir, args.git_dir, False, False, | 77 | excludes = [] |
78 | if args.logfile_archive: | ||
79 | excludes = ['*.log', "*.log.zst"] | ||
80 | |||
81 | tagname = gitarchive.gitarchive(tempdir, args.git_dir, False, False, | ||
78 | "Results of {branch}:{commit}", "branch: {branch}\ncommit: {commit}", "{branch}", | 82 | "Results of {branch}:{commit}", "branch: {branch}\ncommit: {commit}", "{branch}", |
79 | False, "{branch}/{commit_count}-g{commit}/{tag_number}", | 83 | False, "{branch}/{commit_count}-g{commit}/{tag_number}", |
80 | 'Test run #{tag_number} of {branch}:{commit}', '', | 84 | 'Test run #{tag_number} of {branch}:{commit}', '', |
81 | [], [], False, keywords, logger) | 85 | excludes, [], False, keywords, logger) |
82 | 86 | ||
87 | if args.logfile_archive: | ||
88 | logdir = args.logfile_archive + "/" + tagname | ||
89 | shutil.copytree(tempdir, logdir) | ||
90 | for root, dirs, files in os.walk(logdir): | ||
91 | for name in files: | ||
92 | if not name.endswith(".log"): | ||
93 | continue | ||
94 | f = os.path.join(root, name) | ||
95 | subprocess.run(["zstd", f, "--rm"], check=True, capture_output=True) | ||
83 | finally: | 96 | finally: |
84 | subprocess.check_call(["rm", "-rf", tempdir]) | 97 | subprocess.check_call(["rm", "-rf", tempdir]) |
85 | 98 | ||
@@ -107,3 +120,5 @@ def register_commands(subparsers): | |||
107 | help='add extra test environment data to each result file configuration') | 120 | help='add extra test environment data to each result file configuration') |
108 | parser_build.add_argument('-r', '--revision', default='', | 121 | parser_build.add_argument('-r', '--revision', default='', |
109 | help='only store data for the specified revision') | 122 | help='only store data for the specified revision') |
123 | parser_build.add_argument('-l', '--logfile-archive', default='', | ||
124 | help='directory to separately archive log files along with a copy of the results') | ||