autorun_post: refactor doc collection function

This will be useful for other directories where we only want to keep one
copy.

Change-Id: Iac3cf964936e03c1164ffd961cf8c35a24db5f31
Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
Reviewed-on: https://review.gerrithub.io/403739
Reviewed-by: Seth Howell <seth.howell5141@gmail.com>
Tested-by: SPDK Automated Test System <sys_sgsw@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
This commit is contained in:
Daniel Verkamp 2018-03-13 15:02:09 -07:00
parent b86ae8534a
commit bba169c1f4

View File

@ -50,17 +50,19 @@ def generateCoverageReport(output_dir, repo_dir):
print(e, file=log_file) print(e, file=log_file)
def prepDocumentation(output_dir, repo_dir): def collectOne(output_dir, dir_name):
# Find one instance of 'doc' output directory and move it to the top level dirs = glob.glob(os.path.join(output_dir, '*', dir_name))
docDirs = glob.glob(os.path.join(output_dir, '*', 'doc')) dirs.sort()
docDirs.sort() if len(dirs) == 0:
if len(docDirs) == 0:
return return
print("docDirs: ", docDirs) # Collect first instance of dir_name and move it to the top level
docDir = docDirs[0] collect_dir = dirs.pop(0)
print("docDir: ", docDir) shutil.move(collect_dir, os.path.join(output_dir, dir_name))
shutil.move(docDir, os.path.join(output_dir, 'doc'))
# Delete all other instances
for d in dirs:
shutil.rmtree(d)
def aggregateCompletedTests(output_dir, repo_dir): def aggregateCompletedTests(output_dir, repo_dir):
@ -129,7 +131,7 @@ def aggregateCompletedTests(output_dir, repo_dir):
def main(output_dir, repo_dir): def main(output_dir, repo_dir):
generateCoverageReport(output_dir, repo_dir) generateCoverageReport(output_dir, repo_dir)
prepDocumentation(output_dir, repo_dir) collectOne(output_dir, 'doc')
aggregateCompletedTests(output_dir, repo_dir) aggregateCompletedTests(output_dir, repo_dir)