mirror of
https://git.yoctoproject.org/poky
synced 2026-09-15 15:49:32 +02:00
resulttool/store: Handle results files for multiple revisions
Currently we cant store results if the results files span multiple different build revisons. Remove this limitation by iterating. (From OE-Core rev: 4da12c00963b02508056b87ce9b972528ce3a1be) Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
This commit is contained in:
@@ -29,7 +29,7 @@ def store(args, logger):
|
|||||||
try:
|
try:
|
||||||
results = {}
|
results = {}
|
||||||
logger.info('Reading files from %s' % args.source)
|
logger.info('Reading files from %s' % args.source)
|
||||||
for root, dirs, files in os.walk(args.source):
|
for root, dirs, files in os.walk(args.source):
|
||||||
for name in files:
|
for name in files:
|
||||||
f = os.path.join(root, name)
|
f = os.path.join(root, name)
|
||||||
if name == "testresults.json":
|
if name == "testresults.json":
|
||||||
@@ -38,7 +38,8 @@ def store(args, logger):
|
|||||||
dst = f.replace(args.source, tempdir + "/")
|
dst = f.replace(args.source, tempdir + "/")
|
||||||
os.makedirs(os.path.dirname(dst), exist_ok=True)
|
os.makedirs(os.path.dirname(dst), exist_ok=True)
|
||||||
shutil.copyfile(f, dst)
|
shutil.copyfile(f, dst)
|
||||||
resultutils.save_resultsdata(results, tempdir)
|
|
||||||
|
revisions = {}
|
||||||
|
|
||||||
if not results and not args.all:
|
if not results and not args.all:
|
||||||
if args.allow_empty:
|
if args.allow_empty:
|
||||||
@@ -47,26 +48,32 @@ def store(args, logger):
|
|||||||
logger.error("No results found to store")
|
logger.error("No results found to store")
|
||||||
return 1
|
return 1
|
||||||
|
|
||||||
keywords = {'branch': None, 'commit': None, 'commit_count': None}
|
|
||||||
|
|
||||||
# Find the branch/commit/commit_count and ensure they all match
|
# Find the branch/commit/commit_count and ensure they all match
|
||||||
for suite in results:
|
for suite in results:
|
||||||
for result in results[suite]:
|
for result in results[suite]:
|
||||||
config = results[suite][result]['configuration']['LAYERS']['meta']
|
config = results[suite][result]['configuration']['LAYERS']['meta']
|
||||||
for k in keywords:
|
revision = (config['commit'], config['branch'], str(config['commit_count']))
|
||||||
if keywords[k] is None:
|
if revision not in revisions:
|
||||||
keywords[k] = config.get(k)
|
revisions[revision] = {}
|
||||||
if config.get(k) != keywords[k]:
|
if suite not in revisions[revision]:
|
||||||
logger.error("Mismatched source commit/branch/count: %s vs %s" % (config.get(k), keywords[k]))
|
revisions[revision][suite] = {}
|
||||||
return 1
|
revisions[revision][suite] = results[suite][result]
|
||||||
|
|
||||||
logger.info('Storing test result into git repository %s' % args.git_dir)
|
logger.info("Found %d revisions to store" % len(revisions))
|
||||||
|
|
||||||
gitarchive.gitarchive(tempdir, args.git_dir, False, False,
|
for r in revisions:
|
||||||
"Results of {branch}:{commit}", "branch: {branch}\ncommit: {commit}", "{branch}",
|
results = revisions[r]
|
||||||
False, "{branch}/{commit_count}-g{commit}/{tag_number}",
|
keywords = {'commit': r[0], 'branch': r[1], "commit_count": r[2]}
|
||||||
'Test run #{tag_number} of {branch}:{commit}', '',
|
subprocess.check_call(["find", tempdir, "!", "-path", "./.git/*", "-delete"])
|
||||||
[], [], False, keywords, logger)
|
resultutils.save_resultsdata(results, tempdir)
|
||||||
|
|
||||||
|
logger.info('Storing test result into git repository %s' % args.git_dir)
|
||||||
|
|
||||||
|
gitarchive.gitarchive(tempdir, args.git_dir, False, False,
|
||||||
|
"Results of {branch}:{commit}", "branch: {branch}\ncommit: {commit}", "{branch}",
|
||||||
|
False, "{branch}/{commit_count}-g{commit}/{tag_number}",
|
||||||
|
'Test run #{tag_number} of {branch}:{commit}', '',
|
||||||
|
[], [], False, keywords, logger)
|
||||||
|
|
||||||
finally:
|
finally:
|
||||||
subprocess.check_call(["rm", "-rf", tempdir])
|
subprocess.check_call(["rm", "-rf", tempdir])
|
||||||
|
|||||||
Reference in New Issue
Block a user