Commit bba169c1 authored by Daniel Verkamp's avatar Daniel Verkamp
Browse files

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: default avatarDaniel Verkamp <daniel.verkamp@intel.com>
Reviewed-on: https://review.gerrithub.io/403739


Reviewed-by: default avatarSeth Howell <seth.howell5141@gmail.com>
Tested-by: default avatarSPDK Automated Test System <sys_sgsw@intel.com>
Reviewed-by: default avatarJim Harris <james.r.harris@intel.com>
parent b86ae853
Loading
Loading
Loading
Loading
+12 −10
Original line number Diff line number Diff line
@@ -50,17 +50,19 @@ def generateCoverageReport(output_dir, repo_dir):
            print(e, file=log_file)


def prepDocumentation(output_dir, repo_dir):
    # Find one instance of 'doc' output directory and move it to the top level
    docDirs = glob.glob(os.path.join(output_dir, '*', 'doc'))
    docDirs.sort()
    if len(docDirs) == 0:
def collectOne(output_dir, dir_name):
    dirs = glob.glob(os.path.join(output_dir, '*', dir_name))
    dirs.sort()
    if len(dirs) == 0:
        return

    print("docDirs: ", docDirs)
    docDir = docDirs[0]
    print("docDir: ", docDir)
    shutil.move(docDir, os.path.join(output_dir, 'doc'))
    # Collect first instance of dir_name and move it to the top level
    collect_dir = dirs.pop(0)
    shutil.move(collect_dir, os.path.join(output_dir, dir_name))

    # Delete all other instances
    for d in dirs:
        shutil.rmtree(d)


def aggregateCompletedTests(output_dir, repo_dir):
@@ -129,7 +131,7 @@ def aggregateCompletedTests(output_dir, repo_dir):

def main(output_dir, repo_dir):
    generateCoverageReport(output_dir, repo_dir)
    prepDocumentation(output_dir, repo_dir)
    collectOne(output_dir, 'doc')
    aggregateCompletedTests(output_dir, repo_dir)